Class: Rulz::Evaluator::Condition
Instance Method Summary collapse
- #condition(name, *args) ⇒ Object
- #evaluate ⇒ Object
-
#initialize(receiver, name, *args) ⇒ Condition
constructor
A new instance of Condition.
- #opposite_of(name, *args) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(receiver, name, *args) ⇒ Condition
Returns a new instance of Condition.
19 20 21 22 |
# File 'lib/rulz/evaluator.rb', line 19 def initialize(receiver, name, *args) @condition = Rulz::Condition.find(receiver.class, name) super(receiver, *args) end |
Instance Method Details
#condition(name, *args) ⇒ Object
25 26 27 |
# File 'lib/rulz/evaluator.rb', line 25 def condition(name, *args) Rulz::Evaluator::Condition.new(@receiver, name, *args).evaluate end |
#evaluate ⇒ Object
33 34 35 |
# File 'lib/rulz/evaluator.rb', line 33 def evaluate instance_exec(*@args, &@condition.proc) end |
#opposite_of(name, *args) ⇒ Object
29 30 31 |
# File 'lib/rulz/evaluator.rb', line 29 def opposite_of(name, *args) not condition(name, *args) end |