Module: Speculations::Parser::State::Candidate

Extended by:
Candidate
Included in:
Candidate
Defined in:
lib/speculations/parser/state/candidate.rb

Instance Method Summary collapse

Instance Method Details

#parse(line, lnb, node, ctxt) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/speculations/parser/state/candidate.rb', line 5

def parse line, lnb, node, ctxt
  case
  when State.blank_line(line)
    [:candidate, node, ctxt]
  when match = State.context_match(line)
    _parse_context(match, lnb:, node:)
  when match = State.maybe_include(line)
    [:candidate, node, :inc]
  when match = State.maybe_example(line)
    [:candidate, node, match[:title]]
  when match = State.ruby_code_block(line)
    _parse_ruby_code_block(match, ctxt:, lnb:, node:)
  else
    [:out, node]
  end
end