Module: Speculations::Parser::State::Includes

Extended by:
Includes
Includes:
ContextMaker
Included in:
Includes
Defined in:
lib/speculations/parser/state/includes.rb

Instance Method Summary collapse

Instance Method Details

#parse(data) ⇒ Object

def parse line, lnb, node, _ctxt, debug: true



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/speculations/parser/state/includes.rb', line 9

def parse(data)
  line = data.line
  case
  when match = State.context_match(line)
    #dbg_match("context", data)
    make_new_context(data, match: match)
  when match = State.maybe_include(line)
    #dbg_match("maybe_include", data)
    data.update(state: :candidate, ctxt: :inc)
  when match = State.maybe_example(line)
    #dbg_match("maybe_example", data)
    data.update(state: :candidate, ctxt: match[:title])
  else
    data
  end
end