Class: Sus::Be

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

Constant Summary collapse

NIL =
Be.new(:nil?)

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*arguments) ⇒ Be

Returns a new instance of Be.



8
9
10
# File 'lib/sus/be.rb', line 8

def initialize(*arguments)
	@arguments = arguments
end

Class Method Details

.!=(value) ⇒ Object



29
30
31
# File 'lib/sus/be.rb', line 29

def != value
	Be.new(:!=, value)
end

.<(value) ⇒ Object



41
42
43
# File 'lib/sus/be.rb', line 41

def < value
	Be.new(:<, value)
end

.<=(value) ⇒ Object



45
46
47
# File 'lib/sus/be.rb', line 45

def <= value
	Be.new(:<=, value)
end

.==(value) ⇒ Object



25
26
27
# File 'lib/sus/be.rb', line 25

def == value
	Be.new(:==, value)
end

.===(value) ⇒ Object



53
54
55
# File 'lib/sus/be.rb', line 53

def === value
	Be.new(:===, value)
end

.=~(value) ⇒ Object



49
50
51
# File 'lib/sus/be.rb', line 49

def =~ value
	Be.new(:=~, value)
end

.>(value) ⇒ Object



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

def > value
	Be.new(:>, value)
end

.>=(value) ⇒ Object



37
38
39
# File 'lib/sus/be.rb', line 37

def >= value
	Be.new(:>=, value)
end

Instance Method Details

#call(assertions, subject) ⇒ Object



18
19
20
21
22
# File 'lib/sus/be.rb', line 18

def call(assertions, subject)
	assertions.nested(self) do |assertions|
		assertions.assert(subject.public_send(*@arguments))
	end
end


12
13
14
15
16
# File 'lib/sus/be.rb', line 12

def print(output)
	operation, *arguments = *@arguments
	
	output.write("be ", :be, operation.to_s, :reset, " ", :variable, arguments.map(&:inspect).join, :reset)
end