diff --git a/lib/irb/command/pushws.rb b/lib/irb/command/pushws.rb index b51928c65..9713b8142 100644 --- a/lib/irb/command/pushws.rb +++ b/lib/irb/command/pushws.rb @@ -13,13 +13,14 @@ 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| + 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 @@ -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