Class: Stockboy::Translations::Decimal
- Inherits:
-
Stockboy::Translator
- Object
- Stockboy::Translator
- Stockboy::Translations::Decimal
- Defined in:
- lib/stockboy/translations/decimal.rb
Overview
Convert numeric strings to BigDecimal
Job template DSL
Registered as :decimal
. Use with:
attributes do
check_in as: :decimal
end
Instance Attribute Summary
Attributes inherited from Stockboy::Translator
Instance Method Summary collapse
Methods inherited from Stockboy::Translator
Constructor Details
This class inherits a constructor from Stockboy::Translator
Instance Method Details
#translate(context) ⇒ BigDecimal
25 26 27 28 29 30 |
# File 'lib/stockboy/translations/decimal.rb', line 25 def translate(context) value = field_value(context, field_key) return nil if value.blank? BigDecimal.new(value, 10) end |