Class: Bignum
- Inherits:
-
Object
- Object
- Bignum
- Defined in:
- lib/oa_templater.rb
Instance Method Summary collapse
Instance Method Details
#commas ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/oa_templater.rb', line 18 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
26 27 28 29 30 31 32 |
# File 'lib/oa_templater.rb', line 26 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 |