Class: MDOM::Parser::Reader

Inherits:
Object
  • Object
show all
Defined in:
lib/mdom/parser.rb

Overview

Line-oriented block scanner. parse_blocks returns a flat array of sibmling block nodes (and nothing else), so callers don't juggle an index.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lines) ⇒ Reader

Returns a new instance of Reader.



60
61
62
63
# File 'lib/mdom/parser.rb', line 60

def initialize(lines)
  @lines = lines
  @pos = 0
end

Class Method Details

.parse_lines(lines) ⇒ Object



69
70
71
# File 'lib/mdom/parser.rb', line 69

def self.parse_lines(lines)
  new(lines).send(:parse_blocks)
end

Instance Method Details

#parseObject



65
66
67
# File 'lib/mdom/parser.rb', line 65

def parse
  Document.new(children: parse_blocks)
end