Class: Twb::Analysis::DashSheetsAnalyzer

Inherits:
Object
  • Object
show all
Includes:
TabTool
Defined in:
lib/twb/analysis/sheets/dashsheetsanalyzer.rb

Instance Attribute Summary collapse

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

#initialize(**args) ⇒ DashSheetsAnalyzer

Returns a new instance of DashSheetsAnalyzer.


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/twb/analysis/sheets/dashsheetsanalyzer.rb', line 28

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=>'Analyze Dashboard Worksheets', :description=>'Identifies the Worksheets present in Dashboards.',}
  #--
  docFileName     = docFile('DashboardSheets.csv')
  @dashSheetsCSV  = CSV.open(docFileName,@csvMode)
  unless @csvAdd
    if @recordDir
      @dashSheetsCSV  << ['Rec #','Workbook','Dashboard','Worksheet','Hidden','Visible', 'Workbook Dir']
    else
      @dashSheetsCSV  << ['Rec #','Workbook','Dashboard','Worksheet','Hidden','Visible'                ]
    end
  end
  addDocFile @dashSheetsCSV, docFileName, "Workbooks, Dashboards, and their Worksheets"
  #--
  @twbCount    = 0
  @dashCount   = 0
  @sheetCount  = 0
  @recNum      = 0
end

Instance Attribute Details

#localEmitObject

Returns the value of attribute localEmit


26
27
28
# File 'lib/twb/analysis/sheets/dashsheetsanalyzer.rb', line 26

def localEmit
  @localEmit
end

Instance Method Details

#metricsObject


54
55
56
57
58
59
60
# File 'lib/twb/analysis/sheets/dashsheetsanalyzer.rb', line 54

def metrics
  {
    # '# of Workbooks'  => @twbCount,
    '# of Dashboards' => @dashCount,
    '# of Worksheets' => @sheetCount
  }
end

#parseDashesObject


73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/twb/analysis/sheets/dashsheetsanalyzer.rb', line 73

def parseDashes
  @dashboards  = @twb.dashboards
  @dashboards.each do |dash|
    emit "DASH:: #{dash.name}"
    @dashCount += 1
    dash.worksheets.each do |sheet|
      @sheetCount += 1
      # puts "SHEET: #{sheet} -> #{sheet.name}"
      recordCSV [@twbName, dash.name, sheet.name, sheet.hidden, sheet.visible ]
      # recordCSV [@twbName, @modTime, dash.name, sheet.name, sheet.hidden, sheet.visible ]
    end
  end
end

#processTWB(twb) ⇒ Object


62
63
64
65
66
67
68
69
70
71
# File 'lib/twb/analysis/sheets/dashsheetsanalyzer.rb', line 62

def processTWB twb
   @twb     = twb
   @twbName = @twb.name
   @twbDir  = @twb.dir
   @modTime = @twb.modtime
   emit "   -- #{@twbName}"
   @twbCount += 1
   parseDashes
   finis
end