Class: Fastgem::Table

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

Instance Method Summary collapse

Constructor Details

#initializeTable

Returns a new instance of Table.



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

def initialize
  @table = Terminal::Table.new headings: %w(Name Downloads GEMFILE LinkGithub)
  @table.align_column(0,:right)
end

Instance Method Details

#afterObject



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

def after
  puts @table.to_s
end

#format(result) ⇒ Object



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

def format(result)
  row = []
  row << Rainbow("#{result['name']}").color(:green)
  row << result['downloads']
  row << "gem '#{result['name']}', '#{result['version']}'"
  row << Rainbow(result['homepage_uri']).color(:blue)
  @table << row
end