Class: Muzak::Album

Inherits:
Object
  • Object
show all
Defined in:
lib/muzak/album.rb

Overview

Represents a collection of songs for muzak.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, album_hash) ⇒ Album

Note:

instead of passing an album hash directly from the index, this should really just take a title and an array of Song objects.

Returns a new instance of Album.



15
16
17
18
19
20
21
22
23
24
# File 'lib/muzak/album.rb', line 15

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_artString (readonly)

Returns the path to the album's cover art.

Returns:

  • (String)

    the path to the album's cover art



11
12
13
# File 'lib/muzak/album.rb', line 11

def cover_art
  @cover_art
end

#songsArray<Muzak::Song> (readonly)

Returns the album's songs.

Returns:



8
9
10
# File 'lib/muzak/album.rb', line 8

def songs
  @songs
end

#titleString (readonly)

Returns the album's title.

Returns:

  • (String)

    the album's title



5
6
7
# File 'lib/muzak/album.rb', line 5

def title
  @title
end