Class: Searcher
- Inherits:
-
Object
- Object
- Searcher
- Defined in:
- lib/teuton-get/searcher.rb
Class Method Summary collapse
Instance Method Summary collapse
- #get(input) ⇒ Object
-
#initialize(args) ⇒ Searcher
constructor
A new instance of Searcher.
- #show_result ⇒ Object
Constructor Details
#initialize(args) ⇒ Searcher
Returns a new instance of Searcher.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/teuton-get/searcher.rb', line 9 def initialize(args) @dev = args[:writer] @repodata = args[:repodata] filename = @repodata.database_filename @reader = args[:reader] @database = @reader.read(filename) @results = {} end |
Class Method Details
.new_by_default ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/teuton-get/searcher.rb', line 21 def self.new_by_default Searcher.new( writer: TerminalWriter.new, repodata: RepoData.new_by_default, reader: YamlReader.new ) end |
Instance Method Details
#get(input) ⇒ Object
29 30 31 32 |
# File 'lib/teuton-get/searcher.rb', line 29 def get(input) reponame_filter, filters = parse_input(input) search_inside(reponame_filter, filters) end |
#show_result ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/teuton-get/searcher.rb', line 34 def show_result @results.each do |i| @dev.write ("(x%02d) " % i[:score]), color: :white reponame = TeutonGet::Format.colorize(i[:reponame], i[:repoindex]) @dev.writeln "#{reponame}#{Application::SEPARATOR}#{i[:testname]}" end end |