Class: Mutant::Expression::Method Private
- Inherits:
- 
      Mutant::Expression
      
        - Object
- Mutant::Expression
- Mutant::Expression::Method
 
- Extended by:
- AST::Sexp
- Defined in:
- lib/mutant/expression/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.
Explicit method expression
Constant Summary collapse
- MATCHERS =
          This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future. 
- { '.' => [Matcher::Methods::Singleton, Matcher::Methods::Metaclass].freeze, '#' => [Matcher::Methods::Instance].freeze }.freeze 
- METHOD_NAME_PATTERN =
          This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future. 
- /(?<method_name>.+)/.freeze 
- REGEXP =
          This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future. 
- /\A#{SCOPE_NAME_PATTERN}#{SCOPE_SYMBOL_PATTERN}#{METHOD_NAME_PATTERN}\z/.freeze 
Constants inherited from Mutant::Expression
SCOPE_NAME_PATTERN, SCOPE_SYMBOL_PATTERN
Instance Attribute Summary collapse
- 
  
    
      #syntax  ⇒ String 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  private
  
    Syntax of expression. 
Class Method Summary collapse
- .try_parse(input) ⇒ Object private
Instance Method Summary collapse
- 
  
    
      #initialize  ⇒ Method 
    
    
  
  
  
    constructor
  
  
  
  
  
  private
  
    A new instance of Method. 
- 
  
    
      #matcher  ⇒ Matcher 
    
    
  
  
  
  
  
  
  
  private
  
    Matcher for expression. 
Methods inherited from Mutant::Expression
Constructor Details
#initialize ⇒ 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.
Returns a new instance of Method.
| 29 30 31 32 | # File 'lib/mutant/expression/method.rb', line 29 def initialize(*) super @syntax = [scope_name, scope_symbol, method_name].join.freeze end | 
Instance Attribute Details
#syntax ⇒ String (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.
Syntax of expression
| 37 38 39 | # File 'lib/mutant/expression/method.rb', line 37 def syntax @syntax end | 
Class Method Details
.try_parse(input) ⇒ Object
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.
| 51 52 53 54 55 | # File 'lib/mutant/expression/method.rb', line 51 def self.try_parse(input) match = REGEXP.match(input) or return from_match(match) if valid_method_name?(match[:method_name]) end | 
Instance Method Details
#matcher ⇒ Matcher
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.
Matcher for expression
| 42 43 44 45 46 47 48 49 | # File 'lib/mutant/expression/method.rb', line 42 def matcher matcher_candidates = MATCHERS.fetch(scope_symbol) .map { |submatcher| submatcher.new(scope) } methods_matcher = Matcher::Chain.new(matcher_candidates) Matcher::Filter.new(methods_matcher, ->(subject) { subject.expression.eql?(self) }) end |