Class: KBL::Playlist

Inherits:
Object
  • Object
show all
Includes:
Serializable::Playlist
Defined in:
lib/kbl/playlist.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Serializable::Playlist

#to_kbl_node

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

#descriptionObject

Returns the value of attribute description.



6
7
8
# File 'lib/kbl/playlist.rb', line 6

def description
  @description
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/kbl/playlist.rb', line 6

def id
  @id
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/kbl/playlist.rb', line 6

def name
  @name
end

#songsObject (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