Class: Lilac::Parser
- Inherits:
-
Object
- Object
- Lilac::Parser
- Defined in:
- lib/lilac/parser.rb
Instance Method Summary collapse
-
#initialize(text = nil) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
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
#parse ⇒ Object
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 |