Class: Cronin::Parser
- Inherits:
-
Object
- Object
- Cronin::Parser
- Defined in:
- lib/cronin/parser.rb
Instance Method Summary collapse
-
#initialize(entry) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
Constructor Details
#initialize(entry) ⇒ Parser
Returns a new instance of Parser.
3 4 5 |
# File 'lib/cronin/parser.rb', line 3 def initialize(entry) @entry = entry end |
Instance Method Details
#parse ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/cronin/parser.rb', line 7 def parse splited = @entry.split[0..4] klasses = [Minutes, Hours, MonthDays, Months, WeekDays] keys = [:minutes, :hours, :month_days, :months, :week_days] result = {} splited.each_with_index do |entry,i| result[keys[i]] = klasses[i].new(entry) end result end |