Module: Rubeus::Jdbc::CloseableResource

Included in:
Extensions::Java::Sql::Connection, Extensions::Java::Sql::Statement
Defined in:
lib/rubeus/jdbc/closeable_resource.rb

Instance Method Summary collapse

Instance Method Details

#with_close(resource) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/rubeus/jdbc/closeable_resource.rb', line 3

def with_close(resource)
  if block_given?
    begin
      yield(resource)
    ensure
      resource.close
    end
    return nil
  else
    resource
  end
end