Module: Deep::Hash::Struct::PP::Dashboard::Table::Tr

Included in:
Dashboard::Table::Tr
Defined in:
lib/deep/hash/struct/pp/dashboard/table/tr.rb

Instance Method Summary collapse

Instance Method Details

#inspectObject



8
9
10
11
12
13
14
15
16
# File 'lib/deep/hash/struct/pp/dashboard/table/tr.rb', line 8

def inspect
  attributes  = []
  attributes << "header=#{header}" if header.present?
  attributes << "side=#{side}"     if side.present?
  attributes << "body=#{body}"     if body.size > 0
  attributes << "options=#{options}"
  attributes  = "#{attributes.size.zero? ? '' : ' '}#{attributes.join(' ')}"
  "#<#{self.class.name.split("::").last}#{attributes}>"
end

#pretty_print(q) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/deep/hash/struct/pp/dashboard/table/tr.rb', line 18

def pretty_print(q)
  q.group(2, "#(#{self.class.name}:#{sprintf("0x%x", object_id)} {", "})") do
    q.breakable

    if header.present?
      q.text ":header => "
      q.pp header
      q.breakable
    end

    if side.present?
      q.text ":side => "
      q.pp side
      q.breakable
    end

    if body.size > 0
      q.text ":body => "
      q.pp body
      q.breakable
    end

    q.group(2, ":options => {", "}") do
      q.breakable
      q.seplist(options) do |k, v|
        q.text ":#{k} => "
        q.pp v
      end
      q.breakable
    end

    q.breakable
  end
end