From cac10a29d4589d72085fb5f750f70ebe46d526f8 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Thu, 15 Oct 2020 17:27:13 +0530 Subject: [PATCH] Replace read-only empty hash with private constant --- 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 3ee277d0..157babd4 100644 --- a/lib/jekyll-seo-tag/drop.rb +++ b/lib/jekyll-seo-tag/drop.rb @@ -11,8 +11,11 @@ class Drop < Jekyll::Drops::Drop ].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 @@ def sub_hash(hash, key) if hash[key].is_a?(Hash) hash[key] else - {} + EMPTY_READ_ONLY_HASH end end end