Class: TorrentSearch::Views::Download

Inherits:
Base
  • Object
show all
Defined in:
lib/torrent_search/views/download.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #invalid_command!, #invalid_option!

Constructor Details

This class inherits a constructor from TorrentSearch::Views::Base

Instance Method Details

#directory?(default) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/torrent_search/views/download.rb', line 9

def directory?(default)
  ask "Directory to save file (default '#{default}'):"
end

#downloading!(torrent) ⇒ Object



13
14
15
# File 'lib/torrent_search/views/download.rb', line 13

def downloading!(torrent)
  say "Downloading #{torrent.name}...", :blue
end

#failure(error, href) ⇒ Object



21
22
23
# File 'lib/torrent_search/views/download.rb', line 21

def failure(error, href)
  say "Error: #{error.message} - #{href}", :red
end

#open?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/torrent_search/views/download.rb', line 25

def open?
  yes? 'Open? (y/n):'
end

#successObject



17
18
19
# File 'lib/torrent_search/views/download.rb', line 17

def success
  say 'Complete', :green
end

#torrent?(max) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/torrent_search/views/download.rb', line 5

def torrent?(max)
  ask("Torrent (0-#{max}):")
end