irby 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/irby.rb +23 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.0
|
data/lib/irby.rb
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
require 'irb'
|
2
2
|
|
3
|
+
$irby_binding_stack = []
|
4
|
+
set_trace_func lambda { |event, file, line, id, binding, klass|
|
5
|
+
case event
|
6
|
+
when 'call'
|
7
|
+
$irby_binding_stack << binding
|
8
|
+
when 'return', 'raise'
|
9
|
+
$irby_binding_stack.pop
|
10
|
+
end
|
11
|
+
}
|
12
|
+
|
3
13
|
module IRB
|
4
14
|
def self.start_session(binding)
|
5
15
|
unless @__irb_initialized
|
@@ -24,8 +34,19 @@ module IRB
|
|
24
34
|
end
|
25
35
|
|
26
36
|
class Object
|
27
|
-
def irb(
|
28
|
-
|
37
|
+
def irb(specific_binding = nil)
|
38
|
+
if specific_binding
|
39
|
+
target_binding = specific_binding
|
40
|
+
else
|
41
|
+
caller_binding = $irby_binding_stack[-2]
|
42
|
+
if self == caller_binding.eval('self')
|
43
|
+
target_binding = caller_binding
|
44
|
+
else
|
45
|
+
target_binding = binding
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
IRB.start_session(target_binding)
|
29
50
|
end
|
30
51
|
alias_method :irby, :irb
|
31
52
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
7
|
+
- 4
|
8
8
|
- 0
|
9
|
-
version: 1.
|
9
|
+
version: 1.4.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- jugyo
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-09-
|
17
|
+
date: 2010-09-30 00:00:00 +09:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|