Class: Sinclair::Matchers::AddMethod Abstract Private

Inherits:
RSpec::Matchers::BuiltIn::BaseMatcher
  • Object
show all
Defined in:
lib/sinclair/matchers/add_method.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.

This class is abstract.

Base class for add_method matcher

Author:

  • darthjee

Direct Known Subclasses

AddClassMethod, AddInstanceMethod

Instance Method Summary collapse

Constructor Details

#initialize(method) ⇒ AddMethod

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 AddMethod.

Parameters:

  • method (String, Symbol)

    the method, to be checked, name



12
13
14
# File 'lib/sinclair/matchers/add_method.rb', line 12

def initialize(method)
  @method = method.to_sym
end

Instance Method Details

#equal?(other) ⇒ Boolean Also known as: ==

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.

Checkes if another instnce is equal self

Returns:

  • (Boolean)


26
27
28
29
30
# File 'lib/sinclair/matchers/add_method.rb', line 26

def equal?(other)
  return unless other.class == self.class

  other.method == method
end

#supports_block_expectations?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.

definition needed for block matchers

Returns:

  • (Boolean)


19
20
21
# File 'lib/sinclair/matchers/add_method.rb', line 19

def supports_block_expectations?
  true
end