Skip to content

Commit

Permalink
Centralize rstrip calls (#918)
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 authored Apr 10, 2024
1 parent 8fb776e commit 97898b6
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 97898b6

Please sign in to comment.