Class: Constraint::OrConstraint

Inherits:
Array
  • Object
show all
Defined in:
lib/constraint.rb

Overview

At least one constraint must succeed.

Instance Method Summary collapse

Instance Method Details

#evaluate(invoker, object) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/constraint.rb', line 59

def evaluate(invoker, object)
    c = nil
    for o in self
        begin
            return o.evaluate(invoker, object)
        rescue Constraint::Violation => e
            c = e
        end
    end
    raise c
end