Class: Looks::Gravatar::Image

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/looks/gravatar/image.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, url, rating) ⇒ Image

Returns a new instance of Image.



24
25
26
27
28
# File 'lib/looks/gravatar/image.rb', line 24

def initialize(id, url, rating)
  @id     = id
  @url    = url
  @rating = rating
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



22
23
24
# File 'lib/looks/gravatar/image.rb', line 22

def id
  @id
end

#ratingObject

Returns the value of attribute rating.



22
23
24
# File 'lib/looks/gravatar/image.rb', line 22

def rating
  @rating
end

#urlObject

Returns the value of attribute url.



22
23
24
# File 'lib/looks/gravatar/image.rb', line 22

def url
  @url
end

Class Method Details

.new_from_addresses(value) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/looks/gravatar/image.rb', line 6

def self.new_from_addresses(value)
  id     = value['userimage']
  url    = value['userimage_url']
  rating = value['rating']

  new(id, url, rating)
end

.new_from_images(key, value) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/looks/gravatar/image.rb', line 14

def self.new_from_images(key, value)
  id     = key
  url    = value[1]
  rating = value[0]

  new(id, url, rating)
end

Instance Method Details

#<=>(other) ⇒ Object



30
31
32
# File 'lib/looks/gravatar/image.rb', line 30

def <=>(other)
  id <=> other.id
end

#to_sObject



34
35
36
# File 'lib/looks/gravatar/image.rb', line 34

def to_s
  id
end