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



167
168
# File 'docs/000_a_root.rb', line 167

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



152
153
# File 'docs/000_a_root.rb', line 152

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



158
159
# File 'docs/000_a_root.rb', line 158

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



163
164
# File 'docs/000_a_root.rb', line 163

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:



138
139
# File 'docs/000_a_root.rb', line 138

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



142
143
# File 'docs/000_a_root.rb', line 142

def force_return(object)
end