Sha256: 309d1047558c865ffa4fe69de0e0c2f467ae3049391c86799622d3b9e7b888d3

Contents?: true

Size: 612 Bytes

Versions: 6

Compression:

Stored size: 612 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::#{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

6 entries across 6 versions & 1 rubygems

Version Path
pghero-1.4.1 lib/pghero/database.rb
pghero-1.4.0 lib/pghero/database.rb
pghero-1.3.2 lib/pghero/database.rb
pghero-1.3.1 lib/pghero/database.rb
pghero-1.3.0 lib/pghero/database.rb
pghero-1.2.4 lib/pghero/database.rb