Skip to content

Commit

Permalink
Simplify Jekyll::Hooks.trigger logic (#8044)
Browse files Browse the repository at this point in the history
Merge pull request 8044
  • Loading branch information
ashmaroli committed Mar 4, 2020
1 parent 6ae6407 commit ea57ef7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/jekyll/hooks.rb
Expand Up @@ -91,11 +91,8 @@ def self.insert_hook(owner, event, priority, &block)
# 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|
Expand Down

0 comments on commit ea57ef7

Please sign in to comment.