Module: Torrentz

Extended by:
Logger
Defined in:
lib/torrentz.rb,
lib/torrentz/fetch.rb,
lib/torrentz/logger.rb,
lib/torrentz/search.rb,
lib/torrentz/version.rb

Defined Under Namespace

Modules: Logger Classes: Fetch, Search

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Methods included from Logger

logger, logger=

Class Method Details

.get(query) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/torrentz.rb', line 14

def get(query)
  search_results = Search.new(query).get
  logger.info "Found #{search_results.size} candidates"

  return nil if search_results.empty?

  results = {}

  search_results.each do |search_result|
    results.merge!(Fetch.new(search_result.url).get)
    break if results[:torrent] && results[:magnet]
  end

  results
end