Class: DevSystem::IrbCommand

Inherits:
Command show all
Defined in:
lib/dev_system/sub/command/commands/irb_command.rb

Class Method Summary collapse

Methods inherited from Command

#call, get_command_signatures

Methods inherited from Liza::Controller

color, inherited, on_connected

Methods inherited from Liza::Unit

const_missing, division, part, system, #system, test_class

Class Method Details

.call(args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/dev_system/sub/command/commands/irb_command.rb', line 3

def self.call args
  log "args = #{args.inspect}"

  # https://github.com/ruby/ruby/blob/master/lib/irb.rb
  require "irb"

  IRB.setup(nil)
  workspace = IRB::WorkSpace.new(binding)
  irb = IRB::Irb.new(workspace)
  IRB.conf[:MAIN_CONTEXT] = irb.context

  irb.eval_input
rescue Interrupt
  log "Control-C"
end