Class: Sus::Be
- Inherits:
-
Object
- Object
- Sus::Be
- Defined in:
- lib/sus/be.rb
Defined Under Namespace
Constant Summary collapse
- NIL =
Be.new(:nil?)
Class Method Summary collapse
- .!=(value) ⇒ Object
- .<(value) ⇒ Object
- .<=(value) ⇒ Object
- .==(value) ⇒ Object
- .===(value) ⇒ Object
- .=~(value) ⇒ Object
- .>(value) ⇒ Object
- .>=(value) ⇒ Object
Instance Method Summary collapse
- #&(other) ⇒ Object
- #and(*others) ⇒ Object
- #call(assertions, subject) ⇒ Object
-
#initialize(*arguments) ⇒ Be
constructor
A new instance of Be.
- #or(*others) ⇒ Object
- #print(output) ⇒ Object
- #|(other) ⇒ Object
Constructor Details
#initialize(*arguments) ⇒ Be
Returns a new instance of Be.
78 79 80 |
# File 'lib/sus/be.rb', line 78 def initialize(*arguments) @arguments = arguments end |
Class Method Details
.!=(value) ⇒ Object
119 120 121 |
# File 'lib/sus/be.rb', line 119 def != value Be.new(:!=, value) end |
.<=(value) ⇒ Object
135 136 137 |
# File 'lib/sus/be.rb', line 135 def <= value Be.new(:<=, value) end |
.==(value) ⇒ Object
115 116 117 |
# File 'lib/sus/be.rb', line 115 def == value Be.new(:==, value) end |
.===(value) ⇒ Object
143 144 145 |
# File 'lib/sus/be.rb', line 143 def === value Be.new(:===, value) end |
Instance Method Details
#and(*others) ⇒ Object
94 95 96 |
# File 'lib/sus/be.rb', line 94 def and(*others) And.new([self, *others]) end |
#call(assertions, subject) ⇒ Object
108 109 110 111 112 |
# File 'lib/sus/be.rb', line 108 def call(assertions, subject) assertions.nested(self) do |assertions| assertions.assert(subject.public_send(*@arguments)) end end |
#or(*others) ⇒ Object
86 87 88 |
# File 'lib/sus/be.rb', line 86 def or(*others) Or.new([self, *others]) end |
#print(output) ⇒ Object
98 99 100 101 102 103 104 105 106 |
# File 'lib/sus/be.rb', line 98 def print(output) operation, *arguments = *@arguments output.write("be ", :be, operation.to_s, :reset) if arguments.any? output.write(" ", :variable, arguments.map(&:inspect).join, :reset) end end |