Sha256: 40cfc8909d0494abde760047e622c560ebfebcd211675720cd6b3885a3400bfc

Contents?: true

Size: 288 Bytes

Versions: 3

Compression:

Stored size: 288 Bytes

Contents

module Etcd
  module Lockable
    def lock(opts={})
      opts[:client] = opts[:client] || self
      lock = Lock.new(opts)
      lock.acquire
      begin
        yield lock.lock_id
      rescue Exception => e
        raise e
      ensure
        lock.release
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
etcd-0.0.6 lib/etcd/mixins/lockable.rb
etcd-0.0.5 lib/etcd/mixins/lockable.rb
etcd-0.0.4 lib/etcd/mixins/lockable.rb