Class: Decimal
Instance Method Summary collapse
Instance Method Details
#hours ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/jeweler/utils/core_ext/Decimal.rb', line 14 def hours result = self.prettify if result == 1 result = result + ' hr' else result = result + 'hrs' end return result end |
#money ⇒ Object
24 25 26 27 28 29 |
# File 'lib/jeweler/utils/core_ext/Decimal.rb', line 24 def money require 'action_view' result = self.prettify result = ActionView::Base.new.number_to_currency(result).to_s return result end |
#prettify ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# File 'lib/jeweler/utils/core_ext/Decimal.rb', line 2 def prettify if self.nil? return 0 else if self.to_i == self return self.to_i else return self end end end |