class MPD::Playlist

Array<SongInfo> with some useful methods

Public Class Methods

from_response(response) click to toggle source
# File lib/mpd/playlist.rb, line 6
def self.from_response(response)
  data = [{}]
  response.key_value_pairs.each do |k, v|
    data.push({}) if data.last.key?(k) # next song reached
    data.last[k] = v
  end
  new(data)
end
new(data) click to toggle source

data - array of hashes from MPD

Calls superclass method
# File lib/mpd/playlist.rb, line 16
def initialize(data)
  super(data.map { |info| Song.new(info) })
end