Class: AppMap::Event::MethodEvent
- Inherits:
-
MethodEventStruct
- Object
- Struct
- MethodEventStruct
- AppMap::Event::MethodEvent
- Defined in:
- lib/appmap/event.rb
Direct Known Subclasses
MethodCall, MethodReturnIgnoreValue, Rails::ActionHandler::HTTPServerRequest::Call, Rails::SQLHandler::SQLCall
Constant Summary collapse
- LIMIT =
100
Instance Attribute Summary
Attributes inherited from MethodEventStruct
#defined_class, #event, #id, #lineno, #method_id, #path, #static, #thread_id
Class Method Summary collapse
- .build_from_invocation(me, event_type, defined_class, method) ⇒ Object
-
.display_string(value) ⇒ Object
Gets a display string for a value.
Class Method Details
.build_from_invocation(me, event_type, defined_class, method) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/appmap/event.rb', line 24 def build_from_invocation(me, event_type, defined_class, method) singleton = method.owner.singleton_class? me.id = AppMap::Event.next_id_counter me.event = event_type me.defined_class = defined_class me.method_id = method.name.to_s path = method.source_location[0] path = path[Dir.pwd.length + 1..-1] if path.index(Dir.pwd) == 0 me.path = path me.lineno = method.source_location[1] me.static = singleton me.thread_id = Thread.current.object_id end |
.display_string(value) ⇒ Object
Gets a display string for a value. This is not meant to be a machine deserializable value.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/appmap/event.rb', line 40 def display_string(value) return nil unless value last_resort_string = lambda do warn "AppMap encountered an error inspecting a #{value.class.name}: #{$!.}" '*Error inspecting variable*' end value_string = \ begin value.to_s rescue NoMethodError begin value.inspect rescue StandardError last_resort_string.call end rescue StandardError last_resort_string.call end (value_string||'')[0...LIMIT].encode('utf-8', invalid: :replace, undef: :replace, replace: '_') end |