Class: DbCharmer::AbstractAdapter::ConnectionName::InstrumenterDecorator
- Inherits:
- ActiveSupport::BasicObject
- Defined in:
- lib/db_charmer/rails3/abstract_adapter/connection_name.rb
Overview
We use this proxy to push connection name down to instrumenters w/o monkey-patching the log method itself
Instance Method Summary collapse
-
#initialize(adapter, instrumenter) ⇒ InstrumenterDecorator
constructor
A new instance of InstrumenterDecorator.
- #instrument(name, payload = {}, &block) ⇒ Object
- #method_missing(meth, *args, &block) ⇒ Object
Constructor Details
#initialize(adapter, instrumenter) ⇒ InstrumenterDecorator
Returns a new instance of InstrumenterDecorator.
7 8 9 10 |
# File 'lib/db_charmer/rails3/abstract_adapter/connection_name.rb', line 7 def initialize(adapter, instrumenter) @adapter = adapter @instrumenter = instrumenter end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
17 18 19 |
# File 'lib/db_charmer/rails3/abstract_adapter/connection_name.rb', line 17 def method_missing(meth, *args, &block) @instrumenter.send(meth, *args, &block) end |
Instance Method Details
#instrument(name, payload = {}, &block) ⇒ Object
12 13 14 15 |
# File 'lib/db_charmer/rails3/abstract_adapter/connection_name.rb', line 12 def instrument(name, payload = {}, &block) payload[:connection_name] ||= @adapter.connection_name @instrumenter.instrument(name, payload, &block) end |