Module: IRB
- Defined in:
- lib/drbirbc.rb,
lib/drbirb/server.rb
Defined Under Namespace
Classes: Irb, RemoteOutputMethod, RemoteReadlineInputMethod, RemoteService
Class Method Summary
collapse
Class Method Details
.remote_url ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/drbirbc.rb', line 21
def IRB.remote_url
uri = ARGV[0] || ENV['IRB_URL']
unless uri =~ /^dr(uby|b[a-z0-9]+):/
uri = "druby://127.0.0.1:7777"
end
uri
end
|
.start_remote(drb_uri) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/drbirbc.rb', line 7
def IRB.start_remote drb_uri
DRb.start_service
remote_service = DRbObject.new nil, drb_uri
input_proc = proc do |prompt|
l = Readline.readline prompt
Readline::HISTORY.push(l) if l and !l.empty?
l
end
output_proc = proc do |l|
print l
end
remote_service.irb_start input_proc, output_proc
end
|
.start_with_io_procs(input_proc = nil, output_proc = nil) ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/drbirb/server.rb', line 5
def IRB.start_with_io_procs input_proc=nil, output_proc=nil
irb = Irb.new nil, RemoteReadlineInputMethod.new(input_proc),
RemoteOutputMethod.new(output_proc)
@CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
@CONF[:MAIN_CONTEXT] = irb.context
trap("SIGINT") do
irb.signal_handle
end
catch(:IRB_EXIT) do
irb.eval_input
end
end
|