Sha256: e5bc0a54f62de9dd8d08ececf6573d3efbe33e2956e1ec755d02d3a394a0cfbe
Contents?: true
Size: 1.61 KB
Versions: 2
Compression:
Stored size: 1.61 KB
Contents
# encoding: UTF-8 require_relative '../md_object' require_relative '../../helpers' module GoodData module Model ## # This is a base class for server-side LDM elements such as attributes, labels and # facts # class Column < MdObject attr_accessor :folder, :name, :title, :schema def initialize(hash, schema) super() fail(ArgumentError, "Schema must be provided, got #{schema.class}") unless schema.is_a? Schema fail('Data set fields must have their names defined') if hash[:name].nil? @name = hash[:name] @title = hash[:title] || hash[:name].humanize @folder = hash[:folder] @schema = schema end ## # Generates an identifier from the object name by transliterating # non-Latin character and then dropping non-alphanumerical characters. # def identifier @identifier ||= "#{type_prefix}.#{@schema.name}.#{name}" end def to_maql_drop "DROP {#{identifier}};\n" end def visual visual = super visual += ", FOLDER {#{folder_prefix}.#{(folder)}}" if folder visual end def to_csv_header(row) name end def to_csv_data(headers, row) row[name] end # Overriden to prevent long strings caused by the @schema attribute # def inspect to_s.sub(/>$/, " @title=#{@title.inspect}, @name=#{@name.inspect}, @folder=#{@folder.inspect}," \ " @schema=#{@schema.to_s.sub(/>$/, ' @title=' + @schema.name.inspect + '>')}" \ ">") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gooddata-0.6.3 | lib/gooddata/models/metadata/column.rb |
gooddata-0.6.2 | lib/gooddata/models/metadata/column.rb |