class Twb::Analysis::DashboardsSummarizer

Attributes

localEmit[RW]

Public Class Methods

new(**args) click to toggle source
# File lib/twb/analysis/Sheets/dashboardsummarizer.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('DashboardSummaries.csv')
  @dashboardsCSV  = CSV.open(docFileName,@csvMode)
  unless @csvAdd
    if @recordDir
      @dashboardsCSV  << ['Rec #','Workbook','Dashboard','# Worksheets','Workbook Dir']
    else
      @dashboardsCSV  << ['Rec #','Workbook','Dashboard','# Worksheets'               ]
    end
  end
  addDocFile @dashboardsCSV, docFileName, "Workbooks and their Dashboards' summaries"
  #--
  @twbCount    = 0
  @dashCount   = 0
  @recNum      = 0
end

Public Instance Methods

metrics() click to toggle source
# File lib/twb/analysis/Sheets/dashboardsummarizer.rb, line 53
def metrics
  {
    # '# of Workbooks'  => @twbCount,
    '# of Dashboards' => @dashCount,
  }
end
parseDashes() click to toggle source
# File lib/twb/analysis/Sheets/dashboardsummarizer.rb, line 71
def parseDashes
  @dashboards = @twb.dashboards
  @dashboards.each do |dash|
    emit "DASH:: #{dash.name}"
    @dashCount += 1
    recordCSV [@twbName, dash.name, dash.worksheets.length]
  end
end
processTWB(twb) click to toggle source
# File lib/twb/analysis/Sheets/dashboardsummarizer.rb, line 60
def processTWB twb
   @twb     = twb
   @twbName = @twb.name
   @twbDir  = @twb.dir
   @modTime = @twb.modtime
   emit "   -- #{@twbName}"
   @twbCount += 1
   parseDashes
   finis
end

Private Instance Methods

recordCSV(record) click to toggle source
# File lib/twb/analysis/Sheets/dashboardsummarizer.rb, line 82
def recordCSV record
  numberedRec = [@recNum+=1] + record
  if @recordDir
    @dashboardsCSV  << numberedRec.push(@twbDir)
  else
    @dashboardsCSV  << numberedRec
  end
end