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