Exceptions, which are raised after ensure will not be raised
This commit is contained in:
parent
9cae19fee4
commit
f35c674923
|
@ -17,7 +17,7 @@ module SBDB
|
|||
def unknown( *ps) Unknown.new *ps end
|
||||
alias open_db unknown
|
||||
|
||||
def raise_barrier *ps, &e
|
||||
def self.raise_barrier *ps, &e
|
||||
e.call *ps
|
||||
rescue Object
|
||||
$stderr.puts [$!.class,$!,$!.backtrace].inspect
|
||||
|
|
|
@ -36,7 +36,7 @@ module SBDB
|
|||
end
|
||||
|
||||
def self.new *ps
|
||||
ret = obj = super *ps
|
||||
ret = obj = super( *ps)
|
||||
begin ret = yield obj
|
||||
ensure obj.close
|
||||
end if block_given?
|
||||
|
|
|
@ -50,8 +50,8 @@ module SBDB
|
|||
ret = obj = super( *ps)
|
||||
begin ret = exe.call obj
|
||||
ensure
|
||||
SBDB::raise_barrier obj.method(:sync)
|
||||
SBDB::raise_barrier obj.method(:close)
|
||||
SBDB::raise_barrier &obj.method(:sync)
|
||||
SBDB::raise_barrier &obj.method(:close)
|
||||
end if exe
|
||||
ret
|
||||
end
|
||||
|
@ -133,7 +133,7 @@ module SBDB
|
|||
Array = Recno
|
||||
TYPES[DB::RECNO] = Recno
|
||||
|
||||
class Queue < Arrayisch
|
||||
class Queue < DB
|
||||
extend Arrayisch
|
||||
def unshift txn = nil
|
||||
@db.get _txn(txn), "\0\0\0\0", nil, Bdb::DB_CONSUME
|
||||
|
|
|
@ -75,7 +75,7 @@ module SBDB
|
|||
def self.new *args
|
||||
obj = ret = super( *args)
|
||||
begin ret = yield obj
|
||||
ensure SBDB::raise_barrier obj.method(:close)
|
||||
ensure SBDB::raise_barrier &obj.method(:close)
|
||||
end if block_given?
|
||||
ret
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|||
|
||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||
s.authors = ["Denis Knauf"]
|
||||
s.date = %q{2010-03-11}
|
||||
s.date = %q{2010-03-21}
|
||||
s.description = %q{Simple Ruby Berkeley DB wrapper library for bdb.}
|
||||
s.email = %q{Denis.Knauf@gmail.com}
|
||||
s.extra_rdoc_files = [
|
||||
|
@ -17,7 +17,8 @@ Gem::Specification.new do |s|
|
|||
"README.md"
|
||||
]
|
||||
s.files = [
|
||||
"README.md",
|
||||
"AUTHORS",
|
||||
"README.md",
|
||||
"VERSION",
|
||||
"lib/sbdb.rb",
|
||||
"lib/sbdb/cursor.rb",
|
||||
|
|
Loading…
Reference in a new issue