Class: RRSchedule::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/rrschedule.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#gtObject

Returns the value of attribute gt.



350
351
352
# File 'lib/rrschedule.rb', line 350

def gt
  @gt
end

#psObject

Returns the value of attribute ps.



350
351
352
# File 'lib/rrschedule.rb', line 350

def ps
  @ps
end

#wdayObject

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