Class: Spectre::Assertion::Evaluation
- Inherits:
-
Object
- Object
- Spectre::Assertion::Evaluation
show all
- Defined in:
- lib/spectre/assertion.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Evaluation.
179
180
181
|
# File 'lib/spectre/assertion.rb', line 179
def initialize val
@val = val
end
|
Instance Method Details
#evaluate(val, predicate) ⇒ Object
187
188
189
190
191
192
193
|
# File 'lib/spectre/assertion.rb', line 187
def evaluate(val, predicate)
if val.is_a? Evaluation
val.run &predicate
else
predicate.call(val)
end
end
|
#run(&block) ⇒ Object
183
184
185
|
# File 'lib/spectre/assertion.rb', line 183
def run &block
evaluate(@val, block)
end
|
195
196
197
|
# File 'lib/spectre/assertion.rb', line 195
def to_s
@val.to_s
end
|