Differentiate between class and instance methods
firelizzard18 opened this issue · 0 comments
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
- Include the above class and
loop { Foo.new.bar; Foo.bar }
intest.rb
- Debug
test.rb
with byebug - Set a method breakpoint with
Foo#bar
orFoo.bar
- Byebug breaks on both the instance and class method, regardless of how the breakpoint is created