Method: TimeCalc::Value#-

Defined in:
lib/time_calc/value.rb

#-(span, unit) ⇒ Value #-(date_or_time) ⇒ Diff

Subtracts ‘span units` from wrapped value.

Overloads:

  • #-(span, unit) ⇒ Value

    Subtracts ‘span units` from wrapped value.

    Parameters:

    • span (Integer)
    • unit (Symbol)

    Returns:

  • #-(date_or_time) ⇒ Diff

    Produces Diff, allowing to calculate structured difference between two points in time.

    Parameters:

    • date_or_time (Date, Time, DateTime)

    Returns:



171
172
173
# File 'lib/time_calc/value.rb', line 171

def -(span_or_other, unit = nil)
  unit.nil? ? Diff.new(self, span_or_other) : self.+(-span_or_other, unit)
end