Class: Chrono::Fields::Base

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

Direct Known Subclasses

Day, Hour, Minute, Month, Wday

Defined Under Namespace

Classes: InvalidField

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ Base

Returns a new instance of Base.



15
16
17
# File 'lib/chrono/fields/base.rb', line 15

def initialize(source)
  @source = source
end

Instance Attribute Details

#sourceObject (readonly)

Returns the value of attribute source.



13
14
15
# File 'lib/chrono/fields/base.rb', line 13

def source
  @source
end

Instance Method Details

#to_aObject



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

def to_a
  if has_multiple_elements?
    fields.map(&:to_a).flatten.uniq.sort
  else
    validate!
    wildcard? ? [] : lower.step(upper, step).to_a.sort
  end
end