Module: Neo4Apis::Neolytics::TracePointHelpers
- Defined in:
- lib/neo4apis/neolytics/trace_point_helpers.rb
Constant Summary collapse
- FILE_LINES =
{}
Class Method Summary collapse
- .each_received_arguments(tp) ⇒ Object
- .each_referenced_object(tp) ⇒ Object
- .each_referenced_variable(tp) ⇒ Object
Class Method Details
.each_received_arguments(tp) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/neo4apis/neolytics/trace_point_helpers.rb', line 9 def each_received_arguments(tp) # Can't just use #method method because some objects implement a #method method method = if tp.self.class.instance_method(:method).source_location.nil? tp.self.method(tp.method_id) else tp.self.class.instance_method(tp.method_id) end parameter_names = method.parameters.map {|_, name| name } arguments = parameter_names.compact.each_with_object({}) do |name, arguments| catch :not_found do begin arguments[name] = get_trace_point_var(tp, name) rescue Exception => e require 'pry' binding.pry end end end arguments.each do |name, object| yield name, object end end |
.each_referenced_object(tp) ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/neo4apis/neolytics/trace_point_helpers.rb', line 45 def each_referenced_object(tp) line = get_file_line(tp.path, tp.lineno) root = Parser::CurrentRuby.parse(line) extract_object_references(root).each do |inspect_string| value = tp.binding.eval(inspect_string) yield value end rescue Parser::SyntaxError nil end |
.each_referenced_variable(tp) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/neo4apis/neolytics/trace_point_helpers.rb', line 32 def each_referenced_variable(tp) line = get_file_line(tp.path, tp.lineno) root = Parser::CurrentRuby.parse(line) extract_variables(root).each do |variable| catch :not_found do value = get_trace_point_var(tp, variable) yield variable, value end end rescue Parser::SyntaxError nil end |