class RSpec::Matchers::BuiltIn::BeBetween
Not intended to be instantiated directly.
Provides the implementation for ‘be_between`.
@api private
def comparable?
def comparable? @actual.respond_to?(@less_than_operator) && @actual.respond_to?(@greater_than_operator) end
def compare
def compare @actual.__send__(@greater_than_operator, @min) && @actual.__send__(@less_than_operator, @max) end
def description
-
(String)
-
Other tags:
- Api: - private
def description "be between #{description_of @min} and #{description_of @max} (#{@mode})" end
def exclusive
- Api: - public
def exclusive @less_than_operator = :< @greater_than_operator = :> @mode = :exclusive self end
def failure_message
-
(String)
-
Other tags:
- Api: - private
def failure_message "#{super}#{not_comparable_clause}" end
def inclusive
- Note: - The matcher is inclusive by default; this simply provides
Other tags:
- Api: - public
def inclusive @less_than_operator = :<= @greater_than_operator = :>= @mode = :inclusive self end
def initialize(min, max)
def initialize(min, max) @min, @max = min, max inclusive end
def matches?(actual)
-
(Boolean)
-
Other tags:
- Api: - private
def matches?(actual) @actual = actual comparable? && compare rescue ArgumentError false end
def not_comparable_clause
def not_comparable_clause ", but it does not respond to `#{@less_than_operator}` and `#{@greater_than_operator}`" unless comparable? end