Class: Mutant::Expression::Namespace::Recursive Private
- Inherits:
-
Mutant::Expression::Namespace
- Object
- Mutant::Expression
- Mutant::Expression::Namespace
- Mutant::Expression::Namespace::Recursive
- Defined in:
- lib/mutant/expression/namespace.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.
Recursive namespace expression
Constant Summary collapse
- 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}?\*\z/
Constants inherited from Mutant::Expression
SCOPE_NAME_PATTERN, SCOPE_SYMBOL_PATTERN
Instance Attribute Summary collapse
-
#syntax ⇒ String
readonly
private
Syntax for expression.
Instance Method Summary collapse
-
#initialize ⇒ undefined
constructor
private
Initialize object.
-
#match_length(expression) ⇒ Integer
private
Length of match with other expression.
-
#matcher(env:) ⇒ Matcher
private
Matcher for expression.
Methods inherited from Mutant::Expression
Constructor Details
#initialize ⇒ undefined
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.
Initialize object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/mutant/expression/namespace.rb', line 17 def initialize(*) super @syntax = "#{scope_name}*".freeze @recursion_pattern = Regexp.union( /\A#{scope_name}\z/, /\A#{scope_name}::/, /\A#{scope_name}[.#]/ ) 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 for expression
32 33 34 |
# File 'lib/mutant/expression/namespace.rb', line 32 def syntax @syntax end |
Instance Method Details
#match_length(expression) ⇒ Integer
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.
Length of match with other expression
48 49 50 51 52 53 54 55 56 |
# File 'lib/mutant/expression/namespace.rb', line 48 def match_length(expression) if eql?(expression) syntax.length elsif @recursion_pattern.match?(expression.syntax) scope_name.length else 0 end end |
#matcher(env:) ⇒ 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
rubocop:disable Lint/UnusedMethodArgument
39 40 41 |
# File 'lib/mutant/expression/namespace.rb', line 39 def matcher(env:) Matcher::Namespace.new(expression: self) end |