Class: Rlastfm::Album
- Inherits:
-
Object
- Object
- Rlastfm::Album
- Includes:
- Helpers::Scraper
- Defined in:
- lib/rlastfm/album.rb
Instance Attribute Summary collapse
-
#artist ⇒ Object
Returns the value of attribute artist.
-
#images ⇒ Object
Returns the value of attribute images.
-
#name ⇒ Object
Returns the value of attribute name.
-
#play_count ⇒ Object
Returns the value of attribute play_count.
-
#rank ⇒ Object
Returns the value of attribute rank.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(hash = {}) ⇒ Album
constructor
A new instance of Album.
- #tracks ⇒ Object
Methods included from Helpers::Scraper
Constructor Details
#initialize(hash = {}) ⇒ Album
Returns a new instance of Album.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rlastfm/album.rb', line 8 def initialize(hash={}) @raw = hash.stringify_keys! @images = hash['images'] || hash['image'] @name = hash['name'] @play_count = hash['play_count'] || hash['playcount'] @rank = hash['rank'] @url = hash['url'] if (a = hash['artist']) @artist = a.is_a?(Hash) ? a['name'] : a end end |
Instance Attribute Details
#artist ⇒ Object
Returns the value of attribute artist.
6 7 8 |
# File 'lib/rlastfm/album.rb', line 6 def artist @artist end |
#images ⇒ Object
Returns the value of attribute images.
6 7 8 |
# File 'lib/rlastfm/album.rb', line 6 def images @images end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/rlastfm/album.rb', line 6 def name @name end |
#play_count ⇒ Object
Returns the value of attribute play_count.
6 7 8 |
# File 'lib/rlastfm/album.rb', line 6 def play_count @play_count end |
#rank ⇒ Object
Returns the value of attribute rank.
6 7 8 |
# File 'lib/rlastfm/album.rb', line 6 def rank @rank end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
5 6 7 |
# File 'lib/rlastfm/album.rb', line 5 def raw @raw end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/rlastfm/album.rb', line 6 def url @url end |
Instance Method Details
#tracks ⇒ Object
20 21 22 |
# File 'lib/rlastfm/album.rb', line 20 def tracks @tracks ||= get_tracks end |