Module: Shackles::ConnectionHandler

Defined in:
lib/shackles/connection_handler.rb

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/shackles/connection_handler.rb', line 3

def self.included(klass)
  %w{clear_active_connections clear_reloadable_connections
     clear_all_connections verify_active_connections }.each do |method|
    klass.class_eval(<<EOS)
      def #{method}_with_multiple_environments!
        ::Shackles.connection_handlers.values.each(&:#{method}_without_multiple_environments!)
      end
EOS
    klass.alias_method_chain "#{method}!".to_sym, :multiple_environments
  end
end