Method: AppMap::Hook.already_hooked?

Defined in:
lib/appmap/hook.rb

.already_hooked?(method) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
34
35
36
37
# File 'lib/appmap/hook.rb', line 31

def already_hooked?(method)
  # After a method is defined, the statement "module_function <the-method>" can convert that method
  # into a module (class) method. The method is hooked first when it's defined, then AppMap will attempt to
  # hook it again when it's redefined as a module method. So we check the method source location - if it's
  # part of the AppMap source tree, we ignore it.
  method.source_location && method.source_location[0].index(__dir__) == 0
end