class ActionView::Renderer

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/action_view/renderer/renderer.rbs

class ActionView::Renderer
  def cache_hits: () -> untyped
  def collection_from_options: (Hash options) -> nil
  def initialize: (ActionView::LookupContext lookup_context) -> void
  
  type ActionView__Renderer_render_context = #<Class:0x000000010fd1fb40> | #<Class:0x0000000112f705b8> | #<Class:0x000000011a28aaa8> | #<Class:0x000000010c9dfbe0> | #<Class:0x000000011fcbe380>
  
  def render: (ActionView__Renderer_render_context context, Hash options) -> ActionView::OutputBuffer
  
  type ActionView__Renderer_render_partial_to_object_context = #<Class:0x00000001129d5018> | #<Class:0x00000001077afb40> | #<Class:0x0000000112ef7460> | #<Class:0x0000000117253b78>
  
  def render_partial_to_object: (ActionView__Renderer_render_partial_to_object_context context, Hash options, ) -> ActionView::AbstractRenderer::RenderedTemplate
  def render_template_to_object: ((#<Class:0x0000000108d7e610> | #<Class:0x00000001077afb40> | #<Class:0x0000000116cb8858>) context, Hash options) -> ActionView::AbstractRenderer::RenderedTemplate
  
  type ActionView__Renderer_render_to_object_context = #<Class:0x000000011a1a2640> | #<Class:0x000000010fd1fb40> | #<Class:0x0000000116cdc140> | #<Class:0x000000010fb94398> | #<Class:0x000000010ff1d168> | #<Class:0x00000001089f1d80>
  
  def render_to_object: (ActionView__Renderer_render_to_object_context context, Hash options) -> ActionView::AbstractRenderer::RenderedTemplate
end

each time render is called.
the setup and logic necessary to render a view and a new object is created
TemplateRenderer and PartialRenderer objects are wrappers which do all
method and render a partial or a template based on the options. The
The Renderer will parse the options from the render or render_body
actually renders the template.
to other objects like TemplateRenderer and PartialRenderer which
This is the main entry point for rendering. It basically delegates

def cache_hits # :nodoc:

Experimental RBS support (using type sampling data from the type_fusion project).

def cache_hits: () -> untyped

This signature was generated using 2 samples from 1 application.

:nodoc:
def cache_hits # :nodoc:
  @cache_hits ||= {}
end

def collection_from_object(object)

def collection_from_object(object)
  object if object.respond_to?(:to_ary)
end

def collection_from_options(options)

Experimental RBS support (using type sampling data from the type_fusion project).

def collection_from_options: ((partial | String | partial | String | locals | result | NilClass) options) -> nil

This signature was generated using 7 samples from 1 application.

def collection_from_options(options)
  if options.key?(:collection)
    collection = options[:collection]
    collection || []
  end
end

def initialize(lookup_context)

Experimental RBS support (using type sampling data from the type_fusion project).

def initialize: (ActionView::LookupContext lookup_context) -> void

This signature was generated using 1 sample from 1 application.

def initialize(lookup_context)
  @lookup_context = lookup_context
end

def render(context, options)

Experimental RBS support (using type sampling data from the type_fusion project).

type ActionView__Renderer_render_context = #<Class:0x000000010fd1fb40> | #<Class:0x0000000112f705b8> | #<Class:0x000000011a28aaa8> | #<Class:0x000000010c9dfbe0> | #<Class:0x000000011fcbe380>

def render: (ActionView__Renderer_render_context context, partial | String options) -> ActionView::OutputBuffer

This signature was generated using 5 samples from 1 application.

Main render entry point shared by Action View and Action Controller.
def render(context, options)
  render_to_object(context, options).body
end

def render_body(context, options)

so in such cases, we just wrap them in an array.
Note that partials are not supported to be rendered with streaming,

a streaming body that renders the template piece by piece.
Render but returns a valid Rack body. If fibers are defined, we return
def render_body(context, options)
  if options.key?(:partial)
    [render_partial(context, options)]
  else
    StreamingTemplateRenderer.new(@lookup_context).render(context, options)
  end
end

def render_partial(context, options, &block) # :nodoc:

:nodoc:
Direct access to partial rendering.
def render_partial(context, options, &block) # :nodoc:
  render_partial_to_object(context, options, &block).body
end

def render_partial_to_object(context, options, &block) # :nodoc:

Experimental RBS support (using type sampling data from the type_fusion project).

type ActionView__Renderer_render_partial_to_object_context = #<Class:0x00000001129d5018> | #<Class:0x00000001077afb40> | #<Class:0x0000000112ef7460> | #<Class:0x0000000117253b78>

def render_partial_to_object: (ActionView__Renderer_render_partial_to_object_context context, (partial | String | partial | String | locals | result | ) options, ) -> ActionView::AbstractRenderer::RenderedTemplate

This signature was generated using 4 samples from 1 application.

:nodoc:
def render_partial_to_object(context, options, &block) # :nodoc:
  partial = options[:partial]
  if String === partial
    collection = collection_from_options(options)
    if collection
      # Collection + Partial
      renderer = CollectionRenderer.new(@lookup_context, options)
      renderer.render_collection_with_partial(collection, partial, context, block)
    else
      if options.key?(:object)
        # Object + Partial
        renderer = ObjectRenderer.new(@lookup_context, options)
        renderer.render_object_with_partial(options[:object], partial, context, block)
      else
        # Partial
        renderer = PartialRenderer.new(@lookup_context, options)
        renderer.render(partial, context, block)
      end
    end
  else
    collection = collection_from_object(partial) || collection_from_options(options)
    if collection
      # Collection + Derived Partial
      renderer = CollectionRenderer.new(@lookup_context, options)
      renderer.render_collection_derive_partial(collection, context, block)
    else
      # Object + Derived Partial
      renderer = ObjectRenderer.new(@lookup_context, options)
      renderer.render_object_derive_partial(partial, context, block)
    end
  end
end

def render_template(context, options) # :nodoc:

:nodoc:
Direct access to template rendering.
def render_template(context, options) # :nodoc:
  render_template_to_object(context, options).body
end

def render_template_to_object(context, options) # :nodoc:

Experimental RBS support (using type sampling data from the type_fusion project).

def render_template_to_object: ((#<Class:0x0000000108d7e610> | #<Class:0x00000001077afb40> | #<Class:0x0000000116cb8858>) context, (prefixes | String | template | String | layout | Proc | renderable | UI::CodeBlock | prefixes |  | template | String | layout | NilClass) options) -> ActionView::AbstractRenderer::RenderedTemplate

This signature was generated using 3 samples from 1 application.

:nodoc:
def render_template_to_object(context, options) # :nodoc:
  TemplateRenderer.new(@lookup_context).render(context, options)
end

def render_to_object(context, options) # :nodoc:

Experimental RBS support (using type sampling data from the type_fusion project).

type ActionView__Renderer_render_to_object_context = #<Class:0x000000011a1a2640> | #<Class:0x000000010fd1fb40> | #<Class:0x0000000116cdc140> | #<Class:0x000000010fb94398> | #<Class:0x000000010ff1d168> | #<Class:0x00000001089f1d80>

def render_to_object: (ActionView__Renderer_render_to_object_context context, (partial | String | prefixes | String | template | String | layout | Proc | partial | String | locals | modules | ModuleDefinition | ModuleDefinition | ModuleDefinition | ModuleDefinition | ModuleDefinition | classes | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | ClassDefinition | instance_methods | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | ClassMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod | InstanceMethod) options) -> ActionView::AbstractRenderer::RenderedTemplate

This signature was generated using 6 samples from 1 application.

:nodoc:
def render_to_object(context, options) # :nodoc:
  if options.key?(:partial)
    render_partial_to_object(context, options)
  else
    render_template_to_object(context, options)
  end
end