mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
700c58355c
* Remove template assignment: there is no need for this assignment, given we are rendering a collection with possibly different templates, and a second call to render (with the same instance) would behave differently if the template is set. * Remove segments array in favor of Array#map * Use local vars whenever possible * Cache local template keys, remove defaults from find_template
27 lines
708 B
Ruby
27 lines
708 B
Ruby
module ActionView
|
|
class AbstractRenderer #:nodoc:
|
|
delegate :find_template, :template_exists?, :with_fallbacks, :update_details,
|
|
:with_layout_format, :formats, :to => :@lookup_context
|
|
|
|
def initialize(lookup_context)
|
|
@lookup_context = lookup_context
|
|
end
|
|
|
|
def render
|
|
raise NotImplementedError
|
|
end
|
|
|
|
protected
|
|
|
|
def extract_details(options)
|
|
@lookup_context.registered_details.each_with_object({}) do |key, details|
|
|
next unless value = options[key]
|
|
details[key] = Array(value)
|
|
end
|
|
end
|
|
|
|
def instrument(name, options={})
|
|
ActiveSupport::Notifications.instrument("render_#{name}.action_view", options){ yield }
|
|
end
|
|
end
|
|
end
|