Class: Twb::DbField
Instance Attribute Summary collapse
-
#dbname ⇒ Object
readonly
Returns the value of attribute dbname.
-
#dbtable ⇒ Object
readonly
Returns the value of attribute dbtable.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#uiname ⇒ Object
readonly
Returns the value of attribute uiname.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #id ⇒ Object
-
#initialize(dataSource, node, nodeType, table = nil) ⇒ DbField
constructor
A new instance of DbField.
- #loadProperties ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(dataSource, node, nodeType, table = nil) ⇒ DbField
Returns a new instance of DbField.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/twb/dbfield.rb', line 29 def initialize dataSource, node, nodeType, table=nil @node = node @nodeType = nodeType case @nodeType when :map @uiname = @node.attribute('key').text.gsub(/^\[|\]$/,'') @name = @uiname fldRef = @node.attribute('value').text.gsub(/^\[|\]$/,'') parts = fldRef.split('].[') @dbtable = parts[0] @dbname = parts[1] when :tableColumn @uiname = @node.attribute('name').text @name = @uiname @dbtable = table else raise ArgumentError.new("ERROR in DbField creation: invalid Node type, is #{nodeType} \n ") end @id = "#{dataSource}::#{dbname}::#{dbtable}::#{uiname}" end |
Instance Attribute Details
#dbname ⇒ Object (readonly)
Returns the value of attribute dbname.
27 28 29 |
# File 'lib/twb/dbfield.rb', line 27 def dbname @dbname end |
#dbtable ⇒ Object (readonly)
Returns the value of attribute dbtable.
27 28 29 |
# File 'lib/twb/dbfield.rb', line 27 def dbtable @dbtable end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
26 27 28 |
# File 'lib/twb/dbfield.rb', line 26 def name @name end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
24 25 26 |
# File 'lib/twb/dbfield.rb', line 24 def node @node end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
25 26 27 |
# File 'lib/twb/dbfield.rb', line 25 def properties @properties end |
#uiname ⇒ Object (readonly)
Returns the value of attribute uiname.
26 27 28 |
# File 'lib/twb/dbfield.rb', line 26 def uiname @uiname end |
Instance Method Details
#<=>(other) ⇒ Object
68 69 70 |
# File 'lib/twb/dbfield.rb', line 68 def <=>(other) @id <=> other.id end |
#id ⇒ Object
50 51 52 |
# File 'lib/twb/dbfield.rb', line 50 def id @id ||= @id = @name.hash end |
#loadProperties ⇒ Object
58 59 60 61 62 |
# File 'lib/twb/dbfield.rb', line 58 def loadProperties @properties = {:name=>@name,:uiname=>@uiname, :dbtable=>@dbtable} @properties[:dbname] = @dbname if :map == @nodeType return @properties end |
#to_s ⇒ Object
64 65 66 |
# File 'lib/twb/dbfield.rb', line 64 def to_s @id end |