Sha256: 40353b2b741d8d6f7f3ce84beacf27b5f22873051e03074f819c8425c3c99967

Contents?: true

Size: 885 Bytes

Versions: 24

Compression:

Stored size: 885 Bytes

Contents

require_relative 'abstract'
require 'shellwords'

module Hanami
  module Model
    module Sql
      module Consoles
        # SQLite adapter
        #
        # @since 0.7.0
        # @api private
        class Sqlite < Abstract
          # @since 0.7.0
          # @api private
          COMMAND = 'sqlite3'.freeze

          # @since 0.7.0
          # @api private
          def connection_string
            concat(command, ' ', host, database)
          end

          private

          # @since 0.7.0
          # @api private
          def command
            COMMAND
          end

          # @since 0.7.0
          # @api private
          def host
            @uri.host unless @uri.host.nil?
          end

          # @since 0.7.0
          # @api private
          def database
            Shellwords.escape(@uri.path)
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
hanami-model-1.0.0.beta3 lib/hanami/model/sql/consoles/sqlite.rb
hanami-model-1.0.0.beta2 lib/hanami/model/sql/consoles/sqlite.rb
hanami-model-1.0.0.beta1 lib/hanami/model/sql/consoles/sqlite.rb
hanami-model-0.7.0 lib/hanami/model/sql/consoles/sqlite.rb