DEV: Use a set in `SiteSetting.settings_hash`

DEV: Use a set in SiteSetting.settings_hash.

From 96168cb3c6b06e2bc8683300b532790ae5a9666f Mon Sep 17 00:00:00 2001
From: Guo Xiang Tan <tgx_world@hotmail.com>
Date: Thu, 22 Nov 2018 17:16:40 +0800
Subject: [PATCH] DEV: Use a set in `SiteSetting.settings_hash`.


diff --git a/lib/site_setting_extension.rb b/lib/site_setting_extension.rb
index f7be775..abdafe7 100644
--- a/lib/site_setting_extension.rb
+++ b/lib/site_setting_extension.rb
@@ -177,7 +177,11 @@ module SiteSettingExtension
 
   def settings_hash
     result = {}
-    deprecated_settings = SiteSettings::DeprecatedSettings::SETTINGS.map { |s| s[0] }
+    deprecated_settings = Set.new
+
+    SiteSettings::DeprecatedSettings::SETTINGS.each do |s|
+      deprecated_settings << s[0]
+    end
 
     defaults.all.keys.each do |s|
       result[s] =

GitHub

2 Likes