Class: Sus::Be::And
- Inherits:
-
Object
- Object
- Sus::Be::And
- Defined in:
- lib/sus/be.rb
Instance Method Summary collapse
- #&(other) ⇒ Object
- #call(assertions, subject) ⇒ Object
-
#initialize(predicates) ⇒ And
constructor
A new instance of And.
- #print(output) ⇒ Object
- #|(other) ⇒ Object
Constructor Details
#initialize(predicates) ⇒ And
Returns a new instance of And.
9 10 11 |
# File 'lib/sus/be.rb', line 9 def initialize(predicates) @predicates = predicates end |
Instance Method Details
#&(other) ⇒ Object
29 30 31 |
# File 'lib/sus/be.rb', line 29 def &(other) And.new(@predicates + [other]) end |
#call(assertions, subject) ⇒ Object
23 24 25 26 27 |
# File 'lib/sus/be.rb', line 23 def call(assertions, subject) @predicates.each do |predicate| predicate.call(assertions, subject) end end |
#print(output) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/sus/be.rb', line 13 def print(output) @predicates.each_with_index do |predicate, index| if index > 0 output.write(" and ", :reset) end predicate.print(output) end end |