pry would be great for debugging a subclass of BasicObject !
https://github.com/pry/pry says that pry has: "Exotic object support (BasicObject instances..."
But how to do that? As can be expected a BasicObject does not understand binding.
NameError:
undefined local variable or method `binding' for #<C30Course:0xbefbc0c>
When method_missing is invoked, where to send binding?
You'll need to directly call the binding
method on Kernel
like this:
[13] pry(main)> class O < BasicObject
| def hi
| x = 10
| ::Kernel.binding.pry
| end
| end
=> nil
[14] pry(main)> O.new.hi
From: (pry) @ line 19 O#hi:
17: def hi
18: x = 10
=> 19: ::Kernel.binding.pry
20: end
[1] pry(unknown)> x
=> 10
[2] pry(unknown)> self
=> #<O:0x3fd5310d04f8>