Sha256: 1c8c0fb2c1a3804169ed073097f3e43683651ff742ff6c2544791be351a3aae4

Contents?: true

Size: 807 Bytes

Versions: 2

Compression:

Stored size: 807 Bytes

Contents

module Hanami
  module Model
    module Adapters
      module Sql
        class Console
          extend Forwardable

          def_delegator :console, :connection_string

          def initialize(uri)
            @uri = URI.parse(uri)
          end

          private

          def console
            case @uri.scheme
            when 'sqlite'
              require 'hanami/model/adapters/sql/consoles/sqlite'
              Consoles::Sqlite.new(@uri)
            when 'postgres'
              require 'hanami/model/adapters/sql/consoles/postgresql'
              Consoles::Postgresql.new(@uri)
            when 'mysql', 'mysql2'
              require 'hanami/model/adapters/sql/consoles/mysql'
              Consoles::Mysql.new(@uri)
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hanami-model-0.6.1 lib/hanami/model/adapters/sql/console.rb
hanami-model-0.6.0 lib/hanami/model/adapters/sql/console.rb