Class: ArgumentSpecification::Matchers::BeWithinRange
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- ArgumentSpecification::Matchers::BeWithinRange
- Defined in:
- lib/argspec/matchers/be_within_range.rb
Instance Attribute Summary collapse
-
#range ⇒ Object
readonly
Returns the value of attribute range.
Attributes inherited from BaseMatcher
Instance Method Summary collapse
-
#initialize(range) ⇒ BeWithinRange
constructor
Create a new matcher instance.
-
#matches? ⇒ Boolean
Check if the actual object matches.
Methods inherited from BaseMatcher
#failure_message, #failure_message_when_negated, matcher_name
Constructor Details
#initialize(range) ⇒ BeWithinRange
Create a new matcher instance
Arguments:
range: (Range)
Example:
>> ArgumentSpecification::Matchers::BeWithinRange.new(1..10)
=> #<ArgumentSpecification::Matchers::BeWithinRange:0x00000000000000 @range=1..10>
17 18 19 |
# File 'lib/argspec/matchers/be_within_range.rb', line 17 def initialize(range) @range = range end |
Instance Attribute Details
#range ⇒ Object (readonly)
Returns the value of attribute range.
6 7 8 |
# File 'lib/argspec/matchers/be_within_range.rb', line 6 def range @range end |
Instance Method Details
#matches? ⇒ Boolean
Check if the actual object matches
Example:
>> matcher.matches?
=> true
27 28 29 |
# File 'lib/argspec/matchers/be_within_range.rb', line 27 def matches? @range.include?(@actual) end |