Class: Hoozuki::Pattern
- Inherits:
-
Object
- Object
- Hoozuki::Pattern
- Defined in:
- lib/hoozuki.rb
Instance Method Summary collapse
-
#initialize(pattern, engine: :dfa) ⇒ Pattern
constructor
A new instance of Pattern.
- #match?(input) ⇒ Boolean
Constructor Details
Instance Method Details
#match?(input) ⇒ Boolean
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/hoozuki.rb', line 17 def match?(input) case @engine when :dfa @compiled.match?(input, Hoozuki.__send__(:use_cache?, input)) when :vm Hoozuki::VM::Evaluator.evaluate(@compiled, input, 0, 0) else raise ArgumentError, "Unknown engine: #{@engine}" end end |