Sha256: 2394d7e1308a339d3a57af4fc6d3b20d3ffda9f7742dce78fba23d39adf6dfc9

Contents?: true

Size: 620 Bytes

Versions: 1

Compression:

Stored size: 620 Bytes

Contents

module PgHero
  class Database
    attr_reader :id, :config

    def initialize(id, config)
      @id = id
      @config = config
    end

    def connection_model
      @connection_model ||= begin
        url = config["url"]
        Class.new(PgHero::Connection) do
          def self.name
            "PgHero::Connection::Database#{object_id}"
          end
          establish_connection(url) if url
        end
      end
    end

    def db_instance_identifier
      @db_instance_identifier ||= @config["db_instance_identifier"]
    end

    def name
      @name ||= @config["name"] || id.titleize
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pghero-1.4.2 lib/pghero/database.rb