Replace read-only empty hash with private constant (#418)

Merge pull request 418
This commit is contained in:
Ashwin Maroli 2020-10-15 19:29:48 +05:30 committed by GitHub
parent d77ffc4de5
commit 80da6a7da9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -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