Class: Sus::BeWithin::Bounded
- Inherits:
-
Object
- Object
- Sus::BeWithin::Bounded
- Defined in:
- lib/sus/be_within.rb
Overview
Represents a bounded range check.
Instance Method Summary collapse
-
#call(assertions, subject) ⇒ Object
Evaluate this predicate against a subject.
-
#initialize(range) ⇒ Bounded
constructor
Initialize a new bounded predicate.
-
#print(output) ⇒ Object
Print a representation of this predicate.
Constructor Details
#initialize(range) ⇒ Bounded
Initialize a new bounded predicate.
13 14 15 |
# File 'lib/sus/be_within.rb', line 13 def initialize(range) @range = range end |
Instance Method Details
#call(assertions, subject) ⇒ Object
Evaluate this predicate against a subject.
26 27 28 29 30 |
# File 'lib/sus/be_within.rb', line 26 def call(assertions, subject) assertions.nested(self) do |assertions| assertions.assert(@range.include?(subject)) end end |
#print(output) ⇒ Object
Print a representation of this predicate.
19 20 21 |
# File 'lib/sus/be_within.rb', line 19 def print(output) output.write("be within ", :variable, @range, :reset) end |