Class: Kafo::Condition

Inherits:
Object
  • Object
show all
Defined in:
lib/kafo/condition.rb

Constant Summary collapse

VARIABLE_RE =
/(\$\w+)/

Instance Method Summary collapse

Constructor Details

#initialize(expression, context = []) ⇒ Condition

Returns a new instance of Condition.



6
7
8
9
# File 'lib/kafo/condition.rb', line 6

def initialize(expression, context = [])
  @expression = expression
  @context = context
end

Instance Method Details

#evaluateObject



11
12
13
# File 'lib/kafo/condition.rb', line 11

def evaluate
  !!eval(substitute(@expression))
end