rdoc 6.17.0 → 8.1.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 (169) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +193 -0
  3. data/LEGAL.rdoc +6 -0
  4. data/LICENSE.rdoc +4 -0
  5. data/README.md +132 -8
  6. data/RI.md +75 -75
  7. data/doc/markup_reference/markdown.md +659 -0
  8. data/doc/markup_reference/rdoc.rdoc +1169 -0
  9. data/exe/rdoc +2 -2
  10. data/lib/rdoc/code_object/alias.rb +70 -74
  11. data/lib/rdoc/code_object/any_method.rb +308 -293
  12. data/lib/rdoc/code_object/attr.rb +150 -142
  13. data/lib/rdoc/code_object/class_module.rb +802 -715
  14. data/lib/rdoc/code_object/constant.rb +181 -144
  15. data/lib/rdoc/code_object/context/section.rb +140 -130
  16. data/lib/rdoc/code_object/context.rb +925 -941
  17. data/lib/rdoc/code_object/extend.rb +7 -5
  18. data/lib/rdoc/code_object/include.rb +7 -5
  19. data/lib/rdoc/code_object/method_attr.rb +328 -315
  20. data/lib/rdoc/code_object/mixin.rb +97 -92
  21. data/lib/rdoc/code_object/normal_class.rb +77 -78
  22. data/lib/rdoc/code_object/normal_module.rb +61 -59
  23. data/lib/rdoc/code_object/require.rb +23 -39
  24. data/lib/rdoc/code_object/single_class.rb +21 -19
  25. data/lib/rdoc/code_object/top_level.rb +215 -202
  26. data/lib/rdoc/code_object.rb +305 -305
  27. data/lib/rdoc/comment.rb +274 -337
  28. data/lib/rdoc/cross_reference.rb +195 -206
  29. data/lib/rdoc/encoding.rb +105 -103
  30. data/lib/rdoc/erb_partial.rb +13 -11
  31. data/lib/rdoc/erbio.rb +29 -27
  32. data/lib/rdoc/generator/aliki.rb +196 -30
  33. data/lib/rdoc/generator/darkfish.rb +647 -629
  34. data/lib/rdoc/generator/json_index.rb +233 -229
  35. data/lib/rdoc/generator/markup.rb +165 -122
  36. data/lib/rdoc/generator/pot/message_extractor.rb +57 -51
  37. data/lib/rdoc/generator/pot/po.rb +52 -51
  38. data/lib/rdoc/generator/pot/po_entry.rb +138 -132
  39. data/lib/rdoc/generator/pot.rb +85 -81
  40. data/lib/rdoc/generator/ri.rb +23 -19
  41. data/lib/rdoc/generator/template/aliki/DESIGN.md +538 -0
  42. data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +1 -1
  43. data/lib/rdoc/generator/template/aliki/_footer.rhtml +2 -2
  44. data/lib/rdoc/generator/template/aliki/_head.rhtml +15 -10
  45. data/lib/rdoc/generator/template/aliki/_header.rhtml +29 -44
  46. data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +8 -6
  47. data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +8 -6
  48. data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +1 -1
  49. data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +3 -3
  50. data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +3 -3
  51. data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +1 -1
  52. data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +1 -1
  53. data/lib/rdoc/generator/template/aliki/class.rhtml +71 -61
  54. data/lib/rdoc/generator/template/aliki/css/rdoc.css +796 -323
  55. data/lib/rdoc/generator/template/aliki/index.rhtml +1 -1
  56. data/lib/rdoc/generator/template/aliki/js/aliki.js +119 -113
  57. data/lib/rdoc/generator/template/aliki/js/bash_highlighter.js +167 -0
  58. data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +1 -1
  59. data/lib/rdoc/generator/template/aliki/js/{search.js → search_controller.js} +16 -7
  60. data/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
  61. data/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
  62. data/lib/rdoc/generator/template/aliki/page.rhtml +1 -1
  63. data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +1 -1
  64. data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +2 -2
  65. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +1 -1
  66. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -6
  67. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -6
  68. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +1 -1
  69. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +2 -2
  70. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +1 -1
  71. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +5 -5
  72. data/lib/rdoc/generator/template/darkfish/class.rhtml +29 -32
  73. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +19 -1
  74. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +3 -3
  75. data/lib/rdoc/generator.rb +48 -46
  76. data/lib/rdoc/i18n/locale.rb +99 -95
  77. data/lib/rdoc/i18n/text.rb +109 -105
  78. data/lib/rdoc/i18n.rb +7 -5
  79. data/lib/rdoc/markdown/byte_runtime.rb +80 -0
  80. data/lib/rdoc/markdown.kpeg +52 -33
  81. data/lib/rdoc/markdown.rb +365 -177
  82. data/lib/rdoc/markup/blank_line.rb +25 -23
  83. data/lib/rdoc/markup/block_quote.rb +12 -8
  84. data/lib/rdoc/markup/document.rb +127 -123
  85. data/lib/rdoc/markup/element.rb +21 -0
  86. data/lib/rdoc/markup/formatter.rb +220 -203
  87. data/lib/rdoc/markup/hard_break.rb +30 -27
  88. data/lib/rdoc/markup/heading.rb +163 -77
  89. data/lib/rdoc/markup/include.rb +33 -29
  90. data/lib/rdoc/markup/indented_paragraph.rb +37 -33
  91. data/lib/rdoc/markup/inline_parser.rb +316 -0
  92. data/lib/rdoc/markup/list.rb +80 -88
  93. data/lib/rdoc/markup/list_item.rb +73 -85
  94. data/lib/rdoc/markup/paragraph.rb +23 -19
  95. data/lib/rdoc/markup/parser.rb +501 -497
  96. data/lib/rdoc/markup/pre_process.rb +284 -305
  97. data/lib/rdoc/markup/raw.rb +52 -55
  98. data/lib/rdoc/markup/rule.rb +16 -12
  99. data/lib/rdoc/markup/table.rb +48 -40
  100. data/lib/rdoc/markup/to_ansi.rb +143 -92
  101. data/lib/rdoc/markup/to_bs.rb +86 -102
  102. data/lib/rdoc/markup/to_html.rb +608 -506
  103. data/lib/rdoc/markup/to_html_crossref.rb +219 -210
  104. data/lib/rdoc/markup/to_html_snippet.rb +210 -205
  105. data/lib/rdoc/markup/to_joined_paragraph.rb +40 -41
  106. data/lib/rdoc/markup/to_label.rb +64 -51
  107. data/lib/rdoc/markup/to_markdown.rb +212 -184
  108. data/lib/rdoc/markup/to_rdoc.rb +341 -277
  109. data/lib/rdoc/markup/to_table_of_contents.rb +66 -62
  110. data/lib/rdoc/markup/to_test.rb +62 -50
  111. data/lib/rdoc/markup/to_tt_only.rb +83 -92
  112. data/lib/rdoc/markup/verbatim.rb +62 -58
  113. data/lib/rdoc/markup.rb +196 -215
  114. data/lib/rdoc/options.rb +1063 -1076
  115. data/lib/rdoc/parser/c.rb +1039 -1036
  116. data/lib/rdoc/parser/changelog.rb +320 -287
  117. data/lib/rdoc/parser/markdown.rb +17 -13
  118. data/lib/rdoc/parser/rbs.rb +279 -0
  119. data/lib/rdoc/parser/rd.rb +17 -13
  120. data/lib/rdoc/parser/ruby.rb +1231 -2222
  121. data/lib/rdoc/parser/ruby_colorizer.rb +303 -0
  122. data/lib/rdoc/parser/simple.rb +31 -27
  123. data/lib/rdoc/parser/text.rb +12 -8
  124. data/lib/rdoc/parser.rb +230 -221
  125. data/lib/rdoc/rbs_helper.rb +186 -0
  126. data/lib/rdoc/rd/inline.rb +57 -53
  127. data/lib/rdoc/rd.rb +90 -88
  128. data/lib/rdoc/rdoc.rb +547 -366
  129. data/lib/rdoc/ri/driver.rb +1141 -1130
  130. data/lib/rdoc/ri/formatter.rb +7 -3
  131. data/lib/rdoc/ri/paths.rb +140 -136
  132. data/lib/rdoc/ri/servlet.rb +456 -0
  133. data/lib/rdoc/ri/store.rb +4 -2
  134. data/lib/rdoc/ri/task.rb +55 -51
  135. data/lib/rdoc/ri.rb +14 -11
  136. data/lib/rdoc/rubygems_hook.rb +194 -192
  137. data/lib/rdoc/server.rb +462 -0
  138. data/lib/rdoc/stats/normal.rb +46 -42
  139. data/lib/rdoc/stats/quiet.rb +39 -35
  140. data/lib/rdoc/stats/verbose.rb +35 -31
  141. data/lib/rdoc/stats.rb +363 -338
  142. data/lib/rdoc/store.rb +919 -725
  143. data/lib/rdoc/task.rb +260 -255
  144. data/lib/rdoc/text.rb +164 -240
  145. data/lib/rdoc/token_stream.rb +88 -106
  146. data/lib/rdoc/tom_doc.rb +203 -201
  147. data/lib/rdoc/version.rb +1 -1
  148. data/lib/rdoc.rb +35 -7
  149. data/lib/rubygems_plugin.rb +2 -11
  150. data/rdoc-logo.svg +43 -0
  151. data/rdoc.gemspec +9 -7
  152. metadata +46 -32
  153. data/CONTRIBUTING.rdoc +0 -219
  154. data/ExampleMarkdown.md +0 -39
  155. data/ExampleRDoc.rdoc +0 -210
  156. data/lib/rdoc/code_object/anon_class.rb +0 -10
  157. data/lib/rdoc/code_object/ghost_method.rb +0 -6
  158. data/lib/rdoc/code_object/meta_method.rb +0 -6
  159. data/lib/rdoc/markdown/literals.kpeg +0 -21
  160. data/lib/rdoc/markdown/literals.rb +0 -454
  161. data/lib/rdoc/markup/attr_changer.rb +0 -22
  162. data/lib/rdoc/markup/attr_span.rb +0 -35
  163. data/lib/rdoc/markup/attribute_manager.rb +0 -405
  164. data/lib/rdoc/markup/attributes.rb +0 -70
  165. data/lib/rdoc/markup/regexp_handling.rb +0 -40
  166. data/lib/rdoc/parser/prism_ruby.rb +0 -1100
  167. data/lib/rdoc/parser/ripper_state_lex.rb +0 -302
  168. data/lib/rdoc/parser/ruby_tools.rb +0 -163
  169. data/lib/rdoc/servlet.rb +0 -452
@@ -1,120 +1,125 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # A Mixin adds features from a module into another context. RDoc::Include and
4
- # RDoc::Extend are both mixins.
2
+ module RDoc
3
+ ##
4
+ # A Mixin adds features from a module into another context. RDoc::Include and
5
+ # RDoc::Extend are both mixins.
5
6
 
6
- class RDoc::Mixin < RDoc::CodeObject
7
+ class Mixin < CodeObject
7
8
 
8
- ##
9
- # Name of included module
9
+ ##
10
+ # Name of included module
10
11
 
11
- attr_accessor :name
12
+ attr_accessor :name
12
13
 
13
- ##
14
- # Creates a new Mixin for +name+ with +comment+
14
+ ##
15
+ # Creates a new Mixin for +name+ with +comment+
15
16
 
16
- def initialize(name, comment)
17
- super()
18
- @name = name
19
- self.comment = comment
20
- @module = nil # cache for module if found
21
- end
17
+ def initialize(name, comment)
18
+ super()
19
+ @name = name
20
+ self.comment = comment
21
+ @module = nil # cache for module if found
22
+ end
22
23
 
23
- ##
24
- # Mixins are sorted by name
24
+ ##
25
+ # Mixins are sorted by name
25
26
 
26
- def <=>(other)
27
- return unless self.class === other
27
+ def <=>(other)
28
+ return unless self.class === other
28
29
 
29
- name <=> other.name
30
- end
30
+ name <=> other.name
31
+ end
31
32
 
32
- def ==(other) # :nodoc:
33
- self.class === other and @name == other.name
34
- end
33
+ def ==(other) # :nodoc:
34
+ self.class === other and @name == other.name
35
+ end
35
36
 
36
- alias eql? == # :nodoc:
37
+ alias eql? == # :nodoc:
37
38
 
38
- ##
39
- # Full name based on #module
39
+ ##
40
+ # Full name based on #module
40
41
 
41
- def full_name
42
- m = self.module
43
- RDoc::ClassModule === m ? m.full_name : @name
44
- end
42
+ def full_name
43
+ m = self.module
44
+ ClassModule === m ? m.full_name : @name
45
+ end
45
46
 
46
- def hash # :nodoc:
47
- [@name, self.module].hash
48
- end
47
+ def hash # :nodoc:
48
+ [@name, self.module].hash
49
+ end
49
50
 
50
- def inspect # :nodoc:
51
- "#<%s:0x%x %s.%s %s>" % [
52
- self.class,
53
- object_id,
54
- parent_name, self.class.name.downcase, @name,
55
- ]
56
- end
51
+ def inspect # :nodoc:
52
+ "#<%s:0x%x %s.%s %s>" % [
53
+ self.class,
54
+ object_id,
55
+ parent_name, self.class.name.downcase, @name,
56
+ ]
57
+ end
57
58
 
58
- ##
59
- # Attempts to locate the included module object. Returns the name if not
60
- # known.
61
- #
62
- # The scoping rules of Ruby to resolve the name of an included module are:
63
- # - first look into the children of the current context;
64
- # - if not found, look into the children of included modules,
65
- # in reverse inclusion order;
66
- # - if still not found, go up the hierarchy of names.
67
- #
68
- # This method has <code>O(n!)</code> behavior when the module calling
69
- # include is referencing nonexistent modules. Avoid calling #module until
70
- # after all the files are parsed. This behavior is due to ruby's constant
71
- # lookup behavior.
72
- #
73
- # As of the beginning of October, 2011, no gem includes nonexistent modules.
74
-
75
- def module
76
- return @module if @module
77
-
78
- # search the current context
79
- return @name unless parent
80
- full_name = parent.child_name(@name)
81
- @module = @store.modules_hash[full_name]
82
- return @module if @module
83
- return @name if @name =~ /^::/
84
-
85
- # search the includes before this one, in reverse order
86
- searched = parent.includes.take_while { |i| i != self }.reverse
87
- searched.each do |i|
88
- inc = i.module
89
- next if String === inc
90
- full_name = inc.child_name(@name)
91
- @module = @store.modules_hash[full_name]
59
+ ##
60
+ # Attempts to locate the included module object. Returns the name if not
61
+ # known.
62
+ #
63
+ # The scoping rules of Ruby to resolve the name of an included module are:
64
+ # - first look into the children of the current context;
65
+ # - if not found, look into the children of included modules,
66
+ # in reverse inclusion order;
67
+ # - if still not found, go up the hierarchy of names.
68
+ #
69
+ # This method has <code>O(n!)</code> behavior when the module calling
70
+ # include is referencing nonexistent modules. Avoid calling #module until
71
+ # after all the files are parsed. This behavior is due to ruby's constant
72
+ # lookup behavior.
73
+ #
74
+ # As of the beginning of October, 2011, no gem includes nonexistent modules.
75
+ #
76
+ # The Ruby parser passes an already-resolved full-path +name+, so most of this
77
+ # logic only runs for the C parser, which passes the unresolved local name.
78
+
79
+ def module
92
80
  return @module if @module
93
- end
94
81
 
95
- # go up the hierarchy of names
96
- up = parent.parent
97
- while up
98
- full_name = up.child_name(@name)
82
+ # search the current context
83
+ return @name unless parent
84
+ full_name = parent.child_name(@name)
99
85
  @module = @store.modules_hash[full_name]
100
86
  return @module if @module
101
- up = up.parent
87
+ return @name if @name =~ /^::/
88
+
89
+ # search the includes before this one, in reverse order
90
+ searched = parent.includes.take_while { |i| i != self }.reverse
91
+ searched.each do |i|
92
+ inc = i.module
93
+ next if String === inc
94
+ full_name = inc.child_name(@name)
95
+ @module = @store.modules_hash[full_name]
96
+ return @module if @module
97
+ end
98
+
99
+ # go up the hierarchy of names
100
+ up = parent.parent
101
+ while up
102
+ full_name = up.child_name(@name)
103
+ @module = @store.modules_hash[full_name]
104
+ return @module if @module
105
+ up = up.parent
106
+ end
107
+
108
+ @name
102
109
  end
103
110
 
104
- @name
105
- end
111
+ ##
112
+ # Sets the store for this class or module and its contained code objects.
106
113
 
107
- ##
108
- # Sets the store for this class or module and its contained code objects.
114
+ def store=(store)
115
+ super
109
116
 
110
- def store=(store)
111
- super
117
+ @file = @store.add_file @file.full_name if @file
118
+ end
112
119
 
113
- @file = @store.add_file @file.full_name if @file
114
- end
120
+ def to_s # :nodoc:
121
+ "#{self.class.name.downcase} #@name in: #{parent}"
122
+ end
115
123
 
116
- def to_s # :nodoc:
117
- "#{self.class.name.downcase} #@name in: #{parent}"
118
124
  end
119
-
120
125
  end
@@ -1,92 +1,91 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # A normal class, neither singleton nor anonymous
4
-
5
- class RDoc::NormalClass < RDoc::ClassModule
6
-
2
+ module RDoc
7
3
  ##
8
- # The ancestors of this class including modules. Unlike Module#ancestors,
9
- # this class is not included in the result. The result will contain both
10
- # RDoc::ClassModules and Strings.
11
-
12
- def ancestors
13
- if String === superclass then
14
- super << superclass
15
- elsif superclass then
16
- ancestors = super
17
- ancestors << superclass
18
- ancestors.concat superclass.ancestors
19
- else
20
- super
4
+ # A normal class, neither singleton nor anonymous
5
+
6
+ class NormalClass < ClassModule
7
+
8
+ ##
9
+ # The ancestors of this class including modules. Unlike Module#ancestors,
10
+ # this class is not included in the result. The result will contain both
11
+ # RDoc::ClassModules and Strings.
12
+
13
+ def ancestors
14
+ ancestors = included_ancestors
15
+ super_classes.each do |sclass|
16
+ ancestors << sclass
17
+ ancestors.concat sclass.included_ancestors unless String === sclass
18
+ end
19
+ ancestors
21
20
  end
22
- end
23
21
 
24
- def aref_prefix # :nodoc:
25
- 'class'
26
- end
22
+ def aref_prefix # :nodoc:
23
+ 'class'
24
+ end
27
25
 
28
- ##
29
- # The definition of this class, <tt>class MyClassName</tt>
26
+ ##
27
+ # The definition of this class, <tt>class MyClassName</tt>
30
28
 
31
- def definition
32
- "class #{full_name}"
33
- end
29
+ def definition
30
+ "class #{full_name}"
31
+ end
34
32
 
35
- def direct_ancestors
36
- superclass ? super + [superclass] : super
37
- end
33
+ def direct_ancestors
34
+ superclass ? super + [superclass] : super
35
+ end
38
36
 
39
- def inspect # :nodoc:
40
- superclass = @superclass ? " < #{@superclass}" : nil
41
- "<%s:0x%x class %s%s includes: %p extends: %p attributes: %p methods: %p aliases: %p>" % [
42
- self.class, object_id,
43
- full_name, superclass, @includes, @extends, @attributes, @method_list, @aliases
44
- ]
45
- end
37
+ def inspect # :nodoc:
38
+ superclass = @superclass ? " < #{@superclass}" : nil
39
+ "<%s:0x%x class %s%s includes: %p extends: %p attributes: %p methods: %p aliases: %p>" % [
40
+ self.class, object_id,
41
+ full_name, superclass, @includes, @extends, @attributes, @method_list, @aliases
42
+ ]
43
+ end
46
44
 
47
- def to_s # :nodoc:
48
- display = "#{self.class.name} #{self.full_name}"
49
- if superclass
50
- display += ' < ' + (superclass.is_a?(String) ? superclass : superclass.full_name)
45
+ def to_s # :nodoc:
46
+ display = "#{self.class.name} #{self.full_name}"
47
+ if superclass
48
+ display += ' < ' + (superclass.is_a?(String) ? superclass : superclass.full_name)
49
+ end
50
+ display += ' -> ' + is_alias_for.to_s if is_alias_for
51
+ display
51
52
  end
52
- display += ' -> ' + is_alias_for.to_s if is_alias_for
53
- display
54
- end
55
53
 
56
- def pretty_print(q) # :nodoc:
57
- superclass = @superclass ? " < #{@superclass}" : nil
58
-
59
- q.group 2, "[class #{full_name}#{superclass}", "]" do
60
- q.breakable
61
- q.text "includes:"
62
- q.breakable
63
- q.seplist @includes do |inc| q.pp inc end
64
-
65
- q.breakable
66
- q.text "constants:"
67
- q.breakable
68
- q.seplist @constants do |const| q.pp const end
69
-
70
- q.breakable
71
- q.text "attributes:"
72
- q.breakable
73
- q.seplist @attributes do |attr| q.pp attr end
74
-
75
- q.breakable
76
- q.text "methods:"
77
- q.breakable
78
- q.seplist @method_list do |meth| q.pp meth end
79
-
80
- q.breakable
81
- q.text "aliases:"
82
- q.breakable
83
- q.seplist @aliases do |aliaz| q.pp aliaz end
84
-
85
- q.breakable
86
- q.text "comment:"
87
- q.breakable
88
- q.pp comment
54
+ def pretty_print(q) # :nodoc:
55
+ superclass = @superclass ? " < #{@superclass}" : nil
56
+
57
+ q.group 2, "[class #{full_name}#{superclass}", "]" do
58
+ q.breakable
59
+ q.text "includes:"
60
+ q.breakable
61
+ q.seplist @includes do |inc| q.pp inc end
62
+
63
+ q.breakable
64
+ q.text "constants:"
65
+ q.breakable
66
+ q.seplist @constants do |const| q.pp const end
67
+
68
+ q.breakable
69
+ q.text "attributes:"
70
+ q.breakable
71
+ q.seplist @attributes do |attr| q.pp attr end
72
+
73
+ q.breakable
74
+ q.text "methods:"
75
+ q.breakable
76
+ q.seplist @method_list do |meth| q.pp meth end
77
+
78
+ q.breakable
79
+ q.text "aliases:"
80
+ q.breakable
81
+ q.seplist @aliases do |aliaz| q.pp aliaz end
82
+
83
+ q.breakable
84
+ q.text "comment:"
85
+ q.breakable
86
+ q.pp comment
87
+ end
89
88
  end
90
- end
91
89
 
90
+ end
92
91
  end
@@ -1,73 +1,75 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # A normal module, like NormalClass
2
+ module RDoc
3
+ ##
4
+ # A normal module, like NormalClass
4
5
 
5
- class RDoc::NormalModule < RDoc::ClassModule
6
+ class NormalModule < ClassModule
6
7
 
7
- def aref_prefix # :nodoc:
8
- 'module'
9
- end
8
+ def aref_prefix # :nodoc:
9
+ 'module'
10
+ end
10
11
 
11
- def inspect # :nodoc:
12
- "#<%s:0x%x module %s includes: %p extends: %p attributes: %p methods: %p aliases: %p>" % [
13
- self.class, object_id,
14
- full_name, @includes, @extends, @attributes, @method_list, @aliases
15
- ]
16
- end
12
+ def inspect # :nodoc:
13
+ "#<%s:0x%x module %s includes: %p extends: %p attributes: %p methods: %p aliases: %p>" % [
14
+ self.class, object_id,
15
+ full_name, @includes, @extends, @attributes, @method_list, @aliases
16
+ ]
17
+ end
17
18
 
18
- ##
19
- # The definition of this module, <tt>module MyModuleName</tt>
19
+ ##
20
+ # The definition of this module, <tt>module MyModuleName</tt>
20
21
 
21
- def definition
22
- "module #{full_name}"
23
- end
22
+ def definition
23
+ "module #{full_name}"
24
+ end
24
25
 
25
- ##
26
- # This is a module, returns true
26
+ ##
27
+ # This is a module, returns true
27
28
 
28
- def module?
29
- true
30
- end
29
+ def module?
30
+ true
31
+ end
31
32
 
32
- def pretty_print(q) # :nodoc:
33
- q.group 2, "[module #{full_name}:", "]" do
34
- q.breakable
35
- q.text "includes:"
36
- q.breakable
37
- q.seplist @includes do |inc| q.pp inc end
38
- q.breakable
39
-
40
- q.breakable
41
- q.text "constants:"
42
- q.breakable
43
- q.seplist @constants do |const| q.pp const end
44
-
45
- q.text "attributes:"
46
- q.breakable
47
- q.seplist @attributes do |attr| q.pp attr end
48
- q.breakable
49
-
50
- q.text "methods:"
51
- q.breakable
52
- q.seplist @method_list do |meth| q.pp meth end
53
- q.breakable
54
-
55
- q.text "aliases:"
56
- q.breakable
57
- q.seplist @aliases do |aliaz| q.pp aliaz end
58
- q.breakable
59
-
60
- q.text "comment:"
61
- q.breakable
62
- q.pp comment
33
+ def pretty_print(q) # :nodoc:
34
+ q.group 2, "[module #{full_name}:", "]" do
35
+ q.breakable
36
+ q.text "includes:"
37
+ q.breakable
38
+ q.seplist @includes do |inc| q.pp inc end
39
+ q.breakable
40
+
41
+ q.breakable
42
+ q.text "constants:"
43
+ q.breakable
44
+ q.seplist @constants do |const| q.pp const end
45
+
46
+ q.text "attributes:"
47
+ q.breakable
48
+ q.seplist @attributes do |attr| q.pp attr end
49
+ q.breakable
50
+
51
+ q.text "methods:"
52
+ q.breakable
53
+ q.seplist @method_list do |meth| q.pp meth end
54
+ q.breakable
55
+
56
+ q.text "aliases:"
57
+ q.breakable
58
+ q.seplist @aliases do |aliaz| q.pp aliaz end
59
+ q.breakable
60
+
61
+ q.text "comment:"
62
+ q.breakable
63
+ q.pp comment
64
+ end
63
65
  end
64
- end
65
66
 
66
- ##
67
- # Modules don't have one, raises NoMethodError
67
+ ##
68
+ # Modules don't have one, raises NoMethodError
68
69
 
69
- def superclass
70
- raise NoMethodError, "#{full_name} is a module"
71
- end
70
+ def superclass
71
+ raise NoMethodError, "#{full_name} is a module"
72
+ end
72
73
 
74
+ end
73
75
  end
@@ -1,51 +1,35 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # A file loaded by \#require
4
-
5
- class RDoc::Require < RDoc::CodeObject
6
-
7
- ##
8
- # Name of the required file
9
-
10
- attr_accessor :name
11
-
2
+ module RDoc
12
3
  ##
13
- # Creates a new Require that loads +name+ with +comment+
4
+ # A file loaded by \#require
14
5
 
15
- def initialize(name, comment)
16
- super()
17
- @name = name.gsub(/'|"/, "") #'
18
- @top_level = nil
19
- self.comment = comment
20
- end
6
+ class Require < CodeObject
21
7
 
22
- def inspect # :nodoc:
23
- "#<%s:0x%x require '%s' in %s>" % [
24
- self.class,
25
- object_id,
26
- @name,
27
- @parent ? @parent.base_name : '(unknown)'
28
- ]
29
- end
8
+ ##
9
+ # Name of the required file
30
10
 
31
- def to_s # :nodoc:
32
- "require #{name} in: #{parent}"
33
- end
11
+ attr_accessor :name
34
12
 
35
- ##
36
- # The RDoc::TopLevel corresponding to this require, or +nil+ if not found.
13
+ ##
14
+ # Creates a new Require that loads +name+ with +comment+
37
15
 
38
- def top_level
39
- @top_level ||= begin
40
- tl = RDoc::TopLevel.all_files_hash[name + '.rb']
16
+ def initialize(name, comment)
17
+ super()
18
+ @name = name.gsub(/'|"/, "")
19
+ self.comment = comment
20
+ end
41
21
 
42
- if tl.nil? and RDoc::TopLevel.all_files.first.full_name =~ %r(^lib/) then
43
- # second chance
44
- tl = RDoc::TopLevel.all_files_hash['lib/' + name + '.rb']
45
- end
22
+ def inspect # :nodoc:
23
+ "#<%s:0x%x require '%s' in %s>" % [
24
+ self.class,
25
+ object_id,
26
+ @name,
27
+ @parent ? @parent.base_name : '(unknown)'
28
+ ]
29
+ end
46
30
 
47
- tl
31
+ def to_s # :nodoc:
32
+ "require #{name} in: #{parent}"
48
33
  end
49
34
  end
50
-
51
35
  end
@@ -1,30 +1,32 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # A singleton class
2
+ module RDoc
3
+ ##
4
+ # A singleton class
4
5
 
5
- class RDoc::SingleClass < RDoc::ClassModule
6
+ class SingleClass < ClassModule
6
7
 
7
- ##
8
- # Adds the superclass to the included modules.
8
+ ##
9
+ # Adds the superclass to the included modules.
9
10
 
10
- def ancestors
11
- superclass ? super + [superclass] : super
12
- end
11
+ def ancestors
12
+ superclass ? super + [superclass] : super
13
+ end
13
14
 
14
- def aref_prefix # :nodoc:
15
- 'sclass'
16
- end
15
+ def aref_prefix # :nodoc:
16
+ 'sclass'
17
+ end
17
18
 
18
- ##
19
- # The definition of this singleton class, <tt>class << MyClassName</tt>
19
+ ##
20
+ # The definition of this singleton class, <tt>class << MyClassName</tt>
20
21
 
21
- def definition
22
- "class << #{full_name}"
23
- end
22
+ def definition
23
+ "class << #{full_name}"
24
+ end
24
25
 
25
- def pretty_print(q) # :nodoc:
26
- q.group 2, "[class << #{full_name}", "]" do
27
- next
26
+ def pretty_print(q) # :nodoc:
27
+ q.group 2, "[class << #{full_name}", "]" do
28
+ next
29
+ end
28
30
  end
29
31
  end
30
32
  end