Sha256: f54c711ed574b9cad0164e0845dcef00b42e955a3299b974302e1c3c66478cc2
Contents?: true
Size: 1.36 KB
Versions: 3
Compression:
Stored size: 1.36 KB
Contents
module PoolParty module Callbacks module ClassMethods def additional_callbacks(arr=[]) @additional_callbacks ||= arr end end module InstanceMethods 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 # Callbacks on bootstrap and configuration def setup_callbacks defined_callbacks.each do |meth| unless respond_to?("call_#{meth}_callbacks".to_sym) self.class.module_eval <<-EOE def call_#{meth}_callbacks(*args) if respond_to?(:plugin_store) && plugin_store plugin_store.each do |a| a.call_#{meth}_callbacks(*args) if a.respond_to?(:call_#{meth}_callbacks) end end self.send :#{meth}, *args if respond_to?(:#{meth}) end EOE end end end end def self.included(receiver) receiver.extend ClassMethods receiver.send :include, InstanceMethods end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
auser-poolparty-1.2.3 | lib/poolparty/modules/callbacks.rb |
auser-poolparty-1.2.4 | lib/poolparty/modules/callbacks.rb |
auser-poolparty-1.2.7 | lib/poolparty/modules/callbacks.rb |