Module: Speculations::Parser::State::Candidate
- Extended by:
- Candidate
- Included in:
- Candidate
- Defined in:
- lib/speculations/parser/state/candidate.rb
Instance Method Summary collapse
-
#parse(data) ⇒ Object
def parse line, lnb, node, ctxt, debug: false.
Instance Method Details
#parse(data) ⇒ Object
def parse line, lnb, node, ctxt, debug: false
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/speculations/parser/state/candidate.rb', line 8 def parse(data) line = data.line case when State.blank_line(line) #dbg_match("blank_line", data) data when match = State.context_match(line) #dbg_match("context", data) _parse_context(data, match:) when match = State.maybe_include(line) #dbg_match("maybe_include", data) data.update(ctxt: :inc) when match = State.maybe_example(line) #dbg_match("maybe_example", data) data.update(ctxt: match[:title]) when match = State.ruby_code_block(line) #dbg_match("ruby_code_block", data) _parse_ruby_code_block(data, match:) else data.update(state: :out) end end |