Class: Double
Instance Method Summary collapse
Instance Method Details
#hours ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/jeweler/utils/core_ext/Double.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/Double.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/Double.rb', line 2 def prettify if self.nil? return 0 else if self.round(2) == self return self.round(2) else return self end end end |