Class: Blocks::PartialRenderer
- Inherits:
-
AbstractRenderer
- Object
- AbstractRenderer
- Blocks::PartialRenderer
- Defined in:
- lib/blocks/renderers/partial_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(partial, options = {}, &block) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/blocks/renderers/partial_renderer.rb', line 3 def render(partial, ={}, &block) if !.is_a?(Blocks::RuntimeContext) = RuntimeContext.new(builder, ).to_hash.with_indifferent_access end overrides_and_provided_content = capture(builder, , &block) if block_given? locals = .merge( ([:builder_variable] || :builder) => builder, ) locals = if locals.respond_to?(:deep_symbolize_keys) locals.deep_symbolize_keys else locals.symbolize_keys end partial = partial.to_partial_path if partial.respond_to?(:to_partial_path) locals[:options] = view.render(layout: partial, locals: locals) do |*args| if overrides_and_provided_content overrides_and_provided_content.to_str.gsub(/PLACEHOLDER_FOR_([\w]+)/) do |s| builder.render $1, *args end.html_safe end end end |