Skip to content

Commit 994aeac

Browse files
committed
#render_template_to_object and #render_partial_to_object are private
Apparently it had not been clear what visibility they should assume when they were initially created at rails#35265, then a big refactoring took place at rails#38594 after which they remain intact. So I think they can now become properly private as they are nodoc and not refered to but from within the same class.
1 parent bc21ccf commit 994aeac

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

actionview/lib/action_view/renderer/renderer.rb

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -59,46 +59,46 @@ def cache_hits # :nodoc:
5959
@cache_hits ||= {}
6060
end
6161

62-
def render_template_to_object(context, options) # :nodoc:
63-
TemplateRenderer.new(@lookup_context).render(context, options)
64-
end
62+
private
63+
def render_template_to_object(context, options)
64+
TemplateRenderer.new(@lookup_context).render(context, options)
65+
end
6566

66-
def render_partial_to_object(context, options, &block) # :nodoc:
67-
partial = options[:partial]
68-
if String === partial
69-
collection = collection_from_options(options)
67+
def render_partial_to_object(context, options, &block)
68+
partial = options[:partial]
69+
if String === partial
70+
collection = collection_from_options(options)
7071

71-
if collection
72-
# Collection + Partial
73-
renderer = CollectionRenderer.new(@lookup_context, options)
74-
renderer.render_collection_with_partial(collection, partial, context, block)
75-
else
76-
if options.key?(:object)
77-
# Object + Partial
78-
renderer = ObjectRenderer.new(@lookup_context, options)
79-
renderer.render_object_with_partial(options[:object], partial, context, block)
72+
if collection
73+
# Collection + Partial
74+
renderer = CollectionRenderer.new(@lookup_context, options)
75+
renderer.render_collection_with_partial(collection, partial, context, block)
8076
else
81-
# Partial
82-
renderer = PartialRenderer.new(@lookup_context, options)
83-
renderer.render(partial, context, block)
77+
if options.key?(:object)
78+
# Object + Partial
79+
renderer = ObjectRenderer.new(@lookup_context, options)
80+
renderer.render_object_with_partial(options[:object], partial, context, block)
81+
else
82+
# Partial
83+
renderer = PartialRenderer.new(@lookup_context, options)
84+
renderer.render(partial, context, block)
85+
end
8486
end
85-
end
86-
else
87-
collection = collection_from_object(partial) || collection_from_options(options)
88-
89-
if collection
90-
# Collection + Derived Partial
91-
renderer = CollectionRenderer.new(@lookup_context, options)
92-
renderer.render_collection_derive_partial(collection, context, block)
9387
else
94-
# Object + Derived Partial
95-
renderer = ObjectRenderer.new(@lookup_context, options)
96-
renderer.render_object_derive_partial(partial, context, block)
88+
collection = collection_from_object(partial) || collection_from_options(options)
89+
90+
if collection
91+
# Collection + Derived Partial
92+
renderer = CollectionRenderer.new(@lookup_context, options)
93+
renderer.render_collection_derive_partial(collection, context, block)
94+
else
95+
# Object + Derived Partial
96+
renderer = ObjectRenderer.new(@lookup_context, options)
97+
renderer.render_object_derive_partial(partial, context, block)
98+
end
9799
end
98100
end
99-
end
100101

101-
private
102102
def collection_from_options(options)
103103
if options.key?(:collection)
104104
collection = options[:collection]

0 commit comments

Comments
 (0)