Class: GoodData::Model::AnchorBlueprintField
- Inherits:
-
AttributeBlueprintField
- Object
- BlueprintField
- AttributeBlueprintField
- GoodData::Model::AnchorBlueprintField
- Defined in:
- lib/gooddata/models/blueprint/anchor_field.rb
Instance Attribute Summary
Attributes inherited from BlueprintField
Instance Method Summary collapse
-
#anchor? ⇒ Boolean
Returns true if it is an anchor.
-
#grain ⇒ Array<Hash>
Returns grain definition if the anchor has it.
-
#grain? ⇒ Boolean
Returns true if grain is defined.
-
#labels ⇒ Array<GoodData::Model::LabelBlueprintField>
Returns labels for anchor or empty array if there are none.
-
#remove! ⇒ GoodData::Model::ProjectBlueprint
Alias for strip!.
-
#strip! ⇒ GoodData::Model::ProjectBlueprint
Removes all the labels from the anchor.
-
#validate ⇒ Array<Hash>
Validates the field for presence of mandatory fields.
Methods inherited from AttributeBlueprintField
Methods inherited from BlueprintField
#==, #id, #in_project, #initialize, #method_missing, #respond_to_missing?, #title
Constructor Details
This class inherits a constructor from GoodData::Model::BlueprintField
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class GoodData::Model::BlueprintField
Instance Method Details
#anchor? ⇒ Boolean
Returns true if it is an anchor
15 16 17 |
# File 'lib/gooddata/models/blueprint/anchor_field.rb', line 15 def anchor? true end |
#grain ⇒ Array<Hash>
Returns grain definition if the anchor has it. Nil otherwise
29 30 31 |
# File 'lib/gooddata/models/blueprint/anchor_field.rb', line 29 def grain data[:grain] end |
#grain? ⇒ Boolean
Returns true if grain is defined
22 23 24 |
# File 'lib/gooddata/models/blueprint/anchor_field.rb', line 22 def grain? !data[:grain].nil? end |
#labels ⇒ Array<GoodData::Model::LabelBlueprintField>
Returns labels for anchor or empty array if there are none
50 51 52 |
# File 'lib/gooddata/models/blueprint/anchor_field.rb', line 50 def labels dataset_blueprint.labels_for_attribute(self) end |
#remove! ⇒ GoodData::Model::ProjectBlueprint
Alias for strip!. Removes all the labels from the anchor. This is a typical operation that people want to perform
43 44 45 |
# File 'lib/gooddata/models/blueprint/anchor_field.rb', line 43 def remove! strip! end |
#strip! ⇒ GoodData::Model::ProjectBlueprint
Removes all the labels from the anchor. This is a typical operation that people want to perform
36 37 38 |
# File 'lib/gooddata/models/blueprint/anchor_field.rb', line 36 def strip! dataset_blueprint.strip_anchor! end |
#validate ⇒ Array<Hash>
Validates the field for presence of mandatory fields
57 58 59 60 61 62 |
# 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 |