Sha256: 0a7d6d8dd1658a9ab56caf27d1cc954420ce72e983b6f352addb5fab331efe1e

Contents?: true

Size: 430 Bytes

Versions: 26

Compression:

Stored size: 430 Bytes

Contents

module WebsocketRails
  class EventQueue

    attr_reader :queue

    def initialize
      @queue = []
    end

    def enqueue(event)
      @queue << event
    end
    alias :<< :enqueue

    def last
      @queue.last
    end

    def size
      @queue.size
    end

    def flush(&block)
      unless block.nil?
        @queue.each do |item|
          block.call item
        end
      end
      @queue = []
    end

  end
end

Version data entries

26 entries across 26 versions & 3 rubygems

Version Path
hkroger-websocket-rails-0.7.1 lib/websocket_rails/event_queue.rb
wwl-websocket-rails-0.7.3 lib/websocket_rails/event_queue.rb
wwl-websocket-rails-0.7.2 lib/websocket_rails/event_queue.rb
wwl-websocket-rails-0.7.1 lib/websocket_rails/event_queue.rb
websocket-rails-0.7.0 lib/websocket_rails/event_queue.rb
websocket-rails-0.6.2 lib/websocket_rails/event_queue.rb
websocket-rails-0.6.1 lib/websocket_rails/event_queue.rb
websocket-rails-0.6.0 lib/websocket_rails/event_queue.rb
websocket-rails-0.5.0 lib/websocket_rails/event_queue.rb
websocket-rails-0.4.9 lib/websocket_rails/event_queue.rb
websocket-rails-0.4.8 lib/websocket_rails/event_queue.rb
websocket-rails-0.4.7 lib/websocket_rails/event_queue.rb
websocket-rails-0.4.6 lib/websocket_rails/event_queue.rb
websocket-rails-0.4.5 lib/websocket_rails/event_queue.rb
websocket-rails-0.4.4 lib/websocket_rails/event_queue.rb
websocket-rails-0.4.3 lib/websocket_rails/event_queue.rb
websocket-rails-0.4.2 lib/websocket_rails/event_queue.rb
websocket-rails-0.4.1 lib/websocket_rails/event_queue.rb
websocket-rails-0.4.0 lib/websocket_rails/event_queue.rb
websocket-rails-0.3.0 lib/websocket_rails/event_queue.rb