class GoodData::Model::AnchorBlueprintField

Public Instance Methods

anchor?() click to toggle source

Returns true if it is an anchor

@return [Boolean] returns true

# File lib/gooddata/models/blueprint/anchor_field.rb, line 15
def anchor?
  true
end
grain() click to toggle source

Returns grain definition if the anchor has it. Nil otherwise

@return [Array<Hash>] Returns grain definitions

# File lib/gooddata/models/blueprint/anchor_field.rb, line 29
def grain
  data[:grain]
end
grain?() click to toggle source

Returns true if grain is defined

@return [Boolean] Returns true if grain is defined on the anchor

# File lib/gooddata/models/blueprint/anchor_field.rb, line 22
def grain?
  !data[:grain].nil?
end
labels() click to toggle source

Returns labels for anchor or empty array if there are none

@return [Array<GoodData::Model::LabelBlueprintField>] Returns list of labels

# File lib/gooddata/models/blueprint/anchor_field.rb, line 50
def labels
  dataset_blueprint.labels_for_attribute(self)
end
remove!() click to toggle source

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

# File lib/gooddata/models/blueprint/anchor_field.rb, line 43
def remove!
  strip!
end
strip!() click to toggle source

Removes all the labels from the anchor. This is a typical operation that people want to perform

@return [GoodData::Model::ProjectBlueprint] Returns changed blueprint

# File lib/gooddata/models/blueprint/anchor_field.rb, line 36
def strip!
  dataset_blueprint.strip_anchor!
end
validate() click to toggle source

Validates the field for presence of mandatory fields

@return [Array<Hash>] Returns list of errors as hashes

Calls superclass method
# File lib/gooddata/models/blueprint/anchor_field.rb, line 57
def validate
  errors = super
  errors.concat(validate_presence_of(:id).map do |e|
    { type: :error, message: "Field \"#{e}\" is not defined or empty for anchor \"#{id}\"" }
  end)
end