Class: RRSchedule::Rule
- Inherits:
-
Object
- Object
- RRSchedule::Rule
- Defined in:
- lib/rrschedule.rb
Instance Attribute Summary collapse
-
#gt ⇒ Object
Returns the value of attribute gt.
-
#ps ⇒ Object
Returns the value of attribute ps.
-
#wday ⇒ Object
Returns the value of attribute wday.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(params) ⇒ Rule
constructor
A new instance of Rule.
Constructor Details
#initialize(params) ⇒ Rule
Returns a new instance of Rule.
352 353 354 355 356 |
# File 'lib/rrschedule.rb', line 352 def initialize(params) self.wday = params[:wday] self.gt = params[:gt] self.ps = params[:ps] end |
Instance Attribute Details
#gt ⇒ Object
Returns the value of attribute gt.
350 351 352 |
# File 'lib/rrschedule.rb', line 350 def gt @gt end |
#ps ⇒ Object
Returns the value of attribute ps.
350 351 352 |
# File 'lib/rrschedule.rb', line 350 def ps @ps end |
#wday ⇒ Object
Returns the value of attribute wday.
350 351 352 |
# File 'lib/rrschedule.rb', line 350 def wday @wday end |
Instance Method Details
#<=>(other) ⇒ Object
380 381 382 383 384 |
# File 'lib/rrschedule.rb', line 380 def <=>(other) self.wday == other.wday ? DateTime.parse(self.gt.first.to_s) <=> DateTime.parse(other.gt.first.to_s) : self.wday <=> other.wday end |