devel-which 0.3.0 → 0.3.1
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/README.md +1 -0
- data/devel-which.gemspec +1 -0
- data/doc/diff.txt +244 -0
- data/lib/devel/which.rb +1 -1
- data/lib/devel/which/forobject.rb +2 -2
- metadata +4 -3
data/README.md
CHANGED
data/devel-which.gemspec
CHANGED
data/doc/diff.txt
ADDED
@@ -0,0 +1,244 @@
|
|
1
|
+
devel-which のみに存在: LICENSE
|
2
|
+
devel-which.orig のみに存在: Makefile
|
3
|
+
devel-which.orig のみに存在: README
|
4
|
+
devel-which のみに存在: README.md
|
5
|
+
devel-which のみに存在: Rakefile
|
6
|
+
devel-which のみに存在: devel-which-0.3.0.gem
|
7
|
+
devel-which のみに存在: devel-which.gemspec
|
8
|
+
devel-which.orig のみに存在: doc
|
9
|
+
devel-which.orig のみに存在: install.rb
|
10
|
+
devel-which.orig のみに存在: install19.rb
|
11
|
+
diff -r devel-which.orig/lib/devel/which/forclass.rb devel-which/lib/devel/which/forclass.rb
|
12
|
+
1,2d0
|
13
|
+
< # $kNotwork: forclass.rb,v 1.2 2002/02/08 19:52:57 gotoken Exp $
|
14
|
+
<
|
15
|
+
diff -r devel-which.orig/lib/devel/which/formodule.rb devel-which/lib/devel/which/formodule.rb
|
16
|
+
1,2d0
|
17
|
+
< # $kNotwork: formodule.rb,v 1.2 2002/02/08 19:52:57 gotoken Exp $
|
18
|
+
<
|
19
|
+
7a6
|
20
|
+
>
|
21
|
+
9,33c8,33
|
22
|
+
< name = Devel::Which::name2string(name)
|
23
|
+
< nest = []
|
24
|
+
< pos = 0
|
25
|
+
< space = mod.name
|
26
|
+
< begin
|
27
|
+
< pos -= 1
|
28
|
+
< space = space[0..pos]
|
29
|
+
< nest.push(space)
|
30
|
+
< end while pos = space.rindex(/::/)
|
31
|
+
< nest.map!{|i| eval "::#{i}"}
|
32
|
+
< mod.ancestors.each{|i| nest.push i}
|
33
|
+
< a = (class <<self; self; end).ancestors.each{|i| nest.push i}
|
34
|
+
<
|
35
|
+
< cand = nest.find_all{|m| m.const_defined? name}
|
36
|
+
<
|
37
|
+
< last = cand.shift
|
38
|
+
< return nil if not last
|
39
|
+
< value = last.const_get(name)
|
40
|
+
<
|
41
|
+
< while car = cand.shift
|
42
|
+
< break if value != car.const_get(name)
|
43
|
+
< last = car
|
44
|
+
< end
|
45
|
+
<
|
46
|
+
< last
|
47
|
+
---
|
48
|
+
>
|
49
|
+
> name = Devel::Which::name2string(name)
|
50
|
+
> nest = []
|
51
|
+
> pos = 0
|
52
|
+
> space = mod.name
|
53
|
+
>
|
54
|
+
> begin
|
55
|
+
> pos -= 1
|
56
|
+
> space = space[0..pos]
|
57
|
+
> nest.push(space)
|
58
|
+
> end while pos = space.rindex(/::/)
|
59
|
+
>
|
60
|
+
> nest.map!{|i| eval "::#{i}"}
|
61
|
+
> mod.ancestors.each{|i| nest.push i}
|
62
|
+
> a = (class << self; self; end).ancestors.each{|i| nest.push i}
|
63
|
+
> cand = nest.find_all{|m| m.const_defined? name}
|
64
|
+
> last = cand.shift
|
65
|
+
> return nil if not last
|
66
|
+
> value = last.const_get(name)
|
67
|
+
>
|
68
|
+
> while car = cand.shift
|
69
|
+
> break if value != car.const_get(name)
|
70
|
+
> last = car
|
71
|
+
> end
|
72
|
+
>
|
73
|
+
> last
|
74
|
+
38,42c38,41
|
75
|
+
< name = Devel::Which::name2string(name)
|
76
|
+
<
|
77
|
+
< mod.ancestors.find{|a|
|
78
|
+
< a.instance_methods.include?(name)
|
79
|
+
< }
|
80
|
+
---
|
81
|
+
> name = Devel::Which::name2string(name)
|
82
|
+
> mod.ancestors.find{|a|
|
83
|
+
> a.instance_methods.include?(name)
|
84
|
+
> }
|
85
|
+
44a44
|
86
|
+
>
|
87
|
+
diff -r devel-which.orig/lib/devel/which/forobject.rb devel-which/lib/devel/which/forobject.rb
|
88
|
+
1,2d0
|
89
|
+
< # $kNotwork: forobject.rb,v 1.2 2002/01/14 16:20:15 gotoken Exp $
|
90
|
+
<
|
91
|
+
9,31c7,29
|
92
|
+
< unless lib.is_a? String
|
93
|
+
< raise TypeError,
|
94
|
+
< "wrong argument type #{lib.type} (expected String)"
|
95
|
+
< end
|
96
|
+
< ext = ["rb", Config::CONFIG["DLEXT"], Config::CONFIG["DLEXT2"]]
|
97
|
+
< ext.map!{|i| i.length > 0 ? ".#{i}" : nil}
|
98
|
+
< ext.compact!
|
99
|
+
< ext.push("")
|
100
|
+
<
|
101
|
+
< at = with = nil
|
102
|
+
< at = $:.find{|path|
|
103
|
+
< file = "#{File::expand_path(path)}/#{lib}"
|
104
|
+
<
|
105
|
+
< begin
|
106
|
+
< with = ext.find{|i|
|
107
|
+
< test(?f, file+i) && test(?r, file+i)
|
108
|
+
< }
|
109
|
+
< rescue
|
110
|
+
< next
|
111
|
+
< end
|
112
|
+
< }
|
113
|
+
<
|
114
|
+
< "#{at}/#{lib}#{with}" if at
|
115
|
+
---
|
116
|
+
> unless lib.is_a? String
|
117
|
+
> raise TypeError,
|
118
|
+
> "wrong argument type #{lib.type} (expected String)"
|
119
|
+
> end
|
120
|
+
> ext = ["rb", Config::CONFIG["DLEXT"], Config::CONFIG["DLEXT2"]]
|
121
|
+
> ext.map!{|i| i.length > 0 ? ".#{i}" : nil}
|
122
|
+
> ext.compact!
|
123
|
+
> ext.push("")
|
124
|
+
>
|
125
|
+
> at = with = nil
|
126
|
+
> at = $:.find{|path|
|
127
|
+
> file = "#{File::expand_path(path)}/#{lib}"
|
128
|
+
>
|
129
|
+
> begin
|
130
|
+
> with = ext.find{|i|
|
131
|
+
> test(?f, file+i) && test(?r, file+i)
|
132
|
+
> }
|
133
|
+
> rescue
|
134
|
+
> next
|
135
|
+
> end
|
136
|
+
> }
|
137
|
+
>
|
138
|
+
> "#{at}/#{lib}#{with}" if at
|
139
|
+
36,66c34,64
|
140
|
+
< unless lib.is_a? String
|
141
|
+
< raise TypeError,
|
142
|
+
< "wrong argument type #{lib.type} (expected String)"
|
143
|
+
< end
|
144
|
+
< unless opt.is_a? Hash
|
145
|
+
< raise TypeError,
|
146
|
+
< "wrong argument type #{lib.type} (expected Hash)"
|
147
|
+
< end
|
148
|
+
< optpath = opt[:path] || opt[:p] || []
|
149
|
+
< optext = opt[:ext] || opt[:e] || ""
|
150
|
+
< ext = ["rb", Config::CONFIG["DLEXT"], Config::CONFIG["DLEXT2"], optext]
|
151
|
+
< ext.map!{|i| i.length > 0 ? ".#{i}" : nil}
|
152
|
+
< ext.compact!
|
153
|
+
< ext.push("")
|
154
|
+
<
|
155
|
+
< at = []
|
156
|
+
<
|
157
|
+
< ($: + optpath).each{|path|
|
158
|
+
< with = nil
|
159
|
+
< file = "#{File::expand_path(path)}/#{lib}"
|
160
|
+
<
|
161
|
+
< begin
|
162
|
+
< ext.each{|with|
|
163
|
+
< if (test(?f, file+with) && test(?r, file+with) rescue false)
|
164
|
+
< at << "#{path}/#{lib}#{with}"
|
165
|
+
< end
|
166
|
+
< }
|
167
|
+
< rescue
|
168
|
+
< next
|
169
|
+
< end
|
170
|
+
< }
|
171
|
+
---
|
172
|
+
> unless lib.is_a? String
|
173
|
+
> raise TypeError,
|
174
|
+
> "wrong argument type #{lib.type} (expected String)"
|
175
|
+
> end
|
176
|
+
> unless opt.is_a? Hash
|
177
|
+
> raise TypeError,
|
178
|
+
> "wrong argument type #{lib.type} (expected Hash)"
|
179
|
+
> end
|
180
|
+
> optpath = opt[:path] || opt[:p] || []
|
181
|
+
> optext = opt[:ext] || opt[:e] || ""
|
182
|
+
> ext = ["rb", Config::CONFIG["DLEXT"], Config::CONFIG["DLEXT2"], optext]
|
183
|
+
> ext.map!{|i| i.length > 0 ? ".#{i}" : nil}
|
184
|
+
> ext.compact!
|
185
|
+
> ext.push("")
|
186
|
+
>
|
187
|
+
> at = []
|
188
|
+
>
|
189
|
+
> ($: + optpath).each{|path|
|
190
|
+
> with = nil
|
191
|
+
> file = "#{File::expand_path(path)}/#{lib}"
|
192
|
+
>
|
193
|
+
> begin
|
194
|
+
> ext.each{|with|
|
195
|
+
> if (test(?f, file+with) && test(?r, file+with) rescue false)
|
196
|
+
> at << "#{path}/#{lib}#{with}"
|
197
|
+
> end
|
198
|
+
> }
|
199
|
+
> rescue
|
200
|
+
> next
|
201
|
+
> end
|
202
|
+
> }
|
203
|
+
68c66
|
204
|
+
< at
|
205
|
+
---
|
206
|
+
> at
|
207
|
+
70a69
|
208
|
+
>
|
209
|
+
diff -r devel-which.orig/lib/devel/which/libwhich.rb devel-which/lib/devel/which/libwhich.rb
|
210
|
+
6,7c6,7
|
211
|
+
< raise TypeError,
|
212
|
+
< "wrong argument type #{name.type} (expected String or Symbol)"
|
213
|
+
---
|
214
|
+
> raise TypeError,
|
215
|
+
> "wrong argument type #{name.type} (expected String or Symbol)"
|
216
|
+
9c9
|
217
|
+
< name
|
218
|
+
---
|
219
|
+
> name
|
220
|
+
diff -r devel-which.orig/lib/devel/which.rb devel-which/lib/devel/which.rb
|
221
|
+
9c9
|
222
|
+
< VERSION = "0.2.0"
|
223
|
+
---
|
224
|
+
> VERSION = "0.3.0"
|
225
|
+
43c43
|
226
|
+
<
|
227
|
+
---
|
228
|
+
>
|
229
|
+
64c64
|
230
|
+
< Y = "1"
|
231
|
+
---
|
232
|
+
> Y = "1"
|
233
|
+
77c77
|
234
|
+
< include M1
|
235
|
+
---
|
236
|
+
> include M1
|
237
|
+
79,81c79,81
|
238
|
+
< module C
|
239
|
+
< include M2
|
240
|
+
< end
|
241
|
+
---
|
242
|
+
> module C
|
243
|
+
> include M2
|
244
|
+
> end
|
data/lib/devel/which.rb
CHANGED
@@ -8,7 +8,7 @@ module Devel
|
|
8
8
|
raise TypeError,
|
9
9
|
"wrong argument type #{lib.type} (expected String)"
|
10
10
|
end
|
11
|
-
ext = ["rb",
|
11
|
+
ext = ["rb", RbConfig::CONFIG["DLEXT"], RbConfig::CONFIG["DLEXT2"]]
|
12
12
|
ext.map!{|i| i.length > 0 ? ".#{i}" : nil}
|
13
13
|
ext.compact!
|
14
14
|
ext.push("")
|
@@ -41,7 +41,7 @@ module Devel
|
|
41
41
|
end
|
42
42
|
optpath = opt[:path] || opt[:p] || []
|
43
43
|
optext = opt[:ext] || opt[:e] || ""
|
44
|
-
ext = ["rb",
|
44
|
+
ext = ["rb", RbConfig::CONFIG["DLEXT"], RbConfig::CONFIG["DLEXT2"], optext]
|
45
45
|
ext.map!{|i| i.length > 0 ? ".#{i}" : nil}
|
46
46
|
ext.compact!
|
47
47
|
ext.push("")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devel-which
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-12 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! " Devel::Which provides an effective definition finder, for example,\n
|
15
15
|
\ Fixnum#nonzero? is defined at Numeric and\n Fixnum.which_method(\"nonzero?\")
|
@@ -21,6 +21,7 @@ extensions: []
|
|
21
21
|
extra_rdoc_files: []
|
22
22
|
files:
|
23
23
|
- devel-which.gemspec
|
24
|
+
- doc/diff.txt
|
24
25
|
- lib/devel/which/forclass.rb
|
25
26
|
- lib/devel/which/forobject.rb
|
26
27
|
- lib/devel/which/libwhich.rb
|
@@ -50,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
51
|
version: '0'
|
51
52
|
requirements: []
|
52
53
|
rubyforge_project:
|
53
|
-
rubygems_version: 1.8.
|
54
|
+
rubygems_version: 1.8.17
|
54
55
|
signing_key:
|
55
56
|
specification_version: 3
|
56
57
|
summary: Devel::Which - locate a symbol/library in the users namespace/path
|