Class: IRB::Command::ChangeWorkspace

Inherits:
Base show all
Defined in:
lib/irb/command/chws.rb

Instance Attribute Summary

Attributes inherited from Base

#irb_context

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

#execute(arg) ⇒ Object

[View source]

26
27
28
29
30
31
32
33
34
35
# File 'lib/irb/command/chws.rb', line 26

def execute(arg)
  if arg.empty?
    irb_context.change_workspace
  else
    obj = eval(arg, irb_context.workspace.binding)
    irb_context.change_workspace(obj)
  end

  puts "Current workspace: #{irb_context.main}"
end