Sha256: 61c1fed6f235c4e6dba474a6cec08b3f2079ee8b92679527f1f89d01aca9cba5

Contents?: true

Size: 1003 Bytes

Versions: 8

Compression:

Stored size: 1003 Bytes

Contents

require 'spiderfw/templates/template_blocks'

module Spider; module TemplateBlocks
    
    class Run < Block
        
        def compile(options={})
            c = ""
            init = nil
            runtime_contents = @el.children_of_type('tpl:runtime-content')
            if (@el.attributes['obj'])
                scene_obj = var_to_scene(@el.attributes['obj'])
                runtime_contents.each do |rc|
                    content = rc.innerHTML.strip
                    content.gsub!("'", "\\\\'")
                    condition = ""
                    if (rc.attributes['for'])
                        condition = " if #{scene_obj}.local_id.to_s == '#{rc.attributes['for']}'"
                    end
                    c += "#{scene_obj}.parse_runtime_content_xml('#{content}')#{condition}\n"
                end
                c += "#{scene_obj}.render if (#{scene_obj})\n"
            end
            return CompiledBlock.new(init, c)
        end
        
    end
    
    
end; end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
spiderfw-0.5.7 lib/spiderfw/templates/blocks/run.rb
spiderfw-0.5.6 lib/spiderfw/templates/blocks/run.rb
spiderfw-0.5.5 lib/spiderfw/templates/blocks/run.rb
spiderfw-0.5.4 lib/spiderfw/templates/blocks/run.rb
spiderfw-0.5.3 lib/spiderfw/templates/blocks/run.rb
spiderfw-0.5.2 lib/spiderfw/templates/blocks/run.rb
spiderfw-0.5.1 lib/spiderfw/templates/blocks/run.rb
spiderfw-0.5 lib/spiderfw/templates/blocks/run.rb