Class: Castiel::Elements::HourElement

Inherits:
BaseElement show all
Defined in:
lib/castiel/elements/hour_element.rb

Instance Method Summary collapse

Instance Method Details

#evaluate(element, context = nil) ⇒ Object



9
10
11
# File 'lib/castiel/elements/hour_element.rb', line 9

def evaluate(element, context = nil)
  element.to_i
end

#match?(element, context = nil) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/castiel/elements/hour_element.rb', line 5

def match?(element, context = nil)
  element =~ /^(\d|[01]\d|2[0-3])(:\d\d)?$/
end