Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace read-only empty hash with private constant #418

Merged
merged 1 commit into from
Oct 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/jekyll-seo-tag/drop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down