Class: AppMap::Event::MethodCall
- Inherits:
-
MethodEvent
- Object
- Struct
- MethodEventStruct
- MethodEvent
- AppMap::Event::MethodCall
- Defined in:
- lib/appmap/event.rb
Direct Known Subclasses
Rails::ActionHandler::HTTPServerRequest::Call, Rails::SQLHandler::SQLCall
Constant Summary
Constants inherited from MethodEvent
AppMap::Event::MethodEvent::LIMIT
Instance Attribute Summary collapse
-
#defined_class ⇒ Object
Returns the value of attribute defined_class.
-
#lineno ⇒ Object
Returns the value of attribute lineno.
-
#method_id ⇒ Object
Returns the value of attribute method_id.
-
#parameters ⇒ Object
Returns the value of attribute parameters.
-
#path ⇒ Object
Returns the value of attribute path.
-
#receiver ⇒ Object
Returns the value of attribute receiver.
-
#static ⇒ Object
(also: #static?)
Returns the value of attribute static.
Attributes inherited from MethodEventStruct
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from MethodEvent
Instance Attribute Details
#defined_class ⇒ Object
Returns the value of attribute defined_class.
58 59 60 |
# File 'lib/appmap/event.rb', line 58 def defined_class @defined_class end |
#lineno ⇒ Object
Returns the value of attribute lineno.
58 59 60 |
# File 'lib/appmap/event.rb', line 58 def lineno @lineno end |
#method_id ⇒ Object
Returns the value of attribute method_id.
58 59 60 |
# File 'lib/appmap/event.rb', line 58 def method_id @method_id end |
#parameters ⇒ Object
Returns the value of attribute parameters.
58 59 60 |
# File 'lib/appmap/event.rb', line 58 def parameters @parameters end |
#path ⇒ Object
Returns the value of attribute path.
58 59 60 |
# File 'lib/appmap/event.rb', line 58 def path @path end |
#receiver ⇒ Object
Returns the value of attribute receiver.
58 59 60 |
# File 'lib/appmap/event.rb', line 58 def receiver @receiver end |
#static ⇒ Object Also known as: static?
Returns the value of attribute static.
58 59 60 |
# File 'lib/appmap/event.rb', line 58 def static @static end |
Class Method Details
.build_from_invocation(mc = MethodCall.new, defined_class, method, receiver, arguments) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/appmap/event.rb', line 61 def build_from_invocation(mc = MethodCall.new, defined_class, method, receiver, arguments) mc.tap do static = receiver.is_a?(Module) mc.defined_class = defined_class mc.method_id = method.name.to_s if method.source_location path = method.source_location[0] path = path[Dir.pwd.length + 1..-1] if path.index(Dir.pwd) == 0 mc.path = path mc.lineno = method.source_location[1] else mc.path = [ defined_class, static ? '.' : '#', method.name ].join end mc.parameters = method.parameters.map.with_index do |method_param, idx| param_type, param_name = method_param param_name ||= 'arg' value = arguments[idx] { name: param_name, class: value.class.name, object_id: value.__id__, value: display_string(value), kind: param_type } end mc.receiver = { class: receiver.class.name, object_id: receiver.__id__, value: display_string(receiver) } mc.static = static MethodEvent.build_from_invocation(mc, :call) end end |
Instance Method Details
#to_h ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/appmap/event.rb', line 97 def to_h super.tap do |h| h[:defined_class] = defined_class h[:method_id] = method_id h[:path] = path h[:lineno] = lineno h[:static] = static h[:parameters] = parameters h[:receiver] = receiver h.delete_if { |_, v| v.nil? } end end |