Sha256: 9c49f46e424ab9339ecaf90c8cce2544cb0caa2af8f8e874d4d290405da410f7
Contents?: true
Size: 911 Bytes
Versions: 1
Compression:
Stored size: 911 Bytes
Contents
module PgBouncerHero class Database include Methods::Basics attr_reader :id, :config, :group def initialize(group, id, config) @id = id @config = config || {} @url = URI.parse(config["url"]) @group = group end def name @name ||= id.to_s end def connection connection_model.new(host, port, user, password, dbname).connection end def host @url.host if @url end def port @url.port if @url end def user @url.user if @url end def password @url.password if @url end def dbname @url.path[1..-1] if @url end private def connection_model @connection_model ||= begin Class.new(PgBouncerHero::Connection) do def self.name "PgBouncerHero::Connection::Database#{object_id}" end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pgbouncerhero-0.1.0 | lib/pgbouncerhero/database.rb |