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
Instance Attribute Details
#exceptions ⇒ Object
Returns the value of attribute exceptions.
178 179 180 |
# File 'lib/appmap/event.rb', line 178 def exceptions @exceptions end |
#return_value ⇒ Object
Returns the value of attribute return_value.
178 179 180 |
# File 'lib/appmap/event.rb', line 178 def return_value @return_value end |
Class Method Details
.build_from_invocation(mr = MethodReturn.new, parent_id, elapsed, return_value, exception) ⇒ Object
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/appmap/event.rb', line 181 def build_from_invocation(mr = MethodReturn.new, parent_id, elapsed, return_value, exception) mr.tap do |_| if return_value mr.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: 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, parent_id, elapsed) end end |
Instance Method Details
#to_h ⇒ Object
212 213 214 215 216 217 |
# File 'lib/appmap/event.rb', line 212 def to_h super.tap do |h| h[:return_value] = return_value if return_value h[:exceptions] = exceptions if exceptions end end |