Class: Stockboy::Translations::Time
- Inherits:
-
Stockboy::Translator
- Object
- Stockboy::Translator
- Stockboy::Translations::Time
- Defined in:
- lib/stockboy/translations/time.rb
Overview
Convert ISO-8601 and other recognized time-like strings to Time
Uses ActiveSupport::TimeWithZone
if available.
Job template DSL
Registered as :time
. Use with:
attributes do
arriving as: :time
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) ⇒ Time
27 28 29 30 31 32 |
# File 'lib/stockboy/translations/time.rb', line 27 def translate(context) value = field_value(context, field_key) return nil if (value).blank? clock.parse(value).to_time end |