Class: Numeric
Instance Method Summary collapse
- #commaize ⇒ Object
- #quantity(unit) ⇒ Object (also: #of)
- #to_dollars ⇒ Object
- #to_dollars_cents ⇒ Object (also: #format_currency)
- #to_places(num_places) ⇒ Object
Instance Method Details
#commaize ⇒ Object
697 698 699 |
# File 'lib/kiss/ext/core.rb', line 697 def commaize to_s.commaize end |
#quantity(unit) ⇒ Object Also known as: of
714 715 716 |
# File 'lib/kiss/ext/core.rb', line 714 def quantity(unit) "#{self.commaize} #{ self != 1 ? unit.pluralize : unit }" end |
#to_dollars ⇒ Object
705 706 707 |
# File 'lib/kiss/ext/core.rb', line 705 def to_dollars commaize end |
#to_dollars_cents ⇒ Object Also known as: format_currency
709 710 711 |
# File 'lib/kiss/ext/core.rb', line 709 def to_dollars_cents to_places(2).commaize end |
#to_places(num_places) ⇒ Object
701 702 703 |
# File 'lib/kiss/ext/core.rb', line 701 def to_places(num_places) sprintf("%0.#{num_places}f", self) end |