Class: Erubis::Context
Overview
This is added to the Erubis Content class to allow the same helper methods to be used with both Markaby and Erubis.
Instance Method Summary collapse
Instance Method Details
#<<(s) ⇒ Object
9 10 11 |
# File 'lib/layers/renderers/erubis.rb', line 9 def <<(s) eval("_buf << '#{s}'", @binding) end |
#capture ⇒ Object
13 14 15 16 17 18 |
# File 'lib/layers/renderers/erubis.rb', line 13 def capture eval("_context.push(_buf); _buf = ''", @binding) #ignore output from that eval, will be added via "<<" result = Erubis::Eruby.new(yield).result @binding eval("_buf = _context.pop", @binding) result end |
#to_s(eruby) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/layers/renderers/erubis.rb', line 20 def to_s(eruby) unless @binding @binding = binding eval("_buf = ''; _context = []", @binding) end eruby.result @binding end |