Class: MethodFound::Interceptor::Matcher

Inherits:
Struct
  • Object
show all
Defined in:
lib/method_found/interceptor.rb

Instance Method Summary collapse

Instance Method Details

#inspectObject



79
80
81
# File 'lib/method_found/interceptor.rb', line 79

def inspect
  matcher.inspect
end

#match(method_name) ⇒ Object



69
70
71
72
73
74
75
76
77
# File 'lib/method_found/interceptor.rb', line 69

def match(method_name)
  if matcher.is_a?(Regexp)
    matcher.match(method_name)
  elsif matcher.respond_to?(:call)
    matcher.call(method_name) && [method_name.to_s]
  else
    (matcher.to_sym == method_name) && [method_name.to_s]
  end
end