Class: LastFM::Result
- Inherits:
-
Object
- Object
- LastFM::Result
- Defined in:
- lib/last_fm/result.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#images ⇒ Object
readonly
Returns the value of attribute images.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Result
constructor
A new instance of Result.
Constructor Details
#initialize(attributes) ⇒ Result
Returns a new instance of Result.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/last_fm/result.rb', line 5 def initialize(attributes) @id = attributes['id'] @url = attributes['url'] @name = attributes['name'] @images = {} attributes['image'].each do |image| @images[image['size'].to_sym] = image['#text'] end @image = @images[:large] end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/last_fm/result.rb', line 3 def id @id end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
3 4 5 |
# File 'lib/last_fm/result.rb', line 3 def image @image end |
#images ⇒ Object (readonly)
Returns the value of attribute images.
3 4 5 |
# File 'lib/last_fm/result.rb', line 3 def images @images end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/last_fm/result.rb', line 3 def name @name end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
3 4 5 |
# File 'lib/last_fm/result.rb', line 3 def url @url end |