Class: RSpec::Matchers::BuiltIn::BeBetween Private
- Inherits:
- 
      BaseMatcher
        - Object
- BaseMatcher
- RSpec::Matchers::BuiltIn::BeBetween
 
- Defined in:
- lib/rspec/matchers/built_in/be_between.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Provides the implementation for be_between.
Not intended to be instantiated directly.
Constant Summary
Constant Summary
Constants inherited from BaseMatcher
RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED
Instance Method Summary (collapse)
- - (String) description private
- 
  
      - (Object) exclusive 
  
    Makes the between comparison exclusive. 
- - (String) failure_message private
- 
  
      - (Object) inclusive 
  
    Makes the between comparison inclusive. 
- 
  
      - (BeBetween) initialize(min, max) 
  
    constructor
  private
    A new instance of BeBetween. 
- - (Boolean) matches?(actual) private
Methods inherited from BaseMatcher
#diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?
Methods included from RSpec::Matchers::BuiltIn::BaseMatcher::DefaultFailureMessages
Methods included from Composable
#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?
Constructor Details
- (BeBetween) initialize(min, max)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of BeBetween
| 8 9 10 11 | # File 'lib/rspec/matchers/built_in/be_between.rb', line 8 def initialize(min, max) @min, @max = min, max inclusive end | 
Instance Method Details
- (String) description
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
| 57 58 59 | # File 'lib/rspec/matchers/built_in/be_between.rb', line 57 def description "be between #{description_of @min} and #{description_of @max} (#{@mode})" end | 
- (Object) exclusive
Makes the between comparison exclusive.
| 33 34 35 36 37 38 | # File 'lib/rspec/matchers/built_in/be_between.rb', line 33 def exclusive @less_than_operator = :< @greater_than_operator = :> @mode = :exclusive self end | 
- (String) failure_message
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
| 51 52 53 | # File 'lib/rspec/matchers/built_in/be_between.rb', line 51 def "#{super}#{not_comparable_clause}" end | 
- (Object) inclusive
The matcher is inclusive by default; this simply provides a way to be more explicit about it.
Makes the between comparison inclusive.
| 21 22 23 24 25 26 | # File 'lib/rspec/matchers/built_in/be_between.rb', line 21 def inclusive @less_than_operator = :<= @greater_than_operator = :>= @mode = :inclusive self end | 
- (Boolean) matches?(actual)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
| 42 43 44 45 46 47 | # File 'lib/rspec/matchers/built_in/be_between.rb', line 42 def matches?(actual) @actual = actual comparable? && compare rescue ArgumentError false end |