Sha256: f31b83912ad3c241005a624273b9babf91d0e1dffb4ae214b19429ff964f079c
Contents?: true
Size: 723 Bytes
Versions: 4
Compression:
Stored size: 723 Bytes
Contents
module Blocks class NestingBlocksRenderer < AbstractRenderer def render(hook, runtime_context) block = block_for(runtime_context.block_name) hooks = block.try(:hooks_for, hook) if hooks.present? content_block = Proc.new { with_output_buffer { yield } } renderer = hooks.inject(content_block) do |inner_content, hook_definition| hook_runtime_context = runtime_context.extend_to_block_definition(hook_definition) Proc.new { with_output_buffer do block_renderer.render(inner_content, hook_runtime_context) end } end output_buffer << renderer.call else yield end end end end
Version data entries
4 entries across 4 versions & 1 rubygems