Class: Flexr::Codegen::Firstmatch
- Defined in:
- lib/flexr/codegen/firstmatch.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(compiled, experimental: false) ⇒ Firstmatch
constructor
A new instance of Firstmatch.
Methods inherited from Base
Constructor Details
#initialize(compiled, experimental: false) ⇒ Firstmatch
Returns a new instance of Firstmatch.
6 7 8 9 10 |
# File 'lib/flexr/codegen/firstmatch.rb', line 6 def initialize(compiled, experimental: false) raise CompileError, "firstmatch requires option :experimental" unless experimental super(compiled) end |
Instance Method Details
#generate ⇒ Object
12 13 14 |
# File 'lib/flexr/codegen/firstmatch.rb', line 12 def generate compiled.rules.map { |rule| rule.patterns }.flatten.freeze end |