Class: Holiday

Inherits:
Object
  • Object
show all
Defined in:
lib/holiday.rb

Constant Summary collapse

CALENDARS_FILENAME =
File.expand_path(
  "#{File.dirname(__FILE__)}/../data/calendars.json"
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(calendars) ⇒ Holiday

Returns a new instance of Holiday.



13
14
15
# File 'lib/holiday.rb', line 13

def initialize(calendars)
  @calendars = calendars
end

Instance Attribute Details

#calendarsObject (readonly)

Returns the value of attribute calendars.



7
8
9
# File 'lib/holiday.rb', line 7

def calendars
  @calendars
end

Instance Method Details

#in(year) ⇒ Object



17
18
19
# File 'lib/holiday.rb', line 17

def in(year)
  holidays[year]
end

#load_dataObject



21
22
23
24
25
# File 'lib/holiday.rb', line 21

def load_data
  # TODO: remove this in a major version
  holidays
  calendars
end