Class: Twb::Dashboard
- Inherits:
-
Object
- Object
- Twb::Dashboard
- Defined in:
- lib/twb/dashboard.rb
Constant Summary collapse
- @@hasher =
Digest::SHA256.new
Instance Attribute Summary collapse
-
#autosize ⇒ Object
readonly
Returns the value of attribute autosize.
-
#dimensions ⇒ Object
readonly
Returns the value of attribute dimensions.
-
#maxheight ⇒ Object
readonly
Returns the value of attribute maxheight.
-
#maxwidth ⇒ Object
readonly
Returns the value of attribute maxwidth.
-
#minheight ⇒ Object
readonly
Returns the value of attribute minheight.
-
#minwidth ⇒ Object
readonly
Returns the value of attribute minwidth.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#rangesize ⇒ Object
readonly
Returns the value of attribute rangesize.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#worksheets ⇒ Object
readonly
Returns the value of attribute worksheets.
-
#zonecount ⇒ Object
readonly
Returns the value of attribute zonecount.
Instance Method Summary collapse
-
#initialize(dashboardNode, twbworksheets) ⇒ Dashboard
constructor
A new instance of Dashboard.
- #loadSheets(twbworksheets) ⇒ Object
- #loadSize(size) ⇒ Object
- #worksheetNames ⇒ Object
Constructor Details
#initialize(dashboardNode, twbworksheets) ⇒ Dashboard
Returns a new instance of Dashboard.
31 32 33 34 35 36 37 38 39 40 |
# 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 |
Instance Attribute Details
#autosize ⇒ Object (readonly)
Returns the value of attribute autosize.
28 29 30 |
# File 'lib/twb/dashboard.rb', line 28 def autosize @autosize end |
#dimensions ⇒ Object (readonly)
Returns the value of attribute dimensions.
28 29 30 |
# File 'lib/twb/dashboard.rb', line 28 def dimensions @dimensions end |
#maxheight ⇒ Object (readonly)
Returns the value of attribute maxheight.
28 29 30 |
# File 'lib/twb/dashboard.rb', line 28 def maxheight @maxheight end |
#maxwidth ⇒ Object (readonly)
Returns the value of attribute maxwidth.
28 29 30 |
# File 'lib/twb/dashboard.rb', line 28 def maxwidth @maxwidth end |
#minheight ⇒ Object (readonly)
Returns the value of attribute minheight.
28 29 30 |
# File 'lib/twb/dashboard.rb', line 28 def minheight @minheight end |
#minwidth ⇒ Object (readonly)
Returns the value of attribute minwidth.
28 29 30 |
# File 'lib/twb/dashboard.rb', line 28 def minwidth @minwidth end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
26 27 28 |
# File 'lib/twb/dashboard.rb', line 26 def name @name end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
25 26 27 |
# File 'lib/twb/dashboard.rb', line 25 def node @node end |
#rangesize ⇒ Object (readonly)
Returns the value of attribute rangesize.
28 29 30 |
# File 'lib/twb/dashboard.rb', line 28 def rangesize @rangesize end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
28 29 30 |
# File 'lib/twb/dashboard.rb', line 28 def size @size end |
#worksheets ⇒ Object (readonly)
Returns the value of attribute worksheets.
27 28 29 |
# File 'lib/twb/dashboard.rb', line 27 def worksheets @worksheets end |
#zonecount ⇒ Object (readonly)
Returns the value of attribute zonecount.
29 30 31 |
# File 'lib/twb/dashboard.rb', line 29 def zonecount @zonecount end |
Instance Method Details
#loadSheets(twbworksheets) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/twb/dashboard.rb', line 42 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) ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/twb/dashboard.rb', line 62 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 ⇒ Object
58 59 60 |
# File 'lib/twb/dashboard.rb', line 58 def worksheetNames @sheets.keys end |