class Extant::Coercers::Time

Public Instance Methods

coerce() click to toggle source
# 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