Class: AppMap::Event::MethodCall

Inherits:
MethodEvent show all
Defined in:
lib/appmap/event.rb

Constant Summary

Constants inherited from MethodEvent

AppMap::Event::MethodEvent::LIMIT

Instance Attribute Summary collapse

Attributes inherited from MethodEventStruct

#defined_class, #event, #id, #lineno, #method_id, #path, #static, #thread_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from MethodEvent

display_string

Instance Attribute Details

#parametersObject

Returns the value of attribute parameters.



69
70
71
# File 'lib/appmap/event.rb', line 69

def parameters
  @parameters
end

#receiverObject

Returns the value of attribute receiver.



69
70
71
# File 'lib/appmap/event.rb', line 69

def receiver
  @receiver
end

Class Method Details

.build_from_invocation(mc = MethodCall.new, defined_class, method, receiver, arguments) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/appmap/event.rb', line 72

def build_from_invocation(mc = MethodCall.new, defined_class, method, receiver, arguments)
  mc.tap do
    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)
    }
    MethodEvent.build_from_invocation(mc, :call, defined_class, method)
  end
end

Instance Method Details

#to_hObject



96
97
98
99
100
101
# File 'lib/appmap/event.rb', line 96

def to_h
  super.tap do |h|
    h[:parameters] = parameters
    h[:receiver] = receiver
  end
end