Class: Biz::Holiday

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Comparable
Defined in:
lib/biz/holiday.rb

Instance Method Summary collapse

Constructor Details

#initialize(date, time_zone) ⇒ Holiday

Returns a new instance of Holiday.



10
11
12
13
# File 'lib/biz/holiday.rb', line 10

def initialize(date, time_zone)
  @date      = date
  @time_zone = time_zone
end

Instance Method Details

#to_dateObject



33
34
35
# File 'lib/biz/holiday.rb', line 33

def to_date
  date
end

#to_time_segmentObject



17
18
19
20
21
22
23
24
# 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