rdoc 6.13.0 → 6.17.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.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/History.rdoc +1 -1
  3. data/README.md +112 -0
  4. data/RI.md +1 -1
  5. data/lib/rdoc/code_object/any_method.rb +4 -4
  6. data/lib/rdoc/code_object/attr.rb +3 -3
  7. data/lib/rdoc/code_object/class_module.rb +18 -16
  8. data/lib/rdoc/code_object/constant.rb +5 -5
  9. data/lib/rdoc/code_object/context/section.rb +8 -7
  10. data/lib/rdoc/code_object/context.rb +19 -19
  11. data/lib/rdoc/code_object/method_attr.rb +7 -6
  12. data/lib/rdoc/code_object/mixin.rb +3 -3
  13. data/lib/rdoc/code_object/normal_class.rb +1 -1
  14. data/lib/rdoc/code_object/normal_module.rb +1 -1
  15. data/lib/rdoc/code_object/single_class.rb +1 -1
  16. data/lib/rdoc/code_object/top_level.rb +28 -33
  17. data/lib/rdoc/code_object.rb +3 -3
  18. data/lib/rdoc/comment.rb +196 -14
  19. data/lib/rdoc/cross_reference.rb +4 -4
  20. data/lib/rdoc/encoding.rb +4 -4
  21. data/lib/rdoc/erb_partial.rb +1 -1
  22. data/lib/rdoc/erbio.rb +2 -2
  23. data/lib/rdoc/generator/aliki.rb +42 -0
  24. data/lib/rdoc/generator/darkfish.rb +20 -16
  25. data/lib/rdoc/generator/json_index.rb +3 -3
  26. data/lib/rdoc/generator/markup.rb +12 -0
  27. data/lib/rdoc/generator/pot/message_extractor.rb +4 -4
  28. data/lib/rdoc/generator/pot/po.rb +1 -1
  29. data/lib/rdoc/generator/pot/po_entry.rb +7 -7
  30. data/lib/rdoc/generator/pot.rb +1 -1
  31. data/lib/rdoc/generator/ri.rb +1 -1
  32. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
  33. data/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
  34. data/lib/rdoc/generator/template/aliki/_head.rhtml +158 -0
  35. data/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
  36. data/lib/rdoc/generator/template/aliki/_icons.rhtml +208 -0
  37. data/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +16 -0
  38. data/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +15 -0
  39. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +25 -0
  40. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +25 -0
  41. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
  42. data/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +41 -0
  43. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +67 -0
  44. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
  45. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +21 -0
  46. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
  47. data/lib/rdoc/generator/template/aliki/class.rhtml +220 -0
  48. data/lib/rdoc/generator/template/aliki/css/rdoc.css +1737 -0
  49. data/lib/rdoc/generator/template/aliki/index.rhtml +22 -0
  50. data/lib/rdoc/generator/template/aliki/js/aliki.js +483 -0
  51. data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
  52. data/lib/rdoc/generator/template/aliki/js/search.js +120 -0
  53. data/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
  54. data/lib/rdoc/generator/template/aliki/page.rhtml +18 -0
  55. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
  56. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
  57. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +3 -3
  58. data/lib/rdoc/generator/template/darkfish/_head.rhtml +16 -16
  59. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -8
  60. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -8
  61. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +7 -6
  62. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +6 -6
  63. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +19 -19
  64. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +2 -2
  65. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +1 -0
  66. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +3 -3
  67. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +14 -14
  68. data/lib/rdoc/generator/template/darkfish/class.rhtml +62 -60
  69. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +2 -0
  70. data/lib/rdoc/generator/template/darkfish/index.rhtml +4 -3
  71. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +21 -1
  72. data/lib/rdoc/generator/template/darkfish/js/search.js +11 -1
  73. data/lib/rdoc/generator/template/darkfish/page.rhtml +2 -1
  74. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +2 -1
  75. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +19 -19
  76. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +19 -17
  77. data/lib/rdoc/generator/template/json_index/js/searcher.js +48 -6
  78. data/lib/rdoc/generator.rb +1 -0
  79. data/lib/rdoc/markdown.kpeg +72 -18
  80. data/lib/rdoc/markdown.rb +411 -547
  81. data/lib/rdoc/markup/attribute_manager.rb +5 -5
  82. data/lib/rdoc/markup/attributes.rb +3 -3
  83. data/lib/rdoc/markup/blank_line.rb +2 -2
  84. data/lib/rdoc/markup/block_quote.rb +1 -1
  85. data/lib/rdoc/markup/document.rb +8 -8
  86. data/lib/rdoc/markup/formatter.rb +12 -12
  87. data/lib/rdoc/markup/hard_break.rb +3 -3
  88. data/lib/rdoc/markup/heading.rb +4 -4
  89. data/lib/rdoc/markup/include.rb +3 -3
  90. data/lib/rdoc/markup/indented_paragraph.rb +3 -3
  91. data/lib/rdoc/markup/list.rb +4 -4
  92. data/lib/rdoc/markup/list_item.rb +4 -4
  93. data/lib/rdoc/markup/paragraph.rb +2 -2
  94. data/lib/rdoc/markup/parser.rb +11 -11
  95. data/lib/rdoc/markup/pre_process.rb +39 -15
  96. data/lib/rdoc/markup/raw.rb +5 -5
  97. data/lib/rdoc/markup/rule.rb +2 -2
  98. data/lib/rdoc/markup/table.rb +4 -4
  99. data/lib/rdoc/markup/to_ansi.rb +7 -3
  100. data/lib/rdoc/markup/to_bs.rb +10 -6
  101. data/lib/rdoc/markup/to_html.rb +182 -30
  102. data/lib/rdoc/markup/to_html_crossref.rb +58 -28
  103. data/lib/rdoc/markup/to_html_snippet.rb +17 -17
  104. data/lib/rdoc/markup/to_joined_paragraph.rb +1 -1
  105. data/lib/rdoc/markup/to_label.rb +6 -5
  106. data/lib/rdoc/markup/to_markdown.rb +12 -12
  107. data/lib/rdoc/markup/to_rdoc.rb +40 -31
  108. data/lib/rdoc/markup/to_table_of_contents.rb +3 -3
  109. data/lib/rdoc/markup/to_test.rb +1 -1
  110. data/lib/rdoc/markup/to_tt_only.rb +8 -8
  111. data/lib/rdoc/markup/verbatim.rb +3 -3
  112. data/lib/rdoc/markup.rb +3 -3
  113. data/lib/rdoc/options.rb +53 -23
  114. data/lib/rdoc/parser/c.rb +31 -62
  115. data/lib/rdoc/parser/changelog.rb +9 -9
  116. data/lib/rdoc/parser/prism_ruby.rb +122 -114
  117. data/lib/rdoc/parser/ruby.rb +51 -51
  118. data/lib/rdoc/parser/ruby_tools.rb +5 -7
  119. data/lib/rdoc/parser/simple.rb +5 -22
  120. data/lib/rdoc/parser.rb +8 -8
  121. data/lib/rdoc/rd/inline.rb +4 -4
  122. data/lib/rdoc/rd.rb +1 -1
  123. data/lib/rdoc/rdoc.rb +9 -8
  124. data/lib/rdoc/ri/driver.rb +49 -49
  125. data/lib/rdoc/ri/paths.rb +2 -2
  126. data/lib/rdoc/ri/task.rb +3 -3
  127. data/lib/rdoc/rubygems_hook.rb +14 -11
  128. data/lib/rdoc/servlet.rb +15 -15
  129. data/lib/rdoc/stats/normal.rb +1 -1
  130. data/lib/rdoc/stats/quiet.rb +1 -1
  131. data/lib/rdoc/stats/verbose.rb +3 -3
  132. data/lib/rdoc/stats.rb +12 -12
  133. data/lib/rdoc/store.rb +32 -32
  134. data/lib/rdoc/task.rb +6 -6
  135. data/lib/rdoc/text.rb +11 -11
  136. data/lib/rdoc/token_stream.rb +14 -2
  137. data/lib/rdoc/tom_doc.rb +8 -8
  138. data/lib/rdoc/version.rb +1 -1
  139. data/man/ri.1 +2 -0
  140. data/rdoc.gemspec +72 -0
  141. metadata +61 -6
  142. data/README.rdoc +0 -142
data/lib/rdoc/servlet.rb CHANGED
@@ -66,7 +66,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
66
66
  # +server+ is provided automatically by WEBrick when mounting. +stores+ and
67
67
  # +cache+ are provided automatically by the servlet.
68
68
 
69
- def initialize server, stores, cache, mount_path = nil, extra_doc_dirs = []
69
+ def initialize(server, stores, cache, mount_path = nil, extra_doc_dirs = [])
70
70
  super server
71
71
 
72
72
  @cache = cache
@@ -97,7 +97,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
97
97
  ##
98
98
  # Serves the asset at the path in +req+ for +generator_name+ via +res+.
99
99
 
100
- def asset generator_name, req, res
100
+ def asset(generator_name, req, res)
101
101
  asset_dir = @asset_dirs[generator_name]
102
102
 
103
103
  asset_path = File.join asset_dir, req.path
@@ -116,7 +116,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
116
116
  ##
117
117
  # GET request entry point. Fills in +res+ for the path, etc. in +req+.
118
118
 
119
- def do_GET req, res
119
+ def do_GET(req, res)
120
120
  req.path.sub!(/\A#{Regexp.escape @mount_path}/, '') if @mount_path
121
121
 
122
122
  case req.path
@@ -149,7 +149,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
149
149
  # module or page name (/RDoc/Servlet.html becomes RDoc::Servlet).
150
150
  # +generator+ is used to create the page.
151
151
 
152
- def documentation_page store, generator, path, req, res
152
+ def documentation_page(store, generator, path, req, res)
153
153
  text_name = path.chomp '.html'
154
154
  name = text_name.gsub '/', '::'
155
155
 
@@ -168,7 +168,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
168
168
  # Creates the JSON search index on +res+ for the given +store+. +generator+
169
169
  # must respond to \#json_index to build. +req+ is ignored.
170
170
 
171
- def documentation_search store, generator, req, res
171
+ def documentation_search(store, generator, req, res)
172
172
  json_index = @cache[store].fetch :json_index do
173
173
  @cache[store][:json_index] =
174
174
  JSON.dump generator.json_index.build_index
@@ -182,7 +182,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
182
182
  # Returns the RDoc::Store and path relative to +mount_path+ for
183
183
  # documentation at +path+.
184
184
 
185
- def documentation_source path
185
+ def documentation_source(path)
186
186
  _, source_name, path = path.split '/', 3
187
187
 
188
188
  store = @stores[source_name]
@@ -200,7 +200,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
200
200
  ##
201
201
  # Generates an error page for the +exception+ while handling +req+ on +res+.
202
202
 
203
- def error exception, req, res
203
+ def error(exception, req, res)
204
204
  backtrace = exception.backtrace.join "\n"
205
205
 
206
206
  res.content_type = 'text/html'
@@ -243,7 +243,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
243
243
  ##
244
244
  # Instantiates a Darkfish generator for +store+
245
245
 
246
- def generator_for store
246
+ def generator_for(store)
247
247
  generator = RDoc::Generator::Darkfish.new store, @options
248
248
  generator.file_output = false
249
249
  generator.asset_rel_path = '..'
@@ -265,7 +265,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
265
265
  # file has not been modified a Not Modified response is returned. If the
266
266
  # file has been modified a Last-Modified header is added to +res+.
267
267
 
268
- def if_modified_since req, res, path = nil
268
+ def if_modified_since(req, res, path = nil)
269
269
  last_modified = File.stat(path).mtime if path
270
270
 
271
271
  res['last-modified'] = last_modified.httpdate
@@ -316,7 +316,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
316
316
  ##
317
317
  # Returns a 404 page built by +generator+ for +req+ on +res+.
318
318
 
319
- def not_found generator, req, res, message = nil
319
+ def not_found(generator, req, res, message = nil)
320
320
  message ||= "The page <kbd>#{ERB::Util.h req.path}</kbd> was not found"
321
321
  res.body = generator.generate_servlet_not_found message
322
322
  res.status = 404
@@ -325,14 +325,14 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
325
325
  ##
326
326
  # Enumerates the ri paths. See RDoc::RI::Paths#each
327
327
 
328
- def ri_paths &block
328
+ def ri_paths(&block)
329
329
  RDoc::RI::Paths.each true, true, true, :all, *@extra_doc_dirs, &block #TODO: pass extra_dirs
330
330
  end
331
331
 
332
332
  ##
333
333
  # Generates the root page on +res+. +req+ is ignored.
334
334
 
335
- def root req, res
335
+ def root(req, res)
336
336
  generator = RDoc::Generator::Darkfish.new nil, @options
337
337
 
338
338
  res.body = generator.generate_servlet_root installed_docs
@@ -343,7 +343,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
343
343
  ##
344
344
  # Generates a search index for the root page on +res+. +req+ is ignored.
345
345
 
346
- def root_search req, res
346
+ def root_search(req, res)
347
347
  search_index = []
348
348
  info = []
349
349
 
@@ -393,7 +393,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
393
393
  # Displays documentation for +req+ on +res+, whether that be HTML or some
394
394
  # asset.
395
395
 
396
- def show_documentation req, res
396
+ def show_documentation(req, res)
397
397
  store, path = documentation_source req.path
398
398
 
399
399
  if_modified_since req, res, store.cache_path
@@ -417,7 +417,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
417
417
  ##
418
418
  # Returns an RDoc::Store for the given +source_name+ ('ruby' or a gem name).
419
419
 
420
- def store_for source_name
420
+ def store_for(source_name)
421
421
  case source_name
422
422
  when 'home' then
423
423
  RDoc::Store.new(@options, path: RDoc::RI::Paths.home_dir, type: :home)
@@ -20,7 +20,7 @@ class RDoc::Stats::Normal < RDoc::Stats::Quiet
20
20
  ##
21
21
  # Prints a file with a progress bar
22
22
 
23
- def print_file files_so_far, filename
23
+ def print_file(files_so_far, filename)
24
24
  progress_bar = sprintf("%3d%% [%2d/%2d] ",
25
25
  100 * files_so_far / @num_files,
26
26
  files_so_far,
@@ -7,7 +7,7 @@ class RDoc::Stats::Quiet
7
7
  ##
8
8
  # Creates a new Quiet that will print nothing
9
9
 
10
- def initialize num_files
10
+ def initialize(num_files)
11
11
  @num_files = num_files
12
12
  end
13
13
 
@@ -8,15 +8,15 @@ class RDoc::Stats::Verbose < RDoc::Stats::Normal
8
8
  ##
9
9
  # Returns a marker for RDoc::CodeObject +co+ being undocumented
10
10
 
11
- def nodoc co
11
+ def nodoc(co)
12
12
  " (undocumented)" unless co.documented?
13
13
  end
14
14
 
15
- def print_alias as # :nodoc:
15
+ def print_alias(as) # :nodoc:
16
16
  puts " alias #{as.new_name} #{as.old_name}#{nodoc as}"
17
17
  end
18
18
 
19
- def print_attribute attribute # :nodoc:
19
+ def print_attribute(attribute) # :nodoc:
20
20
  puts " #{attribute.definition} #{attribute.name}#{nodoc attribute}"
21
21
  end
22
22
 
data/lib/rdoc/stats.rb CHANGED
@@ -26,7 +26,7 @@ class RDoc::Stats
26
26
  # Creates a new Stats that will have +num_files+. +verbosity+ defaults to 1
27
27
  # which will create an RDoc::Stats::Normal outputter.
28
28
 
29
- def initialize store, num_files, verbosity = 1
29
+ def initialize(store, num_files, verbosity = 1)
30
30
  @num_files = num_files
31
31
  @store = store
32
32
 
@@ -49,28 +49,28 @@ class RDoc::Stats
49
49
  ##
50
50
  # Records the parsing of an alias +as+.
51
51
 
52
- def add_alias as
52
+ def add_alias(as)
53
53
  @display.print_alias as
54
54
  end
55
55
 
56
56
  ##
57
57
  # Records the parsing of an attribute +attribute+
58
58
 
59
- def add_attribute attribute
59
+ def add_attribute(attribute)
60
60
  @display.print_attribute attribute
61
61
  end
62
62
 
63
63
  ##
64
64
  # Records the parsing of a class +klass+
65
65
 
66
- def add_class klass
66
+ def add_class(klass)
67
67
  @display.print_class klass
68
68
  end
69
69
 
70
70
  ##
71
71
  # Records the parsing of +constant+
72
72
 
73
- def add_constant constant
73
+ def add_constant(constant)
74
74
  @display.print_constant constant
75
75
  end
76
76
 
@@ -155,7 +155,7 @@ class RDoc::Stats
155
155
  # 0:: Classes, modules, constants, attributes, methods
156
156
  # 1:: Level 0 + method parameters
157
157
 
158
- def coverage_level= level
158
+ def coverage_level=(level)
159
159
  level = -1 unless level
160
160
 
161
161
  @coverage_level = level
@@ -164,7 +164,7 @@ class RDoc::Stats
164
164
  ##
165
165
  # Returns the length and number of undocumented items in +collection+.
166
166
 
167
- def doc_stats collection
167
+ def doc_stats(collection)
168
168
  visible = collection.select { |item| item.display? }
169
169
  [visible.length, visible.count { |item| not item.documented? }]
170
170
  end
@@ -256,7 +256,7 @@ class RDoc::Stats
256
256
  ##
257
257
  # Returns a report on undocumented attributes in ClassModule +cm+
258
258
 
259
- def report_attributes cm
259
+ def report_attributes(cm)
260
260
  return if cm.attributes.empty?
261
261
 
262
262
  report = []
@@ -274,7 +274,7 @@ class RDoc::Stats
274
274
  ##
275
275
  # Returns a report on undocumented items in ClassModule +cm+
276
276
 
277
- def report_class_module cm
277
+ def report_class_module(cm)
278
278
  return if cm.fully_documented? and @coverage_level.zero?
279
279
  return unless cm.display?
280
280
 
@@ -326,7 +326,7 @@ class RDoc::Stats
326
326
  ##
327
327
  # Returns a report on undocumented constants in ClassModule +cm+
328
328
 
329
- def report_constants cm
329
+ def report_constants(cm)
330
330
  return if cm.constants.empty?
331
331
 
332
332
  report = []
@@ -348,7 +348,7 @@ class RDoc::Stats
348
348
  ##
349
349
  # Returns a report on undocumented methods in ClassModule +cm+
350
350
 
351
- def report_methods cm
351
+ def report_methods(cm)
352
352
  return if cm.method_list.empty?
353
353
 
354
354
  report = []
@@ -436,7 +436,7 @@ class RDoc::Stats
436
436
  # Determines which parameters in +method+ were not documented. Returns a
437
437
  # total parameter count and an Array of undocumented methods.
438
438
 
439
- def undoc_params method
439
+ def undoc_params(method)
440
440
  @formatter ||= RDoc::Markup::ToTtOnly.new
441
441
 
442
442
  params = method.param_list
data/lib/rdoc/store.rb CHANGED
@@ -54,7 +54,7 @@ class RDoc::Store
54
54
  # Creates a new MissingFileError for the missing +file+ for the given
55
55
  # +name+ that should have been in the +store+.
56
56
 
57
- def initialize store, file, name
57
+ def initialize(store, file, name)
58
58
  @store = store
59
59
  @file = file
60
60
  @name = name
@@ -162,14 +162,14 @@ class RDoc::Store
162
162
  # Adds +module+ as an enclosure (namespace) for the given +variable+ for C
163
163
  # files.
164
164
 
165
- def add_c_enclosure variable, namespace
165
+ def add_c_enclosure(variable, namespace)
166
166
  @c_enclosure_classes[variable] = namespace
167
167
  end
168
168
 
169
169
  ##
170
170
  # Adds C variables from an RDoc::Parser::C
171
171
 
172
- def add_c_variables c_parser
172
+ def add_c_variables(c_parser)
173
173
  filename = c_parser.top_level.relative_name
174
174
 
175
175
  @c_class_variables[filename] = make_variable_map c_parser.classes
@@ -181,7 +181,7 @@ class RDoc::Store
181
181
  # Adds the file with +name+ as an RDoc::TopLevel to the store. Returns the
182
182
  # created RDoc::TopLevel.
183
183
 
184
- def add_file absolute_name, relative_name: absolute_name, parser: nil
184
+ def add_file(absolute_name, relative_name: absolute_name, parser: nil)
185
185
  unless top_level = @files_hash[relative_name] then
186
186
  top_level = RDoc::TopLevel.new absolute_name, relative_name
187
187
  top_level.parser = parser if parser
@@ -268,7 +268,7 @@ class RDoc::Store
268
268
  ##
269
269
  # Path to the ri data for +klass_name+
270
270
 
271
- def class_file klass_name
271
+ def class_file(klass_name)
272
272
  name = klass_name.split('::').last
273
273
  File.join class_path(klass_name), "cdesc-#{name}.ri"
274
274
  end
@@ -284,7 +284,7 @@ class RDoc::Store
284
284
  ##
285
285
  # Path where data for +klass_name+ will be stored (methods or class data)
286
286
 
287
- def class_path klass_name
287
+ def class_path(klass_name)
288
288
  File.join @path, *klass_name.split('::')
289
289
  end
290
290
 
@@ -299,7 +299,7 @@ class RDoc::Store
299
299
  # Removes empty items and ensures item in each collection are unique and
300
300
  # sorted
301
301
 
302
- def clean_cache_collection collection # :nodoc:
302
+ def clean_cache_collection(collection) # :nodoc:
303
303
  collection.each do |name, item|
304
304
  if item.empty? then
305
305
  collection.delete name
@@ -327,7 +327,7 @@ class RDoc::Store
327
327
  #
328
328
  # See also RDoc::Context#remove_from_documentation?
329
329
 
330
- def complete min_visibility
330
+ def complete(min_visibility)
331
331
  fix_basic_object_inheritance
332
332
 
333
333
  # cache included modules before they are removed from the documentation
@@ -374,7 +374,7 @@ class RDoc::Store
374
374
  ##
375
375
  # Finds the enclosure (namespace) for the given C +variable+.
376
376
 
377
- def find_c_enclosure variable
377
+ def find_c_enclosure(variable)
378
378
  @c_enclosure_classes.fetch variable do
379
379
  break unless name = @c_enclosure_names[variable]
380
380
 
@@ -399,14 +399,14 @@ class RDoc::Store
399
399
  ##
400
400
  # Finds the class with +name+ in all discovered classes
401
401
 
402
- def find_class_named name
402
+ def find_class_named(name)
403
403
  @classes_hash[name]
404
404
  end
405
405
 
406
406
  ##
407
407
  # Finds the class with +name+ starting in namespace +from+
408
408
 
409
- def find_class_named_from name, from
409
+ def find_class_named_from(name, from)
410
410
  from = find_class_named from unless RDoc::Context === from
411
411
 
412
412
  until RDoc::TopLevel === from do
@@ -424,7 +424,7 @@ class RDoc::Store
424
424
  ##
425
425
  # Finds the class or module with +name+
426
426
 
427
- def find_class_or_module name
427
+ def find_class_or_module(name)
428
428
  name = $' if name =~ /^::/
429
429
  @classes_hash[name] || @modules_hash[name]
430
430
  end
@@ -432,14 +432,14 @@ class RDoc::Store
432
432
  ##
433
433
  # Finds the file with +name+ in all discovered files
434
434
 
435
- def find_file_named name
435
+ def find_file_named(name)
436
436
  @files_hash[name]
437
437
  end
438
438
 
439
439
  ##
440
440
  # Finds the module with +name+ in all discovered modules
441
441
 
442
- def find_module_named name
442
+ def find_module_named(name)
443
443
  @modules_hash[name]
444
444
  end
445
445
 
@@ -447,7 +447,7 @@ class RDoc::Store
447
447
  # Returns the RDoc::TopLevel that is a text file and has the given
448
448
  # +file_name+
449
449
 
450
- def find_text_page file_name
450
+ def find_text_page(file_name)
451
451
  @text_files_hash.each_value.find do |file|
452
452
  file.full_name == file_name
453
453
  end
@@ -460,7 +460,7 @@ class RDoc::Store
460
460
  #--
461
461
  # TODO aliases should be registered by Context#add_module_alias
462
462
 
463
- def find_unique all_hash
463
+ def find_unique(all_hash)
464
464
  unique = []
465
465
 
466
466
  all_hash.each_pair do |full_name, cm|
@@ -603,7 +603,7 @@ class RDoc::Store
603
603
  ##
604
604
  # Loads ri data for +klass_name+ and hooks it up to this store.
605
605
 
606
- def load_class klass_name
606
+ def load_class(klass_name)
607
607
  obj = load_class_data klass_name
608
608
 
609
609
  obj.store = self
@@ -621,7 +621,7 @@ class RDoc::Store
621
621
  ##
622
622
  # Loads ri data for +klass_name+
623
623
 
624
- def load_class_data klass_name
624
+ def load_class_data(klass_name)
625
625
  file = class_file klass_name
626
626
 
627
627
  marshal_load(file)
@@ -634,7 +634,7 @@ class RDoc::Store
634
634
  ##
635
635
  # Loads ri data for +method_name+ in +klass_name+
636
636
 
637
- def load_method klass_name, method_name
637
+ def load_method(klass_name, method_name)
638
638
  file = method_file klass_name, method_name
639
639
 
640
640
  obj = marshal_load(file)
@@ -650,7 +650,7 @@ class RDoc::Store
650
650
  ##
651
651
  # Loads ri data for +page_name+
652
652
 
653
- def load_page page_name
653
+ def load_page(page_name)
654
654
  file = page_file page_name
655
655
 
656
656
  obj = marshal_load(file)
@@ -673,7 +673,7 @@ class RDoc::Store
673
673
  ##
674
674
  # Sets the main page for this RDoc store.
675
675
 
676
- def main= page
676
+ def main=(page)
677
677
  @cache[:main] = page
678
678
  end
679
679
 
@@ -681,7 +681,7 @@ class RDoc::Store
681
681
  # Converts the variable => ClassModule map +variables+ from a C parser into
682
682
  # a variable => class name map.
683
683
 
684
- def make_variable_map variables
684
+ def make_variable_map(variables)
685
685
  map = {}
686
686
 
687
687
  variables.each { |variable, class_module|
@@ -694,7 +694,7 @@ class RDoc::Store
694
694
  ##
695
695
  # Path to the ri data for +method_name+ in +klass_name+
696
696
 
697
- def method_file klass_name, method_name
697
+ def method_file(klass_name, method_name)
698
698
  method_name = method_name.split('::').last
699
699
  method_name =~ /#(.*)/
700
700
  method_type = $1 ? 'i' : 'c'
@@ -720,10 +720,10 @@ class RDoc::Store
720
720
  end
721
721
 
722
722
  ##
723
- # Returns the RDoc::TopLevel that is a text file and has the given +name+
723
+ # Returns the RDoc::TopLevel that is a file and has the given +name+
724
724
 
725
- def page name
726
- @text_files_hash.each_value.find do |file|
725
+ def page(name)
726
+ @files_hash.each_value.find do |file|
727
727
  file.page_name == name or file.base_name == name
728
728
  end
729
729
  end
@@ -731,7 +731,7 @@ class RDoc::Store
731
731
  ##
732
732
  # Path to the ri data for +page_name+
733
733
 
734
- def page_file page_name
734
+ def page_file(page_name)
735
735
  file_name = File.basename(page_name).gsub('.', '_')
736
736
 
737
737
  File.join @path, File.dirname(page_name), "page-#{file_name}.ri"
@@ -742,7 +742,7 @@ class RDoc::Store
742
742
  #
743
743
  # See RDoc::Context#remove_from_documentation?
744
744
 
745
- def remove_nodoc all_hash
745
+ def remove_nodoc(all_hash)
746
746
  all_hash.keys.each do |name|
747
747
  context = all_hash[name]
748
748
  all_hash.delete(name) if context.remove_from_documentation?
@@ -804,7 +804,7 @@ class RDoc::Store
804
804
  ##
805
805
  # Writes the ri data for +klass+ (or module)
806
806
 
807
- def save_class klass
807
+ def save_class(klass)
808
808
  full_name = klass.full_name
809
809
 
810
810
  FileUtils.mkdir_p class_path(full_name) unless @dry_run
@@ -878,7 +878,7 @@ class RDoc::Store
878
878
  ##
879
879
  # Writes the ri data for +method+ on +klass+
880
880
 
881
- def save_method klass, method
881
+ def save_method(klass, method)
882
882
  full_name = klass.full_name
883
883
 
884
884
  FileUtils.mkdir_p class_path(full_name) unless @dry_run
@@ -901,7 +901,7 @@ class RDoc::Store
901
901
  ##
902
902
  # Writes the ri data for +page+
903
903
 
904
- def save_page page
904
+ def save_page(page)
905
905
  return unless page.text?
906
906
 
907
907
  path = page_file page.full_name
@@ -948,7 +948,7 @@ class RDoc::Store
948
948
  ##
949
949
  # Sets the title page for this RDoc store.
950
950
 
951
- def title= title
951
+ def title=(title)
952
952
  @cache[:title] = title
953
953
  end
954
954
 
data/lib/rdoc/task.rb CHANGED
@@ -58,8 +58,8 @@ require 'rake/tasklib'
58
58
  # require 'rdoc/task'
59
59
  #
60
60
  # RDoc::Task.new do |rdoc|
61
- # rdoc.main = "README.rdoc"
62
- # rdoc.rdoc_files.include("README.rdoc", "lib/**/*.rb")
61
+ # rdoc.main = "README.md"
62
+ # rdoc.rdoc_files.include("README.md", "lib/**/*.rb")
63
63
  # end
64
64
  #
65
65
  # The +rdoc+ object passed to the block is an RDoc::Task object. See the
@@ -74,8 +74,8 @@ require 'rake/tasklib'
74
74
  # require 'rdoc/task'
75
75
  #
76
76
  # RDoc::Task.new :rdoc_dev do |rdoc|
77
- # rdoc.main = "README.rdoc"
78
- # rdoc.rdoc_files.include("README.rdoc", "lib/**/*.rb")
77
+ # rdoc.main = "README.md"
78
+ # rdoc.rdoc_files.include("README.md", "lib/**/*.rb")
79
79
  # rdoc.options << "--all"
80
80
  # end
81
81
  #
@@ -154,7 +154,7 @@ class RDoc::Task < Rake::TaskLib
154
154
  # Create an RDoc task with the given name. See the RDoc::Task class overview
155
155
  # for documentation.
156
156
 
157
- def initialize name = :rdoc # :yield: self
157
+ def initialize(name = :rdoc) # :yield: self
158
158
  defaults
159
159
 
160
160
  check_names name
@@ -170,7 +170,7 @@ class RDoc::Task < Rake::TaskLib
170
170
  # Ensures that +names+ only includes names for the :rdoc, :clobber_rdoc and
171
171
  # :rerdoc. If other names are given an ArgumentError is raised.
172
172
 
173
- def check_names names
173
+ def check_names(names)
174
174
  return unless Hash === names
175
175
 
176
176
  invalid_options =
data/lib/rdoc/text.rb CHANGED
@@ -52,7 +52,7 @@ module RDoc::Text
52
52
  ##
53
53
  # Transcodes +character+ to +encoding+ with a +fallback+ character.
54
54
 
55
- def self.encode_fallback character, encoding, fallback
55
+ def self.encode_fallback(character, encoding, fallback)
56
56
  character.encode(encoding, :fallback => { character => fallback },
57
57
  :undef => :replace, :replace => fallback)
58
58
  end
@@ -60,7 +60,7 @@ module RDoc::Text
60
60
  ##
61
61
  # Expands tab characters in +text+ to eight spaces
62
62
 
63
- def expand_tabs text
63
+ module_function def expand_tabs(text)
64
64
  expanded = []
65
65
 
66
66
  text.each_line do |line|
@@ -79,7 +79,7 @@ module RDoc::Text
79
79
  ##
80
80
  # Flush +text+ left based on the shortest line
81
81
 
82
- def flush_left text
82
+ def flush_left(text)
83
83
  indent = 9999
84
84
 
85
85
  text.each_line do |line|
@@ -98,7 +98,7 @@ module RDoc::Text
98
98
  #
99
99
  # Requires the including class to implement #formatter
100
100
 
101
- def markup text
101
+ def markup(text)
102
102
  if @store.options
103
103
  locale = @store.options.locale
104
104
  else
@@ -114,7 +114,7 @@ module RDoc::Text
114
114
  ##
115
115
  # Strips hashes, expands tabs then flushes +text+ to the left
116
116
 
117
- def normalize_comment text
117
+ def normalize_comment(text)
118
118
  return text if text.empty?
119
119
 
120
120
  case language
@@ -132,7 +132,7 @@ module RDoc::Text
132
132
  ##
133
133
  # Normalizes +text+ then builds a RDoc::Markup::Document from it
134
134
 
135
- def parse text, format = 'rdoc'
135
+ def parse(text, format = 'rdoc')
136
136
  return text if RDoc::Markup::Document === text
137
137
  return text.parse if RDoc::Comment === text
138
138
 
@@ -146,7 +146,7 @@ module RDoc::Text
146
146
  ##
147
147
  # The first +limit+ characters of +text+ as HTML
148
148
 
149
- def snippet text, limit = 100
149
+ def snippet(text, limit = 100)
150
150
  document = parse text
151
151
 
152
152
  RDoc::Markup::ToHtmlSnippet.new(options, limit).convert document
@@ -155,7 +155,7 @@ module RDoc::Text
155
155
  ##
156
156
  # Strips leading # characters from +text+
157
157
 
158
- def strip_hashes text
158
+ def strip_hashes(text)
159
159
  return text if text =~ /^(?>\s*)[^\#]/
160
160
 
161
161
  empty = ''
@@ -167,14 +167,14 @@ module RDoc::Text
167
167
  ##
168
168
  # Strips leading and trailing \n characters from +text+
169
169
 
170
- def strip_newlines text
170
+ def strip_newlines(text)
171
171
  text.gsub(/\A\n*(.*?)\n*\z/m) do $1 end # block preserves String encoding
172
172
  end
173
173
 
174
174
  ##
175
175
  # Strips /* */ style comments
176
176
 
177
- def strip_stars text
177
+ def strip_stars(text)
178
178
  return text unless text =~ %r%/\*.*\*/%m
179
179
 
180
180
  encoding = text.encoding
@@ -197,7 +197,7 @@ module RDoc::Text
197
197
  # Converts ampersand, dashes, ellipsis, quotes, copyright and registered
198
198
  # trademark symbols in +text+ to properly encoded characters.
199
199
 
200
- def to_html text
200
+ def to_html(text)
201
201
  html = (''.encode text.encoding).dup
202
202
 
203
203
  encoded = RDoc::Text::TO_HTML_CHARACTERS[text.encoding]