class Biz::Holiday

Attributes

date[R]
time_zone[R]

Public Class Methods

new(date, time_zone) click to toggle source
# File lib/biz/holiday.rb, line 10
def initialize(date, time_zone)
  @date      = date
  @time_zone = time_zone
end

Public Instance Methods

to_date() click to toggle source
# File lib/biz/holiday.rb, line 33
def to_date
  date
end
to_time_segment() click to toggle source
# File lib/biz/holiday.rb, line 17
def to_time_segment
  @to_time_segment ||= begin
    TimeSegment.new(
      Time.new(time_zone).on_date(date, DayTime.midnight),
      Time.new(time_zone).on_date(date, DayTime.endnight)
    )
  end
end

Private Instance Methods

<=>(other) click to toggle source
# File lib/biz/holiday.rb, line 39
def <=>(other)
  return unless other.is_a?(self.class)

  [date, time_zone] <=> [other.date, other.time_zone]
end