Class: Babl::Rendering::CompiledTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/babl/rendering/compiled_template.rb

Instance Method Summary collapse

Instance Method Details

#json(root) ⇒ Object



9
10
11
12
# File 'lib/babl/rendering/compiled_template.rb', line 9

def json(root)
    data = render(root)
    ::MultiJson.dump(data, pretty: pretty)
end

#render(root) ⇒ Object



14
15
16
17
18
19
# File 'lib/babl/rendering/compiled_template.rb', line 14

def render(root)
    preloaded_data = preloader.preload([root], dependencies).first
    frame = Context.new
    frame.object = preloaded_data
    node.render(frame)
end