Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #184 from stevenweber/master

Preventing transliterator constant from being modified for concurrency concerns
  • Loading branch information...
commit cb5a9d50dc4afd839b401b75f4b066d8606fcf9d 2 parents afdb973 + 17c80e2
@tigrish tigrish authored
View
4 lib/i18n/backend/transliterator.rb
@@ -67,11 +67,11 @@ class HashTransliterator
"ů"=>"u", "Ű"=>"U", "ű"=>"u", "Ų"=>"U", "ų"=>"u", "Ŵ"=>"W", "ŵ"=>"w",
"Ŷ"=>"Y", "ŷ"=>"y", "Ÿ"=>"Y", "Ź"=>"Z", "ź"=>"z", "Ż"=>"Z", "ż"=>"z",
"Ž"=>"Z", "ž"=>"z"
- }
+ }.freeze
def initialize(rule = nil)
@rule = rule
- add DEFAULT_APPROXIMATIONS
+ add DEFAULT_APPROXIMATIONS.dup
add rule if rule
end
View
4 test/backend/transliterator_test.rb
@@ -79,4 +79,8 @@ def setup
assert_not_equal "ue", transliterator.transliterate(char)
end
+ test "DEFAULT_APPROXIMATIONS is frozen to prevent concurrency issues" do
+ assert I18n::Backend::Transliterator::HashTransliterator::DEFAULT_APPROXIMATIONS.frozen?
+ end
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.