Class: TappingDevice::Payload

Inherits:
Object
  • Object
show all
Defined in:
lib/tapping_device/payload.rb

Constant Summary collapse

ATTRS =
[
  :target, :receiver, :method_name, :method_object, :arguments, :return_value, :filepath, :line_number,
  :defined_class, :trace, :tag, :tp, :ivar_changes, :is_private_call
]

Instance Method Summary collapse

Constructor Details

#initialize(target:, receiver:, method_name:, method_object:, arguments:, return_value:, filepath:, line_number:, defined_class:, trace:, tag:, tp:, is_private_call:) ⇒ Payload

Returns a new instance of Payload.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/tapping_device/payload.rb', line 12

def initialize(
  target:, receiver:, method_name:, method_object:, arguments:, return_value:, filepath:, line_number:,
  defined_class:, trace:, tag:, tp:, is_private_call:
)
  @target = target
  @receiver = receiver
  @method_name = method_name
  @method_object = method_object
  @arguments = arguments
  @return_value = return_value
  @filepath = filepath
  @line_number = line_number
  @defined_class = defined_class
  @trace = trace
  @tag = tag
  @tp = tp
  @ivar_changes = {}
  @is_private_call = is_private_call
end

Instance Method Details

#location(options = {}) ⇒ Object



36
37
38
# File 'lib/tapping_device/payload.rb', line 36

def location(options = {})
  "#{filepath}:#{line_number}"
end

#method_headObject



32
33
34
# File 'lib/tapping_device/payload.rb', line 32

def method_head
  method_object.source.strip if method_object.source_location
end