Class: Amrita2::Core::Hook::Renderer
- Inherits:
-
Renderers::Base
- Object
- Renderers::Base
- Amrita2::Core::Hook::Renderer
- Defined in:
- lib/amrita2/template.rb
Overview
:nodoc: all
Instance Method Summary collapse
- #generate_body(cg, de, element) ⇒ Object
-
#initialize ⇒ Renderer
constructor
A new instance of Renderer.
Methods inherited from Renderers::Base
Constructor Details
#initialize ⇒ Renderer
Returns a new instance of Renderer.
1840 1841 1842 |
# File 'lib/amrita2/template.rb', line 1840 def initialize super("Hook") end |
Instance Method Details
#generate_body(cg, de, element) ⇒ Object
1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 |
# File 'lib/amrita2/template.rb', line 1844 def generate_body(cg, de, element) cg.code("e = #{ cg.define_constant(element.to_s.inspect)}") cg.code("$_.call(__stream__, __cnt__, e) do |name, it| ") cg.level_up do cg.case_('name') do cg.when_("nil") do cg.code("render_with(it, __binding__)") end de.children.each do |c| next unless c.kind_of?(DynamicElement) cg.when_(c.name.intern.inspect) do cg.code("#{c.instance_name}.render_with(it, __binding__)") end end end end cg.code("end") end |