Module: MoneyRails::ActionViewExtension
- Defined in:
- lib/money-rails/helpers/action_view_extension.rb
Instance Method Summary collapse
- #currency_symbol ⇒ Object
- #humanized_money(value, symbol = false) ⇒ Object
- #humanized_money_with_symbol(value) ⇒ Object
- #money_without_cents(value, symbol = false) ⇒ Object
- #money_without_cents_and_with_symbol(value) ⇒ Object
Instance Method Details
#currency_symbol ⇒ Object
4 5 6 |
# File 'lib/money-rails/helpers/action_view_extension.rb', line 4 def currency_symbol content_tag(:span, Money.default_currency.symbol, :class => "currency_symbol") end |
#humanized_money(value, symbol = false) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/money-rails/helpers/action_view_extension.rb', line 8 def humanized_money(value, symbol=false) if value.is_a?(Money) value.format(:no_cents_if_whole => true, :symbol => symbol) elsif value.respond_to?(:to_money) value.to_money.format(:no_cents_if_whole => true, :symbol => symbol) else "" end end |
#humanized_money_with_symbol(value) ⇒ Object
18 19 20 |
# File 'lib/money-rails/helpers/action_view_extension.rb', line 18 def humanized_money_with_symbol(value) humanized_money(value, true) end |
#money_without_cents(value, symbol = false) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/money-rails/helpers/action_view_extension.rb', line 22 def money_without_cents(value, symbol=false) if value.is_a?(Money) value.format(:no_cents => true, :symbol => symbol) elsif value.respond_to?(:to_money) value.to_money.format(:no_cents => true, :symbol => symbol) else "" end end |
#money_without_cents_and_with_symbol(value) ⇒ Object
32 33 34 |
# File 'lib/money-rails/helpers/action_view_extension.rb', line 32 def money_without_cents_and_with_symbol(value) money_without_cents(value, true) end |