Class: TraceViz::TraceData::TracePoint::MethodCall

Inherits:
Base
  • Object
show all
Includes:
Helpers::TracePoint::ParamHelper
Defined in:
lib/trace_viz/trace_data/trace_point/method_call.rb

Constant Summary

Constants included from Helpers::TracePoint::ParamHelper

Helpers::TracePoint::ParamHelper::IGNORED_METHODS, Helpers::TracePoint::ParamHelper::IGNORED_VARIABLES

Instance Attribute Summary collapse

Attributes inherited from Base

#action, #event, #klass, #line_number, #memory_id, #path, #trace_point

Attributes included from TraceViz::Traits::Identifiable

#action_id, #id

Attributes inherited from Node

#children, #parent

Attributes included from TraceViz::Traits::TimeTrackable

#timestamp

Attributes included from TraceViz::Traits::DepthTrackable

#depth

Instance Method Summary collapse

Methods included from Helpers::TracePoint::ParamHelper

#extract_parameters_from_signature, #extract_params, #fetch_method_via_instance_method, #placeholder_parameter?, #safe_eval, #safe_local_variable_get, #should_ignore_method?, #should_ignore_parameter?, #should_ignore_variable?, #splat_parameter?

Methods inherited from Base

#key

Methods included from TraceViz::Traits::Identifiable

#assign_ids

Methods inherited from Node

#add_child, #add_children

Methods inherited from Base

#action, #event, #key, #klass, #line_number, #path

Methods included from TraceViz::Traits::TimeTrackable

#record_timestamp

Methods included from TraceViz::Traits::DepthTrackable

#assign_depth

Methods included from Helpers::ConfigHelper

#config, #fetch_general_config

Constructor Details

#initialize(trace_point) ⇒ MethodCall

Returns a new instance of MethodCall.



14
15
16
17
18
# File 'lib/trace_viz/trace_data/trace_point/method_call.rb', line 14

def initialize(trace_point)
  super(trace_point)

  populate_params
end

Instance Attribute Details

#method_returnObject (readonly)

Returns the value of attribute method_return.



12
13
14
# File 'lib/trace_viz/trace_data/trace_point/method_call.rb', line 12

def method_return
  @method_return
end

#paramsObject (readonly)

Returns the value of attribute params.



12
13
14
# File 'lib/trace_viz/trace_data/trace_point/method_call.rb', line 12

def params
  @params
end

Instance Method Details

#durationObject



28
29
30
31
32
# File 'lib/trace_viz/trace_data/trace_point/method_call.rb', line 28

def duration
  return 0 unless method_return

  method_return.timestamp - timestamp
end


24
25
26
# File 'lib/trace_viz/trace_data/trace_point/method_call.rb', line 24

def link(method_return)
  @method_return = method_return
end

#resultObject



20
21
22
# File 'lib/trace_viz/trace_data/trace_point/method_call.rb', line 20

def result
  method_return&.result
end

#to_hObject



34
35
36
37
38
39
40
41
# File 'lib/trace_viz/trace_data/trace_point/method_call.rb', line 34

def to_h
  super.merge(
    {
      params: params,
      method_return_id: method_return&.id,
    },
  )
end