Class: LogConnectionName::AbstractAdapter::ConnectionName::InstrumenterDecorator
- Inherits:
-
Object
- Object
- LogConnectionName::AbstractAdapter::ConnectionName::InstrumenterDecorator
- Defined in:
- lib/log_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.
24 25 26 27 |
# File 'lib/log_connection_name.rb', line 24 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
34 35 36 |
# File 'lib/log_connection_name.rb', line 34 def method_missing(meth, *args, &block) @instrumenter.send(meth, *args, &block) end |
Instance Method Details
#instrument(name, payload = {}, &block) ⇒ Object
29 30 31 32 |
# File 'lib/log_connection_name.rb', line 29 def instrument(name, payload = {}, &block) payload[:connection_name] ||= @adapter.connection_name @instrumenter.instrument(name, payload, &block) end |