]> git.openstreetmap.org Git - rails.git/blobdiff - config/initializers/http_accept_language.rb
Highlight search results when the mouse is over them
[rails.git] / config / initializers / http_accept_language.rb
index 04c3dfaf53395b544d2b589ba9aa6dee97c671cb..2e5c92df1aca1a58de7b3a0c847c2fa8dd046f80 100644 (file)
@@ -3,10 +3,12 @@
 # https://github.com/iain/http_accept_language/pull/6
 #
 module HttpAcceptLanguage
-  def compatible_language_from(available_languages)
-    user_preferred_languages.find do |x|
-      available_languages.find { |y| y.to_s == x.to_s } ||
-      available_languages.find { |y| y.to_s =~ /^#{Regexp.escape(x.to_s)}-/ }
+  class Parser
+    def compatible_language_from(available_languages)
+      user_preferred_languages.find do |x|
+        available_languages.find { |y| y.to_s == x.to_s } ||
+          available_languages.find { |y| y.to_s =~ /^#{Regexp.escape(x.to_s)}-/ }
+      end
     end
   end
 end