From eadf042183c7124823fe1f98098bbba33d769539 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/irb/command/pushws.rb b/lib/irb/command/pushws.rb index b51928c65..398cb29b3 100644 --- a/lib/irb/command/pushws.rb +++ b/lib/irb/command/pushws.rb @@ -25,10 +25,11 @@ def execute(_arg) private def truncated_inspect(obj) + threshold = 20 obj_inspection = obj.inspect - if obj_inspection.size > 20 - obj_inspection = obj_inspection[0, 19] + "...>" + if obj_inspection.size > threshold + obj_inspection = obj_inspection[0, threshold - 1] + "...>" end obj_inspection From 40cbed4ac0fbe23c5241e706c3cae95eb19f6c55 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 398cb29b3..0c2dd9e92 100644 --- a/lib/irb/command/pushws.rb +++ b/lib/irb/command/pushws.rb @@ -15,11 +15,11 @@ class Workspaces < Base description "Show workspaces." 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