Class: Stockboy::Translations::String
- Inherits:
-
Stockboy::Translator
- Object
- Stockboy::Translator
- Stockboy::Translations::String
- Defined in:
- lib/stockboy/translations/string.rb
Overview
Cleans string values by stripping surrounding whitespace
Job template DSL
Registered as :string
. Use with:
attributes do
name as: :string
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) ⇒ String
25 26 27 28 29 30 |
# File 'lib/stockboy/translations/string.rb', line 25 def translate(context) value = field_value(context, field_key) return "" if value.nil? value.to_s.strip end |