class Airplay::Player::Playlist

Attributes

name[R]

Public Class Methods

new(name) click to toggle source
# File lib/airplay/player/playlist.rb, line 14
def initialize(name)
  @name = name
  @items = []
  @position = 0
end

Public Instance Methods

<<(file_or_url) click to toggle source
# File lib/airplay/player/playlist.rb, line 24
def <<(file_or_url)
  @items << Media.new(file_or_url)
end
next() click to toggle source
# File lib/airplay/player/playlist.rb, line 31
def next
  return nil if !next?

  item = @items[@position]
  @position += 1
  item
end
next?() click to toggle source
# File lib/airplay/player/playlist.rb, line 28
def next?;     @position + 1 <= @items.size end
previous() click to toggle source
# File lib/airplay/player/playlist.rb, line 39
def previous
  return nil if !previous?

  @position -= 1
  @items[@position]
end
previous?() click to toggle source
# File lib/airplay/player/playlist.rb, line 29
def previous?; @position - 1 >= 0 end
to_ary() click to toggle source
# File lib/airplay/player/playlist.rb, line 20
def to_ary
  @items
end