class TorrentSearch::Controllers::Search

Constants

ACTIONS

Public Class Methods

new(view = Views::Search.new) click to toggle source
# File lib/torrent_search/controllers/search.rb, line 10
def initialize(view = Views::Search.new)
  @view = view
end

Public Instance Methods

Private Instance Methods

available_actions() click to toggle source
# File lib/torrent_search/controllers/search.rb, line 51
def available_actions
  ACTIONS.dup.tap {|hash| hash.delete(:d) unless @search_result.any? }
end
choose_action!() click to toggle source
# File lib/torrent_search/controllers/search.rb, line 41
def choose_action!
  chosen = @view.action?
  send available_actions.fetch(chosen, :invalid_command)
end
display_menu() click to toggle source
# File lib/torrent_search/controllers/search.rb, line 29
def display_menu
  Views::Menu.new(available_actions, @search_result).display
end
download() click to toggle source
# File lib/torrent_search/controllers/search.rb, line 33
def download
  Download.new(@search_result).download
end
invalid_command() click to toggle source
# File lib/torrent_search/controllers/search.rb, line 46
def invalid_command
  @view.invalid_command!
  choose_action!
end
quit() click to toggle source
# File lib/torrent_search/controllers/search.rb, line 37
def quit
  CLI::quit
end