Reduce allocations of instance-agnostic objects (#376)

Merge pull request 376
This commit is contained in:
Ashwin Maroli 2020-04-13 21:12:30 +05:30 committed by GitHub
parent 47e874a116
commit b019d441b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -20,6 +20,9 @@ module Jekyll
private :type
private :logo
VALID_ENTITY_TYPES = %w(BlogPosting CreativeWork).freeze
private_constant :VALID_ENTITY_TYPES
# page_drop should be an instance of Jekyll::SeoTag::Drop
def initialize(page_drop)
@mutations = {}
@ -27,7 +30,7 @@ module Jekyll
end
def fallback_data
{
@fallback_data ||= {
"@context" => "https://schema.org",
}
end
@ -66,7 +69,7 @@ module Jekyll
end
def main_entity
return unless %w(BlogPosting CreativeWork).include?(type)
return unless VALID_ENTITY_TYPES.include?(type)
{
"@type" => "WebPage",