Class: MPD::Playlist
- Inherits:
-
Array
- Object
- Array
- MPD::Playlist
- Defined in:
- lib/mpd/playlist.rb
Overview
Array<SongInfo> with some useful methods
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ Playlist
constructor
data - array of hashes from MPD.
Constructor Details
#initialize(data) ⇒ Playlist
data - array of hashes from MPD
23 24 25 |
# File 'lib/mpd/playlist.rb', line 23 def initialize(data) super(data.map { |info| Song.new(info) }) end |
Class Method Details
.from_response(response) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/mpd/playlist.rb', line 6 def self.from_response(response) data = [] info = {} response.key_value_pairs.each do |key, value| if info.key?(key) # next song info data << info info = {} end info[key] = value end data << info new(data) end |