Sha256: afa2b42aabcc2009c68a40eaa5599a4683a787f45259cb887c95a07311fedaba
Contents?: true
Size: 1.16 KB
Versions: 4
Compression:
Stored size: 1.16 KB
Contents
module Blocks class Renderer attr_accessor :builder delegate :render, to: :block_with_hooks_renderer def initialize(builder) self.builder = builder end # TODO: this needs to be handled by a new renderer def render_with_overrides(*args, &block) options = args.extract_options! name = args.first if name.is_a?(Symbol) || name.is_a?(String) # TODO: block needs to be handled differently so as to provide overrides block_with_hooks_renderer.render(*args, options, &block) elsif options[:partial] partial_renderer.render(options.delete(:partial), options, &block) else # TODO: handle other possible rendering methods such as a custom renderer end end # TODO: this needs to be handled by a new renderer # TODO: also get rid of BlockPlaceholder def deferred_render(*args, &block) block_definition = builder.define(*args, &block) Blocks::BlockPlaceholder.new(block_definition) end AbstractRenderer::RENDERERS.each do |klass| name = klass.to_s.demodulize.underscore.to_sym define_method name do klass.new(self) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
blocks-3.0.4 | lib/blocks/renderers/renderer.rb |
blocks-3.0.3 | lib/blocks/renderers/renderer.rb |
blocks-3.0.2 | lib/blocks/renderers/renderer.rb |
blocks-3.0.1 | lib/blocks/renderers/renderer.rb |