Class: Predicator::Predicates::Or
- Inherits:
-
Object
- Object
- Predicator::Predicates::Or
- Defined in:
- lib/predicator/predicates/or.rb
Instance Attribute Summary collapse
-
#predicates ⇒ Object
readonly
Returns the value of attribute predicates.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(predicates) ⇒ Or
constructor
A new instance of Or.
- #satisfied?(context = Predicator::Context.new) ⇒ Boolean
Constructor Details
#initialize(predicates) ⇒ Or
Returns a new instance of Or.
6 7 8 |
# File 'lib/predicator/predicates/or.rb', line 6 def initialize predicates @predicates = predicates end |
Instance Attribute Details
#predicates ⇒ Object (readonly)
Returns the value of attribute predicates.
4 5 6 |
# File 'lib/predicator/predicates/or.rb', line 4 def predicates @predicates end |
Instance Method Details
#==(other) ⇒ Object
14 15 16 17 |
# File 'lib/predicator/predicates/or.rb', line 14 def == other other.kind_of?(self.class) && other.predicates == predicates end |
#satisfied?(context = Predicator::Context.new) ⇒ Boolean
10 11 12 |
# File 'lib/predicator/predicates/or.rb', line 10 def satisfied? context=Predicator::Context.new predicates.any?{ |pred| pred.satisfied? context } end |