SusSourceSusBeWithinBounded

class Bounded

Represents a bounded range check.

Definitions

def initialize(range)

Initialize a new bounded predicate.

Signature

parameter range Range

The range to check against.

Implementation

def initialize(range)
	@range = range
end

def print(output)

Print a representation of this predicate.

Signature

parameter output Output

The output target.

Implementation

def print(output)
	output.write("be within ", :variable, @range, :reset)
end

def call(assertions, subject)

Evaluate this predicate against a subject.

Signature

parameter assertions Assertions

The assertions instance to use.

parameter subject Object

The subject to evaluate.

Implementation

def call(assertions, subject)
	assertions.nested(self) do |assertions|
		assertions.assert(@range.include?(subject))
	end
end