Class: GoodData::Model::LabelBlueprintField

Inherits:
BlueprintField show all
Defined in:
lib/gooddata/models/blueprint/label_field.rb

Instance Attribute Summary

Attributes inherited from BlueprintField

#data, #dataset_blueprint

Instance Method Summary collapse

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

#attributeAttributeBlueprintField

Returns the attribute this label is referencing to

Returns:



15
16
17
# File 'lib/gooddata/models/blueprint/label_field.rb', line 15

def attribute
  dataset_blueprint.attribute_for_label(self)
end

#gd_data_typeString

Returns gd_data_type

Returns:

  • (String)

    returns gd_data_type of the label



26
27
28
# File 'lib/gooddata/models/blueprint/label_field.rb', line 26

def gd_data_type
  data[:gd_data_type] || Model::DEFAULT_ATTRIBUTE_DATATYPE
end

#gd_typeString

Returns gd_data_type

Returns:

  • (String)

    returns gd_type of the label



33
34
35
# File 'lib/gooddata/models/blueprint/label_field.rb', line 33

def gd_type
  data[:gd_type] || Model::DEFAULT_TYPE
end

#reference_label?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/gooddata/models/blueprint/label_field.rb', line 19

def reference_label?
  data[:reference_label] == true || self == attribute.reference_label
end

#validateArray

Validates the fields in the label

Returns:

  • (Array)

    returns list of the errors represented by hash structures



40
41
42
43
44
# File 'lib/gooddata/models/blueprint/label_field.rb', line 40

def validate
  validate_presence_of(:id, :reference).map do |e|
    { type: :error, message: "Field \"#{e}\" is not defined or empty for label \"#{id}\"" }
  end
end