Class: Deep::Hash::Struct::Dashboard

Inherits:
Object
  • Object
show all
Includes:
PP::Dashboard
Defined in:
lib/deep/hash/struct/dashboard.rb,
lib/deep/hash/struct/dashboard/table.rb,
lib/deep/hash/struct/dashboard/table/row.rb

Defined Under Namespace

Classes: Table

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PP::Dashboard

#inspect, #pretty_print

Constructor Details

#initializeDashboard

Returns a new instance of Dashboard.



11
12
13
# File 'lib/deep/hash/struct/dashboard.rb', line 11

def initialize
  self.tables = []
end

Instance Attribute Details

#tablesObject

Returns the value of attribute tables.



9
10
11
# File 'lib/deep/hash/struct/dashboard.rb', line 9

def tables
  @tables
end

Instance Method Details

#add_table(options = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/deep/hash/struct/dashboard.rb', line 15

def add_table(options = {})
  tables << if block_given?
              yield table = Table.new(options)
              table.parse!
              table
            else
              Table.new
            end
end

#eachObject



25
26
27
28
29
30
31
32
33
# File 'lib/deep/hash/struct/dashboard.rb', line 25

def each
  if block_given?
    tables.each do |table|
      yield table
    end
  else
    tables.each
  end
end

#mapObject Also known as: collect



35
36
37
38
39
40
41
42
43
# File 'lib/deep/hash/struct/dashboard.rb', line 35

def map
  if block_given?
    tables.map do |table|
      yield table
    end
  else
    tables.map
  end
end