Class: Smartdown::Model::Answer::Money
- Defined in:
- lib/smartdown/model/answer/money.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#*, #+, #-, #/, #<=>, #initialize, #invalid?, #valid?
Constructor Details
This class inherits a constructor from Smartdown::Model::Answer::Base
Instance Method Details
#humanize ⇒ Object
16 17 18 19 20 21 |
# File 'lib/smartdown/model/answer/money.rb', line 16 def humanize number_string = "£#{'%.2f' % value}".gsub(/(\d)(?=(\d\d\d)+(?!\d))/) do |digit_to_delimit| "#{digit_to_delimit}," end number_string.end_with?(".00") ? number_string[0..-4] : number_string end |
#value_type ⇒ Object
12 13 14 |
# File 'lib/smartdown/model/answer/money.rb', line 12 def value_type ::Float end |