aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/renderer/partial_renderer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionview/lib/action_view/renderer/partial_renderer.rb')
-rw-r--r--actionview/lib/action_view/renderer/partial_renderer.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/actionview/lib/action_view/renderer/partial_renderer.rb b/actionview/lib/action_view/renderer/partial_renderer.rb
index b751bca31e..bdbf03191a 100644
--- a/actionview/lib/action_view/renderer/partial_renderer.rb
+++ b/actionview/lib/action_view/renderer/partial_renderer.rb
@@ -1,5 +1,5 @@
require 'action_view/renderer/partial_renderer/collection_caching'
-require 'thread_safe'
+require 'concurrent/map'
module ActionView
class PartialIteration
@@ -283,8 +283,8 @@ module ActionView
class PartialRenderer < AbstractRenderer
include CollectionCaching
- PREFIXED_PARTIAL_NAMES = ThreadSafe::Cache.new do |h, k|
- h[k] = ThreadSafe::Cache.new
+ PREFIXED_PARTIAL_NAMES = Concurrent::Map.new do |h, k|
+ h[k] = Concurrent::Map.new
end
def initialize(*)
@@ -337,7 +337,7 @@ module ActionView
layout = find_template(layout.to_s, @template_keys)
end
- object ||= locals[as]
+ object = locals[as] if object.nil? # Respect object when object is false
locals[as] = object if @has_object
content = @template.render(view, locals) do |*name|
@@ -348,8 +348,6 @@ module ActionView
content
end
- private
-
# Sets up instance variables needed for rendering a partial. This method
# finds the options and details and extracts them. The method also contains
# logic that handles the type of object passed in as the partial.
@@ -522,7 +520,7 @@ module ActionView
def retrieve_variable(path, as)
variable = as || begin
- base = path[-1] == "/" ? "" : File.basename(path)
+ base = path[-1] == "/".freeze ? "".freeze : File.basename(path)
raise_invalid_identifier(path) unless base =~ /\A_?(.*)(?:\.\w+)*\z/
$1.to_sym
end