class CronSpec::MonthFactory

Factory for constructing month cron values from a cron specification.

Constants

MonthExpression

A pipe-delimited list of the months of the year

MonthLowerLimit

The lower limit for a value representing a month of a year

MonthRangePattern

A regular expression to match a range month expression

MonthSingleValuePattern

A regular expression to match a single value month expression

MonthUpperLimit

The upper limit for a value representing a month of a year

Months

The supported names of the months

NamedMonthPattern

A regular expression to match a named month

Public Class Methods

new() click to toggle source

Constructs a new MonthFactory object.

Calls superclass method CronSpec::CronSpecificationFactory::new
# File lib/cron-spec/month_factory.rb, line 31
def initialize
  super
  @lower_limit = MonthLowerLimit
  @upper_limit = MonthUpperLimit
  @single_value_pattern = MonthSingleValuePattern
  @range_pattern = MonthRangePattern
end

Private Instance Methods

convert_value(value) click to toggle source
# File lib/cron-spec/month_factory.rb, line 41
def convert_value(value)
  (value =~ NamedMonthPattern) ? Months.index(value) + 1 : value.to_i
end