about summary refs log tree commit diff
path: root/app/lib/settings
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-11-16 15:02:18 +0100
committerGitHub <noreply@github.com>2018-11-16 15:02:18 +0100
commit8069fd636ba14059524303ce76abe2173c4f3d01 (patch)
tree55dd4f8ecd39813080cb5ddedd834f93a7ffc919 /app/lib/settings
parent367ad2199509e9008c04c08f3476e236b27b52a1 (diff)
Remove intermediary arrays when creating hash maps from results (#9291)
Diffstat (limited to 'app/lib/settings')
-rw-r--r--app/lib/settings/scoped_settings.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/lib/settings/scoped_settings.rb b/app/lib/settings/scoped_settings.rb
index 5ee30825d..3653ab114 100644
--- a/app/lib/settings/scoped_settings.rb
+++ b/app/lib/settings/scoped_settings.rb
@@ -31,7 +31,7 @@ module Settings
 
     def all_as_records
       vars = thing_scoped
-      records = vars.map { |r| [r.var, r] }.to_h
+      records = vars.each_with_object({}) { |r, h| h[r.var] = r }
 
       Setting.default_settings.each do |key, default_value|
         next if records.key?(key) || default_value.is_a?(Hash)
@@ -65,7 +65,7 @@ module Settings
 
     class << self
       def default_settings
-        defaulting = DEFAULTING_TO_UNSCOPED.map { |k| [k, Setting[k]] }.to_h
+        defaulting = DEFAULTING_TO_UNSCOPED.each_with_object({}) { |k, h| h[k] = Setting[k] }
         Setting.default_settings.merge!(defaulting)
       end
     end