class Twb::Analysis::DataSources::DataSourceTableFieldsCSVEmitter
Attributes
csvFileName[R]
csvRecords[R]
dsCount[R]
fieldsCount[R]
tablesCount[R]
Public Class Methods
csvFileType()
click to toggle source
# File lib/twb/analysis/DataSources/DataSourceTableFieldsCSVEmitter.rb, line 69 def self.csvFileType @@csvFileName end
csvHeader()
click to toggle source
# File lib/twb/analysis/DataSources/DataSourceTableFieldsCSVEmitter.rb, line 65 def self.csvHeader @@csvHeader end
new()
click to toggle source
# File lib/twb/analysis/DataSources/DataSourceTableFieldsCSVEmitter.rb, line 42 def initialize @csvFile = CSV.open(@@csvFileName, 'w') @csvFile << @@csvHeader @outputs = Set.new @outputs << @@csvFileName @dsCount = 0 @tablesCount = 0 @fieldsCount = 0 @csvRecords = Set.new end
Public Instance Methods
doc()
click to toggle source
# File lib/twb/analysis/DataSources/DataSourceTableFieldsCSVEmitter.rb, line 53 def doc { :filedoc => [ { :file => @@csvFileName, :description => @csvFileDescription, :header => @@csvHeader } ], :outputs => @outputs } end
outputs()
click to toggle source
# File lib/twb/analysis/DataSources/DataSourceTableFieldsCSVEmitter.rb, line 73 def outputs @outputs end
processTwb(twb)
click to toggle source
# File lib/twb/analysis/DataSources/DataSourceTableFieldsCSVEmitter.rb, line 77 def processTwb twb @recNum = 0 @twb = twb if twb.instance_of? Twb::Workbook @twb = Twb::Workbook.new(twb) if twb.instance_of? String # -- dss = @twb.datasources dss.each do |ds| tables = Set.new @dsCount += 1 ds.node.xpath('./connection/cols/map').each do |cnode| # puts cnode key = cnode.attribute('key').text codename = key.gsub(/^\[|\]$/,'') fielduiname = ds.fieldUIName(codename) value = cnode.attribute('value').text.gsub(/^\[|\]$/,'') parts = value.split('].[') # puts "%-30s %-45s %s \n " % [fielduiname, value, parts] csvRecord = [ @fieldsCount += 1, @twb.name, @twb.dir, ds.uiname, ds.name, parts[0], fielduiname, codename, parts[1] ] tables.add parts[0] @csvRecords.add csvRecord @csvFile << csvRecord end @tablesCount += tables.length end end