Class: Necromancer::DateTimeConverters::StringToTimeConverter
- Inherits:
-
Converter
- Object
- Converter
- Necromancer::DateTimeConverters::StringToTimeConverter
- Defined in:
- lib/necromancer/converters/date_time.rb
Instance Attribute Summary
Attributes inherited from Converter
Instance Method Summary collapse
-
#call(value, options = {}) ⇒ Object
Convert a String value to a Time value.
Methods inherited from Converter
create, #fail_conversion_type, #initialize
Constructor Details
This class inherits a constructor from Necromancer::Converter
Instance Method Details
#call(value, options = {}) ⇒ Object
Convert a String value to a Time value
60 61 62 63 64 65 |
# File 'lib/necromancer/converters/date_time.rb', line 60 def call(value, = {}) strict = .fetch(:strict, config.strict) Time.parse(value) rescue strict ? fail_conversion_type(value) : value end |