class GemFd::CLI
Public Instance Methods
search(gem_name)
click to toggle source
# File lib/gemfd/cli.rb, line 9 def search gem_name gem_list = GemFd::Service.search(gem_name) draw_table(gem_list) end
Private Instance Methods
draw_table(response)
click to toggle source
# File lib/gemfd/cli.rb, line 16 def draw_table response fields = GemFd::Config.header_fields table = Tabulo::Table.new(response) do |t| fields.each_with_index do |field, index| capitalized_field = field.split("_").collect!{|w| w.capitalize}.join(" ") t.add_column(capitalized_field) {|line| line[field]} end end puts table.pack(max_table_width: :auto) end