class Lono::Pro::Repo

Public Instance Methods

run() click to toggle source
# File lib/lono/pro/repo.rb, line 3
def run
  data = api.repos(@options[:type])
  # data = data[7..9]
  header = ["Name", "Docs", "Description"]
  rows = data.map do |d|
    desc = truncate(d[:description])
    [d[:name], d[:docs_url], desc]
  end
  show_table(header, rows)
end

Private Instance Methods

show_table(header, data) click to toggle source
# File lib/lono/pro/repo.rb, line 19
def show_table(header, data)
  table = Text::Table.new
  table.head = header
  data.each do |item|
    table.rows << item
  end
  puts table
end
truncate(string, max=36) click to toggle source
# File lib/lono/pro/repo.rb, line 15
def truncate(string, max=36)
  string.length > max ? "#{string[0...max]}..." : string
end