Sha256: ed08cd9c39521e2b30ed81415355aad8479e4a16bf8e89afaea9d85aa5e1b441

Contents?: true

Size: 708 Bytes

Versions: 12

Compression:

Stored size: 708 Bytes

Contents

require 'spiderfw/templates/template_blocks'

module Spider; module TemplateBlocks
    
    class Lambda < Block
        
        def compile(options={})
            init = ""
            lambda_name = @el.attributes['sp:lambda']
            @el.remove_attribute('sp:lambda')
            c = "#{lambda_name} = Proc.new do\n"            
            content = Spider::TemplateBlocks.parse_element(@el, @allowed_blocks, @template).compile(options)
            content.run_code.each_line do |line|
                c += '  '+line
            end
            c += "end\n"
            c += "#{lambda_name}.call"
            return CompiledBlock.new(init, c)
        end
        
        
    end
    
    
end; end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
spiderfw-1.0.1 lib/spiderfw/templates/blocks/lambda.rb
spiderfw-1.0.0 lib/spiderfw/templates/blocks/lambda.rb
spiderfw-0.6.39 lib/spiderfw/templates/blocks/lambda.rb
spiderfw-0.6.38 lib/spiderfw/templates/blocks/lambda.rb
spiderfw-0.6.37 lib/spiderfw/templates/blocks/lambda.rb
spiderfw-0.6.35 lib/spiderfw/templates/blocks/lambda.rb
spiderfw-0.6.34 lib/spiderfw/templates/blocks/lambda.rb
spiderfw-0.6.33 lib/spiderfw/templates/blocks/lambda.rb
spiderfw-0.6.32 lib/spiderfw/templates/blocks/lambda.rb
spiderfw-0.6.31 lib/spiderfw/templates/blocks/lambda.rb
spiderfw-0.6.30 lib/spiderfw/templates/blocks/lambda.rb
spiderfw-0.6.29 lib/spiderfw/templates/blocks/lambda.rb