Module: Ribose::CLI::Util

Defined in:
lib/ribose/cli/util.rb

Class Method Summary collapse

Class Method Details

.list(headings:, rows:) ⇒ Object



6
7
8
9
10
11
# File 'lib/ribose/cli/util.rb', line 6

def self.list(headings:, rows:)
  Terminal::Table.new do |table|
    table.headings = headings
    table.rows = rows
  end
end

.truncate(content, length = 50) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/ribose/cli/util.rb', line 13

def self.truncate(content, length = 50)
  if content && content.length > length
    content = content[0..length] + "..."
  end

  content
end