Sha256: 71e2ad5f60871641fb9b0239420a41caf457928e0edd147afd5b65b9601b5b20
Contents?: true
Size: 872 Bytes
Versions: 2
Compression:
Stored size: 872 Bytes
Contents
require 'rails' require 'administrate/field/text' require 'administrate/engine' module Administrate module Field class Money < Administrate::Field::Text delegate :currency, to: :money class Engine < ::Rails::Engine Administrate::Engine.add_javascript 'administrate-field-money/application' end def to_s money.format(symbol: symbol, separator: separator, delimiter: delimiter) end def money @money ||= ::Money.new(data, code) end def code options.fetch(:code, ::Money.default_currency.iso_code) end def symbol options.fetch(:symbol, currency.symbol) end def delimiter options.fetch(:delimiter, currency.thousands_separator) end def separator options.fetch(:separator, currency.decimal_mark) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
administrate-field-money-0.1.1 | lib/administrate/field/money.rb |
administrate-field-money-0.1.0 | lib/administrate/field/money.rb |