Class: Blocks::WrapperRenderer
- Inherits:
-
AbstractRenderer
- Object
- AbstractRenderer
- Blocks::WrapperRenderer
- Defined in:
- lib/blocks/renderers/wrapper_renderer.rb
Constant Summary
Constants inherited from AbstractRenderer
Instance Attribute Summary
Attributes inherited from AbstractRenderer
Instance Method Summary collapse
Methods inherited from AbstractRenderer
Constructor Details
This class inherits a constructor from Blocks::AbstractRenderer
Instance Method Details
#render(wrapper, runtime_context) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/blocks/renderers/wrapper_renderer.rb', line 3 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 |