Class: Numeric
- Inherits:
-
Object
- Object
- Numeric
- Defined in:
- lib/core_ext.rb
Instance Method Summary collapse
Instance Method Details
#to_money_s ⇒ Object
17 18 19 |
# File 'lib/core_ext.rb', line 17 def to_money_s ("$%g" % (self / 100.0)).commify.sub(/\.(\d)\Z/, '.\10') end |
#to_percent_s(p = nil) ⇒ Object
21 22 23 |
# File 'lib/core_ext.rb', line 21 def to_percent_s(p = nil) (p ? "%.#{p}f%%" : "%g%%") % (self * 100) end |