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
683 684 685 |
# File 'lib/kiss/ext/core.rb', line 683 def commaize to_s.commaize end |
#quantity(unit) ⇒ Object Also known as: of
700 701 702 |
# File 'lib/kiss/ext/core.rb', line 700 def quantity(unit) "#{self.commaize} #{ self != 1 ? unit.pluralize : unit }" end |
#to_dollars ⇒ Object
691 692 693 |
# File 'lib/kiss/ext/core.rb', line 691 def to_dollars commaize end |
#to_dollars_cents ⇒ Object Also known as: format_currency
695 696 697 |
# File 'lib/kiss/ext/core.rb', line 695 def to_dollars_cents to_places(2).commaize end |
#to_places(num_places) ⇒ Object
687 688 689 |
# File 'lib/kiss/ext/core.rb', line 687 def to_places(num_places) sprintf("%0.#{num_places}f", self) end |