Skip to content

Commit edbef2a

Browse files
committed
* lib/rdoc/servlet.rb: Fixed display of site and home documentation.
Fixes rdoc issue ruby#170 by Thomas Leitner. * test/rdoc/test_rdoc_servlet.rb: Test for above. * lib/rdoc/code_object.rb: Split #initialize_visibility from #initialize for reuse when loading a stored object. Fixes rdoc issue ruby#171 by Thomas Leitner. * lib/rdoc/any_method.rb: Initialize visibility for #display? For rdoc issue ruby#171 * lib/rdoc/attr.rb: ditto. * lib/rdoc/class_module.rb: ditto. * lib/rdoc/top_level.rb: ditto. * test/rdoc/test_rdoc_any_method.rb: Test for above. * test/rdoc/test_rdoc_attr.rb: ditto. * test/rdoc/test_rdoc_class_module.rb: ditto. * test/rdoc/test_rdoc_constant.rb: ditto. * test/rdoc/test_rdoc_top_level.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 77969c3 commit edbef2a

13 files changed

+110
-12
lines changed

ChangeLog

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
Wed Jan 23 09:53:39 2013 Eric Hodel <drbrain@segment7.net>
2+
3+
* lib/rdoc/servlet.rb: Fixed display of site and home documentation.
4+
Fixes rdoc issue #170 by Thomas Leitner.
5+
* test/rdoc/test_rdoc_servlet.rb: Test for above.
6+
7+
* lib/rdoc/code_object.rb: Split #initialize_visibility from
8+
#initialize for reuse when loading a stored object.
9+
Fixes rdoc issue #171 by Thomas Leitner.
10+
11+
* lib/rdoc/any_method.rb: Initialize visibility for #display? For
12+
rdoc issue #171
13+
* lib/rdoc/attr.rb: ditto.
14+
* lib/rdoc/class_module.rb: ditto.
15+
* lib/rdoc/top_level.rb: ditto.
16+
* test/rdoc/test_rdoc_any_method.rb: Test for above.
17+
* test/rdoc/test_rdoc_attr.rb: ditto.
18+
* test/rdoc/test_rdoc_class_module.rb: ditto.
19+
* test/rdoc/test_rdoc_constant.rb: ditto.
20+
* test/rdoc/test_rdoc_top_level.rb: ditto.
21+
122
Wed Jan 23 06:43:26 2013 Eric Hodel <drbrain@segment7.net>
223

324
* lib/rubygems/test_case.rb: Use Dir.tmpdir for rubygems tests instead

lib/rdoc/any_method.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ def marshal_dump
123123
# * #parent_name
124124

125125
def marshal_load array
126+
initialize_visibility
127+
126128
@dont_rename_initialize = nil
127129
@is_alias_for = nil
128130
@token_stream = nil

lib/rdoc/attr.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ def marshal_dump
121121
# * #parent_name
122122

123123
def marshal_load array
124+
initialize_visibility
125+
124126
@aliases = []
125127
@parent = nil
126128
@parent_name = nil

lib/rdoc/class_module.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ def marshal_dump # :nodoc:
323323
end
324324

325325
def marshal_load array # :nodoc:
326+
initialize_visibility
326327
initialize_methods_etc
327328
@current_section = nil
328329
@document_self = true

lib/rdoc/code_object.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ def initialize
116116
@full_name = nil
117117
@store = nil
118118

119+
initialize_visibility
120+
end
121+
122+
##
123+
# Initializes state for visibility of this CodeObject and its children.
124+
125+
def initialize_visibility # :nodoc:
119126
@document_children = true
120127
@document_self = true
121128
@done_documenting = false

lib/rdoc/servlet.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,16 +387,21 @@ def show_documentation req, res
387387

388388
def store_for source_name
389389
case source_name
390+
when 'home' then
391+
RDoc::Store.new RDoc::RI::Paths.home_dir, :home
390392
when 'ruby' then
391393
RDoc::Store.new RDoc::RI::Paths.system_dir, :system
394+
when 'site' then
395+
RDoc::Store.new RDoc::RI::Paths.site_dir, :site
392396
else
393397
ri_dir, type = ri_paths.find do |dir, dir_type|
394398
next unless dir_type == :gem
395399

396400
source_name == dir[%r%/([^/]*)/ri$%, 1]
397401
end
398402

399-
raise "could not find ri documentation for #{source_name}" unless
403+
raise RDoc::Error,
404+
"could not find ri documentation for #{source_name}" unless
400405
ri_dir
401406

402407
RDoc::Store.new ri_dir, type

lib/rdoc/top_level.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ def last_modified
187187

188188
##
189189
# Dumps this TopLevel for use by ri. See also #marshal_load
190+
190191
def marshal_dump
191192
[
192193
MARSHAL_VERSION,

test/rdoc/test_rdoc_any_method.rb

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,24 +100,31 @@ def test_marshal_dump
100100
assert_equal section, loaded.section
101101
end
102102

103-
def test_marshal_load
104-
instance_method = Marshal.load Marshal.dump(@c1.method_list.last)
105-
106-
assert_equal 'C1#m', instance_method.full_name
107-
assert_equal 'C1', instance_method.parent_name
108-
assert_equal '(foo)', instance_method.params
109-
103+
def test_marshal_load_aliased_method
110104
aliased_method = Marshal.load Marshal.dump(@c2.method_list.last)
111105

112106
assert_equal 'C2#a', aliased_method.full_name
113107
assert_equal 'C2', aliased_method.parent_name
114108
assert_equal '()', aliased_method.params
109+
assert aliased_method.display?
110+
end
115111

112+
def test_marshal_load_class_method
116113
class_method = Marshal.load Marshal.dump(@c1.method_list.first)
117114

118115
assert_equal 'C1::m', class_method.full_name
119116
assert_equal 'C1', class_method.parent_name
120117
assert_equal '()', class_method.params
118+
assert class_method.display?
119+
end
120+
121+
def test_marshal_load_instance_method
122+
instance_method = Marshal.load Marshal.dump(@c1.method_list.last)
123+
124+
assert_equal 'C1#m', instance_method.full_name
125+
assert_equal 'C1', instance_method.parent_name
126+
assert_equal '(foo)', instance_method.params
127+
assert instance_method.display?
121128
end
122129

123130
def test_marshal_load_version_0
@@ -163,6 +170,8 @@ def test_marshal_load_version_0
163170
assert_equal nil, loaded.file
164171
assert_equal cm, loaded.parent
165172
assert_equal section, loaded.section
173+
174+
assert loaded.display?
166175
end
167176

168177
def test_name

test/rdoc/test_rdoc_attr.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ def test_marshal_load_version_1
137137
# version 3
138138
assert_equal cm, loaded.parent
139139
assert_equal section, loaded.section
140+
141+
assert loaded.display?
140142
end
141143

142144
def test_marshal_load_version_2
@@ -165,6 +167,8 @@ def test_marshal_load_version_2
165167
# version 3
166168
assert_equal cm, loaded.parent
167169
assert_equal section, loaded.section
170+
171+
assert loaded.display?
168172
end
169173

170174
def test_params

test/rdoc/test_rdoc_class_module.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ def test_marshal_load_version_0
289289

290290
expected = { nil => s0 }
291291
assert_equal expected, loaded.sections_hash
292+
293+
assert loaded.display?
292294
end
293295

294296
def test_marshal_load_version_1

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy