Class: Float
- Inherits:
-
Object
- Object
- Float
- Defined in:
- lib/oa_templater.rb
Instance Method Summary collapse
Instance Method Details
#commas ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/oa_templater.rb', line 36 def commas to_s =~ /([^\.]*)(\..*)?/ int, dec = Regexp.last_match[1].reverse, Regexp.last_match[2] ? Regexp.last_match[2] : '' while int.gsub!(/(,|\.|^)(\d{3})(\d)/, '\1\2,\3') end int.reverse + dec end |
#eurostyle ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/oa_templater.rb', line 44 def eurostyle to_s =~ /([^\.]*)(\..*)?/ int, dec = Regexp.last_match[1].reverse, Regexp.last_match[2] ? Regexp.last_match[2] : '' while int.gsub!(/( |\.|^)(\d{3})(\d)/, '\1\2 \3') end int.reverse + dec end |