Class: RSpec::ChangeToNow::Matchers::Detect Private
- Inherits:
-
Matchers::BuiltIn::Include
- Object
- Matchers::BuiltIn::Include
- RSpec::ChangeToNow::Matchers::Detect
- Defined in:
- lib/rspec/change_to_now/matchers/detect.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 ‘detect`. Not intended to be instantiated directly.
Instance Method Summary collapse
- #description ⇒ String private
- #diffable? ⇒ Boolean private
- #does_not_match?(actual) ⇒ Boolean private
- #failure_message ⇒ String private
- #failure_message_when_negated ⇒ String private
-
#initialize(*expected, &block) ⇒ Detect
constructor
private
A new instance of Detect.
- #matches?(actual) ⇒ Boolean private
Constructor Details
#initialize(*expected, &block) ⇒ Detect
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 Detect.
10 11 12 13 14 15 16 |
# File 'lib/rspec/change_to_now/matchers/detect.rb', line 10 def initialize(*expected, &block) if @block = block block_matcher = RSpec::Matchers::BuiltIn::Satisfy.new(&block) expected << block_matcher end super(*expected) end |
Instance Method Details
#description ⇒ String
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.
54 55 56 |
# File 'lib/rspec/change_to_now/matchers/detect.rb', line 54 def description super.gsub(/^include/, 'detect') end |
#diffable? ⇒ 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.
48 49 50 |
# File 'lib/rspec/change_to_now/matchers/detect.rb', line 48 def diffable? @block.nil? end |
#does_not_match?(actual) ⇒ 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.
28 29 30 31 32 |
# File 'lib/rspec/change_to_now/matchers/detect.rb', line 28 def does_not_match?(actual) handle_arguments_for_match(actual) do |new_actual| super(new_actual) end end |
#failure_message ⇒ String
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.
36 37 38 |
# File 'lib/rspec/change_to_now/matchers/detect.rb', line 36 def check_arguments || super end |
#failure_message_when_negated ⇒ String
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 |
# File 'lib/rspec/change_to_now/matchers/detect.rb', line 42 def check_arguments || super end |
#matches?(actual) ⇒ 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.
20 21 22 23 24 |
# File 'lib/rspec/change_to_now/matchers/detect.rb', line 20 def matches?(actual) handle_arguments_for_match(actual) do |new_actual| super(new_actual) end end |