Sha256: d747722361d3ef59ca3b8e94ff3779288398699fc550a5139fec42f6d476b256
Contents?: true
Size: 831 Bytes
Versions: 1
Compression:
Stored size: 831 Bytes
Contents
class Sinatra::ContentFor2::ErbHandler < Sinatra::ContentFor2::BaseHandler attr_reader :output_buffer def initialize(template) super @output_buffer = template.instance_variable_get(:@_out_buf) end def is_type? ! self.output_buffer.nil? end def block_is_type?(block) is_type? || (block && eval('defined?(__in_erb_template)', block.binding)) end def engines @engines ||= [ :erb, :erubis ] end def capture_from_template(*args, &block) self.output_buffer, _buf_was = '', self.output_buffer block.call(*args) ret = eval('@_out_buf', block.binding) self.output_buffer = _buf_was ret end protected def output_buffer=(value) template.instance_variable_set(:@_out_buf, value) end end Sinatra::ContentFor2::BaseHandler.register(Sinatra::ContentFor2::ErbHandler)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sinatra-content-for2-0.3.alpha1 | lib/sinatra/content_for2/erb_handler.rb |