Sha256: 005fcfae6f04f9dd337686744d8caa663a4359e639fa245a8530a70e9680463d
Contents?: true
Size: 1.02 KB
Versions: 16
Compression:
Stored size: 1.02 KB
Contents
# Currency helper routines #------------------------------------------------------------------------------ module DmUtilities::CurrencyHelper include ActionView::Helpers::NumberHelper # Takes a number and a country code and formats it as a monetary value # TODO see if there is a better way to hook in the Globalize::Currency object # TODO we're not using the country object right now - I think this is a problem #------------------------------------------------------------------------------ def ut_currency(amount, country, options = {}) return "—".html_safe if amount.blank? precision = options[:precision] || 2 number_to_currency(amount, :locale => country.locale, :precision => precision) end # Takes a number and a country code and formats it as a monetary value #------------------------------------------------------------------------------ def ut_currency_cents(cents, country, options = {}) return "—".html_safe if cents.blank? ut_currency(cents/100, country, options) end end
Version data entries
16 entries across 16 versions & 1 rubygems