Class: Sus::BeWithin::Bounded

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

Overview

Represents a bounded range check.

Instance Method Summary collapse

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 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