class Replidog::Proxy::ConnectionPoolCreater

Creates database connection pool from configuration Hash table.

Public Class Methods

create(*args) click to toggle source
# File lib/replidog/proxy.rb, line 177
def self.create(*args)
  new(*args).create
end
new(configuration) click to toggle source
# File lib/replidog/proxy.rb, line 181
def initialize(configuration)
  @configuration = configuration.dup
end

Public Instance Methods

create() click to toggle source
# File lib/replidog/proxy.rb, line 185
def create
  spec =
    if ActiveRecord::VERSION::MAJOR >= 5 || (ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR >= 1)
      ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver.new({}).spec(@configuration)
    elsif ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR < 1
      ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver.new(@configuration, {}).spec
    else
      ActiveRecord::Base::ConnectionSpecification::Resolver.new(@configuration, {}).spec
    end

  ActiveRecord::ConnectionAdapters::ConnectionPool.new(spec)
end