class Queuel::Client

Attributes

credentials[RW]
engine[RW]
given_queue[RW]

Public Class Methods

new(engine, credentials, init_queue = nil) click to toggle source
# File lib/queuel/client.rb, line 4
def initialize(engine, credentials, init_queue = nil)
  self.engine = engine
  self.credentials = credentials
  self.given_queue = init_queue
end

Public Instance Methods

queue() click to toggle source
# File lib/queuel/client.rb, line 20
def queue
  bare = (given_queue || Queuel.default_queue)
  bare.to_s unless bare.nil?
end
with(change_queue = nil) click to toggle source
# File lib/queuel/client.rb, line 16
def with(change_queue = nil)
  self.clone.tap { |client| client.given_queue = change_queue }
end

Private Instance Methods

engine_client() click to toggle source
# File lib/queuel/client.rb, line 42
def engine_client
  @engine_client ||= engine.new credentials
end
queue_connection() click to toggle source
# File lib/queuel/client.rb, line 38
def queue_connection
  engine_client.queue queue
end
with_queue() { || ... } click to toggle source
# File lib/queuel/client.rb, line 30
def with_queue
  if queue.nil? || queue.to_s.strip.empty?
    raise NoQueueGivenError, "Must select a queue with #with or set a default_queue"
  else
    yield
  end
end