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