rdoc 3.6 → 3.6.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rdoc might be problematic. Click here for more details.
- data.tar.gz.sig +0 -0
- data/History.txt +8 -0
- data/lib/rdoc.rb +1 -1
- data/lib/rdoc/context.rb +13 -0
- data/lib/rdoc/parser/c.rb +25 -12
- data/test/test_rdoc_context.rb +32 -0
- data/test/test_rdoc_parser_c.rb +26 -10
- data/test/test_rdoc_ri_store.rb +8 -2
- metadata +4 -3
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
=== 3.6.1 / 2011-05-15
|
2
|
+
|
3
|
+
* Bug fixes
|
4
|
+
* Fix infinite loop created when re-encountering BasicObject.
|
5
|
+
* RDoc::Context#each_ancestor is now provided for duck-typing.
|
6
|
+
* rb_path2class() can now be used to discover the parent class in
|
7
|
+
rb_define_class_under.
|
8
|
+
|
1
9
|
=== 3.6 / 2011-05-13
|
2
10
|
|
3
11
|
* Major Enhancements
|
data/lib/rdoc.rb
CHANGED
data/lib/rdoc/context.rb
CHANGED
@@ -373,6 +373,12 @@ class RDoc::Context < RDoc::CodeObject
|
|
373
373
|
end
|
374
374
|
end
|
375
375
|
|
376
|
+
# fix up superclass
|
377
|
+
superclass = nil if full_name == 'BasicObject'
|
378
|
+
superclass = nil if full_name == 'Object' and defined?(::BasicObject)
|
379
|
+
superclass = '::BasicObject' if
|
380
|
+
defined?(::BasicObject) and full_name == 'Object'
|
381
|
+
|
376
382
|
# find the superclass full name
|
377
383
|
if superclass then
|
378
384
|
if superclass =~ /^:+/ then
|
@@ -657,6 +663,13 @@ class RDoc::Context < RDoc::CodeObject
|
|
657
663
|
end
|
658
664
|
end
|
659
665
|
|
666
|
+
##
|
667
|
+
# Iterator for ancestors for duck-typing. Does nothing. See
|
668
|
+
# RDoc::ClassModule#each_ancestor.
|
669
|
+
|
670
|
+
def each_ancestor # :nodoc:
|
671
|
+
end
|
672
|
+
|
660
673
|
##
|
661
674
|
# Iterator for attributes
|
662
675
|
|
data/lib/rdoc/parser/c.rb
CHANGED
@@ -218,13 +218,22 @@ class RDoc::Parser::C < RDoc::Parser
|
|
218
218
|
handle_class_module(var_name, "module", class_name, nil, in_module)
|
219
219
|
end
|
220
220
|
|
221
|
-
@content.scan(/([\w\.]+)\s* =
|
222
|
-
|
223
|
-
|
224
|
-
\s*
|
225
|
-
\s*(
|
226
|
-
|
227
|
-
|
221
|
+
@content.scan(/([\w\.]+)\s* = # var_name
|
222
|
+
\s*rb_define_class_under\s*
|
223
|
+
\(
|
224
|
+
\s* (\w+), # under
|
225
|
+
\s* "(\w+)", # class_name
|
226
|
+
\s*
|
227
|
+
(?:
|
228
|
+
([\w\*\s\(\)\.\->]+) | # parent_name
|
229
|
+
rb_path2class\("([\w:]+)"\) # path
|
230
|
+
)
|
231
|
+
\s*
|
232
|
+
\)
|
233
|
+
/mx) do |var_name, under, class_name, parent_name, path|
|
234
|
+
parent = path || parent_name
|
235
|
+
|
236
|
+
handle_class_module var_name, 'class', class_name, parent, under
|
228
237
|
end
|
229
238
|
|
230
239
|
@content.scan(/([\w\.]+)\s* = \s*rb_singleton_class\s*
|
@@ -650,8 +659,8 @@ class RDoc::Parser::C < RDoc::Parser
|
|
650
659
|
enclosure = @classes[in_module] || @@enclosure_classes[in_module]
|
651
660
|
|
652
661
|
if enclosure.nil? and enclosure = @known_classes[in_module] then
|
653
|
-
|
654
|
-
handle_class_module in_module,
|
662
|
+
enc_type = /^rb_m/ =~ in_module ? "module" : "class"
|
663
|
+
handle_class_module in_module, enc_type, enclosure, nil, nil
|
655
664
|
enclosure = @classes[in_module]
|
656
665
|
end
|
657
666
|
|
@@ -675,17 +684,21 @@ class RDoc::Parser::C < RDoc::Parser
|
|
675
684
|
end
|
676
685
|
|
677
686
|
cm = enclosure.add_class RDoc::NormalClass, class_name, parent_name
|
678
|
-
|
679
|
-
@stats.add_class cm
|
680
687
|
else
|
681
688
|
cm = enclosure.add_module RDoc::NormalModule, class_name
|
682
|
-
@stats.add_module cm
|
683
689
|
end
|
684
690
|
|
685
691
|
cm.record_location enclosure.top_level
|
686
692
|
|
687
693
|
find_class_comment cm.full_name, cm
|
688
694
|
|
695
|
+
case cm
|
696
|
+
when RDoc::NormalClass
|
697
|
+
@stats.add_class cm
|
698
|
+
when RDoc::NormalModule
|
699
|
+
@stats.add_module cm
|
700
|
+
end
|
701
|
+
|
689
702
|
@classes[var_name] = cm
|
690
703
|
@@enclosure_classes[var_name] = cm
|
691
704
|
@known_classes[var_name] = cm.full_name
|
data/test/test_rdoc_context.rb
CHANGED
@@ -105,6 +105,38 @@ class TestRDocContext < XrefTestCase
|
|
105
105
|
assert_includes RDoc::TopLevel.classes.map { |k| k.full_name }, 'C1::Klass'
|
106
106
|
end
|
107
107
|
|
108
|
+
def test_add_class_basic_object
|
109
|
+
skip 'BasicObject is 1.9 only' unless defined?(BasicObject)
|
110
|
+
|
111
|
+
@xref_data.add_class RDoc::NormalClass, 'BasicObject'
|
112
|
+
|
113
|
+
basic = @xref_data.find_module_named 'BasicObject'
|
114
|
+
|
115
|
+
assert_nil basic.superclass
|
116
|
+
|
117
|
+
@c1.add_class RDoc::NormalClass, 'BasicObject'
|
118
|
+
|
119
|
+
basic = @c1.find_module_named 'BasicObject'
|
120
|
+
|
121
|
+
assert_equal 'Object', basic.superclass
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_add_class_object
|
125
|
+
root_class = defined?(BasicObject) ? 'BasicObject' : nil
|
126
|
+
|
127
|
+
@xref_data.add_class RDoc::NormalClass, 'Object'
|
128
|
+
|
129
|
+
object = @xref_data.find_module_named 'Object'
|
130
|
+
|
131
|
+
assert_equal root_class, object.superclass
|
132
|
+
|
133
|
+
@c1.add_class RDoc::NormalClass, 'Object'
|
134
|
+
|
135
|
+
object = @c1.find_module_named 'Object'
|
136
|
+
|
137
|
+
assert_equal 'Object', object.superclass.full_name
|
138
|
+
end
|
139
|
+
|
108
140
|
def test_add_class_superclass
|
109
141
|
@c1.add_class RDoc::NormalClass, 'Klass', 'Object'
|
110
142
|
@c1.add_class RDoc::NormalClass, 'Klass', 'Other'
|
data/test/test_rdoc_parser_c.rb
CHANGED
@@ -236,27 +236,43 @@ VALUE cFoo = rb_define_class("Foo", rb_cObject);
|
|
236
236
|
assert_equal "this is the Foo class", klass.comment
|
237
237
|
end
|
238
238
|
|
239
|
-
def
|
239
|
+
def test_do_classes_class_under
|
240
240
|
content = <<-EOF
|
241
|
-
|
242
|
-
|
241
|
+
/* Document-class: Kernel::Foo
|
242
|
+
* this is the Foo class under Kernel
|
243
|
+
*/
|
244
|
+
VALUE cFoo = rb_define_class_under(rb_mKernel, "Foo", rb_cObject);
|
243
245
|
EOF
|
244
246
|
|
245
|
-
util_get_class content, '
|
246
|
-
|
247
|
-
assert_equal
|
247
|
+
klass = util_get_class content, 'cFoo'
|
248
|
+
assert_equal 'Kernel::Foo', klass.full_name
|
249
|
+
assert_equal "this is the Foo class under Kernel", klass.comment
|
248
250
|
end
|
249
251
|
|
250
|
-
def
|
252
|
+
def test_do_classes_class_under_rb_path2class
|
251
253
|
content = <<-EOF
|
252
254
|
/* Document-class: Kernel::Foo
|
253
|
-
* this is
|
255
|
+
* this is Kernel::Foo < A::B
|
254
256
|
*/
|
255
|
-
VALUE cFoo = rb_define_class_under(rb_mKernel, "Foo",
|
257
|
+
VALUE cFoo = rb_define_class_under(rb_mKernel, "Foo", rb_path2class("A::B"));
|
256
258
|
EOF
|
257
259
|
|
258
260
|
klass = util_get_class content, 'cFoo'
|
259
|
-
|
261
|
+
|
262
|
+
assert_equal 'Kernel::Foo', klass.full_name
|
263
|
+
assert_equal 'A::B', klass.superclass
|
264
|
+
assert_equal 'this is Kernel::Foo < A::B', klass.comment
|
265
|
+
end
|
266
|
+
|
267
|
+
def test_do_classes_singleton
|
268
|
+
content = <<-EOF
|
269
|
+
VALUE cFoo = rb_define_class("Foo", rb_cObject);
|
270
|
+
VALUE cFooS = rb_singleton_class(cFoo);
|
271
|
+
EOF
|
272
|
+
|
273
|
+
util_get_class content, 'cFooS'
|
274
|
+
|
275
|
+
assert_equal 'Foo', @parser.singleton_classes['cFooS']
|
260
276
|
end
|
261
277
|
|
262
278
|
def test_do_classes_module
|
data/test/test_rdoc_ri_store.rb
CHANGED
@@ -215,6 +215,8 @@ class TestRDocRIStore < MiniTest::Unit::TestCase
|
|
215
215
|
},
|
216
216
|
}
|
217
217
|
|
218
|
+
expected[:ancestors]['Object'] = %w[BasicObject] if defined?(::BasicObject)
|
219
|
+
|
218
220
|
open File.join(@tmpdir, 'cache.ri'), 'rb' do |io|
|
219
221
|
cache = Marshal.load io.read
|
220
222
|
|
@@ -250,8 +252,10 @@ class TestRDocRIStore < MiniTest::Unit::TestCase
|
|
250
252
|
assert_directory File.join(@tmpdir, 'Object')
|
251
253
|
assert_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri')
|
252
254
|
|
255
|
+
object_ancestors = defined?(::BasicObject) ? %w[BasicObject] : []
|
256
|
+
|
253
257
|
assert_cache({}, {}, { 'Object' => ['attr_accessor attr'] }, %w[Object],
|
254
|
-
'Object' =>
|
258
|
+
'Object' => object_ancestors)
|
255
259
|
|
256
260
|
assert_equal @klass, @s.load_class('Object')
|
257
261
|
end
|
@@ -303,8 +307,10 @@ class TestRDocRIStore < MiniTest::Unit::TestCase
|
|
303
307
|
assert_directory File.join(@tmpdir, 'Object')
|
304
308
|
assert_file File.join(@tmpdir, 'Object', 'cdesc-Object.ri')
|
305
309
|
|
310
|
+
object_ancestors = defined?(::BasicObject) ? %w[BasicObject] : []
|
311
|
+
|
306
312
|
assert_cache({}, {}, { 'Object' => ['attr_accessor attr'] }, %w[Object],
|
307
|
-
'Object' =>
|
313
|
+
'Object' => object_ancestors)
|
308
314
|
|
309
315
|
assert_equal @klass, @s.load_class('Object')
|
310
316
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 6
|
9
|
-
|
9
|
+
- 1
|
10
|
+
version: 3.6.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Eric Hodel
|
@@ -38,7 +39,7 @@ cert_chain:
|
|
38
39
|
x52qPcexcYZR7w==
|
39
40
|
-----END CERTIFICATE-----
|
40
41
|
|
41
|
-
date: 2011-05-
|
42
|
+
date: 2011-05-15 00:00:00 Z
|
42
43
|
dependencies:
|
43
44
|
- !ruby/object:Gem::Dependency
|
44
45
|
name: minitest
|
metadata.gz.sig
CHANGED
Binary file
|