Class: Twb::MetadataField
- Includes:
- Comparable
- Defined in:
- lib/twb/metadatafield.rb
Instance Attribute Summary collapse
-
#aggregation ⇒ Object
readonly
Returns the value of attribute aggregation.
-
#caption ⇒ Object
readonly
Returns the value of attribute caption.
-
#containsNull ⇒ Object
readonly
Returns the value of attribute containsNull.
-
#family ⇒ Object
readonly
Returns the value of attribute family.
-
#localName ⇒ Object
readonly
Returns the value of attribute localName.
-
#localType ⇒ Object
readonly
Returns the value of attribute localType.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#ordinal ⇒ Object
readonly
Returns the value of attribute ordinal.
-
#parentName ⇒ Object
readonly
parentName is the Db table.
-
#precision ⇒ Object
readonly
Returns the value of attribute precision.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#remoteAlias ⇒ Object
readonly
Returns the value of attribute remoteAlias.
-
#remoteName ⇒ Object
readonly
Returns the value of attribute remoteName.
-
#remoteType ⇒ Object
readonly
Returns the value of attribute remoteType.
-
#scale ⇒ Object
readonly
Returns the value of attribute scale.
-
#source ⇒ Object
Returns the value of attribute source.
-
#table ⇒ Object
readonly
parentName is the Db table.
-
#twbClass ⇒ Object
readonly
Returns the value of attribute twbClass.
-
#uiname ⇒ Object
readonly
Returns the value of attribute uiname.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Attributes inherited from TabClass
#ttlogfile, #ttlogfilename, #type, #uuid
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #id ⇒ Object
-
#initialize(fieldNode) ⇒ MetadataField
constructor
A new instance of MetadataField.
- #load(nodeName) ⇒ Object
- #loadProperties ⇒ Object
- #to_s ⇒ Object
Methods inherited from TabClass
#docFile, #emit, #setDocFileName
Constructor Details
#initialize(fieldNode) ⇒ MetadataField
Returns a new instance of MetadataField.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/twb/metadatafield.rb', line 58 def initialize fieldNode @node = fieldNode @twbClass = @node.attribute('class').text @parentName = load 'parent-name' @family = load 'family' @table = @family.nil? ? @parentName : @family @remoteName = load 'remote-name' @remoteAlias = load 'remote-alias' @remoteType = load 'remote-type' @caption = load 'caption' @localName = load 'local-name' @name = @localName @uiname = @caption.nil? ? @localName : @caption @aggregation = load 'aggregation' @containsNull = load 'contains-null' @localType = load 'local-type' @ordinal = load 'ordinal' @precision = load 'precision' @scale = load 'scale' @width = load 'width' @id = "'%s::%s' " % [@table,@remoteName] end |
Instance Attribute Details
#aggregation ⇒ Object (readonly)
Returns the value of attribute aggregation.
32 33 34 |
# File 'lib/twb/metadatafield.rb', line 32 def aggregation @aggregation end |
#caption ⇒ Object (readonly)
Returns the value of attribute caption.
29 30 31 |
# File 'lib/twb/metadatafield.rb', line 29 def @caption end |
#containsNull ⇒ Object (readonly)
Returns the value of attribute containsNull.
33 34 35 |
# File 'lib/twb/metadatafield.rb', line 33 def containsNull @containsNull end |
#family ⇒ Object (readonly)
Returns the value of attribute family.
30 31 32 |
# File 'lib/twb/metadatafield.rb', line 30 def family @family end |
#localName ⇒ Object (readonly)
Returns the value of attribute localName.
28 29 30 |
# File 'lib/twb/metadatafield.rb', line 28 def localName @localName end |
#localType ⇒ Object (readonly)
Returns the value of attribute localType.
30 31 32 |
# File 'lib/twb/metadatafield.rb', line 30 def localType @localType end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
28 29 30 |
# File 'lib/twb/metadatafield.rb', line 28 def name @name end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
24 25 26 |
# File 'lib/twb/metadatafield.rb', line 24 def node @node end |
#ordinal ⇒ Object (readonly)
Returns the value of attribute ordinal.
33 34 35 |
# File 'lib/twb/metadatafield.rb', line 33 def ordinal @ordinal end |
#parentName ⇒ Object (readonly)
parentName is the Db table
27 28 29 |
# File 'lib/twb/metadatafield.rb', line 27 def parentName @parentName end |
#precision ⇒ Object (readonly)
Returns the value of attribute precision.
34 35 36 |
# File 'lib/twb/metadatafield.rb', line 34 def precision @precision end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
24 25 26 |
# File 'lib/twb/metadatafield.rb', line 24 def properties @properties end |
#remoteAlias ⇒ Object (readonly)
Returns the value of attribute remoteAlias.
31 32 33 |
# File 'lib/twb/metadatafield.rb', line 31 def remoteAlias @remoteAlias end |
#remoteName ⇒ Object (readonly)
Returns the value of attribute remoteName.
31 32 33 |
# File 'lib/twb/metadatafield.rb', line 31 def remoteName @remoteName end |
#remoteType ⇒ Object (readonly)
Returns the value of attribute remoteType.
32 33 34 |
# File 'lib/twb/metadatafield.rb', line 32 def remoteType @remoteType end |
#scale ⇒ Object (readonly)
Returns the value of attribute scale.
34 35 36 |
# File 'lib/twb/metadatafield.rb', line 34 def scale @scale end |
#source ⇒ Object
Returns the value of attribute source.
26 27 28 |
# File 'lib/twb/metadatafield.rb', line 26 def source @source end |
#table ⇒ Object (readonly)
parentName is the Db table
27 28 29 |
# File 'lib/twb/metadatafield.rb', line 27 def table @table end |
#twbClass ⇒ Object (readonly)
Returns the value of attribute twbClass.
25 26 27 |
# File 'lib/twb/metadatafield.rb', line 25 def twbClass @twbClass end |
#uiname ⇒ Object (readonly)
Returns the value of attribute uiname.
29 30 31 |
# File 'lib/twb/metadatafield.rb', line 29 def uiname @uiname end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
34 35 36 |
# File 'lib/twb/metadatafield.rb', line 34 def width @width end |
Instance Method Details
#<=>(other) ⇒ Object
112 113 114 |
# File 'lib/twb/metadatafield.rb', line 112 def <=>(other) @id <=> other.id end |
#id ⇒ Object
81 82 83 |
# File 'lib/twb/metadatafield.rb', line 81 def id @id ||= @id = @name.hash end |
#load(nodeName) ⇒ Object
102 103 104 105 106 |
# File 'lib/twb/metadatafield.rb', line 102 def load nodeName node = @node.at_xpath(nodeName) val = node.nil? ? nil : node.text.strip.gsub(/^\[|\]$/,'') return val end |
#loadProperties ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/twb/metadatafield.rb', line 89 def loadProperties @properties = {} children = @node.xpath('child::node()') children.each do |child| @properties[child.name] = child.text unless 'attributes'.eql? child.name end @properties[:uiname] = @uiname @node.attributes.each do |name,attr| @properties[name] = attr.value end return @properties end |
#to_s ⇒ Object
108 109 110 |
# File 'lib/twb/metadatafield.rb', line 108 def to_s @id end |