Class: Extant::Coercers::Time
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#coerced?, coercer_name, #initialize
Constructor Details
This class inherits a constructor from Extant::Coercers::Base
Instance Method Details
#coerce ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/extant/coercers/time.rb', line 5 def coerce if value.is_a?(::Time) self.coerced = true return value end result = ::Time.parse(value.to_s) self.coerced = true result rescue ArgumentError UncoercedValue end |