Class: CrontabParser
- Inherits:
-
Object
- Object
- CrontabParser
- Includes:
- Enumerable
- Defined in:
- lib/crontab-parser.rb,
lib/crontab-parser/record.rb,
lib/crontab-parser/time_parser.rb
Defined Under Namespace
Classes: Record, TimeParser
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(crontab, options = {}) ⇒ CrontabParser
constructor
A new instance of CrontabParser.
Constructor Details
#initialize(crontab, options = {}) ⇒ CrontabParser
Returns a new instance of CrontabParser.
10 11 12 13 |
# File 'lib/crontab-parser.rb', line 10 def initialize(crontab, ={}) @crontab = crontab @options = end |
Instance Method Details
#each ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# 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 |