Class: Amalgalite::TraceTap
- Inherits:
-
Object
- Object
- Amalgalite::TraceTap
- Defined in:
- lib/amalgalite/trace_tap.rb
Overview
A TraceTap receives tracing information from SQLite3. It receives the SQL statement being executed as a msg
just before the statement first begins executing.
A TraceTap is a wrapper around another object and a method. The Tap object will receive the call to trace
and redirect that call to another object and method.
Instance Attribute Summary collapse
-
#delegate_method ⇒ Object
readonly
Returns the value of attribute delegate_method.
-
#delegate_obj ⇒ Object
readonly
Returns the value of attribute delegate_obj.
Instance Method Summary collapse
-
#initialize(wrapped_obj, send_to = 'trace') ⇒ TraceTap
constructor
A new instance of TraceTap.
- #trace(msg) ⇒ Object
Constructor Details
#initialize(wrapped_obj, send_to = 'trace') ⇒ TraceTap
Returns a new instance of TraceTap.
21 22 23 24 25 26 27 28 |
# File 'lib/amalgalite/trace_tap.rb', line 21 def initialize( wrapped_obj, send_to = 'trace' ) unless wrapped_obj.respond_to?( send_to ) raise Amalgalite::Error, "#{wrapped_obj.class.name} does not respond to #{send_to.to_s} " end @delegate_obj = wrapped_obj @delegate_method = send_to end |
Instance Attribute Details
#delegate_method ⇒ Object (readonly)
Returns the value of attribute delegate_method.
19 20 21 |
# File 'lib/amalgalite/trace_tap.rb', line 19 def delegate_method @delegate_method end |
#delegate_obj ⇒ Object (readonly)
Returns the value of attribute delegate_obj.
18 19 20 |
# File 'lib/amalgalite/trace_tap.rb', line 18 def delegate_obj @delegate_obj end |
Instance Method Details
#trace(msg) ⇒ Object
30 31 32 |
# File 'lib/amalgalite/trace_tap.rb', line 30 def trace( msg ) delegate_obj.send( delegate_method, msg ) end |