Class: Tsearch::Commands::Search
- Inherits:
-
Tsearch::Command
- Object
- Tsearch::Command
- Tsearch::Commands::Search
- Defined in:
- lib/tsearch/commands/search.rb
Constant Summary collapse
- CATEGORY_MAP =
{ 'movies': [14, 48, 17, 44, 45, 47, 50, 51, 52, 42, 46], 'tv': [18, 41, 49], 'music': [23, 25], 'games': [27, 28, 40, 53, 32], 'software': [33], 'xxx': [4] }.freeze
Instance Method Summary collapse
- #execute(_input: $stdin, output: $stdout) ⇒ Object
-
#initialize(options) ⇒ Search
constructor
A new instance of Search.
Methods inherited from Tsearch::Command
#command, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which
Constructor Details
#initialize(options) ⇒ Search
Returns a new instance of Search.
21 22 23 |
# File 'lib/tsearch/commands/search.rb', line 21 def initialize() @options = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(key, *args, &block) ⇒ Object (private)
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/tsearch/commands/search.rb', line 92 def method_missing(key, *args, &block) super unless %i[string imdb tvdb themoviedb category limit min_seeders min_leechers ranked sort verbose].include?(key) @options[key] end |
Instance Method Details
#execute(_input: $stdin, output: $stdout) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/tsearch/commands/search.rb', line 25 def execute(_input: $stdin, output: $stdout) results = search_torrent.map(&:deep_symbolize_keys) if results.empty? output.puts 'No results were found, please try again' return end display_results(results.reverse, output) end |