Class: Flexr::Codegen::Firstmatch

Inherits:
Base
  • Object
show all
Defined in:
lib/flexr/codegen/firstmatch.rb

Instance Attribute Summary

Attributes inherited from Base

#compiled

Instance Method Summary collapse

Methods inherited from Base

#stats

Constructor Details

#initialize(compiled, experimental: false) ⇒ Firstmatch

Returns a new instance of Firstmatch.

Raises:



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

#generateObject



12
13
14
# File 'lib/flexr/codegen/firstmatch.rb', line 12

def generate
  compiled.rules.map { |rule| rule.patterns }.flatten.freeze
end