Class: RorVsWild::Local::Queue
- Inherits:
-
Object
- Object
- RorVsWild::Local::Queue
- Defined in:
- lib/rorvswild/local/queue.rb
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(config = {}) ⇒ Queue
constructor
A new instance of Queue.
- #jobs ⇒ Object
- #push_error(data) ⇒ Object
- #push_job(data) ⇒ Object
- #push_request(data) ⇒ Object
- #requests ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ Queue
Returns a new instance of Queue.
6 7 8 9 10 11 |
# File 'lib/rorvswild/local/queue.rb', line 6 def initialize(config = {}) @config = config dir = File.directory?("tmp") ? "tmp" : Dir.tmpdir @directoy = File.join(dir, "rorvswild", @config[:prefix].to_s) FileUtils.mkpath(@directoy) end |
Instance Method Details
#errors ⇒ Object
35 36 37 |
# File 'lib/rorvswild/local/queue.rb', line 35 def errors load_data("errors") end |
#jobs ⇒ Object
31 32 33 |
# File 'lib/rorvswild/local/queue.rb', line 31 def jobs load_data("jobs") end |
#push_error(data) ⇒ Object
23 24 25 |
# File 'lib/rorvswild/local/queue.rb', line 23 def push_error(data) push_to(data, "errors") end |
#push_job(data) ⇒ Object
13 14 15 16 |
# File 'lib/rorvswild/local/queue.rb', line 13 def push_job(data) push_to(data, "jobs") push_error(data[:error]) if data[:error] end |
#push_request(data) ⇒ Object
18 19 20 21 |
# File 'lib/rorvswild/local/queue.rb', line 18 def push_request(data) push_to(data, "requests") push_error(data[:error]) if data[:error] end |
#requests ⇒ Object
27 28 29 |
# File 'lib/rorvswild/local/queue.rb', line 27 def requests load_data("requests") end |