Class: Helium::Console::KeyValue

Inherits:
Object
  • Object
show all
Defined in:
lib/helium/console/key_value.rb

Defined Under Namespace

Classes: TableFormatter

Instance Method Summary collapse

Instance Method Details

#as_table(console:, max_width:, level:, left: '|', between: ' ', right: '', format_keys: {}, format_values: {}) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/helium/console/key_value.rb', line 14

def as_table(console:, max_width:, level:, left: '|', between: ' ', right: '', format_keys: {}, format_values: {})
  TableFormatter.(
    self,
    console: console,
    left: left,
    between: between,
    right: right,
    key_options: format_keys,
    value_options: format_values,
    max_width: max_width,
    level: level
  )
end

#row(key, value, format_key: {}, format_value: {}) ⇒ Object



6
7
8
# File 'lib/helium/console/key_value.rb', line 6

def row(key, value, format_key: {}, format_value: {})
  rows << [key, value, { format_key: format_key, format_value: format_value }]
end

#rowsObject



10
11
12
# File 'lib/helium/console/key_value.rb', line 10

def rows
  @rows ||= []
end