Class: Chrono::Fields::Wday

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

Constant Summary collapse

TABLE =
{
  '7'   => '0',
  'sun' => '0',
  'mon' => '1',
  'tue' => '2',
  'wed' => '3',
  'thu' => '4',
  'fri' => '5',
  'sat' => '6',
}
REGEXP =
%r<\A(?:(?<step>(?:\*|(?:(?<atom>\d+|sun|mon|tue|wed|thu|fri|sat)(?:-\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) ⇒ Wday

Returns a new instance of Wday.



16
17
18
19
20
21
# File 'lib/chrono/fields/wday.rb', line 16

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