Class: Stockboy::Translations::DefaultFalse
- Inherits:
-
Stockboy::Translator
- Object
- Stockboy::Translator
- Stockboy::Translations::DefaultFalse
- Defined in:
- lib/stockboy/translations/default_false.rb
Overview
Translate missing values to boolean false
This is a useful fallback for translation errors from boolean fields.
Job template DSL
Registered as :or_false
. Use with:
attributes do
active as: [:boolean, :or_false]
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) ⇒ Boolean
33 34 35 36 37 38 |
# File 'lib/stockboy/translations/default_false.rb', line 33 def translate(context) value = field_value(context, field_key) return false if value.nil? return value end |