Class: Module::Cluster::InstanceController::MultipleHookControllerProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb

Overview

Proxies before include or extend definitions to both include and extend controllers.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, *hook_controllers) ⇒ MultipleHookControllerProxy

Returns a new instance of MultipleHookControllerProxy.

Parameters:

  • name

    Name of this Multiple Hook Controller Proxy.

  • hook_controllers

    Hook Controllers for which this Proxy is operative.



18
19
20
21
22
23
24
# File 'lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb', line 18

def initialize( name, *hook_controllers )
  
  @name = name
  
  @hook_controllers = hook_controllers
      
end

Instance Attribute Details

#Hook Controllers this Proxy proxies.(ControllersthisProxyproxies.) ⇒ Array<Module::Cluster::InstanceController::HookController> (readonly)

Returns Hook Controllers this Proxy proxies.

Returns:



357
# File 'lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb', line 357

attr_reader :hook_controllers

#hook_controllersArray<Module::Cluster::InstanceController::HookController> (readonly)

Returns Hook Controllers this Proxy proxies.

Returns:



357
358
359
# File 'lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb', line 357

def hook_controllers
  @hook_controllers
end

#nameSymbol, String (readonly)

Name of hook controller.

Returns:

  • (Symbol, String)

    Name.



344
345
346
# File 'lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb', line 344

def name
  @name
end

Instance Method Details

#action {|hooked_instance| ... } ⇒ Module::Cluster::InstanceController::HookController

Declare that action should be performed at event hook.

Yields:

  • (hooked_instance)

    Block for event hook action.

Yield Parameters:

  • hooked_instance

    Instance for which event hook is occurring. Equivalent to parameter for #included and #extended.

Returns:



147
148
149
150
151
152
153
154
155
# File 'lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb', line 147

def action( & block )
  
  @hook_controllers.each do |this_hook_controller|
    this_hook_controller.action( & block )
  end

  return self
  
end

#before_extend {|hooked_instance| ... } ⇒ Module::Cluster::InstanceController::HookController::ChainProxy

Declare that chained actions should be inserted into the event stack after the location

in the same event stack where provided module(s) are specified to be extended.

Parameters:

  • module

    Module that insert should be after.

Yields:

  • (hooked_instance)

    Block for event hook action.

Yield Parameters:

  • hooked_instance

    Instance for which event hook is occurring. Equivalent to parameter for #included and #extended.

Returns:



274
275
276
277
278
# File 'lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb', line 274

def after_extend( *modules, & block )

  return chain_proxy.after_extend( *modules, & block )
  
end

#before_include {|hooked_instance| ... } ⇒ Module::Cluster::InstanceController::HookController::ChainProxy

Declare that chained actions should be inserted into the event stack after the location

in the same event stack where provided module(s) are specified to be included.

Parameters:

  • module

    Module that insert should be after.

Yields:

  • (hooked_instance)

    Block for event hook action.

Yield Parameters:

  • hooked_instance

    Instance for which event hook is occurring. Equivalent to parameter for #included and #extended.

Returns:



250
251
252
253
254
# File 'lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb', line 250

def after_include( *modules, & block )

  return chain_proxy.after_include( *modules, & block )
  
end

#before_include_or_extend {|hooked_instance| ... } ⇒ Module::Cluster::InstanceController::HookController::ChainProxy Also known as: after_extend_or_include

Declare that chained actions should be inserted into the event stack after the location

in the same event stack where provided module(s) are specified to be included or extended.

Parameters:

  • module

    Module that insert should be after.

Yields:

  • (hooked_instance)

    Block for event hook action.

Yield Parameters:

  • hooked_instance

    Instance for which event hook is occurring. Equivalent to parameter for #included and #extended.

Returns:



299
300
301
302
303
# File 'lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb', line 299

def after_include_or_extend( *modules, & block )
  
  return chain_proxy.after_include_or_extend( *modules, & block )
  
end

#before_extend {|hooked_instance| ... } ⇒ Module::Cluster::InstanceController::HookController::ChainProxy

Declare that chained actions should be inserted into the event stack prior to the location

in the same event stack where provided module(s) are specified to be extended.

Parameters:

  • module

    Module that insert should be prior to.

Yields:

  • (hooked_instance)

    Block for event hook action.

Yield Parameters:

  • hooked_instance

    Instance for which event hook is occurring. Equivalent to parameter for #included and #extended.

Returns:



175
176
177
178
179
# File 'lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb', line 175

def before_extend( *modules, & block )
  
  return chain_proxy.before_extend( *modules, & block )
  
end

#before_include {|hooked_instance| ... } ⇒ Module::Cluster::InstanceController::HookController::ChainProxy

Declare that chained actions should be inserted into the event stack prior to the location

in the same event stack where provided module(s) are specified to be included.

Parameters:

  • module

    Module that insert should be prior to.

Yields:

  • (hooked_instance)

    Block for event hook action.

Yield Parameters:

  • hooked_instance

    Instance for which event hook is occurring. Equivalent to parameter for #included and #extended.

Returns:



199
200
201
202
203
# File 'lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb', line 199

def before_include( *modules, & block )
  
  return chain_proxy.before_include( *modules, & block )
  
end

#before_include_or_extend {|hooked_instance| ... } ⇒ Module::Cluster::InstanceController::HookController::ChainProxy Also known as: before_extend_or_include

Declare that chained actions should be inserted into the event stack prior to the location

in the same event stack where provided module(s) are specified to be included or extended.

Parameters:

  • module

    Module that insert should be prior to.

Yields:

  • (hooked_instance)

    Block for event hook action.

Yield Parameters:

  • hooked_instance

    Instance for which event hook is occurring. Equivalent to parameter for #included and #extended.

Returns:



224
225
226
227
228
# File 'lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb', line 224

def before_include_or_extend( *modules, & block )

  return chain_proxy.before_include_or_extend( *modules, & block )
  
end

#chain_proxyModule::Cluster::InstanceController::MultipleHookControllerProxy::ChainProxy

Get Chain Proxy instance used by this Multiple Hook Controller Proxy.



327
328
329
330
331
# File 'lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb', line 327

def chain_proxy

  return @chain_proxy ||= self.class::ChainProxy.new( self )
  
end

#extend {|hooked_instance| ... } ⇒ Module::Cluster::InstanceController::HookController

Declare that modules should be extended at event hook.

Parameters:

  • module

    Module to extend at event hook.

Yields:

  • (hooked_instance)

    Block for event hook action.

Yield Parameters:

  • hooked_instance

    Instance for which event hook is occurring. Equivalent to parameter for #included and #extended.

Returns:



70
71
72
73
74
75
76
77
78
# File 'lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb', line 70

def extend( *modules, & block )

  @hook_controllers.each do |this_hook_controller|
    this_hook_controller.extend( *modules, & block )
  end

  return self
  
end

#extend_and_include {|hooked_instance| ... } ⇒ Module::Cluster::InstanceController::HookController

Declare that modules should be extended and included at event hook. Order is reversed from #include_and_extend.

Parameters:

  • module

    Module to extend and include at event hook.

Yields:

  • (hooked_instance)

    Block for event hook action.

Yield Parameters:

  • hooked_instance

    Instance for which event hook is occurring. Equivalent to parameter for #included and #extended.

Returns:



124
125
126
127
128
129
130
131
132
# File 'lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb', line 124

def extend_and_include( *modules, & block )
  
  @hook_controllers.each do |this_hook_controller|
    this_hook_controller.extend_and_include( *modules, & block )
  end

  return self
  
end

#include {|hooked_instance| ... } ⇒ Module::Cluster::InstanceController::HookController

Declare that modules should be included at event hook.

Parameters:

  • module

    Module to include at event hook.

Yields:

  • (hooked_instance)

    Block for event hook action.

Yield Parameters:

  • hooked_instance

    Instance for which event hook is occurring. Equivalent to parameter for #included and #extended.

Returns:



43
44
45
46
47
48
49
50
51
# File 'lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb', line 43

def include( *modules, & block )
  
  @hook_controllers.each do |this_hook_controller|
    this_hook_controller.include( *modules, & block )
  end

  return self
  
end

#include_and_extend {|hooked_instance| ... } ⇒ Module::Cluster::InstanceController::HookController

Declare that modules should be included and extended at event hook. See also #extend_and_include.

Parameters:

  • module

    Module to include and extend at event hook.

Yields:

  • (hooked_instance)

    Block for event hook action.

Yield Parameters:

  • hooked_instance

    Instance for which event hook is occurring. Equivalent to parameter for #included and #extended.

Returns:



97
98
99
100
101
102
103
104
105
# File 'lib/module/cluster/instance_controller/multiple_hook_controller_proxy.rb', line 97

def include_and_extend( *modules, & block )
  
  @hook_controllers.each do |this_hook_controller|
    this_hook_controller.include_and_extend( *modules, & block )
  end

  return self
  
end