Class: RorVsWild::Local::Queue

Inherits:
Object
  • Object
show all
Defined in:
lib/rorvswild/local/queue.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeQueue

Returns a new instance of Queue.


5
6
7
# File 'lib/rorvswild/local/queue.rb', line 5

def initialize
  @requests = []
end

Instance Attribute Details

#requestsObject (readonly)

Returns the value of attribute requests


4
5
6
# File 'lib/rorvswild/local/queue.rb', line 4

def requests
  @requests
end

Instance Method Details

#push_job(data) ⇒ Object


9
10
# File 'lib/rorvswild/local/queue.rb', line 9

def push_job(data)
end

#push_request(data) ⇒ Object


12
13
14
15
16
# File 'lib/rorvswild/local/queue.rb', line 12

def push_request(data)
  requests.unshift(data)
  data[:queued_at] = Time.now
  requests.pop if requests.size > 100
end