dietrb 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/TODO +1 -1
- data/bin/dietrb +3 -3
- data/dietrb.gemspec +1 -1
- data/lib/irb/driver/socket.rb +20 -6
- data/lib/irb/version.rb +1 -1
- metadata +1 -1
data/TODO
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
*
|
1
|
+
* Add specs for irb/driver/socket, and possibly for bin/dietrb
|
2
2
|
* Configurable history file? (:HISTORY_FILE) Configurable number of saved history lines? (:SAVE_HISTORY)
|
3
3
|
* Make sure the following formatters work: hirb, awesome_print, and looksee
|
4
4
|
* Make sure the majority of the utils in utility_belt work
|
data/bin/dietrb
CHANGED
@@ -7,12 +7,12 @@ IRB_CONTEXT_TOPLEVEL_ARGS = [self, TOPLEVEL_BINDING.dup]
|
|
7
7
|
module IRB
|
8
8
|
# Just a namespace so not to pollute the toplevel namespace with lvars.
|
9
9
|
module Bin
|
10
|
+
driver = nil
|
11
|
+
ignore_irbrc = false
|
12
|
+
|
10
13
|
unless ARGV.empty?
|
11
14
|
require 'optparse'
|
12
15
|
|
13
|
-
driver = nil
|
14
|
-
ignore_irbrc = false
|
15
|
-
|
16
16
|
OptionParser.new do |opt|
|
17
17
|
bin = File.basename($0)
|
18
18
|
opt.banner = "Usage: #{bin} [options] [programfile] [arguments]"
|
data/dietrb.gemspec
CHANGED
data/lib/irb/driver/socket.rb
CHANGED
@@ -4,6 +4,15 @@ require 'socket'
|
|
4
4
|
module IRB
|
5
5
|
module Driver
|
6
6
|
class Socket
|
7
|
+
class << self
|
8
|
+
attr_reader :instance
|
9
|
+
|
10
|
+
def run(object, binding)
|
11
|
+
@instance = new(object, binding)
|
12
|
+
@instance.run
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
7
16
|
# Initializes with the object and binding that each new connection will
|
8
17
|
# get as Context. The binding is shared, so local variables will stay
|
9
18
|
# around. The benefit of this is that a socket based irb session is most
|
@@ -34,11 +43,16 @@ module IRB
|
|
34
43
|
end
|
35
44
|
end
|
36
45
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
46
|
+
module Kernel
|
47
|
+
alias_method :irb_before_socket, :irb
|
48
|
+
|
49
|
+
def irb(object, binding = nil)
|
50
|
+
if IRB::Driver::Socket.instance.nil?
|
51
|
+
IRB::Driver::Socket.run(object, binding)
|
52
|
+
else
|
53
|
+
irb_before_socket(object, binding)
|
54
|
+
end
|
43
55
|
end
|
56
|
+
|
57
|
+
private :irb, :irb_before_socket
|
44
58
|
end
|
data/lib/irb/version.rb
CHANGED