Sha256: aa2d0c9d3bb2858017a49c3fac702b11394e79bf15ba42e79cf053d3660a3ea2

Contents?: true

Size: 710 Bytes

Versions: 4

Compression:

Stored size: 710 Bytes

Contents

module Blocks
  class WrapperRenderer < AbstractRenderer
    def render(wrapper, runtime_context)
      content_block = Proc.new { with_output_buffer { yield } }
      if wrapper.nil?
        yield
      elsif wrapper.is_a?(Proc)
        output_buffer << capture(content_block, *(runtime_context.runtime_args), runtime_context, &wrapper)
      elsif block_definition = block_for(wrapper)
        runtime_context = runtime_context.extend_to_block_definition(block_definition)
        block_renderer.render(content_block, runtime_context)
      elsif builder.respond_to?(wrapper)
        output_buffer << builder.send(wrapper, runtime_context, &content_block)
      else
        yield
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
blocks-3.0.4 lib/blocks/renderers/wrapper_renderer.rb
blocks-3.0.3 lib/blocks/renderers/wrapper_renderer.rb
blocks-3.0.2 lib/blocks/renderers/wrapper_renderer.rb
blocks-3.0.1 lib/blocks/renderers/wrapper_renderer.rb