class Snapscatter::Locker

Public Class Methods

new(spec) click to toggle source
# File lib/snapscatter/locker.rb, line 7
def initialize spec
  strategy = spec[:strategy] && spec.delete(:strategy)
  case strategy
  when 'mongo'
    @strategy = MongoLocker.new spec
  else
    @strategy = NoOpLocker.new
  end
end

Public Instance Methods

lock() click to toggle source
# File lib/snapscatter/locker.rb, line 17
def lock
  @strategy.lock
end
unlock() click to toggle source
# File lib/snapscatter/locker.rb, line 21
def unlock
  @strategy.unlock
end