Class: Twb::LocalField

Inherits:
TabClass show all
Defined in:
lib/twb/localfield.rb

Overview

Assumption: A field can only be either a MetadataField or a LocalField, not both in a given Workbook data connection.

Instance Attribute Summary collapse

Attributes inherited from TabClass

#ttlogfile, #ttlogfilename, #uuid

Instance Method Summary collapse

Methods inherited from TabClass

#docFile, #emit, #setDocFileName

Constructor Details

#initialize(fieldNode) ⇒ LocalField

Returns a new instance of LocalField.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/twb/localfield.rb', line 26

def initialize fieldNode
  @node        = fieldNode
  @type        = 'local'
  @datatype    = @node.attr('datatype')
  @name        = @node.attr('name')
  @uiname      = @name
  @ordinal     = @node.attr('ordinal')
  # @properties  = @node.attributes
  # @dbname      = @node.attr('name').gsub(/^\[/,'').gsub(/\]$/,'')
  # @datatype    = @node.attr('datatype')
  # @role        = @node.attr('role')
  # @type        = @node.attr('type')
  @hidden      = @node.attr('hidden')
  # @caption     = @node.attr('caption')
  # @aggregation = @node.attr('aggregation')
  # @calculation = getCalculation
  # @comments    = getComments
  # @uiname      = if @caption.nil? || @caption == '' then @dbname else @caption end
  # return self
end

Instance Attribute Details

#datatypeObject (readonly)

Returns the value of attribute datatype.



24
25
26
# File 'lib/twb/localfield.rb', line 24

def datatype
  @datatype
end

#hiddenObject (readonly)

Returns the value of attribute hidden.



24
25
26
# File 'lib/twb/localfield.rb', line 24

def hidden
  @hidden
end

#nameObject (readonly)

Returns the value of attribute name.



24
25
26
# File 'lib/twb/localfield.rb', line 24

def name
  @name
end

#nodeObject (readonly)

Returns the value of attribute node.



24
25
26
# File 'lib/twb/localfield.rb', line 24

def node
  @node
end

#ordinalObject (readonly)

Returns the value of attribute ordinal.



24
25
26
# File 'lib/twb/localfield.rb', line 24

def ordinal
  @ordinal
end

#propertiesObject (readonly)

Returns the value of attribute properties.



24
25
26
# File 'lib/twb/localfield.rb', line 24

def properties
  @properties
end

#typeObject (readonly)

Returns the value of attribute type.



24
25
26
# File 'lib/twb/localfield.rb', line 24

def type
  @type
end

#uinameObject (readonly)

Returns the value of attribute uiname.



24
25
26
# File 'lib/twb/localfield.rb', line 24

def uiname
  @uiname
end

Instance Method Details

#idObject



47
48
49
# File 'lib/twb/localfield.rb', line 47

def id
    @id ||= @id = @name.hash
end

#loadPropertiesObject



55
56
57
58
59
60
61
62
# File 'lib/twb/localfield.rb', line 55

def loadProperties
  @properties= {}
  @node.attributes.each do |name,attr|
    @properties[name] = attr.value
  end
  @properties[:uiname] = @name
  return @properties
end