summaryrefslogtreecommitdiff
path: root/lib/irb/command/pushws.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irb/command/pushws.rb')
-rw-r--r--lib/irb/command/pushws.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/irb/command/pushws.rb b/lib/irb/command/pushws.rb
index 888fe466f1..b51928c650 100644
--- a/lib/irb/command/pushws.rb
+++ b/lib/irb/command/pushws.rb
@@ -14,7 +14,7 @@ module IRB
category "Workspace"
description "Show workspaces."
- def execute(*obj)
+ def execute(_arg)
inspection_resuls = irb_context.instance_variable_get(:@workspace_stack).map do |ws|
truncated_inspect(ws.main)
end
@@ -39,8 +39,13 @@ module IRB
category "Workspace"
description "Push an object to the workspace stack."
- def execute(*obj)
- irb_context.push_workspace(*obj)
+ def execute(arg)
+ if arg.empty?
+ irb_context.push_workspace
+ else
+ obj = eval(arg, irb_context.workspace.binding)
+ irb_context.push_workspace(obj)
+ end
super
end
end
@@ -49,8 +54,8 @@ module IRB
category "Workspace"
description "Pop a workspace from the workspace stack."
- def execute(*obj)
- irb_context.pop_workspace(*obj)
+ def execute(_arg)
+ irb_context.pop_workspace
super
end
end