Class: Codebeacon::Tracer::NodeBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/codebeacon/tracer/src/models/node_builder.rb

Class Method Summary collapse

Class Method Details

.backtrace_location_eql(loc1, loc2) ⇒ Object



5
6
7
# File 'lib/codebeacon/tracer/src/models/node_builder.rb', line 5

def backtrace_location_eql(loc1, loc2)
  loc1.absolute_path == loc2.absolute_path && loc1.lineno == loc2.lineno && loc1.label == loc2.label
end

.trace_block_call(call_tree, tp, tp_caller) ⇒ Object



14
15
16
17
18
# File 'lib/codebeacon/tracer/src/models/node_builder.rb', line 14

def trace_block_call(call_tree, tp, tp_caller)
  current_context = call_tree.add_block_call
  current_context.block = true
  trace_call(call_tree, tp, tp_caller, :get_block_ast)
end

.trace_method_call(call_tree, tp, tp_caller) ⇒ Object



9
10
11
12
# File 'lib/codebeacon/tracer/src/models/node_builder.rb', line 9

def trace_method_call(call_tree, tp, tp_caller)
  call_tree.add_call
  trace_call(call_tree, tp, tp_caller, :get_method_ast)
end

.trace_return(call_tree, tp) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/codebeacon/tracer/src/models/node_builder.rb', line 20

def trace_return(call_tree, tp)
  begin
    current_context = call_tree.current_node
    variable_values = {}
    current_context.return_value = "--Codebeacon::Tracer ERROR-- could not capture return value"
    previous_line = current_context.trace_status.previous_line
    current_context.return_value = tp.return_value
  ensure
    call_tree.add_return()
  end
end