class WorkingCalendar::WeekDay

Attributes

day_name[R]
hours_ranges[R]

Public Class Methods

new(day_name, hours_ranges) click to toggle source
# File lib/working_calendar/week_day.rb, line 8
def initialize(day_name, hours_ranges)
  @day_name = cast_day_name day_name
  @hours_ranges = cast_hours_ranges hours_ranges
end

Public Instance Methods

include?(time) click to toggle source
# File lib/working_calendar/week_day.rb, line 13
def include?(time)
  hms = Timing::HourMinutesSeconds.new time.hour, time.min, time.sec
  time.public_send("#{day_name}?") && hours_ranges.any? { |from, to| hms.between? from, to }
end
inspect()
Alias for: to_s
to_s() click to toggle source
# File lib/working_calendar/week_day.rb, line 18
def to_s
  "#{day_name.capitalize} #{hours_ranges}"
end
Also aliased as: inspect