Class: CronTab::FieldSet

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(f) ⇒ FieldSet

Returns a new instance of FieldSet.



143
144
145
# File 'lib/cron_tab.rb', line 143

def initialize(f)
  self.fields = f
end

Instance Attribute Details

#fieldsObject

Returns the value of attribute fields.



141
142
143
# File 'lib/cron_tab.rb', line 141

def fields
  @fields
end

Instance Method Details

#===(rhs) ⇒ Object



147
148
149
150
151
152
153
# File 'lib/cron_tab.rb', line 147

def ===(rhs)
  b = false
  fields.each { |field|
    b ||= (field === rhs)
  }
  b
end

#nextof(now) ⇒ Object



155
156
157
158
159
160
161
162
# File 'lib/cron_tab.rb', line 155

def nextof(now)
  ret = nil
  fields.each { |field|
    field_nextof = field.nextof(now)
    ret = field_nextof if ret.nil? || (field_nextof && field_nextof < ret)
  }
  ret
end