Class: HolidayCo::Year
- Inherits:
-
Object
- Object
- HolidayCo::Year
- Defined in:
- lib/holiday_co/models/year.rb
Instance Attribute Summary collapse
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
- #holiday_dates ⇒ Object
- #holiday_names ⇒ Object
- #holidays ⇒ Object
-
#initialize(year) ⇒ Year
constructor
A new instance of Year.
Constructor Details
#initialize(year) ⇒ Year
Returns a new instance of Year.
10 11 12 |
# File 'lib/holiday_co/models/year.rb', line 10 def initialize(year) @year = year.to_s end |
Instance Attribute Details
#year ⇒ Object (readonly)
Returns the value of attribute year.
8 9 10 |
# File 'lib/holiday_co/models/year.rb', line 8 def year @year end |
Instance Method Details
#holiday_dates ⇒ Object
24 25 26 |
# File 'lib/holiday_co/models/year.rb', line 24 def holiday_dates holidays.map { |h| h[:date] } end |
#holiday_names ⇒ Object
20 21 22 |
# File 'lib/holiday_co/models/year.rb', line 20 def holiday_names holidays.map { |h| h[:name] } end |
#holidays ⇒ Object
14 15 16 17 18 |
# File 'lib/holiday_co/models/year.rb', line 14 def holidays raise YearDataNotAvailableError unless year_data_available? HolidayCalculator.for(year) end |