Skip to content

Proper way of hooking methods named call #344

@ikuo

Description

@ikuo

It looks that we globally ignore methods named call here.

When we want to hook methods named call in our application Ruby classes (./app or ./lib in our case), is there any proper way to do this?

Currently, I'm working around it with a monkey patch like this:

# lib/appmap/hook.rb
module AppMap
  class Hook
    def trace_end(...)
      ...
      local_path = location.delete_prefix(Dir.pwd + '/')
      is_app = local_path.start_with?('app') || local_path.start_with?('lib')
      next if !is_app && method_id == :call

But I think there must be a better way to do this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions