Class: GemSearch::Commands::Run

Inherits:
Base
  • Object
show all
Includes:
Rendering, Mem
Defined in:
lib/gem_search/commands/run.rb

Constant Summary collapse

ENABLE_SORT_OPTS =
{
  "a" => "downloads",
  "n" => "name",
  "v" => "version_downloads"
}

Constants included from Rendering

Rendering::DEFAULT_RULED_LINE_SIZE

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods included from Rendering

#render

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from GemSearch::Commands::Base

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
# File 'lib/gem_search/commands/run.rb', line 14

def call
  puts_abort(options) unless valid?(options.arguments)
  gems = search_gems
  puts_abort("We did not find results.") if gems.size.zero?
  gems_sort!(gems)
  render(gems, !options["no-homepage"])
rescue => e
  unexpected_error(e)
end