Class: MPD::Controller::Playlists::Playlist
- Inherits:
-
Object
- Object
- MPD::Controller::Playlists::Playlist
- Includes:
- Enumerable
- Defined in:
- lib/mpd/controller/playlists.rb
Instance Attribute Summary collapse
-
#last_modified ⇒ Object
readonly
Returns the value of attribute last_modified.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#playlists ⇒ Object
readonly
Returns the value of attribute playlists.
Instance Method Summary collapse
- #add(uri) ⇒ Object
- #clear ⇒ Object
- #delete! ⇒ Object
- #each ⇒ Object
-
#initialize(playlists, name, last_modified = nil) ⇒ Playlist
constructor
A new instance of Playlist.
- #load(range = nil) ⇒ Object
- #move(from, to) ⇒ Object
- #rename(new) ⇒ Object
Constructor Details
#initialize(playlists, name, last_modified = nil) ⇒ Playlist
Returns a new instance of Playlist.
19 20 21 22 23 |
# File 'lib/mpd/controller/playlists.rb', line 19 def initialize (playlists, name, last_modified = nil) @playlists = playlists @name = name @last_modified = last_modified end |
Instance Attribute Details
#last_modified ⇒ Object (readonly)
Returns the value of attribute last_modified.
17 18 19 |
# File 'lib/mpd/controller/playlists.rb', line 17 def last_modified @last_modified end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
17 18 19 |
# File 'lib/mpd/controller/playlists.rb', line 17 def name @name end |
#playlists ⇒ Object (readonly)
Returns the value of attribute playlists.
17 18 19 |
# File 'lib/mpd/controller/playlists.rb', line 17 def playlists @playlists end |
Instance Method Details
#add(uri) ⇒ Object
53 54 55 |
# File 'lib/mpd/controller/playlists.rb', line 53 def add (uri) playlists.controller.do_and_raise_if_needed :playlistadd, name, uri end |
#clear ⇒ Object
63 64 65 66 67 |
# File 'lib/mpd/controller/playlists.rb', line 63 def clear playlists.controller.do_and_raise_if_needed :playlistclear, name self end |
#delete! ⇒ Object
47 48 49 50 51 |
# File 'lib/mpd/controller/playlists.rb', line 47 def delete! playlists.controller.do_and_raise_if_needed :rm, name self end |
#each ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/mpd/controller/playlists.rb', line 25 def each return to_enum unless block_given? Database::Song.from_data(playlists.controller.do_and_raise_if_needed(:listplaylistinfo, name)).each {|song| yield song } self end |
#load(range = nil) ⇒ Object
35 36 37 38 39 |
# File 'lib/mpd/controller/playlists.rb', line 35 def load (range = nil) playlists.controller.do_and_raise_if_needed :load, name, *range self end |
#move(from, to) ⇒ Object
57 58 59 60 61 |
# File 'lib/mpd/controller/playlists.rb', line 57 def move (from, to) playlists.controller.do_and_raise_if_needed :playlistmove, name, from, to self end |
#rename(new) ⇒ Object
41 42 43 44 45 |
# File 'lib/mpd/controller/playlists.rb', line 41 def rename (new) playlists.controller.do_and_raise_if_needed :rename, name, new self end |