Skip to content

Commit 80da6a7

Browse files
authored
Replace read-only empty hash with private constant (#418)
Merge pull request 418
1 parent d77ffc4 commit 80da6a7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/jekyll-seo-tag/drop.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ class Drop < Jekyll::Drops::Drop
1111
].freeze
1212
HOMEPAGE_OR_ABOUT_REGEX = %r!^/(about/)?(index.html?)?$!.freeze
1313

14+
EMPTY_READ_ONLY_HASH = {}.freeze
15+
private_constant :EMPTY_READ_ONLY_HASH
16+
1417
def initialize(text, context)
15-
@obj = {}
18+
@obj = EMPTY_READ_ONLY_HASH
1619
@mutations = {}
1720
@text = text
1821
@context = context
@@ -236,7 +239,7 @@ def sub_hash(hash, key)
236239
if hash[key].is_a?(Hash)
237240
hash[key]
238241
else
239-
{}
242+
EMPTY_READ_ONLY_HASH
240243
end
241244
end
242245
end

0 commit comments

Comments
 (0)