[macruby-changes] [4748] DietRB/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri Oct 8 04:09:15 PDT 2010
Revision: 4748
http://trac.macosforge.org/projects/ruby/changeset/4748
Author: eloy.de.enige at gmail.com
Date: 2010-10-08 04:09:14 -0700 (Fri, 08 Oct 2010)
Log Message:
-----------
Ugh, make irb/driver/socket work again.
From: Eloy Duran <eloy.de.enige at gmail.com>
Modified Paths:
--------------
DietRB/trunk/bin/dietrb
DietRB/trunk/lib/irb/driver/socket.rb
Modified: DietRB/trunk/bin/dietrb
===================================================================
--- DietRB/trunk/bin/dietrb 2010-10-08 11:09:04 UTC (rev 4747)
+++ DietRB/trunk/bin/dietrb 2010-10-08 11:09:14 UTC (rev 4748)
@@ -7,12 +7,12 @@
module IRB
# Just a namespace so not to pollute the toplevel namespace with lvars.
module Bin
+ driver = nil
+ ignore_irbrc = false
+
unless ARGV.empty?
require 'optparse'
- driver = nil
- ignore_irbrc = false
-
OptionParser.new do |opt|
bin = File.basename($0)
opt.banner = "Usage: #{bin} [options] [programfile] [arguments]"
Modified: DietRB/trunk/lib/irb/driver/socket.rb
===================================================================
--- DietRB/trunk/lib/irb/driver/socket.rb 2010-10-08 11:09:04 UTC (rev 4747)
+++ DietRB/trunk/lib/irb/driver/socket.rb 2010-10-08 11:09:14 UTC (rev 4748)
@@ -4,6 +4,15 @@
module IRB
module Driver
class Socket
+ class << self
+ attr_reader :instance
+
+ def run(object, binding)
+ @instance = new(object, binding)
+ @instance.run
+ end
+ end
+
# Initializes with the object and binding that each new connection will
# get as Context. The binding is shared, so local variables will stay
# around. The benefit of this is that a socket based irb session is most
@@ -34,11 +43,16 @@
end
end
-def self.irb(object, binding = nil)
- unless @server
- @server = IRB::Driver::Socket.new(object, binding)
- @server.run
- else
- super
+module Kernel
+ alias_method :irb_before_socket, :irb
+
+ def irb(object, binding = nil)
+ if IRB::Driver::Socket.instance.nil?
+ IRB::Driver::Socket.run(object, binding)
+ else
+ irb_before_socket(object, binding)
+ end
end
+
+ private :irb, :irb_before_socket
end
\ No newline at end of file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101008/1f6982b9/attachment.html>
More information about the macruby-changes
mailing list