class Necromancer::DateTimeConverters::StringToTimeConverter
Public Instance Methods
call(value, options = {})
click to toggle source
Convert a String value to a Time value
@param [String] value
the value to convert
@example
converter.call("01-01-2015") # => 2015-01-01 00:00:00 +0100 converter.call("01-01-2015 08:35") # => 2015-01-01 08:35:00 +0100 converter.call("12:35") # => 2015-01-04 12:35:00 +0100
@api public
# File lib/necromancer/converters/date_time.rb, line 59 def call(value, options = {}) strict = options.fetch(:strict, config.strict) Time.parse(value) rescue strict ? fail_conversion_type(value) : value end