Class: GoodData::Model::BlueprintField
- Defined in:
- lib/gooddata/models/blueprint/blueprint_field.rb
Direct Known Subclasses
AttributeBlueprintField, BridgeBlueprintField, FactBlueprintField, LabelBlueprintField, ReferenceBlueprintField
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#dataset_blueprint ⇒ Object
readonly
Returns the value of attribute dataset_blueprint.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #id ⇒ Object
-
#in_project(project) ⇒ GoodData::MdObject
Returns the md object in associated project or throws error if not present.
-
#initialize(data, dataset) ⇒ BlueprintField
constructor
A new instance of BlueprintField.
- #method_missing(method_sym, *arguments, &block) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
- #title ⇒ Object
-
#validate ⇒ Array
Validates the fields in the field.
Constructor Details
#initialize(data, dataset) ⇒ BlueprintField
Returns a new instance of BlueprintField.
16 17 18 19 20 |
# File 'lib/gooddata/models/blueprint/blueprint_field.rb', line 16 def initialize(data, dataset) @data = GoodData::Helpers.symbolize_keys(data) @data[:type] = @data[:type].to_sym @dataset_blueprint = dataset end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_sym, *arguments, &block) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/gooddata/models/blueprint/blueprint_field.rb', line 29 def method_missing(method_sym, *arguments, &block) if @data.key?(method_sym) @data[method_sym] else super end end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
10 11 12 |
# File 'lib/gooddata/models/blueprint/blueprint_field.rb', line 10 def data @data end |
#dataset_blueprint ⇒ Object (readonly)
Returns the value of attribute dataset_blueprint.
10 11 12 |
# File 'lib/gooddata/models/blueprint/blueprint_field.rb', line 10 def dataset_blueprint @dataset_blueprint end |
Instance Method Details
#==(other) ⇒ Object
56 57 58 59 |
# File 'lib/gooddata/models/blueprint/blueprint_field.rb', line 56 def ==(other) return false unless other.respond_to?(:data) @data == other.data end |
#id ⇒ Object
12 13 14 |
# File 'lib/gooddata/models/blueprint/blueprint_field.rb', line 12 def id @data[:id] end |
#in_project(project) ⇒ GoodData::MdObject
Returns the md object in associated project or throws error if not present
25 26 27 |
# File 'lib/gooddata/models/blueprint/blueprint_field.rb', line 25 def in_project(project) GoodData::MdObject[id, project: project, client: project.client] end |
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
37 38 39 40 41 42 43 |
# File 'lib/gooddata/models/blueprint/blueprint_field.rb', line 37 def respond_to_missing?(method_name, include_private = false) if @data.key?(method_name) true else super end end |
#title ⇒ Object
45 46 47 |
# File 'lib/gooddata/models/blueprint/blueprint_field.rb', line 45 def title @data[:title] || GoodData::Helpers.titleize(@data[:id]) end |
#validate ⇒ Array
Validates the fields in the field
52 53 54 |
# File 'lib/gooddata/models/blueprint/blueprint_field.rb', line 52 def validate [] end |