Sha256: e37168732523e180f4384ed12c3e2c6dcd8c16f8e5675853347a38ed1ed6923f
Contents?: true
Size: 700 Bytes
Versions: 2
Compression:
Stored size: 700 Bytes
Contents
# frozen_string_literal: true 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, {}) env_from_sys = case env when ::Hash env.fetch(:id, nil) when ::Contentful::Management::Link, ::Contentful::Management::Environment env.id end return env_from_sys if env_from_sys respond_to?(:content_type) && content_type && content_type.environment_id || 'master' end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
contentful-management-3.10.0 | lib/contentful/management/resource/environment_aware.rb |
contentful-management-3.9.0 | lib/contentful/management/resource/environment_aware.rb |