Sha256: 38c827f5172d5016c34b3399cfda79848d65fcd65f505423ff183e45356ee2c2
Contents?: true
Size: 888 Bytes
Versions: 2
Compression:
Stored size: 888 Bytes
Contents
require 'rails' require 'money' 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.2.0 | lib/administrate/field/money.rb |
administrate-field-money-0.1.2 | lib/administrate/field/money.rb |