Skip to content

Commit

Permalink
[ruby/irb] Centralize rstrip calls
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 authored and matzbot committed Apr 10, 2024
1 parent d60b2ca commit d75dc39
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/irb/command/backtrace.rb
Expand Up @@ -8,7 +8,7 @@ module IRB
module Command
class Backtrace < DebugCommand
def execute(arg)
execute_debug_command(pre_cmds: "backtrace #{arg}".rstrip)
execute_debug_command(pre_cmds: "backtrace #{arg}")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/irb/command/break.rb
Expand Up @@ -8,7 +8,7 @@ module IRB
module Command
class Break < DebugCommand
def execute(arg)
execute_debug_command(pre_cmds: "break #{arg}".rstrip)
execute_debug_command(pre_cmds: "break #{arg}")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/irb/command/catch.rb
Expand Up @@ -8,7 +8,7 @@ module IRB
module Command
class Catch < DebugCommand
def execute(arg)
execute_debug_command(pre_cmds: "catch #{arg}".rstrip)
execute_debug_command(pre_cmds: "catch #{arg}")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/irb/command/continue.rb
Expand Up @@ -8,7 +8,7 @@ module IRB
module Command
class Continue < DebugCommand
def execute(arg)
execute_debug_command(do_cmds: "continue #{arg}".rstrip)
execute_debug_command(do_cmds: "continue #{arg}")
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions lib/irb/command/debug.rb
Expand Up @@ -18,6 +18,9 @@ def execute(_arg)
end

def execute_debug_command(pre_cmds: nil, do_cmds: nil)
pre_cmds = pre_cmds&.rstrip
do_cmds = do_cmds&.rstrip

if irb_context.with_debugger
# If IRB is already running with a debug session, throw the command and IRB.debug_readline will pass it to the debugger.
if cmd = pre_cmds || do_cmds
Expand Down
2 changes: 1 addition & 1 deletion lib/irb/command/delete.rb
Expand Up @@ -8,7 +8,7 @@ module IRB
module Command
class Delete < DebugCommand
def execute(arg)
execute_debug_command(pre_cmds: "delete #{arg}".rstrip)
execute_debug_command(pre_cmds: "delete #{arg}")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/irb/command/finish.rb
Expand Up @@ -8,7 +8,7 @@ module IRB
module Command
class Finish < DebugCommand
def execute(arg)
execute_debug_command(do_cmds: "finish #{arg}".rstrip)
execute_debug_command(do_cmds: "finish #{arg}")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/irb/command/info.rb
Expand Up @@ -8,7 +8,7 @@ module IRB
module Command
class Info < DebugCommand
def execute(arg)
execute_debug_command(pre_cmds: "info #{arg}".rstrip)
execute_debug_command(pre_cmds: "info #{arg}")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/irb/command/next.rb
Expand Up @@ -8,7 +8,7 @@ module IRB
module Command
class Next < DebugCommand
def execute(arg)
execute_debug_command(do_cmds: "next #{arg}".rstrip)
execute_debug_command(do_cmds: "next #{arg}")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/irb/command/step.rb
Expand Up @@ -8,7 +8,7 @@ module IRB
module Command
class Step < DebugCommand
def execute(arg)
execute_debug_command(do_cmds: "step #{arg}".rstrip)
execute_debug_command(do_cmds: "step #{arg}")
end
end
end
Expand Down

0 comments on commit d75dc39

Please sign in to comment.