Module Coercible::Coercer::TimeCoercions
In: lib/coercible/coercer/time_coercions.rb

Common time coercion methods

Methods

Public Instance methods

Coerce given value to Date

@example

  coercer[Time].to_date(time)  # => Date object

@param [Time,DateTime] value

@return [Date]

@api public

Coerce given value to DateTime

@example

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

@param [Date,Time] value

@return [DateTime]

@api public

Coerce given value to String

@example

  coercer[Time].to_string(time)  # => "Wed Jul 20 10:30:41 -0700 2011"

@param [Date,Time,DateTime] value

@return [String]

@api public

Coerce given value to Time

@example

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

@param [Date,DateTime] value

@return [Time]

@api public

[Validate]