Sha256: 38b1007423ec78756ff50f5e2e68fae242d338477170a8d7154b2baa3275b2b5

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

# encoding: UTF-8

require_relative 'attribute_field'

module GoodData
  module Model
    class AnchorBlueprintField < AttributeBlueprintField
      # Returns true if it is an anchor
      #
      # @return [Boolean] returns true
      def anchor?
        true
      end

      # Removes all the labels from the anchor. This is a typical operation that people want to perform
      #
      # @return [GoodData::Model::ProjectBlueprint] Returns changed blueprint
      def strip!
        dataset_blueprint.strip_anchor!
      end

      # Alias for strip!. Removes all the labels from the anchor. This is a typical operation that people want to perform
      #
      # @return [GoodData::Model::ProjectBlueprint] Returns changed blueprint
      def remove!
        strip!
      end

      # Returns labels for anchor or empty array if there are none
      #
      # @return [Array<GoodData::Model::LabelBlueprintField>] Returns list of labels
      def labels
        dataset_blueprint.labels_for_attribute(self)
      end

      # Validates the field for presence of mandatory fields
      #
      # @return [Array<Hash>] Returns list of errors as hashes
      def validate
        validate_presence_of(:id).map do |e|
          { type: :error, message: "Field \"#{e}\" is not defined or empty for anchor \"#{id}\"" }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gooddata-0.6.20 lib/gooddata/models/blueprint/anchor_field.rb
gooddata-0.6.19 lib/gooddata/models/blueprint/anchor_field.rb