Class: YahooWeather::Image
- Inherits:
-
Object
- Object
- YahooWeather::Image
- Defined in:
- lib/yahoo-weather/image.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
the height of the image in pixels.
-
#link ⇒ Object
readonly
the url intended to be used as a link wrapping the image, for instance, to send the user to the main Yahoo Weather home page.
-
#title ⇒ Object
readonly
the title of hte image.
-
#url ⇒ Object
readonly
the full url to the image.
-
#width ⇒ Object
readonly
the width of the image in pixels.
Instance Method Summary collapse
-
#initialize(payload) ⇒ Image
constructor
A new instance of Image.
Constructor Details
#initialize(payload) ⇒ Image
Returns a new instance of Image.
18 19 20 21 22 23 24 |
# File 'lib/yahoo-weather/image.rb', line 18 def initialize (payload) @title = payload.xpath('title').first.content @link = payload.xpath('link').first.content @url = payload.xpath('url').first.content @height = payload.xpath('height').first.content.to_i @width = payload.xpath('width').first.content.to_i end |
Instance Attribute Details
#height ⇒ Object (readonly)
the height of the image in pixels.
3 4 5 |
# File 'lib/yahoo-weather/image.rb', line 3 def height @height end |
#link ⇒ Object (readonly)
the url intended to be used as a link wrapping the image, for instance, to send the user to the main Yahoo Weather home page.
7 8 9 |
# File 'lib/yahoo-weather/image.rb', line 7 def link @link end |
#title ⇒ Object (readonly)
the title of hte image.
10 11 12 |
# File 'lib/yahoo-weather/image.rb', line 10 def title @title end |
#url ⇒ Object (readonly)
the full url to the image.
13 14 15 |
# File 'lib/yahoo-weather/image.rb', line 13 def url @url end |
#width ⇒ Object (readonly)
the width of the image in pixels.
16 17 18 |
# File 'lib/yahoo-weather/image.rb', line 16 def width @width end |