Module: ModelPresenter::Moneyize

Defined in:
lib/model_presenter/moneyize.rb

Instance Method Summary collapse

Instance Method Details

#moneyize(*fields) ⇒ Object


3
4
5
6
7
8
9
# File 'lib/model_presenter/moneyize.rb', line 3

def moneyize(*fields)
  fields.each do |field|
    define_method "formatted_#{field}" do
      "$ #{Money.new(send(field)).to_dollar}"
    end
  end
end