lib/irb/command/pushws.rb in irb-1.12.0 vs lib/irb/command/pushws.rb in irb-1.13.0
- old
+ new
@@ -12,11 +12,11 @@
module Command
class Workspaces < Base
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
puts "[" + inspection_resuls.join(", ") + "]"
@@ -37,21 +37,26 @@
class PushWorkspace < Workspaces
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
class PopWorkspace < Workspaces
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
end