Class: ActiveRecordHostPool::ConnectionProxy

Inherits:
Delegator
  • Object
show all
Defined in:
lib/active_record_host_pool/connection_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(cx, database) ⇒ ConnectionProxy

Returns a new instance of ConnectionProxy.



7
8
9
10
11
# File 'lib/active_record_host_pool/connection_proxy.rb', line 7

def initialize(cx, database)
  super(cx)
  @cx = cx
  @database = database
end

Instance Method Details

#__getobj__Object



13
14
15
16
# File 'lib/active_record_host_pool/connection_proxy.rb', line 13

def __getobj__
  @cx._host_pool_current_database = @database
  @cx
end

#__setobj__(cx) ⇒ Object



18
19
20
# File 'lib/active_record_host_pool/connection_proxy.rb', line 18

def __setobj__(cx)
  @cx = cx
end

#classObject

this is bad. I know. but it allows folks who class_eval on connection.class to do so



27
28
29
# File 'lib/active_record_host_pool/connection_proxy.rb', line 27

def class
  @cx.class
end

#expects(*args) ⇒ Object



31
32
33
# File 'lib/active_record_host_pool/connection_proxy.rb', line 31

def expects(*args)
  @cx.send(:expects, *args)
end

#unproxiedObject



22
23
24
# File 'lib/active_record_host_pool/connection_proxy.rb', line 22

def unproxied
  @cx
end