Sha256: 86a5eeee7f3a0370c11f1da19f738ec9ff7865a0ed764dcc97fa249491a16f15

Contents?: true

Size: 464 Bytes

Versions: 11

Compression:

Stored size: 464 Bytes

Contents

module Superstore
  module Connection
    extend ActiveSupport::Concern

    module ClassMethods
      def adapter
        @adapter ||= adapter_class.new(config)
      end

      def adapter_class
        case config[:adapter]
        when nil, 'jsonb'
          Superstore::Adapters::JsonbAdapter
        else
          raise "Unknown adapter #{config[:adapter]}"
        end
      end

      def connection
        adapter.connection
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
superstore-2.4.4 lib/superstore/connection.rb
superstore-2.4.3 lib/superstore/connection.rb
superstore-2.4.2 lib/superstore/connection.rb
superstore-2.4.1 lib/superstore/connection.rb
superstore-2.4.0 lib/superstore/connection.rb
superstore-2.3.0 lib/superstore/connection.rb
superstore-2.2.0 lib/superstore/connection.rb
superstore-2.1.3 lib/superstore/connection.rb
superstore-2.1.2 lib/superstore/connection.rb
superstore-2.1.1 lib/superstore/connection.rb
superstore-2.1.0 lib/superstore/connection.rb