Class: Muzak::Album
- Inherits:
-
Object
- Object
- Muzak::Album
- Defined in:
- lib/muzak/album.rb
Instance Attribute Summary collapse
-
#cover_art ⇒ Object
readonly
Returns the value of attribute cover_art.
-
#songs ⇒ Object
readonly
Returns the value of attribute songs.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(title, album_hash) ⇒ Album
constructor
instead of passing an album hash directly from the index, this should really just take a title and an array of Song objects.
Constructor Details
#initialize(title, album_hash) ⇒ Album
instead of passing an album hash directly from the index, this should really just take a title and an array of Song objects.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/muzak/album.rb', line 8 def initialize(title, album_hash) @title = title @cover_art = album_hash["cover"] if album_hash["deep-songs"] @songs = album_hash["deep-songs"] else @songs = album_hash["songs"].map { |s| Song.new(s) } end end |
Instance Attribute Details
#cover_art ⇒ Object (readonly)
Returns the value of attribute cover_art.
3 4 5 |
# File 'lib/muzak/album.rb', line 3 def cover_art @cover_art end |
#songs ⇒ Object (readonly)
Returns the value of attribute songs.
3 4 5 |
# File 'lib/muzak/album.rb', line 3 def songs @songs end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/muzak/album.rb', line 3 def title @title end |