Sha256: 04c77af61e0ac348871d8925b04301db455fe16dbe70c62f350e38683aeee123

Contents?: true

Size: 490 Bytes

Versions: 16

Compression:

Stored size: 490 Bytes

Contents

module Contentful
  module Management
    module Resource
      # Mixin for environment aware resources
      module EnvironmentAware
        # Gets the environment ID for the resource.
        def environment_id
          env = sys.fetch(:environment, {})
          case env
          when ::Hash
            env.fetch(:id, 'master')
          when ::Contentful::Management::Link
            env.id
          else
            'master'
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
contentful-management-2.9.1 lib/contentful/management/resource/environment_aware.rb
contentful-management-2.9.0 lib/contentful/management/resource/environment_aware.rb
contentful-management-2.8.2 lib/contentful/management/resource/environment_aware.rb
contentful-management-2.8.1 lib/contentful/management/resource/environment_aware.rb
contentful-management-2.8.0 lib/contentful/management/resource/environment_aware.rb
contentful-management-2.7.0 lib/contentful/management/resource/environment_aware.rb
contentful-management-2.6.0 lib/contentful/management/resource/environment_aware.rb
contentful-management-2.5.0 lib/contentful/management/resource/environment_aware.rb
contentful-management-2.4.0 lib/contentful/management/resource/environment_aware.rb
contentful-management-2.3.0 lib/contentful/management/resource/environment_aware.rb
contentful-management-2.2.2 lib/contentful/management/resource/environment_aware.rb
contentful-management-2.2.1 lib/contentful/management/resource/environment_aware.rb
contentful-management-2.2.0 lib/contentful/management/resource/environment_aware.rb
contentful-management-2.1.1 lib/contentful/management/resource/environment_aware.rb
contentful-management-2.1.0 lib/contentful/management/resource/environment_aware.rb
contentful-management-2.0.2 lib/contentful/management/resource/environment_aware.rb