Method: Chef::EventDispatch::Dispatcher#call_subscribers

Defined in:
lib/chef/event_dispatch/dispatcher.rb

#call_subscribers(method_name, *args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/chef/event_dispatch/dispatcher.rb', line 66

def call_subscribers(method_name, *args)
  @in_call = true
  subscribers.each do |s|
    # Skip new/unsupported event names
    next unless s.respond_to?(method_name)

    mth = s.method(method_name)
    # Trim arguments to match what the subscriber expects to allow
    # adding new arguments without breaking compat.
    if mth.arity < args.size && mth.arity >= 0
      mth.call(*args.take(mth.arity))
    else
      mth.call(*args)
    end
  end
ensure
  @in_call = false
end