Class: Mustermann::Set::Trie::Translator
- Inherits:
-
AST::Translator
- Object
- AST::Translator
- Mustermann::Set::Trie::Translator
- Defined in:
- mustermann/lib/mustermann/set/trie.rb
Constant Summary
Constants inherited from AST::Translator
Instance Attribute Summary collapse
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Instance Method Summary collapse
-
#compile(node, **options) ⇒ Object
\G anchors to a position passed to String#match, avoiding substring allocation.
-
#initialize(pattern) ⇒ Translator
constructor
A new instance of Translator.
Constructor Details
#initialize(pattern) ⇒ Translator
Returns a new instance of Translator.
60 61 62 63 64 65 |
# File 'mustermann/lib/mustermann/set/trie.rb', line 60 def initialize(pattern) @pattern = pattern @compiler = pattern.compiler.new @options = pattern. super() end |
Instance Attribute Details
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
58 59 60 |
# File 'mustermann/lib/mustermann/set/trie.rb', line 58 def pattern @pattern end |
Instance Method Details
#compile(node, **options) ⇒ Object
\G anchors to a position passed to String#match, avoiding substring allocation.
68 |
# File 'mustermann/lib/mustermann/set/trie.rb', line 68 def compile(node, **) = /\G#{@compiler.translate(node, **@options, **)}/ |