mega-max-hub 0.0.1

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 (218) hide show
  1. checksums.yaml +7 -0
  2. data/mega-max-hub.gemspec +11 -0
  3. data/rdoc-8.0.0/CONTRIBUTING.md +195 -0
  4. data/rdoc-8.0.0/CVE-2013-0256.rdoc +49 -0
  5. data/rdoc-8.0.0/History.rdoc +1668 -0
  6. data/rdoc-8.0.0/LEGAL.rdoc +56 -0
  7. data/rdoc-8.0.0/LICENSE.rdoc +63 -0
  8. data/rdoc-8.0.0/README.md +236 -0
  9. data/rdoc-8.0.0/RI.md +842 -0
  10. data/rdoc-8.0.0/TODO.rdoc +60 -0
  11. data/rdoc-8.0.0/doc/markup_reference/markdown.md +659 -0
  12. data/rdoc-8.0.0/doc/markup_reference/rdoc.rdoc +1169 -0
  13. data/rdoc-8.0.0/exe/rdoc +43 -0
  14. data/rdoc-8.0.0/exe/ri +12 -0
  15. data/rdoc-8.0.0/lib/rdoc/code_object/alias.rb +98 -0
  16. data/rdoc-8.0.0/lib/rdoc/code_object/any_method.rb +387 -0
  17. data/rdoc-8.0.0/lib/rdoc/code_object/attr.rb +178 -0
  18. data/rdoc-8.0.0/lib/rdoc/code_object/class_module.rb +969 -0
  19. data/rdoc-8.0.0/lib/rdoc/code_object/constant.rb +221 -0
  20. data/rdoc-8.0.0/lib/rdoc/code_object/context/section.rb +182 -0
  21. data/rdoc-8.0.0/lib/rdoc/code_object/context.rb +1238 -0
  22. data/rdoc-8.0.0/lib/rdoc/code_object/extend.rb +9 -0
  23. data/rdoc-8.0.0/lib/rdoc/code_object/include.rb +9 -0
  24. data/rdoc-8.0.0/lib/rdoc/code_object/method_attr.rb +417 -0
  25. data/rdoc-8.0.0/lib/rdoc/code_object/mixin.rb +123 -0
  26. data/rdoc-8.0.0/lib/rdoc/code_object/normal_class.rb +92 -0
  27. data/rdoc-8.0.0/lib/rdoc/code_object/normal_module.rb +73 -0
  28. data/rdoc-8.0.0/lib/rdoc/code_object/require.rb +51 -0
  29. data/rdoc-8.0.0/lib/rdoc/code_object/single_class.rb +30 -0
  30. data/rdoc-8.0.0/lib/rdoc/code_object/top_level.rb +286 -0
  31. data/rdoc-8.0.0/lib/rdoc/code_object.rb +393 -0
  32. data/rdoc-8.0.0/lib/rdoc/code_objects.rb +5 -0
  33. data/rdoc-8.0.0/lib/rdoc/comment.rb +353 -0
  34. data/rdoc-8.0.0/lib/rdoc/cross_reference.rb +215 -0
  35. data/rdoc-8.0.0/lib/rdoc/encoding.rb +120 -0
  36. data/rdoc-8.0.0/lib/rdoc/erb_partial.rb +18 -0
  37. data/rdoc-8.0.0/lib/rdoc/erbio.rb +37 -0
  38. data/rdoc-8.0.0/lib/rdoc/generator/aliki.rb +200 -0
  39. data/rdoc-8.0.0/lib/rdoc/generator/darkfish.rb +824 -0
  40. data/rdoc-8.0.0/lib/rdoc/generator/json_index.rb +284 -0
  41. data/rdoc-8.0.0/lib/rdoc/generator/markup.rb +196 -0
  42. data/rdoc-8.0.0/lib/rdoc/generator/pot/message_extractor.rb +68 -0
  43. data/rdoc-8.0.0/lib/rdoc/generator/pot/po.rb +84 -0
  44. data/rdoc-8.0.0/lib/rdoc/generator/pot/po_entry.rb +141 -0
  45. data/rdoc-8.0.0/lib/rdoc/generator/pot.rb +94 -0
  46. data/rdoc-8.0.0/lib/rdoc/generator/ri.rb +30 -0
  47. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/DESIGN.md +536 -0
  48. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
  49. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
  50. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_head.rhtml +163 -0
  51. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
  52. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_icons.rhtml +208 -0
  53. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +16 -0
  54. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +15 -0
  55. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +27 -0
  56. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +27 -0
  57. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
  58. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +41 -0
  59. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +67 -0
  60. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
  61. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +21 -0
  62. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
  63. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/class.rhtml +230 -0
  64. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/css/rdoc.css +2181 -0
  65. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/index.rhtml +22 -0
  66. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/aliki.js +513 -0
  67. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/bash_highlighter.js +167 -0
  68. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
  69. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/search_controller.js +129 -0
  70. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
  71. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
  72. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
  73. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/page.rhtml +18 -0
  74. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
  75. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
  76. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_footer.rhtml +5 -0
  77. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_head.rhtml +43 -0
  78. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +5 -0
  79. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +17 -0
  80. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +17 -0
  81. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +16 -0
  82. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +21 -0
  83. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml +11 -0
  84. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +32 -0
  85. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +6 -0
  86. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +15 -0
  87. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +11 -0
  88. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +39 -0
  89. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
  90. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/class.rhtml +220 -0
  91. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/css/fonts.css +167 -0
  92. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/css/rdoc.css +701 -0
  93. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf +0 -0
  94. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf +0 -0
  95. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf +0 -0
  96. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf +0 -0
  97. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
  98. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
  99. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/add.png +0 -0
  100. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
  101. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
  102. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
  103. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
  104. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
  105. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
  106. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
  107. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
  108. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/delete.png +0 -0
  109. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
  110. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
  111. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
  112. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
  113. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
  114. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
  115. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
  116. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
  117. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
  118. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/tag_blue.png +0 -0
  119. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
  120. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/transparent.png +0 -0
  121. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
  122. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
  123. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
  124. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/index.rhtml +24 -0
  125. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/js/darkfish.js +140 -0
  126. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/js/search.js +120 -0
  127. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/page.rhtml +19 -0
  128. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +21 -0
  129. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +65 -0
  130. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +72 -0
  131. data/rdoc-8.0.0/lib/rdoc/generator/template/json_index/js/navigation.js +105 -0
  132. data/rdoc-8.0.0/lib/rdoc/generator/template/json_index/js/searcher.js +271 -0
  133. data/rdoc-8.0.0/lib/rdoc/generator.rb +52 -0
  134. data/rdoc-8.0.0/lib/rdoc/i18n/locale.rb +102 -0
  135. data/rdoc-8.0.0/lib/rdoc/i18n/text.rb +126 -0
  136. data/rdoc-8.0.0/lib/rdoc/i18n.rb +10 -0
  137. data/rdoc-8.0.0/lib/rdoc/known_classes.rb +74 -0
  138. data/rdoc-8.0.0/lib/rdoc/markdown/entities.rb +2131 -0
  139. data/rdoc-8.0.0/lib/rdoc/markdown/literals.kpeg +21 -0
  140. data/rdoc-8.0.0/lib/rdoc/markdown/literals.rb +454 -0
  141. data/rdoc-8.0.0/lib/rdoc/markdown.kpeg +1315 -0
  142. data/rdoc-8.0.0/lib/rdoc/markdown.rb +16865 -0
  143. data/rdoc-8.0.0/lib/rdoc/markup/blank_line.rb +29 -0
  144. data/rdoc-8.0.0/lib/rdoc/markup/block_quote.rb +14 -0
  145. data/rdoc-8.0.0/lib/rdoc/markup/document.rb +164 -0
  146. data/rdoc-8.0.0/lib/rdoc/markup/element.rb +21 -0
  147. data/rdoc-8.0.0/lib/rdoc/markup/formatter.rb +285 -0
  148. data/rdoc-8.0.0/lib/rdoc/markup/hard_break.rb +34 -0
  149. data/rdoc-8.0.0/lib/rdoc/markup/heading.rb +170 -0
  150. data/rdoc-8.0.0/lib/rdoc/markup/include.rb +42 -0
  151. data/rdoc-8.0.0/lib/rdoc/markup/indented_paragraph.rb +47 -0
  152. data/rdoc-8.0.0/lib/rdoc/markup/inline_parser.rb +312 -0
  153. data/rdoc-8.0.0/lib/rdoc/markup/list.rb +101 -0
  154. data/rdoc-8.0.0/lib/rdoc/markup/list_item.rb +99 -0
  155. data/rdoc-8.0.0/lib/rdoc/markup/paragraph.rb +28 -0
  156. data/rdoc-8.0.0/lib/rdoc/markup/parser.rb +585 -0
  157. data/rdoc-8.0.0/lib/rdoc/markup/pre_process.rb +317 -0
  158. data/rdoc-8.0.0/lib/rdoc/markup/raw.rb +66 -0
  159. data/rdoc-8.0.0/lib/rdoc/markup/rule.rb +20 -0
  160. data/rdoc-8.0.0/lib/rdoc/markup/table.rb +64 -0
  161. data/rdoc-8.0.0/lib/rdoc/markup/to_ansi.rb +144 -0
  162. data/rdoc-8.0.0/lib/rdoc/markup/to_bs.rb +86 -0
  163. data/rdoc-8.0.0/lib/rdoc/markup/to_html.rb +682 -0
  164. data/rdoc-8.0.0/lib/rdoc/markup/to_html_crossref.rb +261 -0
  165. data/rdoc-8.0.0/lib/rdoc/markup/to_html_snippet.rb +287 -0
  166. data/rdoc-8.0.0/lib/rdoc/markup/to_joined_paragraph.rb +41 -0
  167. data/rdoc-8.0.0/lib/rdoc/markup/to_label.rb +84 -0
  168. data/rdoc-8.0.0/lib/rdoc/markup/to_markdown.rb +215 -0
  169. data/rdoc-8.0.0/lib/rdoc/markup/to_rdoc.rb +421 -0
  170. data/rdoc-8.0.0/lib/rdoc/markup/to_table_of_contents.rb +88 -0
  171. data/rdoc-8.0.0/lib/rdoc/markup/to_test.rb +77 -0
  172. data/rdoc-8.0.0/lib/rdoc/markup/to_tt_only.rb +107 -0
  173. data/rdoc-8.0.0/lib/rdoc/markup/verbatim.rb +83 -0
  174. data/rdoc-8.0.0/lib/rdoc/markup.rb +219 -0
  175. data/rdoc-8.0.0/lib/rdoc/options.rb +1412 -0
  176. data/rdoc-8.0.0/lib/rdoc/parser/c.rb +1227 -0
  177. data/rdoc-8.0.0/lib/rdoc/parser/changelog.rb +379 -0
  178. data/rdoc-8.0.0/lib/rdoc/parser/markdown.rb +22 -0
  179. data/rdoc-8.0.0/lib/rdoc/parser/rbs.rb +275 -0
  180. data/rdoc-8.0.0/lib/rdoc/parser/rd.rb +22 -0
  181. data/rdoc-8.0.0/lib/rdoc/parser/ruby.rb +1266 -0
  182. data/rdoc-8.0.0/lib/rdoc/parser/ruby_colorizer.rb +253 -0
  183. data/rdoc-8.0.0/lib/rdoc/parser/simple.rb +44 -0
  184. data/rdoc-8.0.0/lib/rdoc/parser/text.rb +11 -0
  185. data/rdoc-8.0.0/lib/rdoc/parser.rb +298 -0
  186. data/rdoc-8.0.0/lib/rdoc/rbs_helper.rb +186 -0
  187. data/rdoc-8.0.0/lib/rdoc/rd/block_parser.rb +1706 -0
  188. data/rdoc-8.0.0/lib/rdoc/rd/block_parser.ry +643 -0
  189. data/rdoc-8.0.0/lib/rdoc/rd/inline.rb +71 -0
  190. data/rdoc-8.0.0/lib/rdoc/rd/inline_parser.rb +1854 -0
  191. data/rdoc-8.0.0/lib/rdoc/rd/inline_parser.ry +593 -0
  192. data/rdoc-8.0.0/lib/rdoc/rd.rb +99 -0
  193. data/rdoc-8.0.0/lib/rdoc/rdoc.rb +724 -0
  194. data/rdoc-8.0.0/lib/rdoc/ri/driver.rb +1572 -0
  195. data/rdoc-8.0.0/lib/rdoc/ri/formatter.rb +6 -0
  196. data/rdoc-8.0.0/lib/rdoc/ri/paths.rb +171 -0
  197. data/rdoc-8.0.0/lib/rdoc/ri/servlet.rb +452 -0
  198. data/rdoc-8.0.0/lib/rdoc/ri/store.rb +6 -0
  199. data/rdoc-8.0.0/lib/rdoc/ri/task.rb +71 -0
  200. data/rdoc-8.0.0/lib/rdoc/ri.rb +21 -0
  201. data/rdoc-8.0.0/lib/rdoc/rubygems_hook.rb +327 -0
  202. data/rdoc-8.0.0/lib/rdoc/server.rb +460 -0
  203. data/rdoc-8.0.0/lib/rdoc/stats/normal.rb +58 -0
  204. data/rdoc-8.0.0/lib/rdoc/stats/quiet.rb +59 -0
  205. data/rdoc-8.0.0/lib/rdoc/stats/verbose.rb +44 -0
  206. data/rdoc-8.0.0/lib/rdoc/stats.rb +484 -0
  207. data/rdoc-8.0.0/lib/rdoc/store.rb +1205 -0
  208. data/rdoc-8.0.0/lib/rdoc/task.rb +355 -0
  209. data/rdoc-8.0.0/lib/rdoc/text.rb +244 -0
  210. data/rdoc-8.0.0/lib/rdoc/token_stream.rb +104 -0
  211. data/rdoc-8.0.0/lib/rdoc/tom_doc.rb +257 -0
  212. data/rdoc-8.0.0/lib/rdoc/version.rb +10 -0
  213. data/rdoc-8.0.0/lib/rdoc.rb +239 -0
  214. data/rdoc-8.0.0/lib/rubygems_plugin.rb +14 -0
  215. data/rdoc-8.0.0/man/ri.1 +249 -0
  216. data/rdoc-8.0.0/rdoc-logo.svg +43 -0
  217. data/rdoc-8.0.0/rdoc.gemspec +74 -0
  218. metadata +256 -0
@@ -0,0 +1,969 @@
1
+ # frozen_string_literal: true
2
+ ##
3
+ # ClassModule is the base class for objects representing either a class or a
4
+ # module.
5
+
6
+ class RDoc::ClassModule < RDoc::Context
7
+
8
+ ##
9
+ # 1::
10
+ # RDoc 3.7
11
+ # * Added visibility, singleton and file to attributes
12
+ # * Added file to constants
13
+ # * Added file to includes
14
+ # * Added file to methods
15
+ # 2::
16
+ # RDoc 3.13
17
+ # * Added extends
18
+ # 3::
19
+ # RDoc 4.0
20
+ # * Added sections
21
+ # * Added in_files
22
+ # * Added parent name
23
+ # * Complete Constant dump
24
+
25
+ MARSHAL_VERSION = 3 # :nodoc:
26
+
27
+ ##
28
+ # Constants that are aliases for this class or module
29
+
30
+ attr_accessor :constant_aliases
31
+
32
+ ##
33
+ # A hash of <tt>{ location => [comments] }</tt> documenting this class/module.
34
+ # Use #add_comment to add comments.
35
+ #
36
+ # Ruby hashes maintain insertion order, so comments render in the order
37
+ # they were first added. Each location maps to an array of comments,
38
+ # allowing a class reopened in the same file to accumulate multiple comments.
39
+ #
40
+ # Before marshalling:
41
+ # - +location+ is an RDoc::TopLevel
42
+ # - +comments+ are Strings
43
+ #
44
+ # After unmarshalling:
45
+ # - +location+ is a filename String
46
+ # - +comments+ are RDoc::Markup::Documents
47
+
48
+ attr_accessor :comment_location
49
+
50
+ ##
51
+ # Class or module this constant is an alias for
52
+
53
+ attr_accessor :is_alias_for
54
+
55
+ ##
56
+ # Return a RDoc::ClassModule of class +class_type+ that is a copy
57
+ # of module +module+. Used to promote modules to classes.
58
+ #--
59
+ # TODO move to RDoc::NormalClass (I think)
60
+
61
+ def self.from_module(class_type, mod)
62
+ klass = class_type.new mod.name
63
+
64
+ mod.comment_location.each do |location, comments|
65
+ comments.each { |comment| klass.add_comment comment, location }
66
+ end
67
+
68
+ klass.parent = mod.parent
69
+ klass.section = mod.section
70
+
71
+ klass.attributes.concat mod.attributes
72
+ klass.method_list.concat mod.method_list
73
+ klass.aliases.concat mod.aliases
74
+ klass.external_aliases.concat mod.external_aliases
75
+ klass.constants.concat mod.constants
76
+ klass.includes.concat mod.includes
77
+ klass.extends.concat mod.extends
78
+
79
+ klass.methods_hash.update mod.methods_hash
80
+ klass.constants_hash.update mod.constants_hash
81
+
82
+ klass.current_section = mod.current_section
83
+ klass.in_files.concat mod.in_files
84
+ klass.sections.concat mod.sections
85
+ klass.unmatched_alias_lists = mod.unmatched_alias_lists
86
+ klass.current_section = mod.current_section
87
+ klass.visibility = mod.visibility
88
+
89
+ klass.classes_hash.update mod.classes_hash
90
+ klass.modules_hash.update mod.modules_hash
91
+ klass.metadata.update mod.metadata
92
+
93
+ klass.document_self = mod.received_nodoc ? nil : mod.document_self
94
+ klass.document_children = mod.document_children
95
+ klass.force_documentation = mod.force_documentation
96
+ klass.done_documenting = mod.done_documenting
97
+
98
+ # update the parent of all children
99
+
100
+ (klass.attributes +
101
+ klass.method_list +
102
+ klass.aliases +
103
+ klass.external_aliases +
104
+ klass.constants +
105
+ klass.includes +
106
+ klass.extends +
107
+ klass.classes +
108
+ klass.modules).each do |obj|
109
+ obj.parent = klass
110
+ obj.full_name = nil
111
+ end
112
+
113
+ klass
114
+ end
115
+
116
+ ##
117
+ # Creates a new ClassModule with +name+ with optional +superclass+
118
+ #
119
+ # This is a constructor for subclasses, and must never be called directly.
120
+
121
+ def initialize(name, superclass = nil)
122
+ @constant_aliases = []
123
+ @is_alias_for = nil
124
+ @name = name
125
+ @superclass = superclass
126
+ @comment_location = {} # Hash of { location => [comments] }
127
+
128
+ super()
129
+ end
130
+
131
+ ##
132
+ # Adds +comment+ to this ClassModule's list of comments at +location+. This
133
+ # method is preferred over #comment= since it allows ri data to be updated
134
+ # across multiple runs.
135
+
136
+ def add_comment(comment, location)
137
+ return unless document_self
138
+
139
+ original = comment
140
+
141
+ comment = case comment
142
+ when RDoc::Comment then
143
+ comment.normalize
144
+ else
145
+ normalize_comment comment
146
+ end
147
+
148
+ (@comment_location[location] ||= []) << comment
149
+
150
+ self.comment = original
151
+ end
152
+
153
+ def add_things(my_things, other_things) # :nodoc:
154
+ other_things.each do |group, things|
155
+ my_things[group].each { |thing| yield false, thing } if
156
+ my_things.include? group
157
+
158
+ things.each do |thing|
159
+ yield true, thing
160
+ end
161
+ end
162
+ end
163
+
164
+ ##
165
+ # Ancestors list for this ClassModule: the list of included modules
166
+ # (classes will add their superclass if any).
167
+ #
168
+ # Returns the included classes or modules, not the includes
169
+ # themselves. The returned values are either String or
170
+ # RDoc::NormalModule instances (see RDoc::Include#module).
171
+ #
172
+ # The values are returned in reverse order of their inclusion,
173
+ # which is the order suitable for searching methods/attributes
174
+ # in the ancestors. The superclass, if any, comes last.
175
+
176
+ def ancestors
177
+ includes.map { |i| i.module }.reverse
178
+ end
179
+
180
+ def aref_prefix # :nodoc:
181
+ raise NotImplementedError, "missing aref_prefix for #{self.class}"
182
+ end
183
+
184
+ ##
185
+ # HTML fragment reference for this module or class using GitHub-style
186
+ # anchor format (lowercase, :: replaced with -).
187
+ #
188
+ # Examples:
189
+ # Foo -> class-foo
190
+ # Foo::Bar -> class-foo-bar
191
+
192
+ def aref
193
+ "#{aref_prefix}-#{full_name.downcase.gsub('::', '-')}"
194
+ end
195
+
196
+ ##
197
+ # Legacy HTML fragment reference for backward compatibility.
198
+ # Returns the old RDoc-style anchor format.
199
+ #
200
+ # Examples:
201
+ # Foo -> class-Foo
202
+ # Foo::Bar -> class-Foo::Bar
203
+
204
+ def legacy_aref
205
+ "#{aref_prefix}-#{full_name}"
206
+ end
207
+
208
+ ##
209
+ # Ancestors of this class or module only
210
+
211
+ alias direct_ancestors ancestors
212
+
213
+ ##
214
+ # Clears the comment. Used by the Ruby parser.
215
+
216
+ def clear_comment
217
+ @comment = ''
218
+ end
219
+
220
+ ##
221
+ # This method is deprecated, use #add_comment instead.
222
+ #
223
+ # Appends +comment+ to the current comment, but separated by a rule. Works
224
+ # more like <tt>+=</tt>.
225
+
226
+ def comment=(comment) # :nodoc:
227
+ comment = case comment
228
+ when RDoc::Comment then
229
+ comment.normalize
230
+ else
231
+ normalize_comment comment
232
+ end
233
+
234
+ comment = "#{@comment.to_s}\n---\n#{comment.to_s}" unless @comment.empty?
235
+
236
+ super comment
237
+ end
238
+
239
+ ##
240
+ # Prepares this ClassModule for use by a generator.
241
+ #
242
+ # See RDoc::Store#complete
243
+
244
+ def complete(min_visibility)
245
+ update_aliases
246
+ remove_nodoc_children
247
+ embed_mixins
248
+ update_includes
249
+ update_extends
250
+ remove_invisible min_visibility
251
+ end
252
+
253
+ ##
254
+ # Does this ClassModule or any of its methods have document_self set?
255
+
256
+ def document_self_or_methods
257
+ document_self || method_list.any?{ |m| m.document_self }
258
+ end
259
+
260
+ ##
261
+ # Does this class or module have a comment with content or is
262
+ # #received_nodoc true?
263
+
264
+ def documented?
265
+ return true if @received_nodoc
266
+ return false if @comment_location.empty?
267
+ @comment_location.each_value.any? { |comments| comments.any? { |c| not c.empty? } }
268
+ end
269
+
270
+ ##
271
+ # Iterates the ancestors of this class or module for which an
272
+ # RDoc::ClassModule exists.
273
+
274
+ def each_ancestor # :yields: module
275
+ return enum_for __method__ unless block_given?
276
+
277
+ ancestors.each do |mod|
278
+ next if String === mod
279
+ next if self == mod
280
+ yield mod
281
+ end
282
+ end
283
+
284
+ ##
285
+ # Looks for a symbol in the #ancestors. See Context#find_local_symbol.
286
+
287
+ def find_ancestor_local_symbol(symbol)
288
+ each_ancestor do |m|
289
+ res = m.find_local_symbol(symbol)
290
+ return res if res
291
+ end
292
+
293
+ nil
294
+ end
295
+
296
+ ##
297
+ # Finds a class or module with +name+ in this namespace or its descendants
298
+
299
+ def find_class_named(name)
300
+ return self if full_name == name
301
+ return self if @name == name
302
+
303
+ @classes.values.find do |klass|
304
+ next if klass == self
305
+ klass.find_class_named name
306
+ end
307
+ end
308
+
309
+ ##
310
+ # Return the fully qualified name of this class or module
311
+
312
+ def full_name
313
+ @full_name ||= if RDoc::ClassModule === parent then
314
+ "#{parent.full_name}::#{@name}"
315
+ else
316
+ @name
317
+ end
318
+ end
319
+
320
+ ##
321
+ # Return array of full_name splitted by +::+.
322
+
323
+ def nesting_namespaces
324
+ @namespaces ||= full_name.split("::").reject(&:empty?)
325
+ end
326
+
327
+ ##
328
+ # Return array of fully qualified nesting namespaces.
329
+ #
330
+ # For example, if full_name is +A::B::C+, this method returns <code>["A", "A::B", "A::B::C"]</code>
331
+
332
+ def fully_qualified_nesting_namespaces
333
+ return nesting_namespaces if nesting_namespaces.length < 2
334
+ @fqns ||= nesting_namespaces.inject([]) do |list, n|
335
+ list << (list.empty? ? n : "#{list.last}::#{n}")
336
+ end
337
+ end
338
+
339
+ ##
340
+ # TODO: filter included items by #display?
341
+
342
+ def marshal_dump # :nodoc:
343
+ attrs = attributes.sort.map do |attr|
344
+ next unless attr.display?
345
+ [ attr.name, attr.rw,
346
+ attr.visibility, attr.singleton, attr.file_name,
347
+ ]
348
+ end.compact
349
+
350
+ method_types = methods_by_type.map do |type, visibilities|
351
+ visibilities = visibilities.map do |visibility, methods|
352
+ method_names = methods.map do |method|
353
+ next unless method.display?
354
+ [method.name, method.file_name]
355
+ end.compact
356
+
357
+ [visibility, method_names.uniq]
358
+ end
359
+
360
+ [type, visibilities]
361
+ end
362
+
363
+ [ MARSHAL_VERSION,
364
+ @name,
365
+ full_name,
366
+ @superclass,
367
+ parse(@comment_location),
368
+ attrs,
369
+ constants.select { |constant| constant.display? },
370
+ includes.map do |incl|
371
+ next unless incl.display?
372
+ [incl.name, parse(incl.comment), incl.file_name]
373
+ end.compact,
374
+ method_types,
375
+ extends.map do |ext|
376
+ next unless ext.display?
377
+ [ext.name, parse(ext.comment), ext.file_name]
378
+ end.compact,
379
+ @sections.values,
380
+ @in_files.map do |tl|
381
+ tl.relative_name
382
+ end,
383
+ parent.full_name,
384
+ parent.class,
385
+ ]
386
+ end
387
+
388
+ def marshal_load(array) # :nodoc:
389
+ initialize_visibility
390
+ initialize_methods_etc
391
+ @current_section = nil
392
+ @document_self = true
393
+ @done_documenting = false
394
+ @parent = nil
395
+ @temporary_section = nil
396
+ @visibility = nil
397
+ @classes = {}
398
+ @modules = {}
399
+
400
+ @name = array[1]
401
+ @full_name = array[2]
402
+ @superclass = array[3]
403
+ document = array[4]
404
+
405
+ @comment = RDoc::Comment.from_document document
406
+
407
+ @comment_location = if document.parts.first.is_a?(RDoc::Markup::Document)
408
+ document.parts.group_by(&:file)
409
+ else
410
+ { document.file => [document] }
411
+ end
412
+
413
+ array[5].each do |name, rw, visibility, singleton, file|
414
+ singleton ||= false
415
+ visibility ||= :public
416
+
417
+ attr = RDoc::Attr.new name, rw, nil, singleton: singleton
418
+
419
+ add_attribute attr
420
+ attr.visibility = visibility
421
+ attr.record_location RDoc::TopLevel.new file
422
+ end
423
+
424
+ array[6].each do |constant, document, file|
425
+ case constant
426
+ when RDoc::Constant then
427
+ add_constant constant
428
+ else
429
+ constant = add_constant RDoc::Constant.new(constant, nil, RDoc::Comment.from_document(document))
430
+ constant.record_location RDoc::TopLevel.new file
431
+ end
432
+ end
433
+
434
+ array[7].each do |name, document, file|
435
+ incl = add_include RDoc::Include.new(name, RDoc::Comment.from_document(document))
436
+ incl.record_location RDoc::TopLevel.new file
437
+ end
438
+
439
+ array[8].each do |type, visibilities|
440
+ visibilities.each do |visibility, methods|
441
+ @visibility = visibility
442
+
443
+ methods.each do |name, file|
444
+ method = RDoc::AnyMethod.new name, singleton: type == 'class'
445
+ method.record_location RDoc::TopLevel.new file
446
+ add_method method
447
+ end
448
+ end
449
+ end
450
+
451
+ array[9].each do |name, document, file|
452
+ ext = add_extend RDoc::Extend.new(name, RDoc::Comment.from_document(document))
453
+ ext.record_location RDoc::TopLevel.new file
454
+ end if array[9] # Support Marshal version 1
455
+
456
+ sections = (array[10] || []).map do |section|
457
+ [section.title, section]
458
+ end
459
+
460
+ @sections = Hash[*sections.flatten]
461
+ @current_section = add_section nil
462
+
463
+ @in_files = []
464
+
465
+ (array[11] || []).each do |filename|
466
+ record_location RDoc::TopLevel.new filename
467
+ end
468
+
469
+ @parent_name = array[12]
470
+ @parent_class = array[13]
471
+ end
472
+
473
+ ##
474
+ # Merges +class_module+ into this ClassModule.
475
+ #
476
+ # The data in +class_module+ is preferred over the receiver.
477
+
478
+ def merge(class_module)
479
+ @parent = class_module.parent
480
+ @parent_name = class_module.parent_name
481
+
482
+ other_document = parse class_module.comment_location
483
+
484
+ if other_document then
485
+ document = parse @comment_location
486
+
487
+ document = document.merge other_document
488
+
489
+ @comment = RDoc::Comment.from_document(document)
490
+
491
+ @comment_location = if document.parts.first.is_a?(RDoc::Markup::Document)
492
+ document.parts.group_by(&:file)
493
+ else
494
+ { document.file => [document] }
495
+ end
496
+ end
497
+
498
+ cm = class_module
499
+ other_files = cm.in_files
500
+
501
+ merge_collections attributes, cm.attributes, other_files do |add, attr|
502
+ if add then
503
+ add_attribute attr
504
+ else
505
+ @attributes.delete attr
506
+ @methods_hash.delete attr.pretty_name
507
+ end
508
+ end
509
+
510
+ merge_collections constants, cm.constants, other_files do |add, const|
511
+ if add then
512
+ add_constant const
513
+ else
514
+ @constants.delete const
515
+ @constants_hash.delete const.name
516
+ end
517
+ end
518
+
519
+ merge_collections includes, cm.includes, other_files do |add, incl|
520
+ if add then
521
+ add_include incl
522
+ else
523
+ @includes.delete incl
524
+ end
525
+ end
526
+
527
+ @includes.uniq! # clean up
528
+
529
+ merge_collections extends, cm.extends, other_files do |add, ext|
530
+ if add then
531
+ add_extend ext
532
+ else
533
+ @extends.delete ext
534
+ end
535
+ end
536
+
537
+ @extends.uniq! # clean up
538
+
539
+ merge_collections method_list, cm.method_list, other_files do |add, meth|
540
+ if add then
541
+ add_method meth
542
+ else
543
+ @method_list.delete meth
544
+ @methods_hash.delete meth.pretty_name
545
+ end
546
+ end
547
+
548
+ merge_sections cm
549
+
550
+ self
551
+ end
552
+
553
+ ##
554
+ # Merges collection +mine+ with +other+ preferring other. +other_files+ is
555
+ # used to help determine which items should be deleted.
556
+ #
557
+ # Yields whether the item should be added or removed (true or false) and the
558
+ # item to be added or removed.
559
+ #
560
+ # merge_collections things, other.things, other.in_files do |add, thing|
561
+ # if add then
562
+ # # add the thing
563
+ # else
564
+ # # remove the thing
565
+ # end
566
+ # end
567
+
568
+ def merge_collections(mine, other, other_files, &block) # :nodoc:
569
+ my_things = mine. group_by { |thing| thing.file }
570
+ other_things = other.group_by { |thing| thing.file }
571
+
572
+ remove_things my_things, other_files, &block
573
+ add_things my_things, other_things, &block
574
+ end
575
+
576
+ ##
577
+ # Merges the comments in this ClassModule with the comments in the other
578
+ # ClassModule +cm+.
579
+
580
+ def merge_sections(cm) # :nodoc:
581
+ my_sections = sections.group_by { |section| section.title }
582
+ other_sections = cm.sections.group_by { |section| section.title }
583
+
584
+ other_files = cm.in_files
585
+
586
+ remove_things my_sections, other_files do |_, section|
587
+ @sections.delete section.title
588
+ end
589
+
590
+ other_sections.each do |group, sections|
591
+ if my_sections.include? group
592
+ my_sections[group].each do |my_section|
593
+ other_section = cm.sections_hash[group]
594
+
595
+ my_comments = my_section.comments
596
+ other_comments = other_section.comments
597
+
598
+ other_files = other_section.in_files
599
+
600
+ merge_collections my_comments, other_comments, other_files do |add, comment|
601
+ if add then
602
+ my_section.add_comment comment
603
+ else
604
+ my_section.remove_comment comment
605
+ end
606
+ end
607
+ end
608
+ else
609
+ sections.each do |section|
610
+ add_section group, section.comments
611
+ end
612
+ end
613
+ end
614
+ end
615
+
616
+ ##
617
+ # Does this object represent a module?
618
+
619
+ def module?
620
+ false
621
+ end
622
+
623
+ ##
624
+ # Allows overriding the initial name.
625
+ #
626
+ # Used for modules and classes that are constant aliases.
627
+
628
+ def name=(new_name)
629
+ @name = new_name
630
+ end
631
+
632
+ ##
633
+ # Parses +comment_location+ into an RDoc::Markup::Document composed of
634
+ # multiple RDoc::Markup::Documents with their file set.
635
+
636
+ def parse(comment_location)
637
+ case comment_location
638
+ when String then
639
+ super
640
+ when Hash then
641
+ docs = comment_location.flat_map do |location, comments|
642
+ comments.map do |comment|
643
+ doc = super comment
644
+ doc.file = location
645
+ doc
646
+ end
647
+ end
648
+
649
+ RDoc::Markup::Document.new(*docs)
650
+ when RDoc::Comment then
651
+ doc = super comment_location.text, comment_location.format
652
+ doc.file = comment_location.location
653
+ doc
654
+ when RDoc::Markup::Document then
655
+ return comment_location
656
+ else
657
+ raise ArgumentError, "unknown comment class #{comment_location.class}"
658
+ end
659
+ end
660
+
661
+ ##
662
+ # Path to this class or module for use with HTML generator output.
663
+
664
+ def path
665
+ prefix = options.class_module_path_prefix
666
+ return http_url unless prefix
667
+ File.join(prefix, http_url)
668
+ end
669
+
670
+ ##
671
+ # Name to use to generate the url:
672
+ # modules and classes that are aliases for another
673
+ # module or class return the name of the latter.
674
+
675
+ def name_for_path
676
+ is_alias_for ? is_alias_for.name_for_path : full_name
677
+ end
678
+
679
+ ##
680
+ # Returns the classes and modules that are not constants
681
+ # aliasing another class or module. For use by formatters
682
+ # only (caches its result).
683
+
684
+ def non_aliases
685
+ @non_aliases ||= classes_and_modules.reject { |cm| cm.is_alias_for }
686
+ end
687
+
688
+ ##
689
+ # Updates the child modules or classes of class/module +parent+ by
690
+ # deleting the ones that have been removed from the documentation.
691
+ #
692
+ # +parent_hash+ is either <tt>parent.modules_hash</tt> or
693
+ # <tt>parent.classes_hash</tt> and +all_hash+ is ::all_modules_hash or
694
+ # ::all_classes_hash.
695
+
696
+ def remove_nodoc_children
697
+ prefix = self.full_name + '::'
698
+
699
+ modules_hash.each_key do |name|
700
+ full_name = prefix + name
701
+ modules_hash.delete name unless @store.modules_hash[full_name]
702
+ end
703
+
704
+ classes_hash.each_key do |name|
705
+ full_name = prefix + name
706
+ classes_hash.delete name unless @store.classes_hash[full_name]
707
+ end
708
+ end
709
+
710
+ def remove_things(my_things, other_files) # :nodoc:
711
+ my_things.delete_if do |file, things|
712
+ next false unless other_files.include? file
713
+
714
+ things.each do |thing|
715
+ yield false, thing
716
+ end
717
+
718
+ true
719
+ end
720
+ end
721
+
722
+ ##
723
+ # Search record used by RDoc::Generator::JsonIndex
724
+ #
725
+ # TODO: Remove this method after dropping the darkfish theme and JsonIndex generator.
726
+ # Use #search_snippet instead for getting documentation snippets.
727
+
728
+ def search_record
729
+ [
730
+ name,
731
+ full_name,
732
+ full_name,
733
+ '',
734
+ path,
735
+ '',
736
+ snippet(@comment_location),
737
+ ]
738
+ end
739
+
740
+ ##
741
+ # Returns an HTML snippet of the first comment for search results.
742
+
743
+ def search_snippet
744
+ first_comment = @comment_location.each_value.first&.first
745
+ return '' unless first_comment && !first_comment.empty?
746
+
747
+ snippet(first_comment)
748
+ end
749
+
750
+ ##
751
+ # Rebuilds +@comment+ from the current +@comment_location+ entries,
752
+ # skipping any empty placeholders.
753
+
754
+ def rebuild_comment_from_location
755
+ texts = @comment_location.each_value.flat_map { |comments|
756
+ comments.filter_map { |c| c.to_s unless c.empty? }
757
+ }
758
+ merged = texts.join("\n---\n")
759
+ @comment = merged.empty? ? '' : RDoc::Comment.new(merged)
760
+ end
761
+
762
+ ##
763
+ # Sets the store for this class or module and its contained code objects.
764
+
765
+ def store=(store)
766
+ super
767
+
768
+ @attributes .each do |attr| attr.store = store end
769
+ @constants .each do |const| const.store = store end
770
+ @includes .each do |incl| incl.store = store end
771
+ @extends .each do |ext| ext.store = store end
772
+ @method_list.each do |meth| meth.store = store end
773
+ end
774
+
775
+ ##
776
+ # Get the superclass of this class. Attempts to retrieve the superclass
777
+ # object, returns the name if it is not known.
778
+
779
+ def superclass
780
+ @store.find_class_named(@superclass) || @superclass
781
+ end
782
+
783
+ ##
784
+ # Set the superclass of this class to +superclass+
785
+ #
786
+ # where +superclass+ is one of:
787
+ #
788
+ # - +nil+
789
+ # - a String containing the full name of the superclass
790
+ # - the RDoc::ClassModule representing the superclass
791
+
792
+ def superclass=(superclass)
793
+ raise NoMethodError, "#{full_name} is a module" if module?
794
+ case superclass
795
+ when RDoc::ClassModule
796
+ @superclass = superclass.full_name
797
+ when nil, String
798
+ @superclass = superclass
799
+ else
800
+ raise TypeError, "superclass must be a String or RDoc::ClassModule, not #{superclass.class}"
801
+ end
802
+ end
803
+
804
+ ##
805
+ # Get all super classes of this class in an array. The last element might be
806
+ # a string if the name is unknown.
807
+
808
+ def super_classes
809
+ result = []
810
+ parent = self
811
+ while parent = parent.superclass
812
+ result << parent
813
+ return result if parent.is_a?(String)
814
+ end
815
+ result
816
+ end
817
+
818
+ def to_s # :nodoc:
819
+ if is_alias_for then
820
+ "#{self.class.name} #{self.full_name} -> #{is_alias_for}"
821
+ else
822
+ super
823
+ end
824
+ end
825
+
826
+ ##
827
+ # 'module' or 'class'
828
+
829
+ def type
830
+ module? ? 'module' : 'class'
831
+ end
832
+
833
+ ##
834
+ # Updates the child modules & classes by replacing the ones that are
835
+ # aliases through a constant.
836
+ #
837
+ # The aliased module/class is replaced in the children and in
838
+ # RDoc::Store#modules_hash or RDoc::Store#classes_hash
839
+ # by a copy that has <tt>RDoc::ClassModule#is_alias_for</tt> set to
840
+ # the aliased module/class, and this copy is added to <tt>#aliases</tt>
841
+ # of the aliased module/class.
842
+ #
843
+ # Formatters can use the #non_aliases method to retrieve children that
844
+ # are not aliases, for instance to list the namespace content, since
845
+ # the aliased modules are included in the constants of the class/module,
846
+ # that are listed separately.
847
+
848
+ def update_aliases
849
+ constants.each do |const|
850
+ cm = const.is_alias_for
851
+ cm ||= const.resolved_alias_target if const.is_a?(RDoc::Constant)
852
+ next unless cm
853
+
854
+ # Resolve chained aliases (A = B = C) to the real class/module.
855
+ cm = @store.find_class_or_module(cm.full_name) || cm
856
+ while (target = cm.is_alias_for)
857
+ cm = target
858
+ end
859
+
860
+ cm_alias = cm.dup
861
+ cm_alias.name = const.name
862
+
863
+ if full_name == 'Object'
864
+ # Don't move top-level aliases under Object, they look ugly there
865
+ cm_alias.parent = top_level
866
+ else
867
+ cm_alias.parent = self
868
+ end
869
+ cm_alias.full_name = nil # force update for new parent
870
+
871
+ # Don't clobber a real (non-alias) class/module already living at this
872
+ # name. Mirrors the BasicObject = BlankSlate guard in
873
+ # Context#add_module_alias. Existing alias copies (set by
874
+ # add_module_alias or a previous update_aliases pass) carry is_alias_for,
875
+ # so they're still overwritable here.
876
+ existing = @store.find_class_or_module(cm_alias.full_name)
877
+ next if existing && !existing.is_alias_for
878
+
879
+ # Persist a lazy-resolved target so Stats#report_constants and
880
+ # Constant#marshal_dump observe the alias relationship. Skipped
881
+ # aliases (above) intentionally leave the constant unmarked.
882
+ const.is_alias_for ||= cm
883
+
884
+ cm_alias.aliases.clear
885
+ cm_alias.is_alias_for = cm
886
+
887
+ if cm.module? then
888
+ @store.modules_hash[cm_alias.full_name] = cm_alias
889
+ modules_hash[const.name] = cm_alias
890
+ else
891
+ @store.classes_hash[cm_alias.full_name] = cm_alias
892
+ classes_hash[const.name] = cm_alias
893
+ end
894
+
895
+ cm.aliases << cm_alias
896
+ end
897
+ end
898
+
899
+ ##
900
+ # Deletes from #includes those whose module has been removed from the
901
+ # documentation.
902
+ #--
903
+ # FIXME: includes are not reliably removed, see _possible_bug test case
904
+
905
+ def update_includes
906
+ includes.reject! do |include|
907
+ mod = include.module
908
+ !(String === mod) && @store.modules_hash[mod.full_name].nil?
909
+ end
910
+
911
+ includes.uniq!
912
+ end
913
+
914
+ ##
915
+ # Deletes from #extends those whose module has been removed from the
916
+ # documentation.
917
+ #--
918
+ # FIXME: like update_includes, extends are not reliably removed
919
+
920
+ def update_extends
921
+ extends.reject! do |ext|
922
+ mod = ext.module
923
+
924
+ !(String === mod) && @store.modules_hash[mod.full_name].nil?
925
+ end
926
+
927
+ extends.uniq!
928
+ end
929
+
930
+ def embed_mixins
931
+ return unless options.embed_mixins
932
+
933
+ includes.each do |include|
934
+ next if String === include.module
935
+ include.module.method_list.each do |code_object|
936
+ add_method(prepare_to_embed(code_object))
937
+ end
938
+ include.module.constants.each do |code_object|
939
+ add_constant(prepare_to_embed(code_object))
940
+ end
941
+ include.module.attributes.each do |code_object|
942
+ add_attribute(prepare_to_embed(code_object))
943
+ end
944
+ end
945
+
946
+ extends.each do |ext|
947
+ next if String === ext.module
948
+ ext.module.method_list.each do |code_object|
949
+ add_method(prepare_to_embed(code_object, true))
950
+ end
951
+ ext.module.attributes.each do |code_object|
952
+ add_attribute(prepare_to_embed(code_object, true))
953
+ end
954
+ end
955
+ end
956
+
957
+ private
958
+
959
+ def prepare_to_embed(code_object, singleton=false)
960
+ code_object = code_object.dup
961
+ code_object.mixin_from = code_object.parent
962
+ code_object.singleton = true if singleton
963
+ set_current_section(code_object.section.title, code_object.section.comment)
964
+ # add_method and add_attribute will reassign self's visibility back to the method/attribute
965
+ # so we need to sync self's visibility with the object's to properly retain that information
966
+ self.visibility = code_object.visibility
967
+ code_object
968
+ end
969
+ end