Class: Erubis::Context
- Includes:
- Waves::Helpers::TagHelper, Waves::Helpers::UrlHelper
- Defined in:
- lib/renderers/erubis.rb
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
11 12 13 |
# File 'lib/renderers/erubis.rb', line 11 def <<(s) eval("_buf", @binding).concat s # add to rendered output end |
#capture ⇒ Object
15 16 17 18 19 20 |
# File 'lib/renderers/erubis.rb', line 15 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 |
#render(eruby) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/renderers/erubis.rb', line 22 def render(eruby) unless @binding @binding = binding eval("_buf = ''; _context = []", @binding) end eruby.result @binding end |