class Twb::Analysis::SheetsInTooltipAnalyzer
Public Class Methods
new(**args)
click to toggle source
# File lib/twb/analysis/Sheets/sheetsintooltipanalyzer.rb, line 26 def initialize(**args) @args = args @recordDir = !@args.nil? && @args[:recordDir] == true @ttdocdir = @args[:ttdocdir] @csvAdd = !@args.nil? && args[:csvMode] == :add @csvMode = @csvAdd ? 'a' : 'w' init @funcdoc = {:class=>self.class, :blurb=>'Tooltip Vizzes', :description=>'Identifies the vizzes used in tooltips.',} #-- docFileName = docFile('SheetsInTooltips.csv') @csvFile = CSV.open(docFileName,@csvMode) unless @csvAdd if @recordDir @csvFile << ['Rec #','Workbook','Worksheet - Host','Worksheet - Toolip viz','Max Width','Max Height', 'Workbook Dir'] else @csvFile << ['Rec #','Workbook','Worksheet - Host','Worksheet - Toolip viz','Max Height','Max Width'] end end addDocFile @csvFile, docFileName, "Workbooks, Worksheets with Vizzes in their Tooltips" #-- @twbCount = 0 @sheetCount = 0 @ttvizCount = 0 @recNum = 0 end
Public Instance Methods
metrics()
click to toggle source
# File lib/twb/analysis/Sheets/sheetsintooltipanalyzer.rb, line 52 def metrics { # '# of Workbooks' => @twbCount, '# of Worksheets' => @sheetCount, '# of Worksheets in Tooltips' => @ttvizCount } end
parseSheets()
click to toggle source
# File lib/twb/analysis/Sheets/sheetsintooltipanalyzer.rb, line 71 def parseSheets @sheets = @twb.worksheets # puts " #Sheets: #{@sheets.length}" @sheetCount += @sheets.length @sheets.each do |sheet| # puts "SHEET:: #{sheet.name}" # @dashCount += 1 ttip = sheet.tooltip runs = ttip.xpath('.//run') runs.each do |run| # puts run.text text = run.text isViz = text =~ /.*<Sheet[ ]+name=.*>.*/ # puts "\t #{text}" if isViz vizCode = text.gsub(/^[^<]*/,'').gsub(/[^>]*$/,'') vizNode = Nokogiri::XML(vizCode).at_xpath('./Sheet') # puts "\t #{vizCode}" # puts "\t #{vizNode.class} \t #{vizNode}" recordCSV [@twbName, sheet.name, vizNode['name'], vizNode['maxwidth'], vizNode['maxheight']] end # @sheetCount += 1 # recordCSV [@twbName, dash.name, sheet.name, sheet.hidden, sheet.visible ] end end end
processTWB(twb)
click to toggle source
# File lib/twb/analysis/Sheets/sheetsintooltipanalyzer.rb, line 60 def processTWB twb @twb = twb @twbName = @twb.name @twbDir = @twb.dir @modTime = @twb.modtime emit " -- #{@twbName}" @twbCount += 1 parseSheets finis end
Private Instance Methods
recordCSV(record)
click to toggle source
# File lib/twb/analysis/Sheets/sheetsintooltipanalyzer.rb, line 101 def recordCSV record numberedRec = [@recNum+=1] + record if @recordDir @csvFile << numberedRec.push(@twbDir) else @csvFile << numberedRec end end