module WorkingHours::CoreExt::DateAndTime

Public Class Methods

included(base) click to toggle source
# File lib/working_hours/core_ext/date_and_time.rb, line 8
def self.included base
  base.class_eval do
    alias_method :minus_without_working_hours, :-
    alias_method :-, :minus_with_working_hours
    alias_method :plus_without_working_hours, :+
    alias_method :+, :plus_with_working_hours
  end
end

Public Instance Methods

in_working_hours?() click to toggle source
# File lib/working_hours/core_ext/date_and_time.rb, line 45
def in_working_hours?
  WorkingHours.in_working_hours?(self)
end
minus_with_working_hours(other) click to toggle source
# File lib/working_hours/core_ext/date_and_time.rb, line 25
def minus_with_working_hours(other)
  if WorkingHours::Duration === other
    other.until(self)
  else
    minus_without_working_hours(other)
  end
end
plus_with_working_hours(other) click to toggle source
# File lib/working_hours/core_ext/date_and_time.rb, line 17
def plus_with_working_hours(other)
  if WorkingHours::Duration === other
    other.since(self)
  else
    plus_without_working_hours(other)
  end
end
working_day?() click to toggle source
# File lib/working_hours/core_ext/date_and_time.rb, line 41
def working_day?
  WorkingHours.working_day?(self)
end
working_days_until(other) click to toggle source
# File lib/working_hours/core_ext/date_and_time.rb, line 33
def working_days_until(other)
  WorkingHours.working_days_between(self, other)
end
working_time_until(other) click to toggle source
# File lib/working_hours/core_ext/date_and_time.rb, line 37
def working_time_until(other)
  WorkingHours.working_time_between(self, other)
end