Class: Kin::Image
- Inherits:
-
Object
- Object
- Kin::Image
- Defined in:
- lib/image.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#url ⇒ Object
Returns the value of attribute url.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(url = '', width = 0, height = 0) ⇒ Image
constructor
A new instance of Image.
- #to_s ⇒ Object
Constructor Details
#initialize(url = '', width = 0, height = 0) ⇒ Image
Returns a new instance of Image.
6 7 8 9 |
# File 'lib/image.rb', line 6 def initialize(obj={}) raise "Invalid Argument" unless obj.is_a?(Hash) initialize(obj['url'], obj['width'], obj['height']) end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
4 5 6 |
# File 'lib/image.rb', line 4 def height @height end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/image.rb', line 4 def url @url end |
#width ⇒ Object
Returns the value of attribute width.
4 5 6 |
# File 'lib/image.rb', line 4 def width @width end |
Instance Method Details
#to_s ⇒ Object
17 18 19 20 21 |
# File 'lib/image.rb', line 17 def to_s vars = {} self.instance_variables.map {|v| vars[v.to_sym] = self.instance_variable_get(v)} vars end |