lib/gooddata/models/blueprint/dataset_blueprint.rb in gooddata-0.6.49 vs lib/gooddata/models/blueprint/dataset_blueprint.rb in gooddata-0.6.50

- old
+ new

@@ -1,8 +1,8 @@ # encoding: UTF-8 # -# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved. +# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. require_relative 'schema_builder' require_relative 'schema_blueprint' @@ -140,9 +140,14 @@ # # @param dataset [Hash] Dataset blueprint # @return [Array<Hash>] returns the label or an empty array def self.labels(dataset) find_columns_by_type(dataset, :label) + end + + def self.reference_label_for_attribtue(dataset, attribute) + labels = labels_for_attribute(dataset, attribute) + labels.find { |label| label[:reference_label] == true } || labels.first end # Returns labels for a particular attribute # # @param dataset [Hash] Dataset blueprint