lib/stringex/localization/converter.rb in stringex-2.0.3 vs lib/stringex/localization/converter.rb in stringex-2.0.4
- old
+ new
@@ -34,10 +34,14 @@
expressions.smart_punctuation.each do |expression, replacement|
string.gsub! expression, replacement
end
end
+ def normalize_currency!
+ string.gsub! /(\d+),(\d+)/, '\1\2'
+ end
+
def smart_strip!
string.strip!
@string = "#{starting_whitespace}#{string}#{ending_whitespace}"
end
@@ -69,10 +73,10 @@
def characters
expressions.characters.each do |key, expression|
next if key == :slash && options[:allow_slash]
replacement = translate(key)
- replacement = " #{replacement} " unless key == :dot
+ replacement = " #{replacement} " unless replacement == '' || key == :dot
string.gsub! expression, replacement
end
end
def currencies
\ No newline at end of file