Class: Twb::Analysis::SheetFieldsAnalyzer

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

Constant Summary collapse

@@fieldTypeCodes =
{ 'DB ref'  => 'Db',
  'color'   => 'Clr',
  'filter'  => 'Flt',
  'lod'     => 'LoD',
  'page'    => 'Pge',
  'path'    => 'Pth',
  'shape'   => 'Shp',
  'size'    => 'Siz',
  'text'    => 'Tex',
  'tooltip' => 'TTp',
  :column   => 'Clm',
  :row      => 'Row',
  'slice'   => 'Slc',
}

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) ⇒ SheetFieldsAnalyzer

Returns a new instance of SheetFieldsAnalyzer.


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/twb/analysis/sheets/sheetfieldsanalyzer.rb', line 44

def initialize(**args)
  @args      = args
  @recordDir = !@args.nil? && @args[:recordDir] == true
  @ttdocdir  = @args[:ttdocdir]
  @csvAdd    = args[:csvMode] == :add
  @csvMode   = @csvAdd ? 'a' : 'w'
  # @localEmit = true
  init
  @funcdoc   = {:class=>self.class, :blurb=>'Analyze Worksheet Fields', :description=>nil,}
  #--
  docFileName      = docFile('WorksheetFields.csv')
  @sheetFieldsCSV  = CSV.open(docFileName,@csvMode)
  unless @csvAdd
    if @recordDir
      @sheetFieldsCSV  << ['Rec #','Workbook','Workbook Modified','Worksheet','Data Source','Data Source (tech)','Field','Field (tech)','Usage','Usage - code','Workbook Dir']
    else
      @sheetFieldsCSV  << ['Rec #','Workbook','Workbook Modified','Worksheet','Data Source','Data Source (tech)','Field','Field (tech)','Usage','Usage - code'               ]
    end
  end
  addDocFile @sheetFieldsCSV, docFileName, "Workbooks, Worksheets, and the Sheets' Data Sources and Fields"
  #--
  @twbCnt     = 0
  @sheetCnt   = 0
  @fieldsCnt  = 0
  @recNum     = 0
end

Instance Attribute Details

#localEmitObject

Returns the value of attribute localEmit


42
43
44
# File 'lib/twb/analysis/sheets/sheetfieldsanalyzer.rb', line 42

def localEmit
  @localEmit
end

Instance Method Details

#metricsObject


71
72
73
74
75
76
77
# File 'lib/twb/analysis/sheets/sheetfieldsanalyzer.rb', line 71

def metrics
  {
    # '# of Workbooks'         => @twbcount,
    '# of Worksheets'        => @sheetCnt,
    '# of Worksheet Fields'  => @fieldsCnt
  }
end

#processTWB(twb) ⇒ Object


79
80
81
82
83
84
85
86
87
# File 'lib/twb/analysis/sheets/sheetfieldsanalyzer.rb', line 79

def processTWB twb
   @twb = twb
   @modTime = @twb.modtime
   emit "   -- twb:: #{@twb.name}"
   @twbCnt += 1
   @twbDomainsLoaded = false
   parseSheets
   finis
end