Sha256: 461083120851b72a15e17a7fba5d251cedd54dcb7688e11bd0b212dd7634dc10

Contents?: true

Size: 1.49 KB

Versions: 61

Compression:

Stored size: 1.49 KB

Contents

module Fog
  module Core
    # This module covers the shared code used by models and collections
    # that deprecates the confusing usage of 'connection' which was
    # actually intended to be an instance of Fog::Service
    module DeprecatedConnectionAccessors
      # Sets the Service but using the wrong name!
      #
      # @deprecated The connection name was wrong and confusing since it refered to the service
      # @param [Fog::Service] service An instance of a Fog service this collection is for
      #
      def connection=(service)
        Fog::Logger.deprecation("#connection= is deprecated, pass :service in at creation [light_black](#{caller.first})[/]")
        @service = service
      end

      # Returns the Service the collection is part of
      #
      # @deprecated #connection is deprecated due to confusing name, use #service instead
      # @return [Fog::Service]
      #
      def connection
        Fog::Logger.deprecation("#connection is deprecated, use #service instead [light_black](#{caller.first})[/]")
        @service
      end

      # Prepares the value of the service based on the passed attributes
      #
      # @note Intended for use where the service is required before the normal
      #   initializer runs. The logic is run there with deprecation warnings.
      #
      # @param [Hash] attributes
      # @return [Fog::Service]
      #
      def prepare_service_value(attributes)
        @service = attributes[:service] || attributes[:connection]
      end
    end
  end
end

Version data entries

61 entries across 57 versions & 5 rubygems

Version Path
fog-core-2.6.0 lib/fog/core/deprecated_connection_accessors.rb
fog-core-2.5.0 lib/fog/core/deprecated_connection_accessors.rb
fog-core-2.4.0 lib/fog/core/deprecated_connection_accessors.rb
fog-core-2.3.0 lib/fog/core/deprecated_connection_accessors.rb
fog-core-2.2.4 lib/fog/core/deprecated_connection_accessors.rb
fog-core-2.2.3 lib/fog/core/deprecated_connection_accessors.rb
fog-core-2.2.2 lib/fog/core/deprecated_connection_accessors.rb
fog-core-2.2.1 lib/fog/core/deprecated_connection_accessors.rb
fog-core-2.2.0 lib/fog/core/deprecated_connection_accessors.rb
fog-core-2.1.2 lib/fog/core/deprecated_connection_accessors.rb
fog-core-2.1.1 lib/fog/core/deprecated_connection_accessors.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-core-1.45.0/lib/fog/core/deprecated_connection_accessors.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-core-1.45.0/lib/fog/core/deprecated_connection_accessors.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-core-2.1.0/lib/fog/core/deprecated_connection_accessors.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-core-1.45.0/lib/fog/core/deprecated_connection_accessors.rb
fog-core-2.1.0 lib/fog/core/deprecated_connection_accessors.rb
fog-core-2.0.0 lib/fog/core/deprecated_connection_accessors.rb
fog-core-1.45.0 lib/fog/core/deprecated_connection_accessors.rb
fog-core-1.44.3 lib/fog/core/deprecated_connection_accessors.rb
fog-core-1.44.2 lib/fog/core/deprecated_connection_accessors.rb