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,221 @@
1
+ # frozen_string_literal: true
2
+ ##
3
+ # A constant
4
+
5
+ class RDoc::Constant < RDoc::CodeObject
6
+
7
+ MARSHAL_VERSION = 0 # :nodoc:
8
+
9
+ ##
10
+ # Sets the module or class this is constant is an alias for.
11
+
12
+ attr_writer :is_alias_for
13
+
14
+ ##
15
+ # The constant's name
16
+
17
+ attr_accessor :name
18
+
19
+ ##
20
+ # The constant's value
21
+
22
+ attr_accessor :value
23
+
24
+ ##
25
+ # The constant's visibility
26
+
27
+ attr_accessor :visibility
28
+
29
+ ##
30
+ # The constant path on the RHS when the RHS is a bare constant reference
31
+ # (+Foo = Bar+ or +Foo = Bar::Baz+). Captured at parse time so
32
+ # #resolved_alias_target doesn't have to re-derive it from the textual
33
+ # #value. nil for other RHS shapes.
34
+
35
+ attr_accessor :is_alias_for_path
36
+
37
+ ##
38
+ # Creates a new constant with +name+, +value+ and +comment+
39
+
40
+ def initialize(name, value, comment)
41
+ super()
42
+
43
+ @name = name
44
+ @value = value
45
+
46
+ @is_alias_for = nil
47
+ @is_alias_for_path = nil
48
+ @visibility = :public
49
+
50
+ self.comment = comment
51
+ end
52
+
53
+ ##
54
+ # Constants are ordered by name
55
+
56
+ def <=>(other)
57
+ return unless self.class === other
58
+
59
+ [parent_name, name] <=> [other.parent_name, other.name]
60
+ end
61
+
62
+ ##
63
+ # Constants are equal when their #parent and #name is the same
64
+
65
+ def ==(other)
66
+ self.class == other.class and
67
+ @parent == other.parent and
68
+ @name == other.name
69
+ end
70
+
71
+ ##
72
+ # A constant is documented if it has a comment, or is an alias
73
+ # for a documented class or module.
74
+
75
+ def documented?
76
+ return true if super
77
+ return false unless @is_alias_for
78
+ case @is_alias_for
79
+ when String then
80
+ found = @store.find_class_or_module @is_alias_for
81
+ return false unless found
82
+ @is_alias_for = found
83
+ end
84
+ @is_alias_for.documented?
85
+ end
86
+
87
+ ##
88
+ # Full constant name including namespace
89
+
90
+ def full_name
91
+ @full_name ||= "#{parent_name}::#{@name}"
92
+ end
93
+
94
+ ##
95
+ # The module or class this constant is an alias for, when one was recorded
96
+ # explicitly (by RDoc::Context#add_module_alias, RDoc::ClassModule#update_aliases,
97
+ # or ri marshal load). Pure accessor; see #resolved_alias_target for the
98
+ # opportunistic lookup path.
99
+
100
+ def is_alias_for
101
+ case @is_alias_for
102
+ when String then
103
+ found = @store.find_class_or_module @is_alias_for
104
+ @is_alias_for = found if found
105
+ @is_alias_for
106
+ else
107
+ @is_alias_for
108
+ end
109
+ end
110
+
111
+ ##
112
+ # Returns the class/module this constant *would* alias if #is_alias_for_path
113
+ # was set by the parser and that path resolves to a known class/module, or
114
+ # nil. Used to support `Const = RHS` parsed before `class RHS;end` is defined
115
+ # in another file. Pure lookup; does not mutate state. Honors :nodoc:
116
+ # (returns nil if document_self is false). Note that module nesting
117
+ # information is lost, so constant lookup is inaccurate.
118
+
119
+ def resolved_alias_target
120
+ return nil unless document_self
121
+ return nil unless @is_alias_for_path
122
+ parent.find_module_named(@is_alias_for_path)
123
+ end
124
+
125
+ def inspect # :nodoc:
126
+ "#<%s:0x%x %s::%s>" % [
127
+ self.class, object_id,
128
+ parent_name, @name,
129
+ ]
130
+ end
131
+
132
+ ##
133
+ # Dumps this Constant for use by ri. See also #marshal_load
134
+
135
+ def marshal_dump
136
+ alias_name = case found = is_alias_for
137
+ when RDoc::CodeObject then found.full_name
138
+ else found
139
+ end
140
+
141
+ [ MARSHAL_VERSION,
142
+ @name,
143
+ full_name,
144
+ @visibility,
145
+ alias_name,
146
+ parse(@comment),
147
+ @file.relative_name,
148
+ parent.name,
149
+ parent.class,
150
+ section.title,
151
+ ]
152
+ end
153
+
154
+ ##
155
+ # Loads this Constant from +array+. For a loaded Constant the following
156
+ # methods will return cached values:
157
+ #
158
+ # * #full_name
159
+ # * #parent_name
160
+
161
+ def marshal_load(array)
162
+ initialize array[1], nil, RDoc::Comment.from_document(array[5])
163
+
164
+ @full_name = array[2]
165
+ @visibility = array[3] || :public
166
+ @is_alias_for = array[4]
167
+ # 5 handled above
168
+ # 6 handled below
169
+ @parent_name = array[7]
170
+ @parent_class = array[8]
171
+ @section_title = array[9]
172
+
173
+ @file = RDoc::TopLevel.new array[6]
174
+ end
175
+
176
+ ##
177
+ # Path to this constant for use with HTML generator output.
178
+
179
+ def path
180
+ "#{@parent.path}##{@name}"
181
+ end
182
+
183
+ ##
184
+ # Returns an HTML snippet of the comment for search results.
185
+
186
+ def search_snippet
187
+ return '' if comment.empty?
188
+
189
+ snippet(comment)
190
+ end
191
+
192
+ def pretty_print(q) # :nodoc:
193
+ q.group 2, "[#{self.class.name} #{full_name}", "]" do
194
+ unless comment.empty? then
195
+ q.breakable
196
+ q.text "comment:"
197
+ q.breakable
198
+ q.pp @comment
199
+ end
200
+ end
201
+ end
202
+
203
+ ##
204
+ # Sets the store for this class or module and its contained code objects.
205
+
206
+ def store=(store)
207
+ super
208
+
209
+ @file = @store.add_file @file.full_name if @file
210
+ end
211
+
212
+ def to_s # :nodoc:
213
+ parent_name = parent ? parent.full_name : '(unknown)'
214
+ if is_alias_for
215
+ "constant #{parent_name}::#@name -> #{is_alias_for}"
216
+ else
217
+ "constant #{parent_name}::#@name"
218
+ end
219
+ end
220
+
221
+ end
@@ -0,0 +1,182 @@
1
+ # frozen_string_literal: true
2
+ require 'cgi/escape'
3
+ require 'cgi/util' unless defined?(CGI::EscapeExt)
4
+
5
+ ##
6
+ # A section of documentation like:
7
+ #
8
+ # # :section: The title
9
+ # # The body
10
+ #
11
+ # Sections can be referenced multiple times and will be collapsed into a
12
+ # single section.
13
+
14
+ class RDoc::Context::Section
15
+
16
+ include RDoc::Text
17
+
18
+ MARSHAL_VERSION = 0 # :nodoc:
19
+
20
+ ##
21
+ # Section comments
22
+
23
+ attr_reader :comments
24
+
25
+ ##
26
+ # Context this Section lives in
27
+
28
+ attr_reader :parent
29
+
30
+ ##
31
+ # Section title
32
+
33
+ attr_reader :title
34
+
35
+ ##
36
+ # The RDoc::Store for this object.
37
+
38
+ attr_reader :store
39
+
40
+ ##
41
+ # Creates a new section with +title+ and +comment+
42
+
43
+ def initialize(parent, title, comment, store = nil)
44
+ @parent = parent
45
+ @title = title ? title.strip : title
46
+ @store = store
47
+
48
+ @comments = []
49
+
50
+ add_comment comment
51
+ end
52
+
53
+ ##
54
+ # Sections are equal when they have the same #title
55
+
56
+ def ==(other)
57
+ self.class === other and @title == other.title
58
+ end
59
+
60
+ alias eql? ==
61
+
62
+ ##
63
+ # Adds +comment+ to this section
64
+
65
+ def add_comment(comment)
66
+ Array(comment).each do |c|
67
+ next if c.nil?
68
+ raise TypeError, "unknown comment #{c.inspect}" unless RDoc::Comment === c
69
+ @comments << c unless c.empty?
70
+ end
71
+ end
72
+
73
+ ##
74
+ # Anchor reference for linking to this section using GitHub-style format.
75
+ #
76
+ # Examples:
77
+ # "Section" -> "section"
78
+ # "One Two" -> "one-two"
79
+ # "[untitled]" -> "untitled"
80
+
81
+ def aref
82
+ title = @title || '[untitled]'
83
+
84
+ RDoc::Text.to_anchor(title)
85
+ end
86
+
87
+ ##
88
+ # Legacy anchor reference for backward compatibility.
89
+ #
90
+ # Examples:
91
+ # "Section" -> "section"
92
+ # "One Two" -> "one+two"
93
+ # "[untitled]" -> "5Buntitled-5D"
94
+
95
+ def legacy_aref
96
+ title = @title || '[untitled]'
97
+
98
+ CGI.escape(title).gsub('%', '-').sub(/^-/, '')
99
+ end
100
+
101
+ def inspect # :nodoc:
102
+ "#<%s:0x%x %p>" % [self.class, object_id, title]
103
+ end
104
+
105
+ def hash # :nodoc:
106
+ @title.hash
107
+ end
108
+
109
+ ##
110
+ # The files comments in this section come from
111
+
112
+ def in_files
113
+ @comments.map(&:file)
114
+ end
115
+
116
+ ##
117
+ # Serializes this Section. The title and parsed comment are saved, but not
118
+ # the section parent which must be restored manually.
119
+
120
+ def marshal_dump
121
+ [
122
+ MARSHAL_VERSION,
123
+ @title,
124
+ to_document,
125
+ ]
126
+ end
127
+
128
+ ##
129
+ # De-serializes this Section. The section parent must be restored manually.
130
+
131
+ def marshal_load(array)
132
+ @parent = nil
133
+
134
+ @title = array[1]
135
+ @comments = array[2].parts.map { |doc| RDoc::Comment.from_document(doc) }
136
+ end
137
+
138
+ ##
139
+ # Parses +comment_location+ into an RDoc::Markup::Document composed of
140
+ # multiple RDoc::Markup::Documents with their file set.
141
+
142
+ def to_document
143
+ RDoc::Markup::Document.new(*@comments.map(&:parse))
144
+ end
145
+
146
+ ##
147
+ # The section's title, or 'Top Section' if the title is nil.
148
+ #
149
+ # This is used by the table of contents template so the name is silly.
150
+
151
+ def plain_html
152
+ @title || 'Top Section'
153
+ end
154
+
155
+ ##
156
+ # Section comment
157
+
158
+ def comment
159
+ return nil if @comments.empty?
160
+ RDoc::Comment.from_document(to_document)
161
+ end
162
+
163
+ def description
164
+ return '' if @comments.empty?
165
+ markup comment
166
+ end
167
+
168
+ def language
169
+ @comments.first&.language
170
+ end
171
+
172
+ ##
173
+ # Removes a comment from this section if it is from the same file as
174
+ # +comment+
175
+
176
+ def remove_comment(target_comment)
177
+ @comments.delete_if do |stored_comment|
178
+ stored_comment.file == target_comment.file
179
+ end
180
+ end
181
+
182
+ end