Class: JsonToTable::Table

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, parent_table = nil) ⇒ Table

Returns a new instance of Table.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/table.rb', line 7

def initialize(object, parent_table = nil)
  if object.is_a? Hash
    @hashes = [object]
  else
    @hashes = object
  end

  @child_hashes = []
  @headings = headings
  @rows = rows
end

Instance Attribute Details

#child_hashesObject (readonly)

Returns the value of attribute child_hashes.



5
6
7
# File 'lib/table.rb', line 5

def child_hashes
  @child_hashes
end

Instance Method Details

#terminal_tableObject



19
20
21
# File 'lib/table.rb', line 19

def terminal_table
  Terminal::Table.new headings: @headings, rows: @rows
end