Class: Twb::Dashboard

Inherits:
Object
  • Object
show all
Defined in:
lib/twb/dashboard.rb

Constant Summary collapse

@@hasher =
Digest::SHA256.new

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dashboardNode) ⇒ Dashboard

Returns a new instance of Dashboard.



27
28
29
30
31
32
33
34
35
36
# File 'lib/twb/dashboard.rb', line 27

def initialize dashboardNode
  "initialize Dashboard"
  @node     = dashboardNode
  @name     = @node.attr('name')
  @size     = @node.xpath('./size')
  @autosize = @size.empty?
  loadSize @size unless @autosize
  loadSheets
  return self
end

Instance Attribute Details

#autosizeObject (readonly)

Returns the value of attribute autosize.



25
26
27
# File 'lib/twb/dashboard.rb', line 25

def autosize
  @autosize
end

#dimensionsObject (readonly)

Returns the value of attribute dimensions.



25
26
27
# File 'lib/twb/dashboard.rb', line 25

def dimensions
  @dimensions
end

#maxheightObject (readonly)

Returns the value of attribute maxheight.



25
26
27
# File 'lib/twb/dashboard.rb', line 25

def maxheight
  @maxheight
end

#maxwidthObject (readonly)

Returns the value of attribute maxwidth.



25
26
27
# File 'lib/twb/dashboard.rb', line 25

def maxwidth
  @maxwidth
end

#minheightObject (readonly)

Returns the value of attribute minheight.



25
26
27
# File 'lib/twb/dashboard.rb', line 25

def minheight
  @minheight
end

#minwidthObject (readonly)

Returns the value of attribute minwidth.



25
26
27
# File 'lib/twb/dashboard.rb', line 25

def minwidth
  @minwidth
end

#nameObject (readonly)

Returns the value of attribute name.



25
26
27
# File 'lib/twb/dashboard.rb', line 25

def name
  @name
end

#nodeObject (readonly)

Returns the value of attribute node.



25
26
27
# File 'lib/twb/dashboard.rb', line 25

def node
  @node
end

#rangesizeObject (readonly)

Returns the value of attribute rangesize.



25
26
27
# File 'lib/twb/dashboard.rb', line 25

def rangesize
  @rangesize
end

#sizeObject (readonly)

Returns the value of attribute size.



25
26
27
# File 'lib/twb/dashboard.rb', line 25

def size
  @size
end

#worksheetsObject (readonly)

Returns the value of attribute worksheets.



25
26
27
# File 'lib/twb/dashboard.rb', line 25

def worksheets
  @worksheets
end

Instance Method Details

#loadSheetsObject



38
39
40
41
42
43
44
45
# File 'lib/twb/dashboard.rb', line 38

def loadSheets
  @sheets = {}
  dsheets = @node.xpath('.//zone[@name]').to_a
  dsheets.each do |sheetNode|
    sheet = Twb::Worksheet.new sheetNode
    @sheets[sheet.name] = sheet
  end
end

#loadSize(size) ⇒ Object



51
52
53
54
55
56
57
58
# File 'lib/twb/dashboard.rb', line 51

def loadSize size
  @maxheight  = size.attr('maxheight')
  @maxwidth   = size.attr('maxwidth')
  @minheight  = size.attr('minheight')
  @minwidth   = size.attr('minwidth')
  @rangesize  = size.attr('rangesize')
  @dimensions = @minwidth.to_s + ':' + @minheight.to_s + ':' +@maxwidth.to_s + ':' +@maxheight.to_s
end