Module: Speculations::Parser::State::Out

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

Instance Method Summary collapse

Instance Method Details

#parse(data) ⇒ Object



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

def parse(data)
  # debug__(msg: "out #{lnb}: #{line}", debug:)
  line = data.line
  case
  when match = State.context_match(line)
    #dbg_match("context", data)
    make_new_context(data, match: match)
  when match = State.spec_context_line(line)
    #dbg_match("specify context", data)
    make_spec_context(data, title: data.line.strip)
  when match = State.maybe_example(line)
    #dbg_match("maybe_example", data)
    data.update(state: :candidate, ctxt: match[:title])
  when match = State.maybe_include(line)
    #dbg_match("maybe_include", data)
    data.update(state: :candidate, ctxt: :inc)
  else
    data.update(state: :out)
  end
end