Class: Speculations::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/speculations/parser.rb,
lib/speculations/parser/context.rb,
lib/speculations/parser/state/in.rb,
lib/speculations/parser/state/out.rb,
lib/speculations/parser/state/examples.rb,
lib/speculations/parser/state/includes.rb,
lib/speculations/parser/state/candidate.rb,
lib/speculations/parser/state/spec_context.rb,
lib/speculations/parser/state/context_maker.rb,
lib/speculations/parser/state/specify_block.rb

Defined Under Namespace

Modules: State Classes: Context

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parsersObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/speculations/parser.rb', line 9

def self.parsers
  @__parsers__ ||= {
    candidate: State::Candidate,
    examples: State::Examples,
    in: State::In,
    includes: State::Includes,
    out: State::Out,
    spec_context: State::SpecContext,
    specify_block: State::SpecifyBlock
  }
end

Instance Method Details

#parse_from_file(file, debug: false) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/speculations/parser.rb', line 21

def parse_from_file(file, debug: false)
  @filename = file
  @input = File
    .new(file)
    .each_line(chomp: true)
    .lazy
  parse!(debug:)
end