Class: Twb::MetadataField

Inherits:
Object
  • Object
show all
Defined in:
lib/twb/metadatafield.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

Instance Method Summary collapse

Constructor Details

#initialize(fieldNode) ⇒ MetadataField

Returns a new instance of MetadataField.



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

def initialize fieldNode
  @node              = fieldNode
  @aggregation       = load 'aggregation'
  @containsnull      = load 'contains-null'
  @localname         = load 'local-name'
  @localtype         = load 'local-type'
  @ordinal           = load 'ordinal'
  @parentname        = load 'parent-name'
  @precision         = load 'precision'
  @remotealias       = load 'remote-alias'
  @remotename        = load 'remote-name'
  @name              = @remotename
  @remotetype        = load 'remote-type'
  @width             = load 'width'
  return self
end

Instance Attribute Details

#aggregationObject (readonly)

Returns the value of attribute aggregation.



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

def aggregation
  @aggregation
end

#containsnullObject (readonly)

Returns the value of attribute containsnull.



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

def containsnull
  @containsnull
end

#localnameObject (readonly)

Returns the value of attribute localname.



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

def localname
  @localname
end

#localtypeObject (readonly)

Returns the value of attribute localtype.



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

def localtype
  @localtype
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#nodeObject (readonly)

Returns the value of attribute node.



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

def node
  @node
end

#ordinalObject (readonly)

Returns the value of attribute ordinal.



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

def ordinal
  @ordinal
end

#parentnameObject (readonly)

Returns the value of attribute parentname.



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

def parentname
  @parentname
end

#precisionObject (readonly)

Returns the value of attribute precision.



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

def precision
  @precision
end

#remotealiasObject (readonly)

Returns the value of attribute remotealias.



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

def remotealias
  @remotealias
end

#remotenameObject (readonly)

Returns the value of attribute remotename.



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

def remotename
  @remotename
end

#remotetypeObject (readonly)

Returns the value of attribute remotetype.



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

def remotetype
  @remotetype
end

#widthObject (readonly)

Returns the value of attribute width.



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

def width
  @width
end

Instance Method Details

#load(nodeName) ⇒ Object



43
44
45
46
47
48
# File 'lib/twb/metadatafield.rb', line 43

def load nodeName
  node = @node.at_xpath(nodeName)
  val  = if node.nil? then  node else node.text end
  # puts "==== MD node:'#{nodeName}' \t nil?'#{node.nil?}' \t == val:#{val} \t = '#{node}' "

  return val
end