Class: Cal::Day
Instance Attribute Summary collapse
-
#calendar ⇒ Object
readonly
Returns the value of attribute calendar.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
-
#initialize(date, calendar) ⇒ Day
constructor
A new instance of Day.
- #number ⇒ Object
- #succ ⇒ Object
Constructor Details
#initialize(date, calendar) ⇒ Day
Returns a new instance of Day.
8 9 10 11 |
# File 'lib/cal/day.rb', line 8 def initialize(date, calendar) @date = date @calendar = calendar end |
Instance Attribute Details
#calendar ⇒ Object (readonly)
Returns the value of attribute calendar.
13 14 15 |
# File 'lib/cal/day.rb', line 13 def calendar @calendar end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
13 14 15 |
# File 'lib/cal/day.rb', line 13 def date @date end |
Instance Method Details
#<=>(other) ⇒ Object
21 22 23 |
# File 'lib/cal/day.rb', line 21 def <=>(other) date <=> other.date end |
#==(other) ⇒ Object
17 18 19 |
# File 'lib/cal/day.rb', line 17 def ==(other) other.is_a?(Day) && calendar == other.calendar && date == other.date end |
#number ⇒ Object
29 30 31 |
# File 'lib/cal/day.rb', line 29 def number date.day end |
#succ ⇒ Object
25 26 27 |
# File 'lib/cal/day.rb', line 25 def succ self.class.new date.tomorrow, calendar end |