Class: DbCharmer::ConnectionProxy
- Inherits:
- ActiveSupport::BasicObject
- Defined in:
- lib/db_charmer/connection_proxy.rb
Instance Attribute Summary collapse
-
#abstract_connection_class ⇒ Object
We use this to get a connection class from the proxy.
Instance Method Summary collapse
- #db_charmer_connection_name ⇒ Object
- #db_charmer_connection_proxy ⇒ Object
-
#initialize(abstract_class, db_name) ⇒ ConnectionProxy
constructor
A new instance of ConnectionProxy.
- #method_missing(meth, *args, &block) ⇒ Object
Constructor Details
#initialize(abstract_class, db_name) ⇒ ConnectionProxy
Returns a new instance of ConnectionProxy.
10 11 12 13 |
# File 'lib/db_charmer/connection_proxy.rb', line 10 def initialize(abstract_class, db_name) @abstract_connection_class = abstract_class @db_name = db_name end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
23 24 25 |
# File 'lib/db_charmer/connection_proxy.rb', line 23 def method_missing(meth, *args, &block) @abstract_connection_class.retrieve_connection.send(meth, *args, &block) end |
Instance Attribute Details
#abstract_connection_class ⇒ Object
We use this to get a connection class from the proxy
8 9 10 |
# File 'lib/db_charmer/connection_proxy.rb', line 8 def abstract_connection_class @abstract_connection_class end |
Instance Method Details
#db_charmer_connection_name ⇒ Object
15 16 17 |
# File 'lib/db_charmer/connection_proxy.rb', line 15 def db_charmer_connection_name @db_name end |
#db_charmer_connection_proxy ⇒ Object
19 20 21 |
# File 'lib/db_charmer/connection_proxy.rb', line 19 def db_charmer_connection_proxy self end |