Method: Jekyll::Hooks.trigger

Defined in:
lib/jekyll/hooks.rb

.trigger(owner, event, *args) ⇒ Object

interface for Jekyll core components to trigger hooks


96
97
98
99
100
101
102
103
104
105
# File 'lib/jekyll/hooks.rb', line 96

def self.trigger(owner, event, *args)
  # proceed only if there are hooks to call
  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|
    hook.call(*args)
  end
end