Method: TimeCalc::Diff#initialize

Defined in:
lib/time_calc/diff.rb

#initialize(from, to) ⇒ Diff

Note:

Typically you should prefer TimeCalc#- to create Diff.

Returns a new instance of Diff.

Parameters:

  • from (Time, Date, DateTime)
  • to (Time, Date, DateTime)


42
43
44
# File 'lib/time_calc/diff.rb', line 42

def initialize(from, to)
  @from, @to = coerce(try_unwrap(from), try_unwrap(to)).map(&Value.method(:wrap))
end