class Parameters::Types::Time
Public Class Methods
coerce(value)
click to toggle source
Coerces a value into a Time
object.
@param [Integer, to_time, to_s] value
The value to coerce.
@return [::Time]
The coerced Time object.
# File lib/parameters/types/time.rb, line 18 def self.coerce(value) case value when Integer ::Time.at(value) else if value.respond_to?(:to_time) value.to_time else ::Time.parse(value.to_s) end end end