Class: DataSource
- Inherits:
-
Object
- Object
- DataSource
- Defined in:
- lib/tableauworkbook.rb
Overview
Tableau Workbook <datasource XML node
Constant Summary collapse
- @@hasher =
Digest::SHA256.new
Instance Attribute Summary collapse
-
#caption ⇒ Object
readonly
Returns the value of attribute caption.
-
#class ⇒ Object
readonly
Returns the value of attribute class.
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#connHash ⇒ Object
readonly
Returns the value of attribute connHash.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#uiname ⇒ Object
readonly
Returns the value of attribute uiname.
Instance Method Summary collapse
-
#initialize(dataSourceNode) ⇒ DataSource
constructor
A new instance of DataSource.
- #processConnection ⇒ Object
Constructor Details
#initialize(dataSourceNode) ⇒ DataSource
Returns a new instance of DataSource.
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# 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 |
Instance Attribute Details
#caption ⇒ Object (readonly)
Returns the value of attribute caption.
36 37 38 |
# File 'lib/tableauworkbook.rb', line 36 def caption @caption end |
#class ⇒ Object (readonly)
Returns the value of attribute class.
36 37 38 |
# File 'lib/tableauworkbook.rb', line 36 def class @class end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
36 37 38 |
# File 'lib/tableauworkbook.rb', line 36 def connection @connection end |
#connHash ⇒ Object (readonly)
Returns the value of attribute connHash.
36 37 38 |
# File 'lib/tableauworkbook.rb', line 36 def connHash @connHash end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
36 37 38 |
# File 'lib/tableauworkbook.rb', line 36 def name @name end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
36 37 38 |
# File 'lib/tableauworkbook.rb', line 36 def node @node end |
#uiname ⇒ Object (readonly)
Returns the value of attribute uiname.
36 37 38 |
# File 'lib/tableauworkbook.rb', line 36 def uiname @uiname end |
Instance Method Details
#processConnection ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# 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 |