Class: MethodFound::Interceptor::Matcher
- Inherits:
-
Struct
- Object
- Struct
- MethodFound::Interceptor::Matcher
- Defined in:
- lib/method_found/interceptor.rb
Instance Method Summary collapse
Instance Method Details
#inspect ⇒ Object
87 88 89 |
# File 'lib/method_found/interceptor.rb', line 87 def inspect matcher.inspect end |
#match(method_name, context) ⇒ Object
73 74 75 76 77 78 79 80 81 |
# File 'lib/method_found/interceptor.rb', line 73 def match(method_name, context) if matcher.is_a?(Regexp) matcher.match(method_name) elsif matcher.respond_to?(:call) context.instance_exec(method_name, &matcher) else (matcher.to_sym == method_name) end end |
#proc? ⇒ Boolean
83 84 85 |
# File 'lib/method_found/interceptor.rb', line 83 def proc? matcher.is_a?(Proc) end |