binding_of_caller 0.7 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/binding_of_caller/mri2.rb +8 -7
- data/lib/binding_of_caller/version.rb +1 -1
- data/test/test_binding_of_caller.rb +9 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb405aa7190a04a128baff727db90ef40ae1468c
|
4
|
+
data.tar.gz: 43cc746def25b335c279df78b070d926bdb43ebc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2352e3c209510a9bed92399403425165c3b18bdaa559803d6a042ff5b98b52e70fb9b299236dad9d9895e06b533bcee7a3f1952bd8e7fea972d944b244e8e345
|
7
|
+
data.tar.gz: 7e47b06c1867cec238f1a772a8659acc738b328fd4425601b7a0bb7ce55925be0ebbbee43709bc453efef4ba41e989eed560d6ed7232fc030b83b2c17185910a
|
@@ -13,12 +13,6 @@ module BindingOfCaller
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
# The description of the frame.
|
17
|
-
# @return [String]
|
18
|
-
def frame_description
|
19
|
-
@frame_description ||= @iseq.label
|
20
|
-
end
|
21
|
-
|
22
16
|
# Return bindings for all caller frames.
|
23
17
|
# @return [Array<Binding>]
|
24
18
|
def callers
|
@@ -54,15 +48,22 @@ module BindingOfCaller
|
|
54
48
|
# The type of the frame.
|
55
49
|
# @return [Symbol]
|
56
50
|
def frame_type
|
51
|
+
return nil if !@iseq
|
52
|
+
|
57
53
|
# apparently the 9th element of the iseq array holds the frame type
|
58
54
|
# ...not sure how reliable this is.
|
59
55
|
@frame_type ||= @iseq.to_a[9]
|
60
56
|
end
|
61
57
|
|
58
|
+
# The description of the frame.
|
59
|
+
# @return [String]
|
60
|
+
def frame_description
|
61
|
+
return nil if !@iseq
|
62
|
+
@frame_description ||= @iseq.label
|
63
|
+
end
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
65
|
-
|
66
67
|
class ::Binding
|
67
68
|
include BindingOfCaller::BindingExtensions
|
68
69
|
end
|
@@ -84,8 +84,12 @@ describe BindingOfCaller do
|
|
84
84
|
binding.frame_count.should == binding.callers.count
|
85
85
|
end
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
88
|
describe "frame_descripton" do
|
89
|
+
it 'can be called on ordinary binding without raising' do
|
90
|
+
lambda { binding.frame_description }.should.not.raise
|
91
|
+
end
|
92
|
+
|
89
93
|
it 'describes a block frame' do
|
90
94
|
binding.of_caller(0).frame_description.should =~ /block/
|
91
95
|
end
|
@@ -107,6 +111,10 @@ describe BindingOfCaller do
|
|
107
111
|
end
|
108
112
|
|
109
113
|
describe "frame_type" do
|
114
|
+
it 'can be called on ordinary binding without raising' do
|
115
|
+
lambda { binding.frame_type }.should.not.raise
|
116
|
+
end
|
117
|
+
|
110
118
|
it 'should return the correct frame types' do
|
111
119
|
o = Object.new
|
112
120
|
|