Sha256: 4266ccb5c28568f475147173e4b428dc60edb8a109a79f7ec4606a5b504db80b

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

# encoding: UTF-8
#
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

module GoodData
  module LCM2
    class Helpers
      class << self
        # @param Array of segments as in release brick parameters
        # @return Hash of segments and production tags
        # @example { { segment: 'tag1, tag1' } }
        def segment_production_tags(segments)
          return {} unless segments
          segments
            .reject { |s| s.production_tag.nil? }
            .map { |s| [s.segment_id, s.production_tag] }
            .to_h
        end

        # @param production_tags Global production tags
        # @param segment_production_tags Segment-specific production tags
        # @return Array of production tags
        # @example ['tag1', 'tag2']
        def parse_production_tags(production_tags, segment_production_tags)
          separator = ','
          tags = segment_production_tags || production_tags
          return [] unless tags
          tags.split(separator).map(&:strip)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gooddata-0.6.53 lib/gooddata/lcm/helpers/tags_helper.rb
gooddata-0.6.52 lib/gooddata/lcm/helpers/tags_helper.rb