Class: Necromancer::DateTimeConverters::StringToDateConverter
- Inherits:
-
Converter
- Object
- Converter
- Necromancer::DateTimeConverters::StringToDateConverter
- Defined in:
- lib/necromancer/converters/date_time.rb
Overview
An object that converts a String to a Date
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 Date.
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 Date
23 24 25 26 27 |
# File 'lib/necromancer/converters/date_time.rb', line 23 def call(value, strict: config.strict) Date.parse(value) rescue StandardError strict ? raise_conversion_type(value) : value end |