binding_of_caller 0.4.0 → 0.8.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.
- checksums.yaml +7 -0
- data/.gemtest +0 -0
- data/.gitignore +8 -7
- data/.travis.yml +35 -0
- data/.yardopts +0 -0
- data/Gemfile +2 -0
- data/HISTORY +35 -0
- data/LICENSE +0 -0
- data/README.md +10 -6
- data/Rakefile +134 -80
- data/binding_of_caller.gemspec +39 -0
- data/examples/benchmark.rb +63 -0
- data/ext/binding_of_caller/binding_of_caller.c +122 -19
- data/ext/binding_of_caller/extconf.rb +25 -11
- data/ext/binding_of_caller/ruby_headers/192/version.h +0 -8
- data/lib/binding_of_caller/jruby_interpreted.rb +123 -0
- data/lib/binding_of_caller/mri2.rb +63 -0
- data/lib/binding_of_caller/rubinius.rb +67 -0
- data/lib/binding_of_caller/version.rb +3 -3
- data/lib/binding_of_caller.rb +14 -0
- data/test/test_binding_of_caller.rb +161 -0
- metadata +79 -46
- data/test/test.rb +0 -59
- /data/ext/binding_of_caller/ruby_headers/192/{gc.h → rubys_gc.h} +0 -0
- /data/ext/binding_of_caller/ruby_headers/193/{gc.h → rubys_gc.h} +0 -0
metadata
CHANGED
|
@@ -1,51 +1,82 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: binding_of_caller
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
5
|
-
version: 0.4.0
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.8.0
|
|
6
5
|
platform: ruby
|
|
7
|
-
authors:
|
|
6
|
+
authors:
|
|
8
7
|
- John Mair (banisterfiend)
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
date: 2018-01-10 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: debug_inspector
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 0.0.1
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 0.0.1
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
16
28
|
name: bacon
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
17
35
|
prerelease: false
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rake
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
24
48
|
type: :development
|
|
25
|
-
|
|
26
|
-
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
description: Retrieve the binding of a method's caller. Can also retrieve bindings
|
|
56
|
+
even further up the stack.
|
|
27
57
|
email: jrmair@gmail.com
|
|
28
58
|
executables: []
|
|
29
|
-
|
|
30
|
-
extensions:
|
|
59
|
+
extensions:
|
|
31
60
|
- ext/binding_of_caller/extconf.rb
|
|
32
61
|
extra_rdoc_files: []
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
- .
|
|
36
|
-
- .
|
|
37
|
-
- .yardopts
|
|
62
|
+
files:
|
|
63
|
+
- ".gemtest"
|
|
64
|
+
- ".gitignore"
|
|
65
|
+
- ".travis.yml"
|
|
66
|
+
- ".yardopts"
|
|
67
|
+
- Gemfile
|
|
38
68
|
- HISTORY
|
|
39
69
|
- LICENSE
|
|
40
70
|
- README.md
|
|
41
71
|
- Rakefile
|
|
72
|
+
- binding_of_caller.gemspec
|
|
73
|
+
- examples/benchmark.rb
|
|
42
74
|
- examples/example.rb
|
|
43
75
|
- ext/binding_of_caller/binding_of_caller.c
|
|
44
76
|
- ext/binding_of_caller/extconf.rb
|
|
45
77
|
- ext/binding_of_caller/ruby_headers/192/debug.h
|
|
46
78
|
- ext/binding_of_caller/ruby_headers/192/dln.h
|
|
47
79
|
- ext/binding_of_caller/ruby_headers/192/eval_intern.h
|
|
48
|
-
- ext/binding_of_caller/ruby_headers/192/gc.h
|
|
49
80
|
- ext/binding_of_caller/ruby_headers/192/id.h
|
|
50
81
|
- ext/binding_of_caller/ruby_headers/192/iseq.h
|
|
51
82
|
- ext/binding_of_caller/ruby_headers/192/method.h
|
|
@@ -53,6 +84,7 @@ files:
|
|
|
53
84
|
- ext/binding_of_caller/ruby_headers/192/regenc.h
|
|
54
85
|
- ext/binding_of_caller/ruby_headers/192/regint.h
|
|
55
86
|
- ext/binding_of_caller/ruby_headers/192/regparse.h
|
|
87
|
+
- ext/binding_of_caller/ruby_headers/192/rubys_gc.h
|
|
56
88
|
- ext/binding_of_caller/ruby_headers/192/thread_pthread.h
|
|
57
89
|
- ext/binding_of_caller/ruby_headers/192/thread_win32.h
|
|
58
90
|
- ext/binding_of_caller/ruby_headers/192/timev.h
|
|
@@ -69,7 +101,6 @@ files:
|
|
|
69
101
|
- ext/binding_of_caller/ruby_headers/193/dln.h
|
|
70
102
|
- ext/binding_of_caller/ruby_headers/193/encdb.h
|
|
71
103
|
- ext/binding_of_caller/ruby_headers/193/eval_intern.h
|
|
72
|
-
- ext/binding_of_caller/ruby_headers/193/gc.h
|
|
73
104
|
- ext/binding_of_caller/ruby_headers/193/id.h
|
|
74
105
|
- ext/binding_of_caller/ruby_headers/193/internal.h
|
|
75
106
|
- ext/binding_of_caller/ruby_headers/193/iseq.h
|
|
@@ -80,6 +111,7 @@ files:
|
|
|
80
111
|
- ext/binding_of_caller/ruby_headers/193/regint.h
|
|
81
112
|
- ext/binding_of_caller/ruby_headers/193/regparse.h
|
|
82
113
|
- ext/binding_of_caller/ruby_headers/193/revision.h
|
|
114
|
+
- ext/binding_of_caller/ruby_headers/193/rubys_gc.h
|
|
83
115
|
- ext/binding_of_caller/ruby_headers/193/thread_pthread.h
|
|
84
116
|
- ext/binding_of_caller/ruby_headers/193/thread_win32.h
|
|
85
117
|
- ext/binding_of_caller/ruby_headers/193/timev.h
|
|
@@ -90,34 +122,35 @@ files:
|
|
|
90
122
|
- ext/binding_of_caller/ruby_headers/193/vm_exec.h
|
|
91
123
|
- ext/binding_of_caller/ruby_headers/193/vm_insnhelper.h
|
|
92
124
|
- ext/binding_of_caller/ruby_headers/193/vm_opts.h
|
|
125
|
+
- lib/binding_of_caller.rb
|
|
126
|
+
- lib/binding_of_caller/jruby_interpreted.rb
|
|
127
|
+
- lib/binding_of_caller/mri2.rb
|
|
128
|
+
- lib/binding_of_caller/rubinius.rb
|
|
93
129
|
- lib/binding_of_caller/version.rb
|
|
94
|
-
- test/
|
|
130
|
+
- test/test_binding_of_caller.rb
|
|
95
131
|
homepage: http://github.com/banister/binding_of_caller
|
|
96
132
|
licenses: []
|
|
97
|
-
|
|
133
|
+
metadata: {}
|
|
98
134
|
post_install_message:
|
|
99
135
|
rdoc_options: []
|
|
100
|
-
|
|
101
|
-
require_paths:
|
|
136
|
+
require_paths:
|
|
102
137
|
- lib
|
|
103
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
|
-
|
|
105
|
-
requirements:
|
|
138
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
139
|
+
requirements:
|
|
106
140
|
- - ">="
|
|
107
|
-
- !ruby/object:Gem::Version
|
|
108
|
-
version:
|
|
109
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
|
-
|
|
111
|
-
requirements:
|
|
141
|
+
- !ruby/object:Gem::Version
|
|
142
|
+
version: '0'
|
|
143
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
|
+
requirements:
|
|
112
145
|
- - ">="
|
|
113
|
-
- !ruby/object:Gem::Version
|
|
114
|
-
version:
|
|
146
|
+
- !ruby/object:Gem::Version
|
|
147
|
+
version: '0'
|
|
115
148
|
requirements: []
|
|
116
|
-
|
|
117
149
|
rubyforge_project:
|
|
118
|
-
rubygems_version:
|
|
150
|
+
rubygems_version: 2.6.14
|
|
119
151
|
signing_key:
|
|
120
|
-
specification_version:
|
|
121
|
-
summary: Retrieve the binding of a method's caller. Can also retrieve bindings even
|
|
122
|
-
|
|
123
|
-
|
|
152
|
+
specification_version: 4
|
|
153
|
+
summary: Retrieve the binding of a method's caller. Can also retrieve bindings even
|
|
154
|
+
further up the stack.
|
|
155
|
+
test_files:
|
|
156
|
+
- test/test_binding_of_caller.rb
|
data/test/test.rb
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
unless Object.const_defined? :BindingOfCaller
|
|
2
|
-
$:.unshift File.expand_path '../../lib', __FILE__
|
|
3
|
-
require 'binding_of_caller'
|
|
4
|
-
require 'binding_of_caller/version'
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
puts "Testing binding_of_caller version #{BindingOfCaller::VERSION}..."
|
|
8
|
-
puts "Ruby version: #{RUBY_VERSION}"
|
|
9
|
-
|
|
10
|
-
describe BindingOfCaller do
|
|
11
|
-
it "should fetch immediate caller's binding when 0 is passed" do
|
|
12
|
-
o = Object.new
|
|
13
|
-
def o.a
|
|
14
|
-
var = 1
|
|
15
|
-
binding.of_caller(0).eval('var')
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
o. a.should == 1
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it "should fetch parent of caller's binding when 1 is passed" do
|
|
22
|
-
o = Object.new
|
|
23
|
-
def o.a
|
|
24
|
-
var = 1
|
|
25
|
-
b
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def o.b
|
|
29
|
-
binding.of_caller(1).eval('var')
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
o.a.should == 1
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it "should modify locals in parent of caller's binding" do
|
|
36
|
-
o = Object.new
|
|
37
|
-
def o.a
|
|
38
|
-
var = 1
|
|
39
|
-
b
|
|
40
|
-
var
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def o.b
|
|
44
|
-
binding.of_caller(1).eval('var = 20')
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
o.a.should == 20
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
it "should raise an exception when retrieving an out of band binding" do
|
|
51
|
-
o = Object.new
|
|
52
|
-
def o.a
|
|
53
|
-
binding.of_caller(100)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
lambda { o.a }.should.raise RuntimeError
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
File without changes
|
|
File without changes
|