class Warg::Context::Playlist

Public Class Methods

new() click to toggle source
# File lib/warg.rb, line 1420
def initialize
  @playing_at = 0
  @insert_at = 0
  @items = []
  @started = false
end

Public Instance Methods

queue(command) click to toggle source
# File lib/warg.rb, line 1439
def queue(command)
  @items.insert(@insert_at, command)
  @insert_at += 1
end
start() click to toggle source
# File lib/warg.rb, line 1427
def start
  @started = true
  @insert_at = 1

  until @playing_at >= @items.length
    @items[@playing_at].run

    @playing_at += 1
    @insert_at = @playing_at + 1
  end
end