Class: TorrentSearch::Controllers::Search

Inherits:
Object
  • Object
show all
Defined in:
lib/torrent_search/controllers/search.rb

Constant Summary collapse

ACTIONS =
{
  d: :download,
  s: :search,
  q: :quit
}

Instance Method Summary collapse

Constructor Details

#initialize(view = Views::Search.new) ⇒ Search

Returns a new instance of Search.



10
11
12
# File 'lib/torrent_search/controllers/search.rb', line 10

def initialize(view = Views::Search.new)
  @view = view
end

Instance Method Details

#search(search_terms = nil, options = {}) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/torrent_search/controllers/search.rb', line 14

def search(search_terms = nil, options = {})
  search_terms ||= @view.search_terms?
  perform_search search_terms, options
  display_menu
  choose_action!
  rescue SocketError
    error 'No network connection?'
end