class CrontabParser

Public Class Methods

new(crontab, options={}) click to toggle source
# File lib/crontab-parser.rb, line 10
def initialize(crontab, options={})
  @crontab = crontab
  @options = options
end

Public Instance Methods

each() { |record| ... } click to toggle source
# File lib/crontab-parser.rb, line 15
def each
  io = if File.exists?(@crontab)
    open(@crontab, 'r')
  else
    StringIO.new(@crontab)
  end
  until io.eof?
    line = io.gets
    line.strip!
    if line.length > 0 && line.index('#') != 0
      yield Record.new(line, @options) 
    end
  end
end