Class: DevSuite::MethodTracer::Tracer
- Inherits:
-
Object
- Object
- DevSuite::MethodTracer::Tracer
- Defined in:
- lib/dev_suite/method_tracer/tracer.rb
Instance Attribute Summary collapse
-
#current_depth ⇒ Object
Returns the value of attribute current_depth.
-
#max_depth ⇒ Object
readonly
Returns the value of attribute max_depth.
-
#show_execution_time ⇒ Object
readonly
Returns the value of attribute show_execution_time.
-
#show_params ⇒ Object
readonly
Returns the value of attribute show_params.
-
#show_results ⇒ Object
readonly
Returns the value of attribute show_results.
-
#start_times ⇒ Object
Returns the value of attribute start_times.
-
#trace_point ⇒ Object
Returns the value of attribute trace_point.
Instance Method Summary collapse
-
#initialize(show_params: false, show_results: false, show_execution_time: false, max_depth: nil) ⇒ Tracer
constructor
A new instance of Tracer.
- #trace(&block) ⇒ Object
Constructor Details
#initialize(show_params: false, show_results: false, show_execution_time: false, max_depth: nil) ⇒ Tracer
Returns a new instance of Tracer.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/dev_suite/method_tracer/tracer.rb', line 9 def initialize( show_params: false, show_results: false, show_execution_time: false, max_depth: nil ) @show_params = show_params @show_results = show_results @show_execution_time = show_execution_time @max_depth = max_depth @start_times = {} @current_depth = 0 end |
Instance Attribute Details
#current_depth ⇒ Object
Returns the value of attribute current_depth.
7 8 9 |
# File 'lib/dev_suite/method_tracer/tracer.rb', line 7 def current_depth @current_depth end |
#max_depth ⇒ Object (readonly)
Returns the value of attribute max_depth.
6 7 8 |
# File 'lib/dev_suite/method_tracer/tracer.rb', line 6 def max_depth @max_depth end |
#show_execution_time ⇒ Object (readonly)
Returns the value of attribute show_execution_time.
6 7 8 |
# File 'lib/dev_suite/method_tracer/tracer.rb', line 6 def show_execution_time @show_execution_time end |
#show_params ⇒ Object (readonly)
Returns the value of attribute show_params.
6 7 8 |
# File 'lib/dev_suite/method_tracer/tracer.rb', line 6 def show_params @show_params end |
#show_results ⇒ Object (readonly)
Returns the value of attribute show_results.
6 7 8 |
# File 'lib/dev_suite/method_tracer/tracer.rb', line 6 def show_results @show_results end |
#start_times ⇒ Object
Returns the value of attribute start_times.
7 8 9 |
# File 'lib/dev_suite/method_tracer/tracer.rb', line 7 def start_times @start_times end |
#trace_point ⇒ Object
Returns the value of attribute trace_point.
7 8 9 |
# File 'lib/dev_suite/method_tracer/tracer.rb', line 7 def trace_point @trace_point end |
Instance Method Details
#trace(&block) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/dev_suite/method_tracer/tracer.rb', line 23 def trace(&block) setup_trace_point trace_point.enable block.call ensure trace_point&.disable end |