class TorrentSearch::Views::Menu

Public Class Methods

new(actions, search_result) click to toggle source
# File lib/torrent_search/views/menu.rb, line 5
def initialize(actions, search_result)
  @actions = actions
  @search_result = search_result
end

Public Instance Methods

display() click to toggle source
# File lib/torrent_search/views/menu.rb, line 10
def display
  say_status "\n[Results]", '', :green
  if results?
    print_search_result_table
  else
    say 'Nothing found'
  end
  say_status "\n[Actions]", action_menu, :blue
end

Private Instance Methods

action_menu() click to toggle source
# File lib/torrent_search/views/menu.rb, line 29
def action_menu
  @actions.map {|hash| hash.join(": ")}.join("\t")
end
print_search_result_table() click to toggle source
results?() click to toggle source
# File lib/torrent_search/views/menu.rb, line 21
def results?
  @search_result.any?
end