class SQLite3::Database

def open(*args)

returns the result of the block instead of the database instance.
With block, like new closes the database at the end, but unlike new
Without block works exactly as new.
def open(*args)
  database = new(*args)
  if block_given?
    begin
      yield database
    ensure
      database.close
    end
  else
    database
  end
end