class Twb::Analysis::AnnotatedFieldsCSVEmitter
Attributes
csvFileName[R]
csvRecords[R]
dsCount[R]
fieldsCount[R]
Public Class Methods
csvFileNaame()
click to toggle source
# File lib/twb/analysis/AnnotatedFieldsCSVEmitter.rb, line 58 def self.csvFileNaame @@csvFileName end
csvFileType()
click to toggle source
# File lib/twb/analysis/AnnotatedFieldsCSVEmitter.rb, line 54 def self.csvFileType @@csvFileType end
csvHeader()
click to toggle source
# File lib/twb/analysis/AnnotatedFieldsCSVEmitter.rb, line 50 def self.csvHeader @@csvHeader end
new()
click to toggle source
# File lib/twb/analysis/AnnotatedFieldsCSVEmitter.rb, line 39 def initialize # puts "AnnotatedFieldsCSVEmitter - initializing" @csvFile = CSV.open(@@csvFileName,'w') @csvFile << @@csvHeader @csvRecords = Set.new # -- @recNum = 0 @dsCount = 0 @fieldNum = 0 end
Public Instance Methods
cleanup()
click to toggle source
# File lib/twb/analysis/AnnotatedFieldsCSVEmitter.rb, line 178 def cleanup @csvFile.close unless @csvFile.nil? end
emitFields(fields)
click to toggle source
def recordField fields, field, props
# puts "%-65s :: %s " % [fieldName,props] return if field.uiname.nil? if fields.has_key? field.uiname fields[field.uiname].merge! field.properties else fields[field.uiname] = field.properties end
end
# File lib/twb/analysis/AnnotatedFieldsCSVEmitter.rb, line 125 def emitFields fields fields.each do |fieldName,props| # puts "FIELD:: %-40s :: %s" % [fieldName,props.inspect] # class = props[] csvRec = [ @recNum+=1, @twb.name, @twb.dir, @dsname, fieldName, props[:type], props['hidden'], props[:columnField], props[:calculatedField], props[:dbField], props[:mappedField], props[:metadataField] ] @csvFile << csvRec @csvRecords.add csvRec end end
emitTech(dataSource, fieldName, type, properties)
click to toggle source
# File lib/twb/analysis/AnnotatedFieldsCSVEmitter.rb, line 162 def emitTech dataSource, fieldName, type, properties # puts "XX #{dataSource.uiname} :: #{fieldName} #{} :: #{type} :: #{properties}" @recNum+=1 properties.each do |name,value| @csvFileTech << [ @recNum, @twb.name, @twb.dir, dataSource.uiname, fieldName, type, name, value ] end end
processTwb(twb)
click to toggle source
# File lib/twb/analysis/AnnotatedFieldsCSVEmitter.rb, line 62 def processTwb twb @twb = nil @twb = twb if twb.instance_of? Twb::Workbook @twb = Twb::Workbook.new(twb) if twb.instance_of? String raise ArgumentError.new("ERROR in Workbok processing: '#{twb}' must be a Workbook (class) or the name of a Workbook (String), is a #{twb.class} \n ") unless @twb.is_a? Twb::Workbook # puts "Processing #{@twb.name}" # -- dss = @twb.datasources dss.each do |ds| @dsname = ds.uiname # puts "\n -- #{ds.uiname} " # tables = Set.new fields = {} @dsCount += 1 ds.columnFields.each do |field| recordField field end end end
recordField(field)
click to toggle source
# File lib/twb/analysis/AnnotatedFieldsCSVEmitter.rb, line 82 def recordField field # puts "- #{field.uiname} :: #{field} ::: #{field.node}" @fieldNum += 1 @lineNum = 0 field.comment.each do |line| # dispLine = if ''.eql?(line) the ? '' : line @csvFile << [ @recNum+=1, @twb.name, @twb.dir, @dsname, field.uiname, 'Comment', @lineNum+=1, # ''.eql?(line) ? " " : line line ] end unless field.calcField.nil? @lineNum = 0 field.calcField.formulaResolvedLines.each do |line| @csvFile << [ @recNum+=1, @twb.name, @twb.dir, @dsname, field.uiname, 'Formula', @lineNum+=1, line ] end end end
recordTech(field, type)
click to toggle source
# File lib/twb/analysis/AnnotatedFieldsCSVEmitter.rb, line 147 def recordTech field, type @recNum+=1 field.properties.each do |name,value| @csvFileTech << [ @recNum, @twb.name, @twb.dir, @dsname, field.uiname, type, name, value ] end end