Class: AirPlayer::Playlist
- Inherits:
-
Array
- Object
- Array
- AirPlayer::Playlist
- Defined in:
- lib/airplayer/playlist.rb
Instance Method Summary collapse
- #add(item) ⇒ Object
- #entries(&blk) ⇒ Object
-
#initialize(options = {}) ⇒ Playlist
constructor
A new instance of Playlist.
Constructor Details
#initialize(options = {}) ⇒ Playlist
Returns a new instance of Playlist.
7 8 9 10 |
# File 'lib/airplayer/playlist.rb', line 7 def initialize( = {}) @shuffle = ['shuffle'] || false @repeat = ['repeat'] || false end |
Instance Method Details
#add(item) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/airplayer/playlist.rb', line 12 def add(item) case type(item) when :local_dir concat(media_in_local(item)) when :podcast concat(media_in_podcast(item)) when :url push(Media.new(item)) end self end |
#entries(&blk) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/airplayer/playlist.rb', line 24 def entries(&blk) loop do shuffle! if @shuffle send(:each, &blk) break unless @repeat end end |