Sha256: 7ccd31a30dad2f894e56bbb7e14d7fa5917c1732d7dcbc717e0b7da56686eb28
Contents?: true
Size: 1.68 KB
Versions: 23
Compression:
Stored size: 1.68 KB
Contents
# encoding: UTF-8 # # Copyright (c) 2010-2015 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. module GoodData module Model class BlueprintField attr_reader :dataset_blueprint, :data def id @data[:id] end def initialize(data, dataset) @data = GoodData::Helpers.symbolize_keys(data) @data[:type] = @data[:type].to_sym @dataset_blueprint = dataset end # Returns the md object in associated project or throws error if not present # # @return [GoodData::MdObject] md object that is represented in the blueprint def in_project(project) GoodData::MdObject[id, project: project, client: project.client] end def method_missing(method_sym, *arguments, &block) if @data.key?(method_sym) @data[method_sym] else super end end def respond_to?(method_sym, *arguments, &block) if @data.key?(method_sym) true else super end end def title @data[:title] || GoodData::Helpers.titleize(@data[:id]) end # Validates the fields in the field # # @return [Array] returns list of the errors represented by hash structures def validate [] end def ==(other) return false unless other.respond_to?(:data) @data == other.data end private def validate_presence_of(*fields) fields.reduce([]) do |a, e| data.key?(e) && !data[e].blank? ? a : a + [e] end end end end end
Version data entries
23 entries across 23 versions & 2 rubygems