Sha256: 07e4ef475d36e1dc6a3841ca50de937cdc3994b8525cef4248a01f099311dab5
Contents?: true
Size: 488 Bytes
Versions: 3
Compression:
Stored size: 488 Bytes
Contents
class ImdbSearch attr_accessor :query def initialize(query) self.query = query end def movies @movies ||= document.search('a[@href^="/title/tt"]').reject do |element| element.innerHTML.strip_tags.empty? end.map do |element| ImdbMovie.new(element['href'][/\d+/], element.innerHTML.strip_tags.unescape_html) end end private def document @document ||= Hpricot(open("http://www.imdb.com/find?q=#{CGI::escape(query)};s=tt").read) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
porras-imdb-0.0.4 | lib/imdb/imdb_search.rb |
porras-imdb-0.0.5 | lib/imdb/imdb_search.rb |
porras-imdb-0.0.6 | lib/imdb/imdb_search.rb |