Module: ABNF::Parser::Compiler::CompileMethod

Defined in:
lib/abnf/parser/compiler.rb

Instance Method Summary collapse

Instance Method Details

#compile(stream) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/abnf/parser/compiler.rb', line 15

def compile stream
  stream = ABNF::Parser::TextStream(stream)
  pattern = self.pattern
  match_data = stream.match pattern

  return unless match_data

  instance = build stream, match_data
  instance.()
end

#compile?(stream) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/abnf/parser/compiler.rb', line 11

def compile? stream
  if compile stream then true else false end
end