Class: Chrono::Fields::Month

Inherits:
Base
  • Object
show all
Defined in:
lib/chrono/fields/month.rb

Constant Summary collapse

TABLE =
{
  'jan' => '1',
  'feb' => '2',
  'mar' => '3',
  'apr' => '4',
  'may' => '5',
  'jun' => '6',
  'jul' => '7',
  'aug' => '8',
  'sep' => '9',
  'oct' => '10',
  'nov' => '11',
  'dec' => '12',
}
REGEXP =
%r<\A(?<step>(?:\*|(?:(?<atom>\d+||jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(?:-\g<atom>)?))(?:/\d+)?)(?:,\g<step>)*\z>ix

Instance Attribute Summary

Attributes inherited from Base

#source

Instance Method Summary collapse

Methods inherited from Base

#to_a

Constructor Details

#initialize(source) ⇒ Month

Returns a new instance of Month.



20
21
22
23
24
25
# File 'lib/chrono/fields/month.rb', line 20

def initialize(source)
  unless REGEXP =~ source
    raise InvalidField.new('Unparsable field', source)
  end
  @source = source
end