Class: Mustermann::AST::Pattern Abstract
- Inherits:
-
RegexpBased
- Object
- Pattern
- RegexpBased
- Mustermann::AST::Pattern
- Extended by:
- Forwardable, SingleForwardable
- Defined in:
- lib/mustermann/ast/pattern.rb
Overview
Superclass for pattern styles that parse an AST from the string pattern.
Constant Summary
Constants included from Mustermann
CompileError, DEFAULT_TYPE, Error, ExpandError, ParseError, TrieError
Instance Attribute Summary
Attributes inherited from RegexpBased
Attributes inherited from Pattern
Class Method Summary collapse
- .ast_cache ⇒ Object private
Instance Method Summary collapse
-
#expand(behavior = nil, values = {}) ⇒ String
All AST-based pattern implementations support expanding.
- #identity_params?(params) ⇒ Boolean private
-
#to_templates ⇒ Array<String>
All AST-based pattern implementations support generating templates.
Methods inherited from RegexpBased
#initialize, #match, #peek_match, #peek_size
Methods inherited from Pattern
#+, #==, #===, #=~, #eql?, #hash, #initialize, #match, new, #params, #peek, #peek_match, #peek_params, #peek_size, supported?, supported_options, #to_proc, #to_s, #|
Methods included from Mustermann
Constructor Details
This class inherits a constructor from Mustermann::RegexpBased
Class Method Details
.ast_cache ⇒ 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.
28 29 30 |
# File 'lib/mustermann/ast/pattern.rb', line 28 def self.ast_cache @ast_cache ||= EqualityMap.new end |
Instance Method Details
#expand(behavior = nil, values = {}) ⇒ String
All AST-based pattern implementations support expanding.
122 123 124 125 |
# File 'lib/mustermann/ast/pattern.rb', line 122 def (behavior = nil, values = {}) @expander ||= Mustermann::Expander.new(self) @expander.(behavior, values) end |
#identity_params?(params) ⇒ 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.
150 151 152 |
# File 'lib/mustermann/ast/pattern.rb', line 150 def identity_params?(params) param_converters.empty? && super end |
#to_templates ⇒ Array<String>
All AST-based pattern implementations support generating templates.
133 134 135 |
# File 'lib/mustermann/ast/pattern.rb', line 133 def to_templates @to_templates ||= generate_templates(to_ast) end |