From b75ac8ce2cb584e5356bed69b7825f00f5d4b942 Mon Sep 17 00:00:00 2001 From: Gabriel Lidenor Date: Sat, 5 Sep 2026 16:17:45 -0500 Subject: [PATCH 1/2] refactor: magic number 20 does not explain well what we are doing --- lib/irb/command/pushws.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/irb/command/pushws.rb b/lib/irb/command/pushws.rb index b51928c65..fccb4878a 100644 --- a/lib/irb/command/pushws.rb +++ b/lib/irb/command/pushws.rb @@ -13,6 +13,7 @@ module Command class Workspaces < Base category "Workspace" description "Show workspaces." + MAX_WORKSPACE_INSPECT_LENGTH = 20 def execute(_arg) inspection_resuls = irb_context.instance_variable_get(:@workspace_stack).map do |ws| @@ -27,7 +28,7 @@ def execute(_arg) def truncated_inspect(obj) obj_inspection = obj.inspect - if obj_inspection.size > 20 + if obj_inspection.size > MAX_WORKSPACE_INSPECT_LENGTH obj_inspection = obj_inspection[0, 19] + "...>" end From ca9a73277989ffca5699caaf60284a89f9ee9822 Mon Sep 17 00:00:00 2001 From: Gabriel Lidenor Date: Sat, 5 Sep 2026 16:18:43 -0500 Subject: [PATCH 2/2] fix: typo inspection_resuls --- lib/irb/command/pushws.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/irb/command/pushws.rb b/lib/irb/command/pushws.rb index fccb4878a..9713b8142 100644 --- a/lib/irb/command/pushws.rb +++ b/lib/irb/command/pushws.rb @@ -16,11 +16,11 @@ class Workspaces < Base MAX_WORKSPACE_INSPECT_LENGTH = 20 def execute(_arg) - inspection_resuls = irb_context.instance_variable_get(:@workspace_stack).map do |ws| + inspection_results = irb_context.instance_variable_get(:@workspace_stack).map do |ws| truncated_inspect(ws.main) end - puts "[" + inspection_resuls.join(", ") + "]" + puts "[" + inspection_results.join(", ") + "]" end private