Class: Predicator::Predicates::Or

Inherits:
Object
  • Object
show all
Defined in:
lib/predicator/predicates/or.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#predicatesObject (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

Returns:

  • (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