class DataSource

Tableau Workbook <datasource XML node

Attributes

caption[R]
class[R]
connHash[R]
connection[R]
name[R]
node[R]
uiname[R]

Public Class Methods

new(dataSourceNode) click to toggle source
# File lib/tableauworkbook.rb, line 38
def initialize dataSourceNode
  @node    = dataSourceNode
  @name    = @node.xpath('./@name').text
  @caption = @node.xpath('./@caption').text
  @uiname  = if @caption.nil? || @caption == '' then @name else @caption end
  # puts "DS:        n:#{@name}"
  # puts "     caption:#{@caption}"
  # puts "      c.len :#{@caption.length}"
  # puts "      c.nil?:#{@caption.nil?}"
  # puts "      uiname:#{@uiname}"
  # puts " "
  processConnection
end

Public Instance Methods

processConnection() click to toggle source
# File lib/tableauworkbook.rb, line 52
def processConnection
  @connHash    = ''
  @connection  = @node.at_xpath('./connection')
  if !@connection.nil? then
    @class       = @connection.attribute('class').text
    dsAttributes = @node.xpath('./connection/@*')
    dsConnStr  = ''
    dsAttributes.each do |attr|
      dsConnStr += attr.text
      # Note: only collects non-'' attribute values
    end
    @connHash = Digest::MD5.hexdigest(dsConnStr)
  end
end