Class: CronTab::NextSeeker

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(s, f, l) ⇒ NextSeeker

Returns a new instance of NextSeeker


48
49
50
51
52
# File 'lib/cron_tab.rb', line 48

def initialize(s, f, l)
  self.scalar = s
  self.field = f
  self.lower_seeker = l
end

Instance Attribute Details

#fieldObject

Returns the value of attribute field


46
47
48
# File 'lib/cron_tab.rb', line 46

def field
  @field
end

#lower_seekerObject

Returns the value of attribute lower_seeker


46
47
48
# File 'lib/cron_tab.rb', line 46

def lower_seeker
  @lower_seeker
end

#scalarObject

Returns the value of attribute scalar


46
47
48
# File 'lib/cron_tab.rb', line 46

def scalar
  @scalar
end

Instance Method Details

#recursive_zeroObject


65
66
67
68
# File 'lib/cron_tab.rb', line 65

def recursive_zero
  self.scalar = 0
  lower_seeker && lower_seeker.recursive_zero
end

#succObject


54
55
56
57
58
59
60
61
62
63
# File 'lib/cron_tab.rb', line 54

def succ
  if lower_seeker.nil? || lower_seeker.succ then
    self.scalar = field.nextof(scalar)
    scalar
  else
    lower_seeker.recursive_zero
    self.scalar += 1
    succ
  end
end