Class: IRB::Command::CD
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
category, description, execute, help_message, #initialize
Constructor Details
This class inherits a constructor from IRB::Command::Base
Instance Method Details
permalink #execute(arg) ⇒ Object
[View source]
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/irb/command/cd.rb', line 29 def execute(arg) case arg when ".." irb_context.pop_workspace when "" # TODO: decide what workspace commands should be kept, and underlying APIs should look like, # and perhaps add a new API to clear the workspace stack. prev_workspace = irb_context.pop_workspace while prev_workspace prev_workspace = irb_context.pop_workspace end else begin obj = eval(arg, irb_context.workspace.binding) irb_context.push_workspace(obj) rescue StandardError => e warn "Error: #{e}" end end end |