Class: KBL::Playlist
- Inherits:
-
Object
- Object
- KBL::Playlist
- Includes:
- Serializable::Playlist
- Defined in:
- lib/kbl/playlist.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#songs ⇒ Object
readonly
Returns the value of attribute songs.
Instance Method Summary collapse
- #add_song(&block) ⇒ Object
-
#initialize(&block) ⇒ Playlist
constructor
A new instance of Playlist.
Methods included from Serializable::Playlist
Constructor Details
#initialize(&block) ⇒ Playlist
Returns a new instance of Playlist.
8 9 10 11 12 |
# File 'lib/kbl/playlist.rb', line 8 def initialize(&block) @songs = [] block.call(self) if block_given? end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/kbl/playlist.rb', line 6 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/kbl/playlist.rb', line 6 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/kbl/playlist.rb', line 6 def name @name end |
#songs ⇒ Object (readonly)
Returns the value of attribute songs.
5 6 7 |
# File 'lib/kbl/playlist.rb', line 5 def songs @songs end |
Instance Method Details
#add_song(&block) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/kbl/playlist.rb', line 14 def add_song(&block) song = Song.new block.call(song) @songs << song end |