Class: Twb::MetadataField
- Inherits:
-
Object
- Object
- 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.
-
#class ⇒ Object
readonly
Returns the value of attribute class.
-
#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.
-
#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.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(fieldNode) ⇒ MetadataField
constructor
A new instance of MetadataField.
- #load(nodeName) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(fieldNode) ⇒ MetadataField
Returns a new instance of MetadataField.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/twb/metadatafield.rb', line 56 def initialize fieldNode @class = fieldNode.attribute('class').text @node = fieldNode @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 = @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] # return self end |
Instance Attribute Details
#aggregation ⇒ Object (readonly)
Returns the value of attribute aggregation.
30 31 32 |
# File 'lib/twb/metadatafield.rb', line 30 def aggregation @aggregation end |
#caption ⇒ Object (readonly)
Returns the value of attribute caption.
27 28 29 |
# File 'lib/twb/metadatafield.rb', line 27 def caption @caption end |
#class ⇒ Object (readonly)
Returns the value of attribute class.
24 25 26 |
# File 'lib/twb/metadatafield.rb', line 24 def class @class end |
#containsNull ⇒ Object (readonly)
Returns the value of attribute containsNull.
31 32 33 |
# File 'lib/twb/metadatafield.rb', line 31 def containsNull @containsNull end |
#family ⇒ Object (readonly)
Returns the value of attribute family.
27 28 29 |
# File 'lib/twb/metadatafield.rb', line 27 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.
28 29 30 |
# File 'lib/twb/metadatafield.rb', line 28 def localType @localType end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
27 28 29 |
# File 'lib/twb/metadatafield.rb', line 27 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.
31 32 33 |
# File 'lib/twb/metadatafield.rb', line 31 def ordinal @ordinal end |
#parentName ⇒ Object (readonly)
parentName is the Db table
26 27 28 |
# File 'lib/twb/metadatafield.rb', line 26 def parentName @parentName end |
#precision ⇒ Object (readonly)
Returns the value of attribute precision.
32 33 34 |
# File 'lib/twb/metadatafield.rb', line 32 def precision @precision end |
#remoteAlias ⇒ Object (readonly)
Returns the value of attribute remoteAlias.
29 30 31 |
# File 'lib/twb/metadatafield.rb', line 29 def remoteAlias @remoteAlias end |
#remoteName ⇒ Object (readonly)
Returns the value of attribute remoteName.
29 30 31 |
# File 'lib/twb/metadatafield.rb', line 29 def remoteName @remoteName end |
#remoteType ⇒ Object (readonly)
Returns the value of attribute remoteType.
30 31 32 |
# File 'lib/twb/metadatafield.rb', line 30 def remoteType @remoteType end |
#scale ⇒ Object (readonly)
Returns the value of attribute scale.
32 33 34 |
# File 'lib/twb/metadatafield.rb', line 32 def scale @scale end |
#source ⇒ Object
Returns the value of attribute source.
25 26 27 |
# File 'lib/twb/metadatafield.rb', line 25 def source @source end |
#table ⇒ Object (readonly)
parentName is the Db table
26 27 28 |
# File 'lib/twb/metadatafield.rb', line 26 def table @table end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
32 33 34 |
# File 'lib/twb/metadatafield.rb', line 32 def width @width end |
Instance Method Details
#<=>(other) ⇒ Object
89 90 91 |
# File 'lib/twb/metadatafield.rb', line 89 def <=>(other) @id <=> other.id end |
#load(nodeName) ⇒ Object
79 80 81 82 83 |
# File 'lib/twb/metadatafield.rb', line 79 def load nodeName node = @node.at_xpath(nodeName) val = node.nil? ? nil : node.text.strip.gsub(/^\[|\]$/,'') return val end |
#to_s ⇒ Object
85 86 87 |
# File 'lib/twb/metadatafield.rb', line 85 def to_s @id end |