Class: Sus::Be::And

Inherits:
Object
  • Object
show all
Defined in:
lib/sus/be.rb

Instance Method Summary collapse

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


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

#|(other) ⇒ Object



33
34
35
# File 'lib/sus/be.rb', line 33

def |(other)
	Or.new(self, other)
end