Sha256: b49a1780dd0a8759e1bb58aa537b03461e898f34308e7f13a97619e81c656d4b

Contents?: true

Size: 718 Bytes

Versions: 10

Compression:

Stored size: 718 Bytes

Contents

module Blocks
  class WrapperRenderer < AbstractRenderer
    def render(wrapper, runtime_context, &block)
      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

10 entries across 10 versions & 1 rubygems

Version Path
blocks-3.0.0 lib/blocks/renderers/wrapper_renderer.rb
blocks-3.0.0.rc9 lib/blocks/renderers/wrapper_renderer.rb
blocks-3.0.0.rc8 lib/blocks/renderers/wrapper_renderer.rb
blocks-3.0.0.rc7 lib/blocks/renderers/wrapper_renderer.rb
blocks-3.0.0.rc6 lib/blocks/renderers/wrapper_renderer.rb
blocks-3.0.0.rc5 lib/blocks/renderers/wrapper_renderer.rb
blocks-3.0.0.rc4 lib/blocks/renderers/wrapper_renderer.rb
blocks-3.0.0.rc3 lib/blocks/renderers/wrapper_renderer.rb
blocks-3.0.0.rc2 lib/blocks/renderers/wrapper_renderer.rb
blocks-3.0.0.rc1 lib/blocks/renderers/wrapper_renderer.rb