Class: Koine::RestClient::AsyncQueue

Inherits:
Object
  • Object
show all
Defined in:
lib/koine/rest_client/async_queue.rb

Overview

queue for async requests

Instance Method Summary collapse

Constructor Details

#initializeAsyncQueue

Returns a new instance of AsyncQueue.



7
8
9
# File 'lib/koine/rest_client/async_queue.rb', line 7

def initialize
  @items = []
end

Instance Method Details

#clearObject



27
28
29
# File 'lib/koine/rest_client/async_queue.rb', line 27

def clear
  @items.clear
end

#eachObject



15
16
17
18
19
# File 'lib/koine/rest_client/async_queue.rb', line 15

def each
  @items.each do |item|
    yield(item[0], item[1])
  end
end

#mapObject



21
22
23
24
25
# File 'lib/koine/rest_client/async_queue.rb', line 21

def map
  @items.map do |item|
    yield(item[0], item[1])
  end
end

#push(item, &block) ⇒ Object



11
12
13
# File 'lib/koine/rest_client/async_queue.rb', line 11

def push(item, &block)
  @items.push([item, block])
end

#to_aObject



31
32
33
# File 'lib/koine/rest_client/async_queue.rb', line 31

def to_a
  @items.to_a
end