Class: VisualizeRuby::ExecutionTracer
- Inherits:
-
Object
- Object
- VisualizeRuby::ExecutionTracer
- Defined in:
- lib/visualize_ruby/execution_tracer.rb
Constant Summary collapse
- TRACE_POINT_OPTIONS =
[ :line ]
Instance Attribute Summary collapse
-
#executed_events ⇒ Object
readonly
Returns the value of attribute executed_events.
Instance Method Summary collapse
-
#initialize(builder = nil, ruby_code: builder.ruby_code, calling_code:, trace_point_options: TRACE_POINT_OPTIONS) ⇒ ExecutionTracer
constructor
A new instance of ExecutionTracer.
- #trace ⇒ Object
Constructor Details
#initialize(builder = nil, ruby_code: builder.ruby_code, calling_code:, trace_point_options: TRACE_POINT_OPTIONS) ⇒ ExecutionTracer
Returns a new instance of ExecutionTracer.
13 14 15 16 17 18 19 |
# File 'lib/visualize_ruby/execution_tracer.rb', line 13 def initialize(builder = nil, ruby_code: builder.ruby_code, calling_code:, trace_point_options: TRACE_POINT_OPTIONS) @ruby_code = InputCoercer.new(ruby_code, name: :ruby_code).tap(&:to_file) @calling_code = InputCoercer.new(calling_code, name: :calling_code).tap(&:to_proc) @trace_point_options = @temp_files = [] @executed_events = [] end |
Instance Attribute Details
#executed_events ⇒ Object (readonly)
Returns the value of attribute executed_events.
9 10 11 |
# File 'lib/visualize_ruby/execution_tracer.rb', line 9 def executed_events @executed_events end |
Instance Method Details
#trace ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/visualize_ruby/execution_tracer.rb', line 21 def trace ruby_code.load_file tracer.enable(&calling_code.to_proc) self ensure ruby_code.close! calling_code.close! end |