Class: Integer
- Inherits:
-
Object
- Object
- Integer
- Defined in:
- lib/shepherd/utils.rb
Instance Method Summary collapse
Instance Method Details
#to_nice ⇒ Object
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/shepherd/utils.rb', line 50 def to_nice s = self.to_s if s.include? ?. pre, post = s.split '.' "#{pre.reverse.gsub( /\d{3}(?=\d)/, '\&,' ).reverse}.#{post}" else s.reverse.gsub( /\d{3}(?=\d)/, '\&.' ).reverse end end |