From 80da6a7da9165c2fa8168bf8cf216356d48f7dc9 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Thu, 15 Oct 2020 19:29:48 +0530 Subject: [PATCH] Replace read-only empty hash with private constant (#418) Merge pull request 418 --- lib/jekyll-seo-tag/drop.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/jekyll-seo-tag/drop.rb b/lib/jekyll-seo-tag/drop.rb index 3ee277d..157babd 100644 --- a/lib/jekyll-seo-tag/drop.rb +++ b/lib/jekyll-seo-tag/drop.rb @@ -11,8 +11,11 @@ module Jekyll ].freeze HOMEPAGE_OR_ABOUT_REGEX = %r!^/(about/)?(index.html?)?$!.freeze + EMPTY_READ_ONLY_HASH = {}.freeze + private_constant :EMPTY_READ_ONLY_HASH + def initialize(text, context) - @obj = {} + @obj = EMPTY_READ_ONLY_HASH @mutations = {} @text = text @context = context @@ -236,7 +239,7 @@ module Jekyll if hash[key].is_a?(Hash) hash[key] else - {} + EMPTY_READ_ONLY_HASH end end end