Class: Mocktail::MatcherPresentation

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/mocktail/matcher_presentation.rb,
lib/mocktail/sorbet/mocktail/matcher_presentation.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, **kwargs, &blk) ⇒ Object

standard:disable Style/ArgumentsForwarding



9
10
11
12
13
14
15
# File 'lib/mocktail/matcher_presentation.rb', line 9

def method_missing(name, *args, **kwargs, &blk) # standard:disable Style/ArgumentsForwarding
  if (matcher = MatcherRegistry.instance.get(name))
    matcher.new(*args, **kwargs, &blk) # standard:disable Style/ArgumentsForwarding
  else
    super
  end
end

Instance Method Details

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/mocktail/matcher_presentation.rb', line 5

def respond_to_missing?(name, include_private = false)
  !!MatcherRegistry.instance.get(name) || super
end