Class: ActionView::AbstractRenderer
Do not use. This class is for internal use only.
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Classes:
| |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Inherits: | Object |
Defined in: | actionview/lib/action_view/renderer/abstract_renderer.rb |
Overview
This class defines the interface for a renderer. Each class that subclasses AbstractRenderer
is used by the base Renderer
class to render a specific type of object.
The base Renderer
class uses its #render method to delegate to the renderers. These currently consist of
PartialRenderer - Used for rendering partials
TemplateRenderer - Used for rendering other types of templates
StreamingTemplateRenderer - Used for streaming
Whenever the #render method is called on the base Renderer
class, a new renderer object of the correct type is created, and the #render method on that new object is called in turn. This abstracts the set up and rendering into a separate classes for partials and templates.
Constant Summary
-
NO_DETAILS =
# File 'actionview/lib/action_view/renderer/abstract_renderer.rb', line 157{}.freeze
Class Method Summary
- .new(lookup_context) ⇒ AbstractRenderer constructor
Instance Attribute Summary
- #formats readonly
Instance Method Summary
Constructor Details
.new(lookup_context) ⇒ AbstractRenderer
# File 'actionview/lib/action_view/renderer/abstract_renderer.rb', line 24
def initialize(lookup_context) @lookup_context = lookup_context end
Instance Attribute Details
#formats (readonly)
[ GitHub ]# File 'actionview/lib/action_view/renderer/abstract_renderer.rb', line 22
delegate :template_exists?, :any_templates?, :formats, to: :@lookup_context
Instance Method Details
#any_templates? ⇒ Boolean
# File 'actionview/lib/action_view/renderer/abstract_renderer.rb', line 22
delegate :template_exists?, :any_templates?, :formats, to: :@lookup_context
#build_rendered_collection(templates, spacer) (private)
[ GitHub ]# File 'actionview/lib/action_view/renderer/abstract_renderer.rb', line 182
def build_rendered_collection(templates, spacer) RenderedCollection.new templates, spacer end
#build_rendered_template(content, template) (private)
[ GitHub ]# File 'actionview/lib/action_view/renderer/abstract_renderer.rb', line 178
def build_rendered_template(content, template) RenderedTemplate.new content, template end
#extract_details(options) (private)
[ GitHub ]# File 'actionview/lib/action_view/renderer/abstract_renderer.rb', line 159
def extract_details( ) # :doc: details = nil LookupContext.registered_details.each do |key| value = [key] if value (details ||= {})[key] = Array(value) end end details || NO_DETAILS end
#prepend_formats(formats) (private)
[ GitHub ]#render
# File 'actionview/lib/action_view/renderer/abstract_renderer.rb', line 28
def render raise NotImplementedError end
#template_exists? ⇒ Boolean
# File 'actionview/lib/action_view/renderer/abstract_renderer.rb', line 22
delegate :template_exists?, :any_templates?, :formats, to: :@lookup_context