mirror of
https://github.com/danbee/mpd-client
synced 2025-03-04 08:39:09 +00:00
29 lines
334 B
Ruby
29 lines
334 B
Ruby
module MPDClient
|
|
class Queue
|
|
|
|
include Enumerable
|
|
include Jsonable
|
|
|
|
attr :songs
|
|
|
|
def initialize
|
|
@songs = fetch_songs
|
|
end
|
|
|
|
def each(&block)
|
|
songs.each(&block)
|
|
end
|
|
|
|
def to_h
|
|
map(&:to_h)
|
|
end
|
|
|
|
private
|
|
|
|
def fetch_songs
|
|
MPDClient.conn.queue.map(&Song)
|
|
end
|
|
|
|
end
|
|
end
|