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
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from MethodEvent
best_class_name, custom_display_string, default_display_string, display_string, encode_dislay_string, object_properties
Instance Attribute Details
#exceptions ⇒ Object
Returns the value of attribute exceptions.
226 227 228 |
# File 'lib/appmap/event.rb', line 226 def exceptions @exceptions end |
#return_value ⇒ Object
Returns the value of attribute return_value.
226 227 228 |
# File 'lib/appmap/event.rb', line 226 def return_value @return_value end |
Class Method Details
.build_from_invocation(parent_id, return_value, exception, elapsed: nil, event: MethodReturn.new) ⇒ Object
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/appmap/event.rb', line 229 def build_from_invocation(parent_id, return_value, exception, elapsed: nil, event: MethodReturn.new) 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__ } end if exception next_exception = exception exceptions = [] while next_exception exception_backtrace = next_exception.backtrace_locations.try(:[], 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
261 262 263 264 265 266 |
# File 'lib/appmap/event.rb', line 261 def to_h super.tap do |h| h[:return_value] = return_value if return_value h[:exceptions] = exceptions if exceptions end end |