Class: Asynchronic::QueueEngine::Synchronic

Inherits:
Object
  • Object
show all
Defined in:
lib/asynchronic/queue_engine/synchronic.rb

Defined Under Namespace

Classes: MockJob, Queue

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Synchronic

Returns a new instance of Synchronic.



7
8
9
10
# File 'lib/asynchronic/queue_engine/synchronic.rb', line 7

def initialize(options={})
  @options = options
  @stubs = {}
end

Instance Attribute Details

#stubsObject (readonly)

Returns the value of attribute stubs.



5
6
7
# File 'lib/asynchronic/queue_engine/synchronic.rb', line 5

def stubs
  @stubs
end

Instance Method Details

#[](name) ⇒ Object



20
21
22
# File 'lib/asynchronic/queue_engine/synchronic.rb', line 20

def [](name)
  Queue.new self
end

#active_connectionsObject



32
33
34
# File 'lib/asynchronic/queue_engine/synchronic.rb', line 32

def active_connections
  [Asynchronic.connection_name]
end

#asynchronic?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/asynchronic/queue_engine/synchronic.rb', line 28

def asynchronic?
  false
end

#default_queueObject



12
13
14
# File 'lib/asynchronic/queue_engine/synchronic.rb', line 12

def default_queue
  Asynchronic.default_queue
end

#environmentObject



16
17
18
# File 'lib/asynchronic/queue_engine/synchronic.rb', line 16

def environment
  @environment ||= options.fetch(:environment, Asynchronic.environment)
end

#stub(job, &block) ⇒ Object



24
25
26
# File 'lib/asynchronic/queue_engine/synchronic.rb', line 24

def stub(job, &block)
  stubs[job] = block
end