class SC::RenderEngine::Erubis
Public Class Methods
new(html_context)
click to toggle source
# File lib/sproutcore/render_engines/erubis.rb, line 12 def initialize(html_context) @html_context = html_context end
Public Instance Methods
capture(*args, &block)
click to toggle source
# File lib/sproutcore/render_engines/erubis.rb, line 30 def capture(*args, &block) begin buffer = eval('_buf', block.binding) rescue buffer = nil end if buffer.nil? block.call(*args).to_s else pos = buffer.length block.call(*args) # get emitted data data = buffer[pos..-1] # remove from buffer buffer[pos..-1] = '' data end end
compile(input)
click to toggle source
# File lib/sproutcore/render_engines/erubis.rb, line 16 def compile(input) begin require 'erubis' rescue raise "Cannot render ERB file because erubis is not installed. Try running 'sudo gem install erubis' and try again" end ::Erubis::Eruby.new.convert(input) end
concat(string, binding)
click to toggle source
# File lib/sproutcore/render_engines/erubis.rb, line 26 def concat(string, binding) eval('_buf', binding) << string end