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/candidate.rb

Defined Under Namespace

Modules: State Classes: Context

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parsersObject



7
8
9
10
11
12
13
# File 'lib/speculations/parser.rb', line 7

def self.parsers
  @__parsers__ ||= {
    candidate: State::Candidate,
    in: State::In,
    out: State::Out
  }
end

Instance Method Details

#parse_from_file(file) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/speculations/parser.rb', line 15

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