Class: LastFM::Album
Instance Attribute Summary collapse
-
#artist ⇒ Object
readonly
Returns the value of attribute artist.
-
#mbid ⇒ Object
readonly
Returns the value of attribute mbid.
-
#released ⇒ Object
readonly
Returns the value of attribute released.
-
#tracks ⇒ Object
readonly
Returns the value of attribute tracks.
Attributes inherited from Result
#id, #image, #images, #name, #url
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Album
constructor
A new instance of Album.
Constructor Details
#initialize(attributes) ⇒ Album
Returns a new instance of Album.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/last_fm/album.rb', line 5 def initialize(attributes) super(attributes) @mbid = attributes['mbid'] if attributes['mbid'] @artist = attributes['artist'] if attributes['artist'] @released = attributes['releasedate'] if attributes['releasedate'] @tracks = [] if attributes['tracks'] and attributes['tracks']['track'] attributes['tracks']['track'].each do |track| @tracks << Track.new(track['name'], track['duration'], track['mbid'], track['url']) end end end |
Instance Attribute Details
#artist ⇒ Object (readonly)
Returns the value of attribute artist.
3 4 5 |
# File 'lib/last_fm/album.rb', line 3 def artist @artist end |
#mbid ⇒ Object (readonly)
Returns the value of attribute mbid.
3 4 5 |
# File 'lib/last_fm/album.rb', line 3 def mbid @mbid end |
#released ⇒ Object (readonly)
Returns the value of attribute released.
3 4 5 |
# File 'lib/last_fm/album.rb', line 3 def released @released end |
#tracks ⇒ Object (readonly)
Returns the value of attribute tracks.
3 4 5 |
# File 'lib/last_fm/album.rb', line 3 def tracks @tracks end |