Sha256: e86d80e5a1e9702b50f69fa6548c6b628b14e7079d4a4934d85440e76c4c0bc9

Contents?: true

Size: 632 Bytes

Versions: 7

Compression:

Stored size: 632 Bytes

Contents

module Vanity
  module Adapters
    class << self
      # Creates new connection to underlying datastore and returns suitable
      # adapter (adapter object extends AbstractAdapter and wraps the
      # connection). Vanity.playground.establish_connection uses this.
      #
      # @since 1.4.0
      def establish_connection(spec)
        begin
          require "vanity/adapters/#{spec[:adapter]}_adapter"
        rescue LoadError
          raise "Could not find #{spec[:adapter]} in your load path"
        end
        adapter_method = "#{spec[:adapter]}_connection"
        send adapter_method, spec
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vanity-2.2.0 lib/vanity/adapters.rb
vanity-2.1.2 lib/vanity/adapters.rb
vanity-2.1.1 lib/vanity/adapters.rb
vanity-2.1.0 lib/vanity/adapters.rb
vanity-2.0.1 lib/vanity/adapters.rb
vanity-2.0.0 lib/vanity/adapters.rb
vanity-2.0.0.beta9 lib/vanity/adapters.rb