Simplify Jekyll::Hooks.trigger logic (#8044)

Merge pull request 8044
This commit is contained in:
Ashwin Maroli 2020-03-04 20:44:53 +05:30 committed by GitHub
parent 6ae640755f
commit ea57ef78da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 5 deletions

View File

@ -91,11 +91,8 @@ module Jekyll
# interface for Jekyll core components to trigger hooks
def self.trigger(owner, event, *args)
# proceed only if there are hooks to call
return unless @registry[owner]
return unless @registry[owner][event]
# hooks to call for this owner and event
hooks = @registry[owner][event]
hooks = @registry.dig(owner, event)
return if hooks.nil? || hooks.empty?
# sort and call hooks according to priority and load order
hooks.sort_by { |h| @hook_priority[h] }.each do |hook|