Module: Promiscuous::Common::Worker

Extended by:
ActiveSupport::Concern
Included in:
Publisher::Worker, Subscriber::Worker
Defined in:
lib/promiscuous/common/worker.rb

Instance Method Summary collapse

Instance Method Details

#bareback?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/promiscuous/common/worker.rb', line 17

def bareback?
  !!ENV['BAREBACK']
end

#initialize(options = {}) ⇒ Object



4
5
6
7
# File 'lib/promiscuous/common/worker.rb', line 4

def initialize(options={})
  self.options = options
  self.stop = false
end

#unit_of_work(type) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/promiscuous/common/worker.rb', line 9

def unit_of_work(type)
  if defined?(Mongoid)
    Mongoid.unit_of_work { yield }
  else
    yield
  end
end