Class: Fastgem::Table
- Inherits:
-
Object
- Object
- Fastgem::Table
- Defined in:
- lib/fastgem/table.rb
Instance Method Summary collapse
- #after ⇒ Object
- #format(result) ⇒ Object
-
#initialize ⇒ Table
constructor
A new instance of Table.
Constructor Details
#initialize ⇒ Table
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
#after ⇒ Object
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 |