Class: NationalHolidays::Holiday
- Inherits:
-
Object
- Object
- NationalHolidays::Holiday
- Defined in:
- lib/national_holidays/holiday.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#names ⇒ Object
readonly
Returns the value of attribute names.
Instance Method Summary collapse
-
#initialize(names, date, public_holiday) ⇒ Holiday
constructor
A new instance of Holiday.
- #public_holiday? ⇒ Boolean
Constructor Details
#initialize(names, date, public_holiday) ⇒ Holiday
Returns a new instance of Holiday.
9 10 11 12 13 |
# File 'lib/national_holidays/holiday.rb', line 9 def initialize(names, date, public_holiday) @names = names.map { |k, v| [k.to_sym, v] }.to_h @date = Date.parse(date.to_s) @public_holiday = public_holiday end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
7 8 9 |
# File 'lib/national_holidays/holiday.rb', line 7 def date @date end |
#names ⇒ Object (readonly)
Returns the value of attribute names.
7 8 9 |
# File 'lib/national_holidays/holiday.rb', line 7 def names @names end |
Instance Method Details
#public_holiday? ⇒ Boolean
15 16 17 |
# File 'lib/national_holidays/holiday.rb', line 15 def public_holiday? @public_holiday end |