Class: EzPool::ConnectionWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/ezpool/connection_wrapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conn, connection_manager) ⇒ ConnectionWrapper

Returns a new instance of ConnectionWrapper.



6
7
8
9
10
# File 'lib/ezpool/connection_wrapper.rb', line 6

def initialize(conn, connection_manager)
  @raw_conn = conn
  @created_at = EzPool.monotonic_time
  @manager = connection_manager
end

Instance Attribute Details

#raw_connObject (readonly)

Returns the value of attribute raw_conn.



4
5
6
# File 'lib/ezpool/connection_wrapper.rb', line 4

def raw_conn
  @raw_conn
end

Instance Method Details

#ageObject



17
18
19
# File 'lib/ezpool/connection_wrapper.rb', line 17

def age
  EzPool.monotonic_time - @created_at
end

#shutdown!Object

Shut down the connection. Can no longer be used after this!



13
14
15
# File 'lib/ezpool/connection_wrapper.rb', line 13

def shutdown!
  @manager.disconnect(@raw_conn)
end