Apply provided hooks

 Used by #call

 @return [Array<Hash>]

 @api private
547531
def apply_hooks(hooks, tuples, *args)
      hooks.reduce(tuples) do |a, e|
        if e.is_a?(Hash)
          hook_meth, hook_args = e.to_a.flatten(1)
          __send__(hook_meth, a, *args, **hook_args)
        else
          __send__(e, a, *args)
        end
      end
    end
882268
def apply_options! options = {}
      options.each_pair do |key, value| 
        send("#{key}=", value) if self.respond_to?(:"#{key}=")
      end      
    end
187580
def on_load(name, options = {}, &block)
      @loaded[name].each do |base|
        execute_hook(name, base, options, block)
      end

      @load_hooks[name] << [block, options]
    end
762191
def merge!(other)
      @hooks.merge!(other.dup.hooks) do |key, array, other_array|
        temp_hash, output = {}, []

        (array + other_array).reverse_each do |pair|
          temp_hash[pair.first] ||= output.unshift(pair)
        end

        output
      end

      self
    end
710389
def dispatch_hook(key, hooks, hook_data, **kwargs):
    """"""
    hooks = hooks or {}
    hooks = hooks.get(key)
    if hooks:
        if hasattr(hooks, '__call__'):
            hooks = [hooks]
        for hook in hooks:
            _hook_data = hook(hook_data, **kwargs)
            if _hook_data is not None:
                hook_data = _hook_data
    return hook_data
915369
def execute_hooks_for(type, name)
      model.hooks[name][type].each { |hook| hook.call(self) }
    end
218203
def run_hooks(self, packet):
        

        if packet.__class__ in self.internal_hooks:
            self.internal_hooks[packet.__class__](packet)

        if packet.__class__ in self.hooks:
            self.hooks[packet.__class__](packet)
34310
def call_elements(buffer = '')
      # Accept both shorthand and default ruby hash style. Following DRY
      # principles, a Proc is used to assign the value to the current key
      #
      # key: value
      # :key => value
      # value
      if (symbol = accept_stripped :hash_symbol)
        buffer += symbol

        # Get the value associated to the current hash key
        if (exp = expression(true))
          buffer += exp[@value]
        else
          error :call_elements
        end

        # If there is an comma ",", recursively gather the next
        # array element into the buffer
        if (terminator = accept_stripped :comma)
          buffer += call_elements terminator
        end
      elsif (exp = expression(true))
        buffer += exp[@value]

        if (assign = accept_stripped :hash_assignment)
          buffer += assign

          # Get the value associated to the current hash key
          if (exp = expression(true))
            buffer += exp[@value]
          else
            error :call_elements
          end
        end

        # If there is an comma ",", recursively gather the next
        # array element into the buffer
        if (terminator = accept_stripped :comma)
          buffer += call_elements terminator
        end
      end

      buffer
    end
569240
def call_hook(self, name, **kwargs):
        
        return [y for y in [x(**kwargs) for x, _ in self._hooks.get(name, [])] if y is not None]
542477
def run_callbacks(callback_name, action=nil)
      callbacks = self.class.send(:"#{callback_name}_callbacks")

      callbacks ||= []
      if action
        callbacks = filter_actions_by_only_exclude(callbacks || [], action)
      end

      begin
        callbacks.map { |v| v[0] }.each do |callback|
          case callback
          when Symbol
            send(callback)
          when Proc
            instance_eval(&callback)
          end
        end

        return false
      rescue StopChainException => e
        return true
      end
    end
81836
def run_hook(hook_name, *args, &block)
      hooks.find {|hook| hook.name == hook_name }.run(self, *args, &block)
    end
702561
def multicall(*methods)
      ok, params = multicall2(*methods)
      if ok
        params
      else
        raise params
      end
    end
418642
def eval_hooks(self):
        
        logging.debug("Evaluating hooks")
        if self.get_edge_triggered():
            logging.debug("Hook triggered")
            for hook in [h for h in self.edge_hooks if h.is_ready()]:
                logging.debug("Hook invoked")
                hook.invoke()
653738
protected function call_hook()
    {
        $args = func_get_args();
        $name = array_shift($args);

        if ($this->has_hook($name)) {
            $callback = $this->_hooks[$name];

            if ( ! is_callable($callback)) {
                return false;
            }

            if (is_php('5.4.0') and $callback instanceof Closure) {
                $callback->bindTo($this);
            }

            return call_user_func_array($callback, $args);
        }

        return false;
    }
1176071
function applyHooks(_target, _hooks, _owner) {
    for(var key in _hooks) {
      if(_hooks.hasOwnProperty(key)) {
        _target.$on(key, wrapHook(_hooks[key], _owner));
      }
    }
  }
716475
function _hook(slf, name, handlerInfo, params) {
  if (!slf.__hooks[name]) return;

  slf.__hooks[name].forEach(function (hook) {
    hook(handlerInfo, params);
  });
}
997701
def add_method_hooks
      eigen_class = @target.singleton_class

      if @options[:class_methods]
        return unless @target.is_a?(Module)

        orig_singleton_method_added = @target.method(:singleton_method_added)

        eigen_class.send :define_method, :singleton_method_added do |method|
          aspector_singleton_method_added(method)
          orig_singleton_method_added.call(method)
        end
      else
        if @target.is_a? Module
          orig_method_added = @target.method(:method_added)
        else
          orig_method_added = eigen_class.method(:method_added)
        end

        eigen_class.send :define_method, :method_added do |method|
          aspector_instance_method_added(method)
          orig_method_added.call(method)
        end
      end
    end