Class: RSpec::ChangeToNow::Matchers::Detect Private

Inherits:
Matchers::BuiltIn::Include
  • Object
show all
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

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

#descriptionString

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:

  • (String)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


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_messageString

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:

  • (String)


36
37
38
# File 'lib/rspec/change_to_now/matchers/detect.rb', line 36

def failure_message
  check_arguments || super
end

#failure_message_when_negatedString

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:

  • (String)


42
43
44
# File 'lib/rspec/change_to_now/matchers/detect.rb', line 42

def failure_message_when_negated
  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.

Returns:

  • (Boolean)


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