Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differentiate between class and instance methods #734

Open
firelizzard18 opened this issue Oct 10, 2020 · 0 comments
Open

Differentiate between class and instance methods #734

firelizzard18 opened this issue Oct 10, 2020 · 0 comments

Comments

@firelizzard18
Copy link
Contributor

Problem description

I want to be able to set a function breakpoint on Foo.method(:bar) separately from Foo.instance_method(:bar). I don't have any strong feelings about how/if this is handled by byebug's frontend/interface, because I am implementing my own interface. For that, I just need some way to create a breakpoint that is instance-only or class/module-only.

class Foo
  def bar
    # ...
  end

  def self.bar
    # ...
  end
end

Expected behavior

When I set a breakpoint on Foo#bar, byebug breaks on the instance method. When I set a breakpoint on Foo.bar, byebug breaks on class method.

Actual behavior

When I set a breakpoint, I cannot specify instance vs class, I can only specify the class name and method name. Because of this and because Byebug's method breakpoint handling is agnostic of instance vs class method, byebug breaks on both methods when I set a method breakpoint.

Steps to reproduce the problem

  1. Include the above class and loop { Foo.new.bar; Foo.bar } in test.rb
  2. Debug test.rb with byebug
  3. Set a method breakpoint with Foo#bar or Foo.bar
  4. Byebug breaks on both the instance and class method, regardless of how the breakpoint is created
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant