Class: Myimdb::Search::Base
- Inherits:
-
Object
- Object
- Myimdb::Search::Base
- Defined in:
- lib/myimdb/search/base.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.search(text, options) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/myimdb/search/base.rb', line 12 def search( text, ) engines = [Myimdb::Search::Google, Myimdb::Search::Bing] def _search(engine, text, ) engine.search_text(text, ) end engines.each do |engine| puts "Retrying using #{engine}" unless engines.index(engine) == 0 result = _search(engine, text, ) return result unless result.nil? or result.empty? end end |
.spell_movie(text, options = {}) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/myimdb/search/base.rb', line 5 def spell_movie( text, ={} ) search_results = search_text(text, :restrict_to=> 'imdb.com') search_results and search_results.collect do |search_result| search_result[:title].gsub(/ \(.*$/, "") end end |
Instance Method Details
#_search(engine, text, options) ⇒ Object
15 16 17 |
# File 'lib/myimdb/search/base.rb', line 15 def _search(engine, text, ) engine.search_text(text, ) end |