class Coercible::Coercer::Time

Coerce Time values

Public Instance Methods

to_integer(value) click to toggle source

Creates a Fixnum instance from a Time object

@example

Coercible::Coercion::Time.to_integer(time)  # => Fixnum object

@param [Time] value

@return [Fixnum]

@api public

# File lib/coercible/coercer/time.rb, line 34
def to_integer(value)
  value.to_i
end
to_time(value) click to toggle source

Passthrough the value

@example

coercer[DateTime].to_time(time)  # => Time object

@param [DateTime] value

@return [Date]

@api public

# File lib/coercible/coercer/time.rb, line 20
def to_time(value)
  value
end