Skip to content

Conversation

QWYNG
Copy link
Contributor

@QWYNG QWYNG commented May 6, 2025

enhancement for #1083

Implemented the ability for users to automatically execute commands like do and pre in the debug gem.

Note: I tried using the debug gem to see what happens when pre and do are specified at the same time. It seems that pre is given priority, and do is not executed, so that is the specification.

➜ ruby -v
ruby 3.4.3 (2025-04-14 revision d0b7e5b6a0) +PRISM [arm64-darwin24]
➜ rdbg -v
rdbg 1.10.0
➜ rdbg --nonstop --no-sigint-hook do_pre.rb
[1, 9] in do_pre.rb
     1|
     2| def foo
     3|   @a = 'hello'
     4|   @b = 'world'
=>   5|   binding.b(pre: "p @a", do: "p @b")
     6| end
     7|
     8| foo
     9|
=>#0    Object#foo at do_pre.rb:5
  #1    <main> at do_pre.rb:8
(rdbg:#debugger) p @a
=> "hello"
(rdbg)

Thank you for maintaining this great Ruby feature.

@QWYNG QWYNG marked this pull request as draft May 6, 2025 03:41
@QWYNG QWYNG force-pushed the add_do_pre_command branch 4 times, most recently from aa7dd18 to 4a6fabf Compare May 6, 2025 04:30
@QWYNG QWYNG force-pushed the add_do_pre_command branch from 4a6fabf to 84d22ce Compare May 6, 2025 04:33
@QWYNG QWYNG marked this pull request as ready for review May 6, 2025 04:40
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

Successfully merging this pull request may close these issues.

1 participant