Class: Mutant::Expression Private
- Inherits:
-
Object
- Object
- Mutant::Expression
- Includes:
- AbstractType, Adamantium::Flat
- Defined in:
- lib/mutant/expression.rb,
lib/mutant/expression/method.rb,
lib/mutant/expression/parser.rb,
lib/mutant/expression/methods.rb,
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.
Abstract base class for match expression
Defined Under Namespace
Classes: Method, Methods, Namespace, Parser
Constant Summary collapse
- SCOPE_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.
/(?<scope_name>#{fragment}(?:#{SCOPE_OPERATOR}#{fragment})*)/.freeze
- SCOPE_SYMBOL_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.
'(?<scope_symbol>[.#])'.freeze
Class Method Summary collapse
-
.try_parse(input) ⇒ Expression?
private
Try to parse input into expression of receiver class.
Instance Method Summary collapse
-
#match_length(other) ⇒ Fixnum
private
Match length with other expression.
-
#prefix?(other) ⇒ Boolean
private
Test if expression is prefix.
-
#syntax ⇒ String
private
Syntax of expression.
Class Method Details
.try_parse(input) ⇒ Expression?
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.
Try to parse input into expression of receiver class
49 50 51 52 53 54 |
# File 'lib/mutant/expression.rb', line 49 def self.try_parse(input) match = self::REGEXP.match(input) return unless match names = anima.attribute_names new(Hash[names.zip(names.map(&match.method(:[])))]) end |
Instance Method Details
#match_length(other) ⇒ Fixnum
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.
Match length with other expression
23 24 25 26 27 28 29 |
# File 'lib/mutant/expression.rb', line 23 def match_length(other) if eql?(other) syntax.length else 0 end end |
#prefix?(other) ⇒ Boolean
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.
Test if expression is prefix
36 37 38 |
# File 'lib/mutant/expression.rb', line 36 def prefix?(other) !match_length(other).zero? end |
#syntax ⇒ String
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
16 |
# File 'lib/mutant/expression.rb', line 16 abstract_method :syntax |