Module: PoolParty::Callbacks::InstanceMethods

Defined in:
lib/poolparty/modules/callbacks.rb

Instance Method Summary collapse

Instance Method Details

#defined_callbacksObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/poolparty/modules/callbacks.rb', line 10

def defined_callbacks
  [
    :before_bootstrap,
    :after_bootstrap,
    :before_configure,
    :after_configure,
    :after_create,
    # TODO: Add after_launch_instance and after_terminate_instance
    # :after_launch_instance,
    # :after_terminate_instance,
    self.class.additional_callbacks
  ].flatten
end

#setup_callbacksObject

Callbacks on bootstrap and configuration



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/poolparty/modules/callbacks.rb', line 25

def setup_callbacks
  defined_callbacks.each do |meth|
    unless respond_to?("call_#{meth}_callbacks".to_sym)
      self.class.module_eval "        def call_\#{meth}_callbacks(*args)\n          plugin_store.each {|a| a.call_\#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n          self.send :\#{meth}, *args if respond_to?(:\#{meth})\n        end\n      EOE\n    end\n  end\nend\n"