Class: Sheha::WeeklyEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/sheha/weekly_event.rb

Instance Attribute Summary

Attributes inherited from Event

#description, #name

Instance Method Summary collapse

Methods inherited from Event

#==, #eql?, #hash

Constructor Details

#initialize(week_day) ⇒ WeeklyEvent

Returns a new instance of WeeklyEvent.



4
5
6
7
# File 'lib/sheha/weekly_event.rb', line 4

def initialize(week_day)
  Sheha::Helper.validate_week_day(week_day)
  super week_day
end

Instance Method Details

#<=>(other) ⇒ Object



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

def <=>(other)
  Sheha::Helper.find_week_day_index(week_day) <=> Sheha::Helper.find_week_day_index(other.week_day)
end

#event?(date) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/sheha/weekly_event.rb', line 9

def event?(date)
  week_day == "#{date.strftime('%A').downcase}"
end

#succObject



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

def succ
  self.class.new succ_week_day
end