Class: Tilt::ERBTemplate

Inherits:
Object show all
Defined in:
lib/rad/template/_support/tilt.rb

Class Method Summary collapse

Class Method Details

.capture(context, &block) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rad/template/_support/tilt.rb', line 38

def self.capture context, &block
  begin
    old_output = context.instance_variable_get "@output"
    old_output.must_be.defined
    context.instance_variable_set "@output", ""
    block.call
    context.instance_variable_get "@output"
  ensure
    context.instance_variable_set "@output", old_output
  end
end

.concat(context, value) ⇒ Object



50
51
52
# File 'lib/rad/template/_support/tilt.rb', line 50

def self.concat context, value
  get_output(context) << value
end

.get_output(context) ⇒ Object



34
35
36
# File 'lib/rad/template/_support/tilt.rb', line 34

def self.get_output context
  context.instance_variable_get "@output"
end