Class: HammerCLI::Output::Generators::Table

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

Defined Under Namespace

Classes: Column

Constant Summary collapse

MAX_COLUMN_WIDTH =
80
MIN_COLUMN_WIDTH =
5
HLINE =
'-'
LINE_SEPARATOR =
'-|-'
COLUMN_SEPARATOR =
' | '

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(columns, data, options = {}) ⇒ Table

Returns a new instance of Table.



25
26
27
28
29
30
# File 'lib/hammer_cli/output/generators/table.rb', line 25

def initialize(columns, data, options = {})
  @columns = columns.map { |label, params| Column.new(label, params) }
  @data = data
  @options = options
  create_table
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



23
24
25
# File 'lib/hammer_cli/output/generators/table.rb', line 23

def body
  @body
end

Returns the value of attribute footer.



23
24
25
# File 'lib/hammer_cli/output/generators/table.rb', line 23

def footer
  @footer
end

#headerObject (readonly)

Returns the value of attribute header.



23
24
25
# File 'lib/hammer_cli/output/generators/table.rb', line 23

def header
  @header
end

#resultObject (readonly)

Returns the value of attribute result.



23
24
25
# File 'lib/hammer_cli/output/generators/table.rb', line 23

def result
  @result
end