Class: Replidog::Proxy::ConnectionPoolCreater
- Inherits:
-
Object
- Object
- Replidog::Proxy::ConnectionPoolCreater
- Defined in:
- lib/replidog/proxy.rb
Overview
Creates database connection pool from configuration Hash table.
Class Method Summary collapse
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(configuration) ⇒ ConnectionPoolCreater
constructor
A new instance of ConnectionPoolCreater.
Constructor Details
#initialize(configuration) ⇒ ConnectionPoolCreater
Returns a new instance of ConnectionPoolCreater.
181 182 183 |
# File 'lib/replidog/proxy.rb', line 181 def initialize(configuration) @configuration = configuration.dup end |
Class Method Details
.create(*args) ⇒ Object
177 178 179 |
# File 'lib/replidog/proxy.rb', line 177 def self.create(*args) new(*args).create end |
Instance Method Details
#create ⇒ Object
185 186 187 188 189 190 191 192 193 194 195 196 |
# 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 |