Class: ImdbImage
- Inherits:
-
Object
- Object
- ImdbImage
- Defined in:
- lib/imdb/imdb_image.rb
Instance Attribute Summary collapse
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #document ⇒ Object
- #image ⇒ Object
-
#initialize(url) ⇒ ImdbImage
constructor
A new instance of ImdbImage.
Constructor Details
#initialize(url) ⇒ ImdbImage
Returns a new instance of ImdbImage.
7 8 9 |
# File 'lib/imdb/imdb_image.rb', line 7 def initialize(url) @url = File.join("http://www.imdb.com/", url) end |
Instance Attribute Details
#url ⇒ Object
Returns the value of attribute url.
5 6 7 |
# File 'lib/imdb/imdb_image.rb', line 5 def url @url end |
Instance Method Details
#document ⇒ Object
15 16 17 |
# File 'lib/imdb/imdb_image.rb', line 15 def document @document ||= Hpricot(open(self.url).read) end |
#image ⇒ Object
11 12 13 |
# File 'lib/imdb/imdb_image.rb', line 11 def image document.at("table#principal tr td img")['src'] rescue nil end |