Class: Lilac::Renderer

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

Instance Method Summary collapse

Constructor Details

#initialize(data = nil) ⇒ Renderer

Returns a new instance of Renderer.



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

def initialize(data = nil)
  @data = data ? data : []
end

Instance Method Details

#renderObject



7
8
9
10
11
12
13
14
# File 'lib/lilac/renderer.rb', line 7

def render
  @data.inject("") { |acc, (t, b)|
    acc << build(t, b, 1)
    acc
  }.instance_eval { |rendered_list|
    "<ul>#{rendered_list}</ul>"
  }
end