Class: Evil::Plugin::TagExecution

Inherits:
Object
  • Object
show all
Defined in:
lib/evil/plugin/block_tag.rb

Instance Method Summary collapse

Constructor Details

#initialize(tag, options, context, &block) ⇒ TagExecution

Returns a new instance of TagExecution.



6
7
8
9
10
11
# File 'lib/evil/plugin/block_tag.rb', line 6

def initialize(tag, options, context, &block)
  @options = Tag.evaluate(options, context)
  @context = context
  @tag = tag
  @proc = block
end

Instance Method Details

#body(locals = {}) ⇒ Object



13
14
15
16
17
18
# File 'lib/evil/plugin/block_tag.rb', line 13

def body(locals={})
  @context.stack do
    locals.each { |k, v| @context[k.to_s] = v }
    return @tag.render_body(@context).to_s
  end
end

#executeObject



20
21
22
# File 'lib/evil/plugin/block_tag.rb', line 20

def execute
  self.instance_exec(@options, &@proc)
end

#to_sObject



24
25
26
# File 'lib/evil/plugin/block_tag.rb', line 24

def to_s
  execute.to_s
end