Class: Twb::Analysis::ParametersAnalyzer

Inherits:
Object
  • Object
show all
Includes:
TabTool
Defined in:
lib/twb/analysis/datasources/parametersanalyzer.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

#initializeParametersAnalyzer

Returns a new instance of ParametersAnalyzer.



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/twb/analysis/datasources/parametersanalyzer.rb', line 30

def initialize
  init
  #-- set up metrics
  @paramscount = 0
  #--
  @funcdoc    = {:class=>self.class, :blurb=>'Analyzing Parameters from Tableau Workbooks.', :description=>nil,}
  docFileName = docFile('Parameters.csv')
  @csv        = CSV.open(docFileName, 'w')
  @csv       << ["Workbook",'Parameter','Caption','Name (tech)','Type','Format','Type (custom)','Type (domain)','Role', 'Value (current)', 'Value','Value (tech)']
              # [ @twbname,  name,       caption,  nameTech,     type,  format,  typeCustom,     domainType,     role]
  @docfiles = [{:name=>docFileName,:description=>"CSV File containing the data relevant for Parameters."}]
end

Instance Attribute Details

#localEmitObject

Returns the value of attribute localEmit.



27
28
29
# File 'lib/twb/analysis/datasources/parametersanalyzer.rb', line 27

def localEmit
  @localEmit
end

#twbcountObject (readonly)

Returns the value of attribute twbcount.



28
29
30
# File 'lib/twb/analysis/datasources/parametersanalyzer.rb', line 28

def twbcount
  @twbcount
end

#twbnameObject (readonly)

Returns the value of attribute twbname.



28
29
30
# File 'lib/twb/analysis/datasources/parametersanalyzer.rb', line 28

def twbname
  @twbname
end

Instance Method Details

#metricsObject



85
86
87
88
89
# File 'lib/twb/analysis/datasources/parametersanalyzer.rb', line 85

def metrics
  {
    '# of Parameters' => @paramscount,
  }
end

#processTWB(twb) ⇒ Object

param-domain-type : 11 role : 11 type : 11 value : 11 default-format : 7 alias : 1



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/twb/analysis/datasources/parametersanalyzer.rb', line 56

def processTWB twb
  if Twb::Workbook != twb.class
    @twb = Twb::Workbook.new twb
  else
    @twb = twb
  end
  @twbname = @twb.name
  emit  "Workbook:: #{@twbname}"
  paramsDS = @twb.datasource 'Parameters'
  @twb.parameters.each do |pName,param|
    @paramscount += 1
    param.values.each do |values|
      @csv       << [ @twbname,
                      param.uiname,
                      param.caption,
                      param.name,
                      param.type,
                      param.format,
                      param.dataTypeCustom,
                      param.domainType,
                      param.role,
                      param.currentValue, # 'Value (current)', 
                      values[:value],     # 'Value',
                      values[:valueTech]      # 'Value (tech)'
                    ]
    end
  end
end