Module: Hooks

Overview

end

Defined Under Namespace

Modules: Reason Classes: ForceReturn

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass)

Function called when Hooks is included

Parameters:

  • klass (Class)

    klass receiving the hooks



169
170
# File 'docs/00000_a_root.rb', line 169

def included(klass)
end

.register(klass, name, reason = nil, &block) {|hook_binding| ... }

Function that register a hook

Parameters:

  • klass (Class)

    class containing the hook information

  • name (Symbol)

    name of the hook list

  • reason (String) (defaults to: nil)

    reason for the hook (so we can remove it)

  • block (Proc)

    actuall hook

Yields:

  • (hook_binding)

    hook called when requested

Yield Parameters:

  • hook_binding (Binding)

    binding from the calling method



154
155
# File 'docs/00000_a_root.rb', line 154

def register(klass, name, reason = nil, &block)
end

.remove(klass, name, reason = 'None')

Function that removes a hook with a reason

Parameters:

  • klass (Class)

    class containing the hook information

  • name (Symbol)

    name of the hook list

  • reason (String) (defaults to: 'None')

    reason for the hook



160
161
# File 'docs/00000_a_root.rb', line 160

def remove(klass, name, reason = 'None')
end

.remove_without_name(klass, reason = 'None')

Function that removes a hook with a reason

Parameters:

  • klass (Class)

    class containing the hook information

  • reason (String) (defaults to: 'None')

    reason for the hook



165
166
# File 'docs/00000_a_root.rb', line 165

def remove_without_name(klass, reason = 'None')
end

Instance Method Details

#exec_hooks(klass, name, method_binding)

Function that execute the hooks

Parameters:

  • klass (Class)

    class containing the hook information

  • name (Symbol)

    name of the hook list

  • method_binding (Binding)

    binding of the method so the hook can modify locals

Raises:



140
141
# File 'docs/00000_a_root.rb', line 140

def exec_hooks(klass, name, method_binding)
end

#force_return(object)

Function that force the return from the hook

Parameters:

  • object (Object)

    object to return



144
145
# File 'docs/00000_a_root.rb', line 144

def force_return(object)
end