Class: ImageInfo::Image
- Inherits:
-
Object
- Object
- ImageInfo::Image
- Defined in:
- lib/image_info/image.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#type ⇒ Object
Returns the value of attribute type.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(uri) ⇒ Image
constructor
A new instance of Image.
- #size ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(uri) ⇒ Image
Returns a new instance of Image.
9 10 11 |
# File 'lib/image_info/image.rb', line 9 def initialize(uri) @uri = ::URI.parse(uri.to_s) end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
7 8 9 |
# File 'lib/image_info/image.rb', line 7 def height @height end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/image_info/image.rb', line 7 def type @type end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
6 7 8 |
# File 'lib/image_info/image.rb', line 6 def uri @uri end |
#width ⇒ Object
Returns the value of attribute width.
7 8 9 |
# File 'lib/image_info/image.rb', line 7 def width @width end |
Instance Method Details
#size ⇒ Object
13 14 15 |
# File 'lib/image_info/image.rb', line 13 def size [width, height].compact end |
#valid? ⇒ Boolean
17 18 19 |
# File 'lib/image_info/image.rb', line 17 def valid? uri.is_a?(::URI::HTTP) end |