Class: DSP::ColumnDescriptor

Inherits:
DSPBase
  • Object
show all
Defined in:
lib/dsp/dsp_protocol.rb

Overview

interface ColumnDescriptor {

    /** Name of the attribute rendered in this column. */
    attributeName: string;
    /** Header UI label of column. */
    label: string;
    /** Format to use for the rendered values in this column. TBD how the format strings looks like. */
    format?: string;
    /** Datatype of values in this column.  Defaults to 'string' if not specified. */
    type?: 'string' | 'number' | 'boolean' | 'unixTimestampUTC';
    /** Width of this column in characters (hint only). */
    width?: number;
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DSPBase

#to_h, #to_json

Constructor Details

#initialize(initial_hash = nil) ⇒ ColumnDescriptor

Returns a new instance of ColumnDescriptor.



3830
3831
3832
3833
# File 'lib/dsp/dsp_protocol.rb', line 3830

def initialize(initial_hash = nil)
  super
  @optional_method_names = %i[format type width]
end

Instance Attribute Details

#attributeNameObject

type: string # type: string # type: string # type: string with value ‘string’ | ‘number’ | ‘boolean’ | ‘unixTimestampUTC’ # type: number



3828
3829
3830
# File 'lib/dsp/dsp_protocol.rb', line 3828

def attributeName
  @attributeName
end

#formatObject

type: string # type: string # type: string # type: string with value ‘string’ | ‘number’ | ‘boolean’ | ‘unixTimestampUTC’ # type: number



3828
3829
3830
# File 'lib/dsp/dsp_protocol.rb', line 3828

def format
  @format
end

#labelObject

type: string # type: string # type: string # type: string with value ‘string’ | ‘number’ | ‘boolean’ | ‘unixTimestampUTC’ # type: number



3828
3829
3830
# File 'lib/dsp/dsp_protocol.rb', line 3828

def label
  @label
end

#typeObject

type: string # type: string # type: string # type: string with value ‘string’ | ‘number’ | ‘boolean’ | ‘unixTimestampUTC’ # type: number



3828
3829
3830
# File 'lib/dsp/dsp_protocol.rb', line 3828

def type
  @type
end

#widthObject

type: string # type: string # type: string # type: string with value ‘string’ | ‘number’ | ‘boolean’ | ‘unixTimestampUTC’ # type: number



3828
3829
3830
# File 'lib/dsp/dsp_protocol.rb', line 3828

def width
  @width
end

Instance Method Details

#from_h!(value) ⇒ Object



3835
3836
3837
3838
3839
3840
3841
3842
3843
# File 'lib/dsp/dsp_protocol.rb', line 3835

def from_h!(value)
  value = {} if value.nil?
  self.attributeName = value['attributeName']
  self.label = value['label']
  self.format = value['format']
  self.type = value['type'] # Unknown type
  self.width = value['width']
  self
end