Class: Spider::TemplateBlocks::Render

Inherits:
Block show all
Defined in:
lib/spiderfw/templates/blocks/render.rb

Instance Attribute Summary

Attributes inherited from Block

#allowed_blocks, #doctype, #el, #template

Instance Method Summary collapse

Methods inherited from Block

#compile_content, #compile_text, #escape_text, #get_following, #initialize, #inspect, #parse_content, var_to_scene, #var_to_scene, #vars_to_scene, vars_to_scene

Constructor Details

This class inherits a constructor from Spider::TemplateBlocks::Block

Instance Method Details

#compile(options = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/spiderfw/templates/blocks/render.rb', line 7

def compile(options={})
    c = ""
    init = ""
    if (@el.has_attribute?('obj'))
        c_scene_obj = var_to_scene(@el.get_attribute('obj'))
        i_scene_obj = var_to_scene(@el.get_attribute('obj'), 'scene')
        init += "#{i_scene_obj}.request = @request\n"
        init += "#{i_scene_obj}.response = @response\n"
        c += "#{c_scene_obj}.render(self)\n"
    end
    return CompiledBlock.new(init, c)
end