Class: HeadlineResponse::HeadlineItem::Image
- Inherits:
-
Object
- Object
- HeadlineResponse::HeadlineItem::Image
- Defined in:
- lib/espn_rb/headline_image.rb
Instance Attribute Summary collapse
-
#image ⇒ Object
readonly
Returns the value of attribute image.
Instance Method Summary collapse
-
#caption ⇒ Object
returns caption of image.
-
#credit ⇒ Object
returns credit (attribution) of image.
-
#height ⇒ Object
returns height of image.
-
#initialize(image) ⇒ Image
constructor
A new instance of Image.
-
#landscape? ⇒ Boolean
returns true if the image is landscape oriented.
-
#name ⇒ Object
returns name of image.
-
#portrait? ⇒ Boolean
returns true if the image is portrait oriented.
-
#url ⇒ Object
returns url of image.
-
#width ⇒ Object
returns width of image.
Constructor Details
#initialize(image) ⇒ Image
23 24 25 |
# File 'lib/espn_rb/headline_image.rb', line 23 def initialize(image) @image = image end |
Instance Attribute Details
#image ⇒ Object (readonly)
Returns the value of attribute image.
21 22 23 |
# File 'lib/espn_rb/headline_image.rb', line 21 def image @image end |
Instance Method Details
#caption ⇒ Object
returns caption of image
38 39 40 |
# File 'lib/espn_rb/headline_image.rb', line 38 def caption @image["caption"] end |
#credit ⇒ Object
returns credit (attribution) of image
53 54 55 |
# File 'lib/espn_rb/headline_image.rb', line 53 def credit @image["credit"] end |
#height ⇒ Object
returns height of image
63 64 65 |
# File 'lib/espn_rb/headline_image.rb', line 63 def height @image["height"] end |
#landscape? ⇒ Boolean
returns true if the image is landscape oriented.
28 29 30 |
# File 'lib/espn_rb/headline_image.rb', line 28 def landscape? @image["width"] > @image["height"] end |
#name ⇒ Object
returns name of image
43 44 45 |
# File 'lib/espn_rb/headline_image.rb', line 43 def name @image["name"] end |
#portrait? ⇒ Boolean
returns true if the image is portrait oriented.
33 34 35 |
# File 'lib/espn_rb/headline_image.rb', line 33 def portrait? !landscape? end |
#url ⇒ Object
returns url of image
48 49 50 |
# File 'lib/espn_rb/headline_image.rb', line 48 def url @image["url"] end |
#width ⇒ Object
returns width of image
58 59 60 |
# File 'lib/espn_rb/headline_image.rb', line 58 def width @image["width"] end |