Class: Twb::Analysis::SheetsInTooltipAnalyzer
- Inherits:
-
Object
- Object
- Twb::Analysis::SheetsInTooltipAnalyzer
show all
- Includes:
- TabTool
- Defined in:
- lib/twb/analysis/sheets/sheetsintooltipanalyzer.rb
Instance Attribute Summary
Attributes included from TabTool
#alerts, #docDir, #docfiles, #funcdoc, #id, #licensed, #logfilename, #logger, #loglevel, #properties, #ttdocdir, #type, #uuid
Instance Method Summary
collapse
Methods included from TabTool
#addDocFile, #alert, #closeDocFiles, #config, #docFile, #docFileMaxNameLen, #docfilesdoc, #docfilesdocto_s, #emit, #emitCSV, #finis, #hasConfig, #init, #initCSV, #initDocDir, #initLogger, #license=, #licensed?, #loadConfig
Constructor Details
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# 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
|
Instance Method Details
#metrics ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/twb/analysis/sheets/sheetsintooltipanalyzer.rb', line 52
def metrics
{
'# of Worksheets' => @sheetCount,
'# of Worksheets in Tooltips' => @ttvizCount
}
end
|
#parseSheets ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/twb/analysis/sheets/sheetsintooltipanalyzer.rb', line 71
def parseSheets
@sheets = @twb.worksheets
@sheetCount += @sheets.length
@sheets.each do |sheet|
ttip = sheet.tooltip
runs = ttip.xpath('.//run')
runs.each do |run|
text = run.text
isViz = text =~ /.*<Sheet[ ]+name=.*>.*/
if isViz
vizCode = text.gsub(/^[^<]*/,'').gsub(/[^>]*$/,'')
vizNode = Nokogiri::XML(vizCode).at_xpath('./Sheet')
recordCSV [@twbName, sheet.name, vizNode['name'], vizNode['maxwidth'], vizNode['maxheight']]
end
end
end
end
|
#processTWB(twb) ⇒ Object
60
61
62
63
64
65
66
67
68
69
|
# 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
|