Class: Cronline::CronMonths
- Defined in:
- lib/cronline/cron_months.rb
Instance Method Summary collapse
-
#initialize(cron_expression) ⇒ CronMonths
constructor
A new instance of CronMonths.
- #time_field(time) ⇒ Object
Methods inherited from CronField
Constructor Details
#initialize(cron_expression) ⇒ CronMonths
Returns a new instance of CronMonths.
3 4 5 6 7 8 9 10 11 |
# File 'lib/cronline/cron_months.rb', line 3 def initialize(cron_expression) expression = cron_expression.split(' ')[4] Date::ABBR_MONTHNAMES.each do |abbreviation| unless abbreviation.nil? expression.gsub!(/(#{abbreviation})/i, Date::ABBR_MONTHNAMES.index(abbreviation).to_s) end end super(expression, 1, 12) end |
Instance Method Details
#time_field(time) ⇒ Object
13 14 15 |
# File 'lib/cronline/cron_months.rb', line 13 def time_field(time) time.month end |