Class: Mutant::Matcher::Method::Classifier
- Inherits:
-
Object
- Object
- Mutant::Matcher::Method::Classifier
- Includes:
- Adamantium::Flat
- Defined in:
- lib/mutant/matcher/method/classifier.rb
Overview
A classifier for input strings
Constant Summary collapse
- TABLE =
{ '.' => Matcher::ScopeMethods::Singleton, '#' => Matcher::ScopeMethods::Instance }.freeze
- SCOPE_FORMAT =
/\A([^#.]+)(\.|#)(.+)\z/.freeze
- SCOPE_NAME_POSITION =
Positions of captured regexp groups Freezing fixnums to avoid their singleton classes are patched.
1.freeze
- SCOPE_SYMBOL_POSITION =
2.freeze
- METHOD_NAME_POSITION =
3.freeze
Instance Attribute Summary collapse
-
#match ⇒ Matche
readonly
private
Return match.
Class Method Summary collapse
-
.run(input) ⇒ Matcher::Method?
private
Run classifier.
Instance Method Summary collapse
-
#matcher ⇒ Matcher::Method
private
Return method matcher.
-
#method ⇒ Method, UnboundMethod
private
Return method.
Instance Attribute Details
#match ⇒ Matche (readonly)
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.
Return match
71 72 73 |
# File 'lib/mutant/matcher/method/classifier.rb', line 71 def match @match end |
Class Method Details
.run(input) ⇒ Matcher::Method?
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.
Run classifier
35 36 37 38 39 |
# File 'lib/mutant/matcher/method/classifier.rb', line 35 def self.run(input) match = SCOPE_FORMAT.match(input) return unless match new(match).matcher end |
Instance Method Details
#matcher ⇒ Matcher::Method
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.
Return method matcher
47 48 49 |
# File 'lib/mutant/matcher/method/classifier.rb', line 47 def matcher scope_matcher.matcher.new(scope, method) end |
#method ⇒ Method, UnboundMethod
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.
Return method
58 59 60 61 62 |
# File 'lib/mutant/matcher/method/classifier.rb', line 58 def method scope_matcher.methods.detect do |method| method.name == method_name end || raise("Cannot find #{method_name} for #{scope}") end |