class Twb::Dashboard

Attributes

autosize[R]
dimensions[R]
maxheight[R]
maxwidth[R]
minheight[R]
minwidth[R]
name[R]
node[R]
rangesize[R]
size[R]
worksheets[R]
zonecount[R]

Public Class Methods

new(dashboardNode, twbworksheets) click to toggle source
# File lib/twb/dashboard.rb, line 31
def initialize dashboardNode, twbworksheets
  @node     = dashboardNode
  @name     = @node.attr('name')
  @size     = @node.xpath('./size')
  @autosize = @size.empty?
  loadSize @size unless @autosize
  loadSheets twbworksheets
  @zonecount = @node.xpath('.//zone').length
  return self
end

Public Instance Methods

id() click to toggle source
# File lib/twb/dashboard.rb, line 42
def id
    @id ||= @id = @name.hash
end
loadSheets(twbworksheets) click to toggle source
# File lib/twb/dashboard.rb, line 46
def loadSheets twbworksheets
  @sheets = {}
  dsheets = @node.xpath('.//zone[@name]').to_a
  dsheets.each do |sheetNode|
    sheetname = sheetNode.attr('name')
    # early Tableau versions (e.g. 7), used "name=''" with text and other Dashboard components
    unless sheetname.eql?('') or sheetname.nil?
      @sheets[sheetname] = twbworksheets[sheetname]
    end
  end
end
loadSize(size) click to toggle source
# File lib/twb/dashboard.rb, line 66
def loadSize size
  @maxheight  = size.attr('maxheight')
  @maxwidth   = size.attr('maxwidth')
  @minheight  = size.attr('minheight')
  @minwidth   = size.attr('minwidth')
  @rangesize  = size.attr('rangesize')
  @dimensions = "%s:%s:%s:%s" % [@minwidth.to_s, @minheight.to_s, @maxwidth.to_s, @maxheight.to_s]
end
worksheetNames() click to toggle source
# File lib/twb/dashboard.rb, line 62
def worksheetNames
  @sheets.keys
end