class GoogleAdsSavon::Hooks::Hook

GoogleAdsSavon::Hooks::Hook

A hook used somewhere in the system.

Constants

HOOKS

Attributes

block[RW]
hook[RW]
id[RW]

Public Class Methods

new(id, hook, &block) click to toggle source

Expects an id, the name of the hook to use and a block to be called.

# File lib/ads_savon/hooks/hook.rb, line 42
def initialize(id, hook, &block)
  unless HOOKS.include?(hook)
    raise ArgumentError, "No such hook: #{hook}. Expected one of: #{HOOKS.join(', ')}"
  end

  self.id = id
  self.hook = hook
  self.block = block
end

Public Instance Methods

call(*args) click to toggle source

Calls the block with the given args.

# File lib/ads_savon/hooks/hook.rb, line 55
def call(*args)
  block.call(*args)
end