Sha256: f4e835c8b0abf4ffe12c75c203619915393ebb4a2ada499f382f570db2081ddb

Contents?: true

Size: 670 Bytes

Versions: 4

Compression:

Stored size: 670 Bytes

Contents

# frozen_string_literal: true

module Blocks
  class Renderer
    def self.render(builder, *args, &default_definition)
      options = args.extract_options!
      runtime_context = if !options.is_a?(RuntimeContext)
        RuntimeContext.build(builder, *args, options, &default_definition)
      else
        options
      end

      BlockWithHooksRenderer.render(runtime_context)
    end

    # TODO: this needs to be handled by a new renderer
    #  TODO: also get rid of BlockPlaceholder
    def self.deferred_render(builder, *args, &block)
      block_definition = builder.define(*args, &block)
      Blocks::BlockPlaceholder.new(block_definition)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
blocks-4.0.1 lib/blocks/renderers/renderer.rb
blocks-4.0.0 lib/blocks/renderers/renderer.rb
blocks-4.0.0.rc2 lib/blocks/renderers/renderer.rb
blocks-4.0.0.rc1 lib/blocks/renderers/renderer.rb