Class: Sheha::YearlyEvent
Instance Attribute Summary
Attributes inherited from Event
Instance Method Summary collapse
- #event?(date) ⇒ Boolean
-
#initialize(month, month_day) ⇒ YearlyEvent
constructor
A new instance of YearlyEvent.
- #month ⇒ Object
- #month=(month) ⇒ Object
- #month_day ⇒ Object
- #month_day=(month_day) ⇒ Object
- #succ ⇒ Object
Methods inherited from Event
Constructor Details
#initialize(month, month_day) ⇒ YearlyEvent
Returns a new instance of YearlyEvent.
2 3 4 5 6 |
# File 'lib/sheha/yearly_event.rb', line 2 def initialize(month, month_day) Sheha::Helper.validate_month(month) Sheha::Helper.validate_month_day(month_day) super "#{month}#{month_day}".to_i end |
Instance Method Details
#event?(date) ⇒ Boolean
26 27 28 |
# File 'lib/sheha/yearly_event.rb', line 26 def event?(date) month == date.month && month_day == date.day end |
#month ⇒ Object
8 9 10 |
# File 'lib/sheha/yearly_event.rb', line 8 def month "#{four_digits_id[0..1]}".to_i end |
#month=(month) ⇒ Object
12 13 14 15 |
# File 'lib/sheha/yearly_event.rb', line 12 def month=(month) Sheha::Helper.validate_month(month) @id = "#{month}#{four_digits_id[2..3]}".to_i end |
#month_day ⇒ Object
17 18 19 |
# File 'lib/sheha/yearly_event.rb', line 17 def month_day "#{four_digits_id[2..3]}".to_i end |
#month_day=(month_day) ⇒ Object
21 22 23 24 |
# File 'lib/sheha/yearly_event.rb', line 21 def month_day=(month_day) Sheha::Helper.validate_month_day(month_day) @id = "#{four_digits_id[0..1]}#{month_day}".to_i end |
#succ ⇒ Object
30 31 32 |
# File 'lib/sheha/yearly_event.rb', line 30 def succ self.class.new(succ_month, succ_month_day) end |