Class: Searcher

Inherits:
Object
  • Object
show all
Defined in:
lib/teuton-get/searcher.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Searcher

Returns a new instance of Searcher.



12
13
14
15
16
17
18
19
20
# File 'lib/teuton-get/searcher.rb', line 12

def initialize(args)
  repodata = args[:repodata]
  filename = repodata.database_filename
  reader = args[:reader]
  database = reader.read(filename)

  dev = args[:writer]
  @search = Search.new(database, dev)
end

Instance Attribute Details

#resultsObject (readonly)

Returns the value of attribute results.



10
11
12
# File 'lib/teuton-get/searcher.rb', line 10

def results
  @results
end

Class Method Details

.defaultObject



22
23
24
25
26
27
28
# File 'lib/teuton-get/searcher.rb', line 22

def self.default
  Searcher.new(
    writer: TerminalWriter.new,
    repodata: RepoData.default,
    reader: YamlReader.new
  )
end

Instance Method Details

#get(input) ⇒ Object



30
31
32
33
34
# File 'lib/teuton-get/searcher.rb', line 30

def get(input)
  reponame_filter, filters = parse_input(input)
  @search.call(reponame_filter, filters)
  @search
end