Class: Cronline::CronDaysOfMonth
- Defined in:
- lib/cronline/cron_days_of_month.rb
Instance Method Summary collapse
- #active? ⇒ Boolean
-
#initialize(cron_expression) ⇒ CronDaysOfMonth
constructor
A new instance of CronDaysOfMonth.
- #range(time) ⇒ Object
- #time_field(time) ⇒ Object
Methods inherited from CronField
Constructor Details
#initialize(cron_expression) ⇒ CronDaysOfMonth
Returns a new instance of CronDaysOfMonth.
5 6 7 8 9 10 11 12 13 |
# File 'lib/cronline/cron_days_of_month.rb', line 5 def initialize(cron_expression) @field_expression = cron_expression.split(' ')[3] if @field_expression == 'L' @last_day_of_month = true @field_expression.sub!('L', '') else super(@field_expression, 0, 31) end end |
Instance Method Details
#active? ⇒ Boolean
15 16 17 |
# File 'lib/cronline/cron_days_of_month.rb', line 15 def active? @field_expression != '?' end |
#range(time) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/cronline/cron_days_of_month.rb', line 23 def range(time) if @last_day_of_month puts @last_day_of_month [last_day_of_month(time)] else super(time) end end |
#time_field(time) ⇒ Object
19 20 21 |
# File 'lib/cronline/cron_days_of_month.rb', line 19 def time_field(time) time.day end |