Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed frozen string bug

  • Loading branch information...
commit c01304107808ddce5a3d734d4402bad35685c3e1 1 parent 226bcb1
Rafael Rosa Fu authored

Showing 1 changed file with 5 additions and 3 deletions. Show diff stats Hide diff stats

  1. +5 3 lib/i18n_localize_core/string_extensions.rb
8 lib/i18n_localize_core/string_extensions.rb
... ... @@ -1,20 +1,22 @@
1 1 class String
2 2 def as_delocalized_number
3   - result = self.clone
  3 + # Using dup to avoid problems with frozen strings
  4 + result = self.dup
4 5 result.gsub!(I18n.thousand_separator, '_') if I18n.thousand_separator
5 6 result.gsub!(I18n.decimal_separator, '.') if I18n.decimal_separator
6 7 result
7 8 end
8   -
  9 +
9 10 alias original_to_f to_f
10 11 def to_f(localize = nil)
11 12 localize = I18n.localize_core if localize.nil?
12 13 (localize ? as_delocalized_number : self).original_to_f
13 14 end
14   -
  15 +
15 16 alias original_to_i to_i
16 17 def to_i(localize = nil)
17 18 localize = I18n.localize_core if localize.nil?
18 19 (localize ? as_delocalized_number : self).original_to_i
19 20 end
20 21 end
  22 +

0 comments on commit c013041

Please sign in to comment.
Something went wrong with that request. Please try again.