Class: Twb::Action

Inherits:
TabClass show all
Defined in:
lib/twb/action.rb

Constant Summary collapse

@@hasher =

Notes Sources: <source>

type="datasource"
  <source datasource="Sample - Superstore - English (Extract)" type="datasource">
    <exclude-sheets  - use to exclude these from the Workbook's sheets
                     - haven't seen an example of named sheet for datasoure
                     - can only target a single worksheet, by observation
type="sheet"
  Worksheet
  <source type="sheet" worksheet="Sheet 3"/>
                     - use the worksheet attribute
                     - can only target a single worksheet, by observation
  Dashboard
  <source dashboard="Dashboard 1" type="sheet" worksheet="Sheet 5"/>
                     - dashboard attribute is present
                     - use the worksheet attribute, if available
  <source dashboard="Dashboard 2" type="sheet"/>
    NO <exclude-sheets - source is all of the dashboard's sheets
Digest::SHA256.new

Instance Attribute Summary collapse

Attributes inherited from TabClass

#properties, #ttlogfile, #ttlogfilename, #uuid

Instance Method Summary collapse

Methods inherited from TabClass

#docFile, #emit, #setDocFileName

Constructor Details

#initialize(actionNode, workbookNode) ⇒ Action

Returns a new instance of Action.


52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/twb/action.rb', line 52

def initialize actionNode, workbookNode
  @workbook  = workbookNode
  @node      = actionNode
  # --
  @name      = @node.attr('name')
  @caption   = @node.attr('caption')
  @uiname    = @caption.nil? ? @name : @caption
  # --
  @type      = setType
  # --
  @cmdTarget     = cmdParam 'target'
  @cmdExclude    = cmdParam 'exclude'
  @cmdSpecFields = cmdParam 'special-fields'
  # --
  @linkExpression = linkExpr
  process
  return self
end

Instance Attribute Details

#captionObject (readonly)

Returns the value of attribute caption


46
47
48
# File 'lib/twb/action.rb', line 46

def caption
  @caption
end

#cmdExcludeObject (readonly)

Returns the value of attribute cmdExclude


49
50
51
# File 'lib/twb/action.rb', line 49

def cmdExclude
  @cmdExclude
end

#cmdSpecFieldsObject (readonly)

Returns the value of attribute cmdSpecFields


49
50
51
# File 'lib/twb/action.rb', line 49

def cmdSpecFields
  @cmdSpecFields
end

#cmdTargetObject (readonly)

Returns the value of attribute cmdTarget


49
50
51
# File 'lib/twb/action.rb', line 49

def cmdTarget
  @cmdTarget
end

#linkExpressionObject (readonly)

Returns the value of attribute linkExpression


50
51
52
# File 'lib/twb/action.rb', line 50

def linkExpression
  @linkExpression
end

#nameObject (readonly)

Returns the value of attribute name


46
47
48
# File 'lib/twb/action.rb', line 46

def name
  @name
end

#nodeObject (readonly)

Returns the value of attribute node


45
46
47
# File 'lib/twb/action.rb', line 45

def node
  @node
end

#sourceDashObject (readonly)

Returns the value of attribute sourceDash


48
49
50
# File 'lib/twb/action.rb', line 48

def sourceDash
  @sourceDash
end

#sourceSheetObject (readonly)

Returns the value of attribute sourceSheet


48
49
50
# File 'lib/twb/action.rb', line 48

def sourceSheet
  @sourceSheet
end

#sourceTypeObject (readonly)

Returns the value of attribute sourceType


48
49
50
# File 'lib/twb/action.rb', line 48

def sourceType
  @sourceType
end

#typeObject (readonly)

Returns the value of attribute type


47
48
49
# File 'lib/twb/action.rb', line 47

def type
  @type
end

#uinameObject (readonly)

Returns the value of attribute uiname


46
47
48
# File 'lib/twb/action.rb', line 46

def uiname
  @uiname
end

#workbookObject (readonly)

Returns the value of attribute workbook


45
46
47
# File 'lib/twb/action.rb', line 45

def workbook
  @workbook
end

Instance Method Details

#cmdParam(param) ⇒ Object


99
100
101
102
103
104
# File 'lib/twb/action.rb', line 99

def cmdParam param
  n = @node.at_xpath("./command/param[@name='#{param}']")
  return nil if n.nil?
  v = n.attribute('value')
  v.nil? ? nil : v.text
end

#idObject


71
72
73
# File 'lib/twb/action.rb', line 71

def id
    @id ||= @id = @name.hash
end

#linkExprObject


94
95
96
97
# File 'lib/twb/action.rb', line 94

def linkExpr
  attr = @node.at_xpath('./link/@expression')
  attr.nil? ? nil : attr.text
end

#processObject


75
76
77
# File 'lib/twb/action.rb', line 75

def process

end

#setTypeObject


79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/twb/action.rb', line 79

def setType
  linkNode = @node.at_xpath('./link')
  return :link unless linkNode.nil?
  command  = @node.at_xpath('./command/@command')
  return :notset if command.nil?
  type = case command.text
    when 'tsc:brush'
      :highlight
    when 'tsc:tsl-filter'
      :filter
    else
      command.text
  end
end

#typeConv(rawType) ⇒ Object


120
121
# File 'lib/twb/action.rb', line 120

def typeConv rawType
end