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
This class is abstract.
Superclass for pattern styles that parse an AST from the string pattern.
Direct Known Subclasses
Constant Summary
Constants included from Mustermann
CompileError, DEFAULT_TYPE, Error, ExpandError, ParseError
Instance Attribute Summary
Attributes inherited from RegexpBased
Attributes inherited from Pattern
Instance Method Summary collapse
-
#expand(behavior = nil, values = {}) ⇒ String
All AST-based pattern implementations support expanding.
-
#to_templates ⇒ Array<String>
All AST-based pattern implementations support generating templates.
Methods inherited from RegexpBased
#initialize, #peek_match, #peek_size
Methods inherited from Pattern
#+, #==, #===, #=~, #eql?, #hash, #initialize, #match, #named_captures, #names, 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
Instance Method Details
#expand(behavior = nil, values = {}) ⇒ String
All AST-based pattern implementations support expanding.
106 107 108 109 |
# File 'lib/mustermann/ast/pattern.rb', line 106 def (behavior = nil, values = {}) @expander ||= Mustermann::Expander.new(self) @expander.(behavior, values) end |
#to_templates ⇒ Array<String>
All AST-based pattern implementations support generating templates.
117 118 119 |
# File 'lib/mustermann/ast/pattern.rb', line 117 def to_templates @to_templates ||= generate_templates(to_ast) end |