Class: AppMap::Event::MethodReturn
- Inherits:
-
MethodReturnIgnoreValue
- Object
- Struct
- MethodEventStruct
- MethodEvent
- MethodReturnIgnoreValue
- AppMap::Event::MethodReturn
- Defined in:
- lib/appmap/event.rb
Constant Summary
Constants inherited from MethodEvent
AppMap::Event::MethodEvent::LIMIT
Instance Attribute Summary collapse
-
#exceptions ⇒ Object
Returns the value of attribute exceptions.
-
#return_value ⇒ Object
Returns the value of attribute return_value.
Attributes inherited from MethodReturnIgnoreValue
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
Instance Attribute Details
#exceptions ⇒ Object
Returns the value of attribute exceptions.
126 127 128 |
# File 'lib/appmap/event.rb', line 126 def exceptions @exceptions end |
#return_value ⇒ Object
Returns the value of attribute return_value.
126 127 128 |
# File 'lib/appmap/event.rb', line 126 def return_value @return_value end |
Class Method Details
.build_from_invocation(mr = MethodReturn.new, defined_class, method, parent_id, elapsed, return_value, exception) ⇒ Object
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/appmap/event.rb', line 129 def build_from_invocation(mr = MethodReturn.new, defined_class, method, parent_id, elapsed, return_value, exception) mr.tap do |_| if return_value mr.return_value = { class: return_value.class.name, value: display_string(return_value), object_id: return_value.__id__ } end if exception next_exception = exception exceptions = [] while next_exception exception_backtrace = next_exception.backtrace_locations.try(:[], 0) exceptions << { class: next_exception.class.name, message: next_exception., object_id: next_exception.__id__, path: exception_backtrace&.path, lineno: exception_backtrace&.lineno }.compact next_exception = next_exception.cause end mr.exceptions = exceptions end MethodReturnIgnoreValue.build_from_invocation(mr, defined_class, method, parent_id, elapsed) end end |
Instance Method Details
#to_h ⇒ Object
160 161 162 163 164 165 |
# File 'lib/appmap/event.rb', line 160 def to_h super.tap do |h| h[:return_value] = return_value if return_value h[:exceptions] = exceptions if exceptions end end |