Class: Yamlt::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/yamlt/parser.rb,
lib/yamlt/parser/line.rb,
lib/yamlt/parser/state.rb,
lib/yamlt/parser/line/serializer.rb

Defined Under Namespace

Classes: Line, State, StateException

Instance Method Summary collapse

Constructor Details

#initialize(filepath) ⇒ Parser

Returns a new instance of Parser.



15
16
17
18
# File 'lib/yamlt/parser.rb', line 15

def initialize(filepath)
  @filepath = filepath
  @state = Yamlt::Parser::State.new
end

Instance Method Details

#parseObject



22
23
24
25
26
27
28
29
30
# File 'lib/yamlt/parser.rb', line 22

def parse
  IO.read(@filepath).each_line do |line|
    parse_line(line)
  end

  @state.flush

  @state
end