Sha256: 8580cd0b0268638cb1808d0b6eb18dd6e2f9996ec2eb8b5eddd736a38ce8efd6
Contents?: true
Size: 993 Bytes
Versions: 4
Compression:
Stored size: 993 Bytes
Contents
module Blocks class PartialRenderer < AbstractRenderer def render(partial, options={}, &block) if !options.is_a?(Blocks::RuntimeContext) options = RuntimeContext.new(builder, options).to_hash.with_indifferent_access.deep_dup end overrides_and_provided_content = capture(builder, options, &block) if block_given? locals = options.merge( (options[: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] = 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 end end
Version data entries
4 entries across 4 versions & 1 rubygems