Class: ActiveRecordHostPool::ConnectionProxy
- Inherits:
-
Delegator
- Object
- Delegator
- ActiveRecordHostPool::ConnectionProxy
- Defined in:
- lib/active_record_host_pool/connection_proxy.rb
Instance Method Summary collapse
- #__getobj__ ⇒ Object
- #__setobj__(cx) ⇒ Object
-
#class ⇒ Object
this is bad.
- #expects(*args) ⇒ Object
-
#initialize(cx, database) ⇒ ConnectionProxy
constructor
A new instance of ConnectionProxy.
- #private_methods(all = true) ⇒ Object
-
#respond_to_missing?(m, include_private) ⇒ Boolean
Override Delegator#respond_to_missing? to allow private methods to be accessed without warning.
- #send(symbol, *args, &blk) ⇒ Object
- #unproxied ⇒ Object
Constructor Details
#initialize(cx, database) ⇒ ConnectionProxy
Returns a new instance of ConnectionProxy.
8 9 10 11 12 |
# File 'lib/active_record_host_pool/connection_proxy.rb', line 8 def initialize(cx, database) super(cx) @cx = cx @database = database end |
Instance Method Details
#__getobj__ ⇒ Object
14 15 16 17 |
# File 'lib/active_record_host_pool/connection_proxy.rb', line 14 def __getobj__ @cx._host_pool_current_database = @database @cx end |
#__setobj__(cx) ⇒ Object
19 20 21 |
# File 'lib/active_record_host_pool/connection_proxy.rb', line 19 def __setobj__(cx) @cx = cx end |
#class ⇒ Object
this is bad. I know. but it allows folks who class_eval on connection.class to do so
28 29 30 |
# File 'lib/active_record_host_pool/connection_proxy.rb', line 28 def class @cx.class end |
#expects(*args) ⇒ Object
32 33 34 |
# File 'lib/active_record_host_pool/connection_proxy.rb', line 32 def expects(*args) @cx.send(:expects, *args) end |
#private_methods(all = true) ⇒ Object
41 42 43 |
# File 'lib/active_record_host_pool/connection_proxy.rb', line 41 def private_methods(all=true) __getobj__.private_methods(all) | super end |
#respond_to_missing?(m, include_private) ⇒ Boolean
Override Delegator#respond_to_missing? to allow private methods to be accessed without warning
37 38 39 |
# File 'lib/active_record_host_pool/connection_proxy.rb', line 37 def respond_to_missing?(m, include_private) __getobj__.respond_to?(m, include_private) end |
#send(symbol, *args, &blk) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/active_record_host_pool/connection_proxy.rb', line 45 def send(symbol, *args, &blk) if respond_to?(symbol, true) && !__getobj__.respond_to?(symbol, true) super else __getobj__.send(symbol, *args, &blk) end end |
#unproxied ⇒ Object
23 24 25 |
# File 'lib/active_record_host_pool/connection_proxy.rb', line 23 def unproxied @cx end |