class Twb::CodedField
Attributes
dataSource[R]
function[R]
name[R]
rawCode[R]
techCode[R]
Public Class Methods
new(code)
click to toggle source
# File lib/twb/codedfield.rb, line 29 def initialize code # puts "...CodedField :: #{code}" @rawCode = code trimmed = code.gsub(/^['"]|['"]$/,'').gsub(/^\[|\]$/,'').gsub(/:[0-9]+$/,'') # puts " trimmed :: #{trimmed}" parts = trimmed.split('].[') #puts "Field: #{code} parts: #{parts.length} - #{parts.inspect}" #puts " p1: #{parts[0]}" #puts " p2: #{parts[1]}" if parts.length == 1 #puts '==1' @name = parts[0] @techCode = "[#{@name}]" elsif # parts.length <> 1 #puts '<>1' #puts "p[0]: #{parts[0]}" #puts "p[1]: #{parts[1]}" @dataSource = parts[0] fldName = parts[1] if fldName.start_with?(':') && fldName.count(':') == 1 @name = fldName else parseField fldName end @techCode = "[#{@dataSource}].[#{@name}]" end end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/twb/codedfield.rb, line 77 def <=>(other) # myName = @uiname.nil? ? '' : @uiname # otherName = other.uiName.nil? ? "" : other.uiName # ##puts "#{@uiname} / #{myName} <=> #{otherName} / #{other.uiName}" # ##puts "#{@uiname.nil?} // #{other.uiName.nil?}" # myName <=> otherName @fqName <=> other.techCode end
id()
click to toggle source
# File lib/twb/codedfield.rb, line 69 def id @id ||= @id = "#{@dataSource}::#{@uiname}" end
parseField(str)
click to toggle source
# File lib/twb/codedfield.rb, line 57 def parseField str # puts "parseField: #{str}" parts = str.split(':') case parts.length when 1 @name = parts[0] else @name = parts[-2] @function = parts[0] end end
to_s()
click to toggle source
# File lib/twb/codedfield.rb, line 73 def to_s "ds:#{dataSource}|n:#{name}|tc:#{techCode}" end