Class: Colonel::Parser::Schedule

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

Overview

Class to store parsed time fields values

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Schedule

Returns a new instance of Schedule.



71
72
73
74
75
76
77
78
79
80
# File 'lib/colonel/parser.rb', line 71

def initialize(opts={})
  @schedule_tokens = opts[:schedule_tokens]
  @all_flag = opts[:all_flag].nil? ? true : opts[:all_flag]

  @_minutes   = opts[:minutes]
  @_hours     = opts[:hours]
  @_days      = opts[:days]
  @_months    = opts[:months]
  @_weekdays  = opts[:weekdays]
end

Instance Method Details

#daysObject



90
91
92
# File 'lib/colonel/parser.rb', line 90

def days
  @_days ||= TimeParser.new(@schedule_tokens.third, :day, @all_flag).result
end

#hoursObject



86
87
88
# File 'lib/colonel/parser.rb', line 86

def hours
  @_hours ||= TimeParser.new(@schedule_tokens.second, :hour, @all_flag).result
end

#minutesObject



82
83
84
# File 'lib/colonel/parser.rb', line 82

def minutes
  @_minutes ||= TimeParser.new(@schedule_tokens.first, :minute, @all_flag).result
end

#monthsObject



94
95
96
# File 'lib/colonel/parser.rb', line 94

def months
  @_months ||= TimeParser.new(@schedule_tokens.fourth, :month, @all_flag).result
end

#weekdaysObject



98
99
100
# File 'lib/colonel/parser.rb', line 98

def weekdays
  @_weekdays ||= TimeParser.new(@schedule_tokens.fifth, :weekday, @all_flag).result
end