Class Erubis::Context
In: lib/layers/renderers/erubis.rb
Parent: Object

This is added to the Erubis Content class to allow the same helper methods to be used with both Markaby and Erubis.

Methods

<<   capture   render  

Public Instance methods

[Source]

    # File lib/layers/renderers/erubis.rb, line 9
 9:     def <<(s) 
10:       eval("_buf", @binding).concat s # add to rendered output
11:     end

[Source]

    # File lib/layers/renderers/erubis.rb, line 13
13:     def capture
14:       eval("_context.push(_buf); _buf = ''", @binding) #ignore output from that eval, will be added via "<<"
15:       result = Erubis::Eruby.new(yield).result @binding
16:       eval("_buf = _context.pop", @binding)
17:       result
18:     end

[Source]

    # File lib/layers/renderers/erubis.rb, line 20
20:     def render(eruby)
21:       unless @binding
22:         @binding = binding
23:         eval("_buf = ''; _context = []", @binding)
24:       end
25:       eruby.result @binding
26:     end

[Validate]