Class: RSpec::Matchers::BuiltIn::Cover Private
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::Matchers::BuiltIn::Cover
- Defined in:
- lib/rspec/matchers/built_in/cover.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 cover
. Not intended to be instantiated directly.
Constant Summary
Constants inherited from BaseMatcher
Instance Method Summary collapse
- #does_not_match?(range) ⇒ Boolean private
-
#initialize(*expected) ⇒ Cover
constructor
private
A new instance of Cover.
- #matches?(range) ⇒ Boolean private
Methods inherited from BaseMatcher
#description, #diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?
Methods included from BaseMatcher::DefaultFailureMessages
#failure_message, #failure_message_when_negated
Methods included from Composable
#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?
Constructor Details
#initialize(*expected) ⇒ Cover
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 Cover.
8 9 10 |
# File 'lib/rspec/matchers/built_in/cover.rb', line 8 def initialize(*expected) @expected = expected end |
Instance Method Details
#does_not_match?(range) ⇒ Boolean
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.
17 18 19 20 |
# File 'lib/rspec/matchers/built_in/cover.rb', line 17 def does_not_match?(range) @actual = range expected.none? { |e| range.cover?(e) } end |
#matches?(range) ⇒ Boolean
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.
12 13 14 15 |
# File 'lib/rspec/matchers/built_in/cover.rb', line 12 def matches?(range) @actual = range @expected.all? { |e| range.cover?(e) } end |