Sha256: aa869da5bed8cb966ae24bd16c9da6cdd2d741a420e8f0ff266aaddcecf1ea2e

Contents?: true

Size: 422 Bytes

Versions: 2

Compression:

Stored size: 422 Bytes

Contents

class Radiodan
class TogglePlaylist
  include Logging
  
  def initialize(main_playlist, toggle_playlist)
    @playlists = [main_playlist, toggle_playlist]
  end
  
  def call(player)
    @player = player
    @player.playlist = @playlists.shift
    
    @player.register_event :toggle do
      logger.info "Toggling playlist"
      @player.playlist, @playlists = @playlists.shift, [@player.playlist]
    end
  end
end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
radiodan-1.0.1 lib/radiodan/middleware/toggle_playlist.rb
radiodan-1.0.0 lib/radiodan/middleware/toggle_playlist.rb