Class: Lilac::Parser

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

Instance Method Summary collapse

Constructor Details

#initialize(text = nil) ⇒ Parser

Returns a new instance of Parser.



3
4
5
# File 'lib/lilac/parser.rb', line 3

def initialize(text = nil)
  @text = text ? text.each_line.lazy : []
end

Instance Method Details

#parseObject



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/lilac/parser.rb', line 7

def parse
  @text.inject([]) { |acc, line|
    line = handle_bullet(line)
    begin
      handle_line(line, acc)
    rescue
      # pass
    end
    acc
  }.lazy
end