Class: Ejaydj::Playlist
- Inherits:
-
Object
- Object
- Ejaydj::Playlist
- Includes:
- Mixins
- Defined in:
- lib/ejaydj/playlist.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#number_of_tracks ⇒ Object
Returns the value of attribute number_of_tracks.
-
#url ⇒ Object
Returns the value of attribute url.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Playlist
constructor
A new instance of Playlist.
- #next_track ⇒ Object
- #reload! ⇒ Object
- #tracks ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Playlist
Returns a new instance of Playlist.
14 15 16 |
# File 'lib/ejaydj/playlist.rb', line 14 def initialize(attributes={}) instantiate_variables_from attributes end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
8 9 10 |
# File 'lib/ejaydj/playlist.rb', line 8 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/ejaydj/playlist.rb', line 8 def name @name end |
#number_of_tracks ⇒ Object
Returns the value of attribute number_of_tracks.
8 9 10 |
# File 'lib/ejaydj/playlist.rb', line 8 def number_of_tracks @number_of_tracks end |
#url ⇒ Object
Returns the value of attribute url.
8 9 10 |
# File 'lib/ejaydj/playlist.rb', line 8 def url @url end |
#user_id ⇒ Object
Returns the value of attribute user_id.
8 9 10 |
# File 'lib/ejaydj/playlist.rb', line 8 def user_id @user_id end |
Instance Method Details
#next_track ⇒ Object
18 19 20 21 22 23 |
# File 'lib/ejaydj/playlist.rb', line 18 def next_track reload! if tracks.empty? track = tracks.pop track.playlist = self track end |
#reload! ⇒ Object
29 30 31 |
# File 'lib/ejaydj/playlist.rb', line 29 def reload! @tracks = all_tracks end |
#tracks ⇒ Object
25 26 27 |
# File 'lib/ejaydj/playlist.rb', line 25 def tracks @tracks ||= all_tracks end |