Class: Mustermann::Set::Trie::Translator
- Inherits:
-
AST::Translator
- Object
- AST::Translator
- Mustermann::Set::Trie::Translator
- Defined in:
- 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
-
#initialize(pattern) ⇒ Translator
constructor
A new instance of Translator.
- #possible_strings(char) ⇒ Object
Constructor Details
#initialize(pattern) ⇒ Translator
Returns a new instance of Translator.
59 60 61 62 63 64 |
# File 'lib/mustermann/set/trie.rb', line 59 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.
57 58 59 |
# File 'lib/mustermann/set/trie.rb', line 57 def pattern @pattern end |
Instance Method Details
#compile(node, **options) ⇒ Object
66 |
# File 'lib/mustermann/set/trie.rb', line 66 def compile(node, **) = /\A#{@compiler.translate(node, **@options, **)}/ |
#possible_strings(char) ⇒ Object
68 69 70 71 |
# File 'lib/mustermann/set/trie.rb', line 68 def possible_strings(char) return [] if char.empty? @compiler.class.char_representations(char, **@options.slice(:uri_decode, :space_matches_plus)) end |