Class: Castiel::Elements::SymbolElement
- Inherits:
-
BaseElement
- Object
- BaseElement
- Castiel::Elements::SymbolElement
- Defined in:
- lib/castiel/elements/symbol_element.rb
Instance Method Summary collapse
- #evaluate(element, context = nil) ⇒ Object
- #match?(element, context = nil) ⇒ Boolean
- #run_today(element, context = nil) ⇒ Object
- #run_tomorrow(element, context = nil) ⇒ Object
- #run_yesterday(element, context = nil) ⇒ Object
Instance Method Details
#evaluate(element, context = nil) ⇒ Object
10 11 12 13 |
# File 'lib/castiel/elements/symbol_element.rb', line 10 def evaluate(element, context = nil) element = element.to_s.downcase send "run_#{element}", element, context end |
#match?(element, context = nil) ⇒ Boolean
5 6 7 8 |
# File 'lib/castiel/elements/symbol_element.rb', line 5 def match?(element, context = nil) element = element.to_s.downcase respond_to? "run_#{element}" end |
#run_today(element, context = nil) ⇒ Object
15 16 17 |
# File 'lib/castiel/elements/symbol_element.rb', line 15 def run_today(element, context = nil) ::Date.today.to_time end |
#run_tomorrow(element, context = nil) ⇒ Object
23 24 25 |
# File 'lib/castiel/elements/symbol_element.rb', line 23 def run_tomorrow(element, context = nil) (::Date.today + 1).to_time end |
#run_yesterday(element, context = nil) ⇒ Object
19 20 21 |
# File 'lib/castiel/elements/symbol_element.rb', line 19 def run_yesterday(element, context = nil) (::Date.today - 1).to_time end |