Class: Kin::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#heightObject

Returns the value of attribute height.



4
5
6
# File 'lib/image.rb', line 4

def height
  @height
end

#urlObject

Returns the value of attribute url.



4
5
6
# File 'lib/image.rb', line 4

def url
  @url
end

#widthObject

Returns the value of attribute width.



4
5
6
# File 'lib/image.rb', line 4

def width
  @width
end

Instance Method Details

#to_sObject



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