rdoc 4.0.1 → 4.1.0.preview.3

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.

Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.autotest +1 -3
  5. data/{DEVELOPERS.rdoc → CONTRIBUTING.rdoc} +28 -3
  6. data/ExampleMarkdown.md +37 -0
  7. data/ExampleRDoc.rdoc +208 -0
  8. data/History.rdoc +81 -0
  9. data/Manifest.txt +11 -2
  10. data/README.rdoc +5 -5
  11. data/Rakefile +34 -4
  12. data/lib/rdoc.rb +4 -3
  13. data/lib/rdoc/any_method.rb +48 -4
  14. data/lib/rdoc/class_module.rb +16 -2
  15. data/lib/rdoc/code_object.rb +85 -24
  16. data/lib/rdoc/comment.rb +0 -3
  17. data/lib/rdoc/constant.rb +9 -1
  18. data/lib/rdoc/context.rb +20 -2
  19. data/lib/rdoc/cross_reference.rb +1 -1
  20. data/lib/rdoc/extend.rb +4 -112
  21. data/lib/rdoc/generator/darkfish.rb +46 -7
  22. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +4 -4
  23. data/lib/rdoc/generator/template/darkfish/_head.rhtml +14 -8
  24. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +4 -3
  25. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +3 -3
  26. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +3 -4
  27. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +4 -3
  28. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +3 -4
  29. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +3 -3
  30. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +4 -4
  31. data/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml +9 -5
  32. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +5 -5
  33. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +4 -3
  34. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +12 -7
  35. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +5 -4
  36. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +6 -7
  37. data/lib/rdoc/generator/template/darkfish/class.rhtml +36 -41
  38. data/lib/rdoc/generator/template/darkfish/fonts.css +167 -0
  39. data/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf +0 -0
  40. data/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf +0 -0
  41. data/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf +0 -0
  42. data/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf +0 -0
  43. data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
  44. data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
  45. data/lib/rdoc/generator/template/darkfish/images/add.png +0 -0
  46. data/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
  47. data/lib/rdoc/generator/template/darkfish/images/delete.png +0 -0
  48. data/lib/rdoc/generator/template/darkfish/images/tag_blue.png +0 -0
  49. data/lib/rdoc/generator/template/darkfish/index.rhtml +11 -7
  50. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +0 -15
  51. data/lib/rdoc/generator/template/darkfish/js/search.js +12 -4
  52. data/lib/rdoc/generator/template/darkfish/page.rhtml +9 -9
  53. data/lib/rdoc/generator/template/darkfish/rdoc.css +226 -241
  54. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +5 -5
  55. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +13 -6
  56. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +17 -14
  57. data/lib/rdoc/include.rb +4 -114
  58. data/lib/rdoc/known_classes.rb +1 -0
  59. data/lib/rdoc/markdown.kpeg +126 -117
  60. data/lib/rdoc/markdown.rb +404 -389
  61. data/lib/rdoc/markdown/literals_1_8.kpeg +1 -1
  62. data/lib/rdoc/markdown/literals_1_8.rb +15 -12
  63. data/lib/rdoc/markdown/literals_1_9.kpeg +1 -1
  64. data/lib/rdoc/markdown/literals_1_9.rb +15 -12
  65. data/lib/rdoc/markup.rb +10 -13
  66. data/lib/rdoc/markup/attribute_manager.rb +3 -2
  67. data/lib/rdoc/markup/formatter.rb +3 -3
  68. data/lib/rdoc/markup/heading.rb +13 -0
  69. data/lib/rdoc/markup/parser.rb +10 -3
  70. data/lib/rdoc/markup/pre_process.rb +1 -1
  71. data/lib/rdoc/markup/to_html.rb +46 -31
  72. data/lib/rdoc/markup/to_html_crossref.rb +3 -0
  73. data/lib/rdoc/markup/to_joined_paragraph.rb +1 -1
  74. data/lib/rdoc/markup/to_markdown.rb +7 -5
  75. data/lib/rdoc/markup/verbatim.rb +1 -1
  76. data/lib/rdoc/method_attr.rb +13 -1
  77. data/lib/rdoc/mixin.rb +120 -0
  78. data/lib/rdoc/normal_class.rb +4 -0
  79. data/lib/rdoc/normal_module.rb +4 -0
  80. data/lib/rdoc/options.rb +42 -8
  81. data/lib/rdoc/parser.rb +4 -2
  82. data/lib/rdoc/parser/c.rb +13 -7
  83. data/lib/rdoc/parser/ruby.rb +683 -480
  84. data/lib/rdoc/rdoc.rb +4 -3
  85. data/lib/rdoc/ri/driver.rb +174 -103
  86. data/lib/rdoc/ri/paths.rb +6 -6
  87. data/lib/rdoc/ruby_lex.rb +125 -102
  88. data/lib/rdoc/ruby_token.rb +41 -40
  89. data/lib/rdoc/servlet.rb +16 -6
  90. data/lib/rdoc/stats.rb +61 -48
  91. data/lib/rdoc/store.rb +5 -3
  92. data/lib/rdoc/test_case.rb +39 -0
  93. data/lib/rdoc/tom_doc.rb +28 -4
  94. data/lib/rdoc/top_level.rb +2 -2
  95. data/test/test_rdoc_any_method.rb +104 -1
  96. data/test/test_rdoc_class_module.rb +9 -15
  97. data/test/test_rdoc_code_object.rb +133 -8
  98. data/test/test_rdoc_context.rb +17 -0
  99. data/test/test_rdoc_context_section.rb +0 -7
  100. data/test/test_rdoc_cross_reference.rb +4 -3
  101. data/test/test_rdoc_generator_darkfish.rb +61 -19
  102. data/test/test_rdoc_generator_json_index.rb +0 -11
  103. data/test/test_rdoc_generator_ri.rb +0 -8
  104. data/test/test_rdoc_markdown.rb +15 -12
  105. data/test/test_rdoc_markdown_test.rb +0 -7
  106. data/test/test_rdoc_markup_attribute_manager.rb +121 -0
  107. data/test/test_rdoc_markup_document.rb +0 -7
  108. data/test/test_rdoc_markup_formatter.rb +29 -3
  109. data/test/test_rdoc_markup_heading.rb +9 -0
  110. data/test/test_rdoc_markup_parser.rb +0 -7
  111. data/test/test_rdoc_markup_pre_process.rb +15 -3
  112. data/test/test_rdoc_markup_raw.rb +0 -7
  113. data/test/test_rdoc_markup_to_html.rb +50 -8
  114. data/test/test_rdoc_markup_to_html_crossref.rb +7 -0
  115. data/test/test_rdoc_markup_to_html_snippet.rb +4 -4
  116. data/test/test_rdoc_markup_to_markdown.rb +6 -0
  117. data/test/test_rdoc_method_attr.rb +8 -0
  118. data/test/test_rdoc_normal_class.rb +5 -0
  119. data/test/test_rdoc_normal_module.rb +5 -0
  120. data/test/test_rdoc_options.rb +61 -22
  121. data/test/test_rdoc_parser.rb +10 -0
  122. data/test/test_rdoc_parser_c.rb +17 -5
  123. data/test/test_rdoc_parser_changelog.rb +0 -7
  124. data/test/test_rdoc_parser_rd.rb +0 -7
  125. data/test/test_rdoc_parser_ruby.rb +305 -28
  126. data/test/test_rdoc_rd_block_parser.rb +0 -8
  127. data/test/test_rdoc_rd_inline_parser.rb +0 -1
  128. data/test/test_rdoc_rdoc.rb +27 -1
  129. data/test/test_rdoc_ri_driver.rb +19 -7
  130. data/test/test_rdoc_ruby_lex.rb +116 -9
  131. data/test/test_rdoc_rubygems_hook.rb +1 -1
  132. data/test/test_rdoc_servlet.rb +44 -6
  133. data/test/test_rdoc_stats.rb +161 -141
  134. data/test/test_rdoc_store.rb +11 -19
  135. data/test/test_rdoc_text.rb +0 -7
  136. data/test/test_rdoc_tom_doc.rb +44 -16
  137. data/test/xref_test_case.rb +2 -0
  138. metadata +28 -27
  139. metadata.gz.sig +0 -0
  140. data/test/test_attribute_manager.rb +0 -120
data/Rakefile CHANGED
@@ -46,11 +46,13 @@ Depending on your version of ruby, you may need to install ruby rdoc/ri data:
46
46
  self.history_file = 'History.rdoc'
47
47
  self.testlib = :minitest
48
48
  self.extra_rdoc_files += %w[
49
- DEVELOPERS.rdoc
50
49
  CVE-2013-0256.rdoc
50
+ CONTRIBUTING.rdoc
51
+ ExampleMarkdown.md
52
+ ExampleRDoc.rdoc
51
53
  History.rdoc
52
- LICENSE.rdoc
53
54
  LEGAL.rdoc
55
+ LICENSE.rdoc
54
56
  README.rdoc
55
57
  RI.rdoc
56
58
  TODO.rdoc
@@ -61,15 +63,43 @@ Depending on your version of ruby, you may need to install ruby rdoc/ri data:
61
63
 
62
64
  require_ruby_version '>= 1.8.7'
63
65
  extra_deps << ['json', '~> 1.4']
64
- extra_dev_deps << ['racc', '~> 1.4']
66
+ extra_dev_deps << ['racc', '~> 1.4', '!= 1.4.10']
65
67
  extra_dev_deps << ['minitest', '~> 4']
66
- extra_dev_deps << ['ZenTest', '~> 4']
67
68
 
68
69
  extra_rdoc_files << 'Rakefile'
69
70
  spec_extras['required_rubygems_version'] = '>= 1.3'
70
71
  spec_extras['homepage'] = 'http://docs.seattlerb.org/rdoc'
71
72
  end
72
73
 
74
+ hoe.test_prelude = 'gem "minitest", "~> 4.0"'
75
+
76
+ def rake(*args)
77
+ sh $0, *args
78
+ end
79
+
80
+ if PARSER_FILES.any? {|file| not File.exist?(file)}
81
+ Rake::Task["default"].prerequisites.clear
82
+ task :default do
83
+ rake "install_plugins"
84
+ rake "newb"
85
+ end
86
+ end
87
+
88
+ Rake::Task['docs'].actions.clear
89
+ task :docs do
90
+ $LOAD_PATH.unshift 'lib'
91
+ require 'rdoc'
92
+
93
+ options = RDoc::Options.new
94
+ options.title = "rdoc #{RDoc::VERSION} Documentation"
95
+ options.op_dir = 'doc'
96
+ options.main_page = 'README.rdoc'
97
+ options.files = hoe.spec.extra_rdoc_files + %w[lib]
98
+ options.setup_generator 'darkfish'
99
+
100
+ RDoc::RDoc.new.document options
101
+ end
102
+
73
103
  # requires ruby 1.8 and ruby 1.8 to build
74
104
  hoe.clean_globs -= PARSER_FILES.grep(/literals_/)
75
105
 
@@ -14,7 +14,7 @@ $DEBUG_RDOC = nil
14
14
  #
15
15
  # == Roadmap
16
16
  #
17
- # If you think you found a bug in RDoc see DEVELOPERS@Bugs
17
+ # If you think you found a bug in RDoc see CONTRIBUTING@Bugs
18
18
  #
19
19
  # If you want to use RDoc to create documentation for your Ruby source files,
20
20
  # see RDoc::Markup and refer to <tt>rdoc --help</tt> for command line usage.
@@ -42,7 +42,7 @@ $DEBUG_RDOC = nil
42
42
  #
43
43
  # If you want to write your own output generator see RDoc::Generator.
44
44
  #
45
- # If you want an overview of how RDoc works see DEVELOPERS
45
+ # If you want an overview of how RDoc works see CONTRIBUTING
46
46
  #
47
47
  # == Credits
48
48
  #
@@ -64,7 +64,7 @@ module RDoc
64
64
  ##
65
65
  # RDoc version you are using
66
66
 
67
- VERSION = '4.0.1'
67
+ VERSION = '4.1.0.preview.3'
68
68
 
69
69
  ##
70
70
  # Method visibilities
@@ -174,6 +174,7 @@ module RDoc
174
174
  autoload :Attr, 'rdoc/attr'
175
175
 
176
176
  autoload :Constant, 'rdoc/constant'
177
+ autoload :Mixin, 'rdoc/mixin'
177
178
  autoload :Include, 'rdoc/include'
178
179
  autoload :Extend, 'rdoc/extend'
179
180
  autoload :Require, 'rdoc/require'
@@ -9,8 +9,11 @@ class RDoc::AnyMethod < RDoc::MethodAttr
9
9
  # Added calls_super
10
10
  # Added parent name and class
11
11
  # Added section title
12
+ # 3::
13
+ # RDoc 4.1
14
+ # Added is_alias_for
12
15
 
13
- MARSHAL_VERSION = 2 # :nodoc:
16
+ MARSHAL_VERSION = 3 # :nodoc:
14
17
 
15
18
  ##
16
19
  # Don't rename \#initialize to \::new
@@ -25,7 +28,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
25
28
  ##
26
29
  # Different ways to call this method
27
30
 
28
- attr_accessor :call_seq
31
+ attr_reader :call_seq
29
32
 
30
33
  ##
31
34
  # Parameters for this method
@@ -89,6 +92,37 @@ class RDoc::AnyMethod < RDoc::MethodAttr
89
92
  end
90
93
  end
91
94
 
95
+ ##
96
+ # Sets the different ways you can call this method. If an empty +call_seq+
97
+ # is given nil is assumed.
98
+ #
99
+ # See also #param_seq
100
+
101
+ def call_seq= call_seq
102
+ return if call_seq.empty?
103
+
104
+ @call_seq = call_seq
105
+ end
106
+
107
+ ##
108
+ # Loads is_alias_for from the internal name. Returns nil if the alias
109
+ # cannot be found.
110
+
111
+ def is_alias_for # :nodoc:
112
+ case @is_alias_for
113
+ when RDoc::MethodAttr then
114
+ @is_alias_for
115
+ when Array then
116
+ return nil unless @store
117
+
118
+ klass_name, singleton, method_name = @is_alias_for
119
+
120
+ return nil unless klass = @store.find_class_or_module(klass_name)
121
+
122
+ @is_alias_for = klass.find_method method_name, singleton
123
+ end
124
+ end
125
+
92
126
  ##
93
127
  # Dumps this AnyMethod for use by ri. See also #marshal_load
94
128
 
@@ -97,6 +131,12 @@ class RDoc::AnyMethod < RDoc::MethodAttr
97
131
  [a.name, parse(a.comment)]
98
132
  end
99
133
 
134
+ is_alias_for = [
135
+ @is_alias_for.parent.full_name,
136
+ @is_alias_for.singleton,
137
+ @is_alias_for.name
138
+ ] if @is_alias_for
139
+
100
140
  [ MARSHAL_VERSION,
101
141
  @name,
102
142
  full_name,
@@ -112,6 +152,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
112
152
  @parent.name,
113
153
  @parent.class,
114
154
  @section.title,
155
+ is_alias_for,
115
156
  ]
116
157
  end
117
158
 
@@ -126,7 +167,6 @@ class RDoc::AnyMethod < RDoc::MethodAttr
126
167
  initialize_visibility
127
168
 
128
169
  @dont_rename_initialize = nil
129
- @is_alias_for = nil
130
170
  @token_stream = nil
131
171
  @aliases = []
132
172
  @parent = nil
@@ -150,6 +190,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
150
190
  @parent_name = array[12]
151
191
  @parent_title = array[13]
152
192
  @section_title = array[14]
193
+ @is_alias_for = array[15]
153
194
 
154
195
  array[8].each do |new_name, comment|
155
196
  add_alias RDoc::Alias.new(nil, @name, new_name, comment, @singleton)
@@ -174,7 +215,10 @@ class RDoc::AnyMethod < RDoc::MethodAttr
174
215
  def name
175
216
  return @name if @name
176
217
 
177
- @name = @call_seq[/^.*?\.(\w+)/, 1] || @call_seq if @call_seq
218
+ @name =
219
+ @call_seq[/^.*?\.(\w+)/, 1] ||
220
+ @call_seq[/^.*?(\w+)/, 1] ||
221
+ @call_seq if @call_seq
178
222
  end
179
223
 
180
224
  ##
@@ -169,13 +169,25 @@ class RDoc::ClassModule < RDoc::Context
169
169
  includes.map { |i| i.module }.reverse
170
170
  end
171
171
 
172
+ def aref_prefix # :nodoc:
173
+ raise NotImplementedError, "missing aref_prefix for #{self.class}"
174
+ end
175
+
176
+ ##
177
+ # HTML fragment reference for this module or class. See
178
+ # RDoc::NormalClass#aref and RDoc::NormalModule#aref
179
+
180
+ def aref
181
+ "#{aref_prefix}-#{full_name}"
182
+ end
183
+
172
184
  ##
173
185
  # Ancestors of this class or module only
174
186
 
175
187
  alias direct_ancestors ancestors
176
188
 
177
189
  ##
178
- # Clears the comment. Used by the ruby parser.
190
+ # Clears the comment. Used by the Ruby parser.
179
191
 
180
192
  def clear_comment
181
193
  @comment = ''
@@ -224,7 +236,9 @@ class RDoc::ClassModule < RDoc::Context
224
236
  # #received_nodoc true?
225
237
 
226
238
  def documented?
227
- super or !@comment_location.empty?
239
+ return true if @received_nodoc
240
+ return false if @comment_location.empty?
241
+ @comment_location.any? { |comment, _| not comment.empty? }
228
242
  end
229
243
 
230
244
  ##
@@ -20,8 +20,9 @@
20
20
  # * RDoc::MetaMethod
21
21
  # * RDoc::Alias
22
22
  # * RDoc::Constant
23
- # * RDoc::Require
24
- # * RDoc::Include
23
+ # * RDoc::Mixin
24
+ # * RDoc::Require
25
+ # * RDoc::Include
25
26
 
26
27
  class RDoc::CodeObject
27
28
 
@@ -92,7 +93,7 @@ class RDoc::CodeObject
92
93
  ##
93
94
  # The RDoc::Store for this object.
94
95
 
95
- attr_accessor :store
96
+ attr_reader :store
96
97
 
97
98
  ##
98
99
  # We are the model of the code, but we know that at some point we will be
@@ -105,16 +106,17 @@ class RDoc::CodeObject
105
106
  # Creates a new CodeObject that will document itself and its children
106
107
 
107
108
  def initialize
108
- @metadata = {}
109
- @comment = ''
110
- @parent = nil
111
- @parent_name = nil # for loading
112
- @parent_class = nil # for loading
113
- @section = nil
114
- @section_title = nil # for loading
115
- @file = nil
116
- @full_name = nil
117
- @store = nil
109
+ @metadata = {}
110
+ @comment = ''
111
+ @parent = nil
112
+ @parent_name = nil # for loading
113
+ @parent_class = nil # for loading
114
+ @section = nil
115
+ @section_title = nil # for loading
116
+ @file = nil
117
+ @full_name = nil
118
+ @store = nil
119
+ @track_visibility = true
118
120
 
119
121
  initialize_visibility
120
122
  end
@@ -129,6 +131,8 @@ class RDoc::CodeObject
129
131
  @force_documentation = false
130
132
  @received_nodoc = false
131
133
  @ignored = false
134
+ @suppressed = false
135
+ @track_visibility = true
132
136
  end
133
137
 
134
138
  ##
@@ -155,10 +159,17 @@ class RDoc::CodeObject
155
159
  end
156
160
 
157
161
  ##
158
- # Should this CodeObject be shown in documentation?
162
+ # Should this CodeObject be displayed in output?
163
+ #
164
+ # A code object should be displayed if:
165
+ #
166
+ # * The item didn't have a nodoc or wasn't in a container that had nodoc
167
+ # * The item wasn't ignored
168
+ # * The item has documentation and was not suppressed
159
169
 
160
170
  def display?
161
- @document_self and not @ignored
171
+ @document_self and not @ignored and
172
+ (documented? or not @suppressed)
162
173
  end
163
174
 
164
175
  ##
@@ -166,6 +177,8 @@ class RDoc::CodeObject
166
177
  # has been turned off by :enddoc:
167
178
 
168
179
  def document_children=(document_children)
180
+ return unless @track_visibility
181
+
169
182
  @document_children = document_children unless @done_documenting
170
183
  end
171
184
 
@@ -175,6 +188,7 @@ class RDoc::CodeObject
175
188
  # documentation is turned off by +:nodoc:+.
176
189
 
177
190
  def document_self=(document_self)
191
+ return unless @track_visibility
178
192
  return if @done_documenting
179
193
 
180
194
  @document_self = document_self
@@ -198,8 +212,9 @@ class RDoc::CodeObject
198
212
  # will have no effect in the current file.
199
213
 
200
214
  def done_documenting=(value)
201
- @done_documenting = value
202
- @document_self = !value
215
+ return unless @track_visibility
216
+ @done_documenting = value
217
+ @document_self = !value
203
218
  @document_children = @document_self
204
219
  end
205
220
 
@@ -249,7 +264,7 @@ class RDoc::CodeObject
249
264
 
250
265
  ##
251
266
  # Use this to ignore a CodeObject and all its children until found again
252
- # (#record_location is called). An ignored item will not be shown in
267
+ # (#record_location is called). An ignored item will not be displayed in
253
268
  # documentation.
254
269
  #
255
270
  # See github issue #55
@@ -259,10 +274,13 @@ class RDoc::CodeObject
259
274
  # and modules to add new documentation to previously created classes.
260
275
  #
261
276
  # If a class was ignored (via stopdoc) then reopened later with additional
262
- # documentation it should be shown. If a class was ignored and never
263
- # reopened it should not be shown. The ignore flag allows this to occur.
277
+ # documentation it should be displayed. If a class was ignored and never
278
+ # reopened it should not be displayed. The ignore flag allows this to
279
+ # occur.
264
280
 
265
281
  def ignore
282
+ return unless @track_visibility
283
+
266
284
  @ignored = true
267
285
 
268
286
  stop_doc
@@ -270,6 +288,8 @@ class RDoc::CodeObject
270
288
 
271
289
  ##
272
290
  # Has this class been ignored?
291
+ #
292
+ # See also #ignore
273
293
 
274
294
  def ignored?
275
295
  @ignored
@@ -282,7 +302,7 @@ class RDoc::CodeObject
282
302
  # This is used by Text#snippet
283
303
 
284
304
  def options
285
- if @store then
305
+ if @store and @store.rdoc then
286
306
  @store.rdoc.options
287
307
  else
288
308
  RDoc::Options.new
@@ -330,8 +350,9 @@ class RDoc::CodeObject
330
350
  # Records the RDoc::TopLevel (file) where this code object was defined
331
351
 
332
352
  def record_location top_level
333
- @ignored = false
334
- @file = top_level
353
+ @ignored = false
354
+ @suppressed = false
355
+ @file = top_level
335
356
  end
336
357
 
337
358
  ##
@@ -353,16 +374,56 @@ class RDoc::CodeObject
353
374
 
354
375
  @document_self = true
355
376
  @document_children = true
356
- @ignored = false
377
+ @ignored = false
378
+ @suppressed = false
357
379
  end
358
380
 
359
381
  ##
360
382
  # Disable capture of documentation
361
383
 
362
384
  def stop_doc
385
+ return unless @track_visibility
386
+
363
387
  @document_self = false
364
388
  @document_children = false
365
389
  end
366
390
 
391
+ ##
392
+ # Sets the +store+ that contains this CodeObject
393
+
394
+ def store= store
395
+ @store = store
396
+
397
+ return unless @track_visibility
398
+
399
+ if :nodoc == options.visibility then
400
+ initialize_visibility
401
+ @track_visibility = false
402
+ end
403
+ end
404
+
405
+ ##
406
+ # Use this to suppress a CodeObject and all its children until the next file
407
+ # it is seen in or documentation is discovered. A suppressed item with
408
+ # documentation will be displayed while an ignored item with documentation
409
+ # may not be displayed.
410
+
411
+ def suppress
412
+ return unless @track_visibility
413
+
414
+ @suppressed = true
415
+
416
+ stop_doc
417
+ end
418
+
419
+ ##
420
+ # Has this class been suppressed?
421
+ #
422
+ # See also #suppress
423
+
424
+ def suppressed?
425
+ @suppressed
426
+ end
427
+
367
428
  end
368
429