Class: AppMap::Event::MethodReturn
- Inherits:
-
MethodReturnIgnoreValue
- Object
- Struct
- MethodEventStruct
- MethodEvent
- MethodReturnIgnoreValue
- AppMap::Event::MethodReturn
- Defined in:
- lib/appmap/event.rb
Direct Known Subclasses
Constant Summary
Constants inherited from MethodEvent
AppMap::Event::MethodEvent::MAX_ARRAY_ENUMERATION, AppMap::Event::MethodEvent::MAX_HASH_ENUMERATION, AppMap::Event::MethodEvent::MAX_STRING_LENGTH
Constants included from ValueInspector
ValueInspector::MAX_ARRAY_ELEMENTS, ValueInspector::MAX_DEPTH
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
#elapsed, #elapsed_instrumentation, #parent_id
Attributes inherited from MethodEventStruct
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from MethodEvent
add_schema, add_size, custom_display_string, default_display_string, display_string, encode_display_string, #ready?
Methods included from ValueInspector
#best_class_name, #detect_schema, #detect_size
Instance Attribute Details
#exceptions ⇒ Object
Returns the value of attribute exceptions.
270 271 272 |
# File 'lib/appmap/event.rb', line 270 def exceptions @exceptions end |
#return_value ⇒ Object
Returns the value of attribute return_value.
270 271 272 |
# File 'lib/appmap/event.rb', line 270 def return_value @return_value end |
Class Method Details
.build_from_invocation(parent_id, return_value, exception, elapsed: nil, event: MethodReturn.new, parameter_schema: false) ⇒ Object
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'lib/appmap/event.rb', line 273 def build_from_invocation(parent_id, return_value, exception, elapsed: nil, event: MethodReturn.new, parameter_schema: false) event ||= MethodReturn.new event.tap do |_| if return_value event.return_value = { class: best_class_name(return_value), value: display_string(return_value), object_id: return_value.__id__ }.tap do |param| add_size param, return_value add_schema param, return_value if parameter_schema && !exception end end if exception next_exception = exception exceptions = [] while next_exception exception_backtrace = AppMap::Util.try(next_exception.backtrace_locations, :[], 0) exceptions << { class: best_class_name(next_exception), message: display_string(next_exception.), object_id: next_exception.__id__, path: exception_backtrace&.path, lineno: exception_backtrace&.lineno }.compact next_exception = next_exception.cause end event.exceptions = exceptions end MethodReturnIgnoreValue.build_from_invocation(parent_id, elapsed: elapsed, event: event) end end |
Instance Method Details
#to_h ⇒ Object
308 309 310 311 312 313 |
# File 'lib/appmap/event.rb', line 308 def to_h super.tap do |h| h[:return_value] = return_value if return_value h[:exceptions] = exceptions if exceptions end end |