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
#config, #convert, #source, #target
Instance Method Summary collapse
-
#call(value, strict: config.strict) ⇒ Object
Convert a String value to a Time value.
Methods inherited from Converter
create, #initialize, #raise_conversion_type
Constructor Details
This class inherits a constructor from Necromancer::Converter
Instance Method Details
#call(value, strict: config.strict) ⇒ Object
Convert a String value to a Time value
58 59 60 61 62 |
# File 'lib/necromancer/converters/date_time.rb', line 58 def call(value, strict: config.strict) Time.parse(value) rescue StandardError strict ? raise_conversion_type(value) : value end |