Class: Nextday::Holidays
- Inherits:
-
Object
- Object
- Nextday::Holidays
- Includes:
- Enumerable, Singleton
- Defined in:
- lib/nextday/holidays.rb
Class Method Summary collapse
-
.dates ⇒ Array
Returning all the dates holidays occur.
-
.find(date) ⇒ Holiday
Find the first holiday for the supplied date.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize ⇒ Holidays
constructor
A new instance of Holidays.
Constructor Details
#initialize ⇒ Holidays
Returns a new instance of Holidays.
9 10 11 |
# File 'lib/nextday/holidays.rb', line 9 def initialize @holidays = PUBLIC_HOLIDAYS end |
Class Method Details
.dates ⇒ Array
Returning all the dates holidays occur
21 22 23 |
# File 'lib/nextday/holidays.rb', line 21 def self.dates instance.map(&:date) end |
.find(date) ⇒ Holiday
Find the first holiday for the supplied date
29 30 31 |
# File 'lib/nextday/holidays.rb', line 29 def self.find(date) instance.find{ |holiday| holiday.date == date } end |
Instance Method Details
#each(&block) ⇒ Object
13 14 15 |
# File 'lib/nextday/holidays.rb', line 13 def each(&block) @holidays.each{|holiday| block.call(holiday)} end |