hyper-pro-gem 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 (380) hide show
  1. checksums.yaml +7 -0
  2. data/hyper-pro-gem.gemspec +12 -0
  3. data/yard-0.9.44/CHANGELOG.md +983 -0
  4. data/yard-0.9.44/LEGAL +94 -0
  5. data/yard-0.9.44/LICENSE +22 -0
  6. data/yard-0.9.44/README.md +329 -0
  7. data/yard-0.9.44/bin/yard +13 -0
  8. data/yard-0.9.44/bin/yardoc +13 -0
  9. data/yard-0.9.44/bin/yri +13 -0
  10. data/yard-0.9.44/docs/CodeObjects.md +115 -0
  11. data/yard-0.9.44/docs/GettingStarted.md +705 -0
  12. data/yard-0.9.44/docs/Handlers.md +152 -0
  13. data/yard-0.9.44/docs/Overview.md +61 -0
  14. data/yard-0.9.44/docs/Parser.md +166 -0
  15. data/yard-0.9.44/docs/Tags.md +304 -0
  16. data/yard-0.9.44/docs/TagsArch.md +123 -0
  17. data/yard-0.9.44/docs/Templates.md +497 -0
  18. data/yard-0.9.44/docs/WhatsNew.md +1297 -0
  19. data/yard-0.9.44/docs/images/code-objects-class-diagram.png +0 -0
  20. data/yard-0.9.44/docs/images/handlers-class-diagram.png +0 -0
  21. data/yard-0.9.44/docs/images/overview-class-diagram.png +0 -0
  22. data/yard-0.9.44/docs/images/parser-class-diagram.png +0 -0
  23. data/yard-0.9.44/docs/images/tags-class-diagram.png +0 -0
  24. data/yard-0.9.44/docs/templates/default/fulldoc/html/full_list_tag.erb +9 -0
  25. data/yard-0.9.44/docs/templates/default/fulldoc/html/setup.rb +6 -0
  26. data/yard-0.9.44/docs/templates/default/layout/html/setup.rb +9 -0
  27. data/yard-0.9.44/docs/templates/default/layout/html/tag_list.erb +11 -0
  28. data/yard-0.9.44/docs/templates/default/yard_tags/html/list.erb +18 -0
  29. data/yard-0.9.44/docs/templates/default/yard_tags/html/setup.rb +26 -0
  30. data/yard-0.9.44/docs/templates/plugin.rb +70 -0
  31. data/yard-0.9.44/lib/rubygems_plugin.rb +9 -0
  32. data/yard-0.9.44/lib/yard/autoload.rb +328 -0
  33. data/yard-0.9.44/lib/yard/cli/command.rb +85 -0
  34. data/yard-0.9.44/lib/yard/cli/command_parser.rb +93 -0
  35. data/yard-0.9.44/lib/yard/cli/config.rb +198 -0
  36. data/yard-0.9.44/lib/yard/cli/diff.rb +278 -0
  37. data/yard-0.9.44/lib/yard/cli/display.rb +69 -0
  38. data/yard-0.9.44/lib/yard/cli/gems.rb +84 -0
  39. data/yard-0.9.44/lib/yard/cli/graph.rb +125 -0
  40. data/yard-0.9.44/lib/yard/cli/help.rb +20 -0
  41. data/yard-0.9.44/lib/yard/cli/i18n.rb +70 -0
  42. data/yard-0.9.44/lib/yard/cli/list.rb +23 -0
  43. data/yard-0.9.44/lib/yard/cli/markup_types.rb +32 -0
  44. data/yard-0.9.44/lib/yard/cli/server.rb +266 -0
  45. data/yard-0.9.44/lib/yard/cli/stats.rb +234 -0
  46. data/yard-0.9.44/lib/yard/cli/yardoc.rb +791 -0
  47. data/yard-0.9.44/lib/yard/cli/yardopts_command.rb +110 -0
  48. data/yard-0.9.44/lib/yard/cli/yri.rb +215 -0
  49. data/yard-0.9.44/lib/yard/code_objects/base.rb +626 -0
  50. data/yard-0.9.44/lib/yard/code_objects/class_object.rb +146 -0
  51. data/yard-0.9.44/lib/yard/code_objects/class_variable_object.rb +11 -0
  52. data/yard-0.9.44/lib/yard/code_objects/constant_object.rb +16 -0
  53. data/yard-0.9.44/lib/yard/code_objects/extended_method_object.rb +24 -0
  54. data/yard-0.9.44/lib/yard/code_objects/extra_file_object.rb +135 -0
  55. data/yard-0.9.44/lib/yard/code_objects/macro_object.rb +171 -0
  56. data/yard-0.9.44/lib/yard/code_objects/method_object.rb +196 -0
  57. data/yard-0.9.44/lib/yard/code_objects/module_object.rb +21 -0
  58. data/yard-0.9.44/lib/yard/code_objects/namespace_mapper.rb +141 -0
  59. data/yard-0.9.44/lib/yard/code_objects/namespace_object.rb +200 -0
  60. data/yard-0.9.44/lib/yard/code_objects/proxy.rb +245 -0
  61. data/yard-0.9.44/lib/yard/code_objects/root_object.rb +19 -0
  62. data/yard-0.9.44/lib/yard/config.rb +274 -0
  63. data/yard-0.9.44/lib/yard/core_ext/array.rb +16 -0
  64. data/yard-0.9.44/lib/yard/core_ext/file.rb +69 -0
  65. data/yard-0.9.44/lib/yard/core_ext/hash.rb +16 -0
  66. data/yard-0.9.44/lib/yard/core_ext/insertion.rb +63 -0
  67. data/yard-0.9.44/lib/yard/core_ext/module.rb +11 -0
  68. data/yard-0.9.44/lib/yard/core_ext/string.rb +68 -0
  69. data/yard-0.9.44/lib/yard/core_ext/symbol_hash.rb +75 -0
  70. data/yard-0.9.44/lib/yard/docstring.rb +386 -0
  71. data/yard-0.9.44/lib/yard/docstring_parser.rb +344 -0
  72. data/yard-0.9.44/lib/yard/gem_index.rb +29 -0
  73. data/yard-0.9.44/lib/yard/globals.rb +22 -0
  74. data/yard-0.9.44/lib/yard/handlers/base.rb +617 -0
  75. data/yard-0.9.44/lib/yard/handlers/c/alias_handler.rb +16 -0
  76. data/yard-0.9.44/lib/yard/handlers/c/attribute_handler.rb +13 -0
  77. data/yard-0.9.44/lib/yard/handlers/c/base.rb +164 -0
  78. data/yard-0.9.44/lib/yard/handlers/c/class_handler.rb +27 -0
  79. data/yard-0.9.44/lib/yard/handlers/c/constant_handler.rb +13 -0
  80. data/yard-0.9.44/lib/yard/handlers/c/handler_methods.rb +212 -0
  81. data/yard-0.9.44/lib/yard/handlers/c/init_handler.rb +20 -0
  82. data/yard-0.9.44/lib/yard/handlers/c/method_handler.rb +45 -0
  83. data/yard-0.9.44/lib/yard/handlers/c/mixin_handler.rb +21 -0
  84. data/yard-0.9.44/lib/yard/handlers/c/module_handler.rb +17 -0
  85. data/yard-0.9.44/lib/yard/handlers/c/override_comment_handler.rb +31 -0
  86. data/yard-0.9.44/lib/yard/handlers/c/path_handler.rb +11 -0
  87. data/yard-0.9.44/lib/yard/handlers/c/struct_handler.rb +13 -0
  88. data/yard-0.9.44/lib/yard/handlers/c/symbol_handler.rb +8 -0
  89. data/yard-0.9.44/lib/yard/handlers/common/method_handler.rb +19 -0
  90. data/yard-0.9.44/lib/yard/handlers/processor.rb +200 -0
  91. data/yard-0.9.44/lib/yard/handlers/rbs/attribute_handler.rb +79 -0
  92. data/yard-0.9.44/lib/yard/handlers/rbs/base.rb +38 -0
  93. data/yard-0.9.44/lib/yard/handlers/rbs/constant_handler.rb +18 -0
  94. data/yard-0.9.44/lib/yard/handlers/rbs/method_handler.rb +327 -0
  95. data/yard-0.9.44/lib/yard/handlers/rbs/mixin_handler.rb +20 -0
  96. data/yard-0.9.44/lib/yard/handlers/rbs/namespace_handler.rb +26 -0
  97. data/yard-0.9.44/lib/yard/handlers/ruby/alias_handler.rb +45 -0
  98. data/yard-0.9.44/lib/yard/handlers/ruby/attribute_handler.rb +90 -0
  99. data/yard-0.9.44/lib/yard/handlers/ruby/base.rb +165 -0
  100. data/yard-0.9.44/lib/yard/handlers/ruby/class_condition_handler.rb +92 -0
  101. data/yard-0.9.44/lib/yard/handlers/ruby/class_handler.rb +119 -0
  102. data/yard-0.9.44/lib/yard/handlers/ruby/class_variable_handler.rb +17 -0
  103. data/yard-0.9.44/lib/yard/handlers/ruby/comment_handler.rb +10 -0
  104. data/yard-0.9.44/lib/yard/handlers/ruby/constant_handler.rb +73 -0
  105. data/yard-0.9.44/lib/yard/handlers/ruby/decorator_handler_methods.rb +123 -0
  106. data/yard-0.9.44/lib/yard/handlers/ruby/dsl_handler.rb +15 -0
  107. data/yard-0.9.44/lib/yard/handlers/ruby/dsl_handler_methods.rb +96 -0
  108. data/yard-0.9.44/lib/yard/handlers/ruby/exception_handler.rb +27 -0
  109. data/yard-0.9.44/lib/yard/handlers/ruby/extend_handler.rb +22 -0
  110. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/alias_handler.rb +37 -0
  111. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/attribute_handler.rb +65 -0
  112. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/base.rb +245 -0
  113. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/class_condition_handler.rb +83 -0
  114. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/class_handler.rb +113 -0
  115. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/class_variable_handler.rb +15 -0
  116. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/comment_handler.rb +10 -0
  117. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/constant_handler.rb +29 -0
  118. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/dsl_handler.rb +17 -0
  119. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/exception_handler.rb +13 -0
  120. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/extend_handler.rb +21 -0
  121. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/method_handler.rb +90 -0
  122. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/mixin_handler.rb +39 -0
  123. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/module_function_handler.rb +19 -0
  124. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/module_handler.rb +12 -0
  125. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/private_class_method_handler.rb +22 -0
  126. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/private_constant_handler.rb +22 -0
  127. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/visibility_handler.rb +18 -0
  128. data/yard-0.9.44/lib/yard/handlers/ruby/legacy/yield_handler.rb +29 -0
  129. data/yard-0.9.44/lib/yard/handlers/ruby/method_condition_handler.rb +9 -0
  130. data/yard-0.9.44/lib/yard/handlers/ruby/method_handler.rb +104 -0
  131. data/yard-0.9.44/lib/yard/handlers/ruby/mixin_handler.rb +61 -0
  132. data/yard-0.9.44/lib/yard/handlers/ruby/module_function_handler.rb +39 -0
  133. data/yard-0.9.44/lib/yard/handlers/ruby/module_handler.rb +12 -0
  134. data/yard-0.9.44/lib/yard/handlers/ruby/private_class_method_handler.rb +14 -0
  135. data/yard-0.9.44/lib/yard/handlers/ruby/private_constant_handler.rb +43 -0
  136. data/yard-0.9.44/lib/yard/handlers/ruby/public_class_method_handler.rb +14 -0
  137. data/yard-0.9.44/lib/yard/handlers/ruby/struct_handler_methods.rb +143 -0
  138. data/yard-0.9.44/lib/yard/handlers/ruby/visibility_handler.rb +35 -0
  139. data/yard-0.9.44/lib/yard/handlers/ruby/yield_handler.rb +31 -0
  140. data/yard-0.9.44/lib/yard/i18n/locale.rb +67 -0
  141. data/yard-0.9.44/lib/yard/i18n/message.rb +57 -0
  142. data/yard-0.9.44/lib/yard/i18n/messages.rb +56 -0
  143. data/yard-0.9.44/lib/yard/i18n/po_parser.rb +61 -0
  144. data/yard-0.9.44/lib/yard/i18n/pot_generator.rb +290 -0
  145. data/yard-0.9.44/lib/yard/i18n/text.rb +173 -0
  146. data/yard-0.9.44/lib/yard/logging.rb +260 -0
  147. data/yard-0.9.44/lib/yard/open_struct.rb +67 -0
  148. data/yard-0.9.44/lib/yard/options.rb +217 -0
  149. data/yard-0.9.44/lib/yard/parser/base.rb +57 -0
  150. data/yard-0.9.44/lib/yard/parser/c/c_parser.rb +235 -0
  151. data/yard-0.9.44/lib/yard/parser/c/comment_parser.rb +134 -0
  152. data/yard-0.9.44/lib/yard/parser/c/statement.rb +66 -0
  153. data/yard-0.9.44/lib/yard/parser/rbs/rbs_parser.rb +325 -0
  154. data/yard-0.9.44/lib/yard/parser/rbs/statement.rb +75 -0
  155. data/yard-0.9.44/lib/yard/parser/ruby/ast_node.rb +559 -0
  156. data/yard-0.9.44/lib/yard/parser/ruby/legacy/irb/slex.rb +294 -0
  157. data/yard-0.9.44/lib/yard/parser/ruby/legacy/ruby_lex.rb +1360 -0
  158. data/yard-0.9.44/lib/yard/parser/ruby/legacy/ruby_parser.rb +32 -0
  159. data/yard-0.9.44/lib/yard/parser/ruby/legacy/statement.rb +68 -0
  160. data/yard-0.9.44/lib/yard/parser/ruby/legacy/statement_list.rb +394 -0
  161. data/yard-0.9.44/lib/yard/parser/ruby/legacy/token_list.rb +74 -0
  162. data/yard-0.9.44/lib/yard/parser/ruby/ruby_parser.rb +792 -0
  163. data/yard-0.9.44/lib/yard/parser/ruby/token_resolver.rb +158 -0
  164. data/yard-0.9.44/lib/yard/parser/source_parser.rb +526 -0
  165. data/yard-0.9.44/lib/yard/rake/yardoc_task.rb +81 -0
  166. data/yard-0.9.44/lib/yard/registry.rb +439 -0
  167. data/yard-0.9.44/lib/yard/registry_resolver.rb +225 -0
  168. data/yard-0.9.44/lib/yard/registry_store.rb +342 -0
  169. data/yard-0.9.44/lib/yard/rubygems/backports/LICENSE.txt +57 -0
  170. data/yard-0.9.44/lib/yard/rubygems/backports/MIT.txt +20 -0
  171. data/yard-0.9.44/lib/yard/rubygems/backports/gem.rb +10 -0
  172. data/yard-0.9.44/lib/yard/rubygems/backports/source_index.rb +365 -0
  173. data/yard-0.9.44/lib/yard/rubygems/backports.rb +10 -0
  174. data/yard-0.9.44/lib/yard/rubygems/doc_manager.rb +90 -0
  175. data/yard-0.9.44/lib/yard/rubygems/hook.rb +197 -0
  176. data/yard-0.9.44/lib/yard/rubygems/specification.rb +50 -0
  177. data/yard-0.9.44/lib/yard/serializers/base.rb +83 -0
  178. data/yard-0.9.44/lib/yard/serializers/file_system_serializer.rb +123 -0
  179. data/yard-0.9.44/lib/yard/serializers/process_serializer.rb +24 -0
  180. data/yard-0.9.44/lib/yard/serializers/stdout_serializer.rb +34 -0
  181. data/yard-0.9.44/lib/yard/serializers/yardoc_serializer.rb +152 -0
  182. data/yard-0.9.44/lib/yard/server/adapter.rb +100 -0
  183. data/yard-0.9.44/lib/yard/server/commands/base.rb +203 -0
  184. data/yard-0.9.44/lib/yard/server/commands/display_file_command.rb +29 -0
  185. data/yard-0.9.44/lib/yard/server/commands/display_object_command.rb +65 -0
  186. data/yard-0.9.44/lib/yard/server/commands/frames_command.rb +16 -0
  187. data/yard-0.9.44/lib/yard/server/commands/library_command.rb +187 -0
  188. data/yard-0.9.44/lib/yard/server/commands/library_index_command.rb +28 -0
  189. data/yard-0.9.44/lib/yard/server/commands/list_command.rb +25 -0
  190. data/yard-0.9.44/lib/yard/server/commands/root_request_command.rb +15 -0
  191. data/yard-0.9.44/lib/yard/server/commands/search_command.rb +79 -0
  192. data/yard-0.9.44/lib/yard/server/commands/static_file_command.rb +23 -0
  193. data/yard-0.9.44/lib/yard/server/commands/static_file_helpers.rb +60 -0
  194. data/yard-0.9.44/lib/yard/server/doc_server_helper.rb +91 -0
  195. data/yard-0.9.44/lib/yard/server/doc_server_serializer.rb +39 -0
  196. data/yard-0.9.44/lib/yard/server/http_utils.rb +512 -0
  197. data/yard-0.9.44/lib/yard/server/library_version.rb +277 -0
  198. data/yard-0.9.44/lib/yard/server/rack_adapter.rb +97 -0
  199. data/yard-0.9.44/lib/yard/server/router.rb +187 -0
  200. data/yard-0.9.44/lib/yard/server/static_caching.rb +77 -0
  201. data/yard-0.9.44/lib/yard/server/templates/default/fulldoc/html/css/custom.css +207 -0
  202. data/yard-0.9.44/lib/yard/server/templates/default/fulldoc/html/images/processing.gif +0 -0
  203. data/yard-0.9.44/lib/yard/server/templates/default/fulldoc/html/js/autocomplete.js +203 -0
  204. data/yard-0.9.44/lib/yard/server/templates/default/layout/html/breadcrumb.erb +21 -0
  205. data/yard-0.9.44/lib/yard/server/templates/default/layout/html/script_setup.erb +7 -0
  206. data/yard-0.9.44/lib/yard/server/templates/default/layout/html/setup.rb +8 -0
  207. data/yard-0.9.44/lib/yard/server/templates/default/method_details/html/permalink.erb +6 -0
  208. data/yard-0.9.44/lib/yard/server/templates/default/method_details/html/setup.rb +5 -0
  209. data/yard-0.9.44/lib/yard/server/templates/doc_server/library_list/html/headers.erb +8 -0
  210. data/yard-0.9.44/lib/yard/server/templates/doc_server/library_list/html/library_list.erb +13 -0
  211. data/yard-0.9.44/lib/yard/server/templates/doc_server/library_list/html/listing.erb +13 -0
  212. data/yard-0.9.44/lib/yard/server/templates/doc_server/library_list/html/setup.rb +6 -0
  213. data/yard-0.9.44/lib/yard/server/templates/doc_server/library_list/html/title.erb +2 -0
  214. data/yard-0.9.44/lib/yard/server/templates/doc_server/processing/html/processing.erb +58 -0
  215. data/yard-0.9.44/lib/yard/server/templates/doc_server/processing/html/setup.rb +4 -0
  216. data/yard-0.9.44/lib/yard/server/templates/doc_server/search/html/search.erb +18 -0
  217. data/yard-0.9.44/lib/yard/server/templates/doc_server/search/html/setup.rb +9 -0
  218. data/yard-0.9.44/lib/yard/server/webrick_adapter.rb +45 -0
  219. data/yard-0.9.44/lib/yard/server.rb +13 -0
  220. data/yard-0.9.44/lib/yard/tags/default_factory.rb +192 -0
  221. data/yard-0.9.44/lib/yard/tags/default_tag.rb +13 -0
  222. data/yard-0.9.44/lib/yard/tags/directives.rb +631 -0
  223. data/yard-0.9.44/lib/yard/tags/library.rb +633 -0
  224. data/yard-0.9.44/lib/yard/tags/option_tag.rb +13 -0
  225. data/yard-0.9.44/lib/yard/tags/overload_tag.rb +72 -0
  226. data/yard-0.9.44/lib/yard/tags/ref_tag.rb +8 -0
  227. data/yard-0.9.44/lib/yard/tags/ref_tag_list.rb +28 -0
  228. data/yard-0.9.44/lib/yard/tags/tag.rb +72 -0
  229. data/yard-0.9.44/lib/yard/tags/tag_format_error.rb +7 -0
  230. data/yard-0.9.44/lib/yard/tags/types_explainer.rb +288 -0
  231. data/yard-0.9.44/lib/yard/templates/engine.rb +185 -0
  232. data/yard-0.9.44/lib/yard/templates/erb_cache.rb +23 -0
  233. data/yard-0.9.44/lib/yard/templates/helpers/base_helper.rb +215 -0
  234. data/yard-0.9.44/lib/yard/templates/helpers/filter_helper.rb +27 -0
  235. data/yard-0.9.44/lib/yard/templates/helpers/html_helper.rb +688 -0
  236. data/yard-0.9.44/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +83 -0
  237. data/yard-0.9.44/lib/yard/templates/helpers/markup/html_entities.rb +2140 -0
  238. data/yard-0.9.44/lib/yard/templates/helpers/markup/hybrid_markdown.rb +2131 -0
  239. data/yard-0.9.44/lib/yard/templates/helpers/markup/rdoc_markdown.rb +23 -0
  240. data/yard-0.9.44/lib/yard/templates/helpers/markup/rdoc_markup.rb +112 -0
  241. data/yard-0.9.44/lib/yard/templates/helpers/markup_helper.rb +175 -0
  242. data/yard-0.9.44/lib/yard/templates/helpers/method_helper.rb +77 -0
  243. data/yard-0.9.44/lib/yard/templates/helpers/module_helper.rb +21 -0
  244. data/yard-0.9.44/lib/yard/templates/helpers/text_helper.rb +112 -0
  245. data/yard-0.9.44/lib/yard/templates/helpers/uml_helper.rb +47 -0
  246. data/yard-0.9.44/lib/yard/templates/section.rb +103 -0
  247. data/yard-0.9.44/lib/yard/templates/template.rb +420 -0
  248. data/yard-0.9.44/lib/yard/templates/template_options.rb +91 -0
  249. data/yard-0.9.44/lib/yard/verifier.rb +151 -0
  250. data/yard-0.9.44/lib/yard/version.rb +6 -0
  251. data/yard-0.9.44/lib/yard.rb +75 -0
  252. data/yard-0.9.44/po/ja.po +31108 -0
  253. data/yard-0.9.44/templates/default/class/dot/setup.rb +7 -0
  254. data/yard-0.9.44/templates/default/class/dot/superklass.erb +3 -0
  255. data/yard-0.9.44/templates/default/class/html/constructor_details.erb +8 -0
  256. data/yard-0.9.44/templates/default/class/html/setup.rb +2 -0
  257. data/yard-0.9.44/templates/default/class/html/subclasses.erb +4 -0
  258. data/yard-0.9.44/templates/default/class/setup.rb +36 -0
  259. data/yard-0.9.44/templates/default/class/text/setup.rb +12 -0
  260. data/yard-0.9.44/templates/default/class/text/subclasses.erb +5 -0
  261. data/yard-0.9.44/templates/default/constant/text/header.erb +11 -0
  262. data/yard-0.9.44/templates/default/constant/text/setup.rb +4 -0
  263. data/yard-0.9.44/templates/default/docstring/html/abstract.erb +4 -0
  264. data/yard-0.9.44/templates/default/docstring/html/deprecated.erb +1 -0
  265. data/yard-0.9.44/templates/default/docstring/html/index.erb +5 -0
  266. data/yard-0.9.44/templates/default/docstring/html/note.erb +6 -0
  267. data/yard-0.9.44/templates/default/docstring/html/private.erb +4 -0
  268. data/yard-0.9.44/templates/default/docstring/html/returns_void.erb +1 -0
  269. data/yard-0.9.44/templates/default/docstring/html/text.erb +1 -0
  270. data/yard-0.9.44/templates/default/docstring/html/todo.erb +6 -0
  271. data/yard-0.9.44/templates/default/docstring/setup.rb +52 -0
  272. data/yard-0.9.44/templates/default/docstring/text/abstract.erb +2 -0
  273. data/yard-0.9.44/templates/default/docstring/text/deprecated.erb +2 -0
  274. data/yard-0.9.44/templates/default/docstring/text/index.erb +2 -0
  275. data/yard-0.9.44/templates/default/docstring/text/note.erb +4 -0
  276. data/yard-0.9.44/templates/default/docstring/text/private.erb +2 -0
  277. data/yard-0.9.44/templates/default/docstring/text/returns_void.erb +1 -0
  278. data/yard-0.9.44/templates/default/docstring/text/text.erb +1 -0
  279. data/yard-0.9.44/templates/default/docstring/text/todo.erb +4 -0
  280. data/yard-0.9.44/templates/default/fulldoc/html/css/common.css +1 -0
  281. data/yard-0.9.44/templates/default/fulldoc/html/css/full_list.css +206 -0
  282. data/yard-0.9.44/templates/default/fulldoc/html/css/style.css +1089 -0
  283. data/yard-0.9.44/templates/default/fulldoc/html/frames.erb +22 -0
  284. data/yard-0.9.44/templates/default/fulldoc/html/full_list.erb +40 -0
  285. data/yard-0.9.44/templates/default/fulldoc/html/full_list_class.erb +2 -0
  286. data/yard-0.9.44/templates/default/fulldoc/html/full_list_file.erb +7 -0
  287. data/yard-0.9.44/templates/default/fulldoc/html/full_list_method.erb +10 -0
  288. data/yard-0.9.44/templates/default/fulldoc/html/js/app.js +801 -0
  289. data/yard-0.9.44/templates/default/fulldoc/html/js/full_list.js +334 -0
  290. data/yard-0.9.44/templates/default/fulldoc/html/js/jquery.js +4 -0
  291. data/yard-0.9.44/templates/default/fulldoc/html/setup.rb +249 -0
  292. data/yard-0.9.44/templates/default/layout/dot/header.erb +6 -0
  293. data/yard-0.9.44/templates/default/layout/dot/setup.rb +15 -0
  294. data/yard-0.9.44/templates/default/layout/html/breadcrumb.erb +11 -0
  295. data/yard-0.9.44/templates/default/layout/html/files.erb +11 -0
  296. data/yard-0.9.44/templates/default/layout/html/footer.erb +5 -0
  297. data/yard-0.9.44/templates/default/layout/html/headers.erb +15 -0
  298. data/yard-0.9.44/templates/default/layout/html/index.erb +2 -0
  299. data/yard-0.9.44/templates/default/layout/html/layout.erb +26 -0
  300. data/yard-0.9.44/templates/default/layout/html/listing.erb +4 -0
  301. data/yard-0.9.44/templates/default/layout/html/objects.erb +32 -0
  302. data/yard-0.9.44/templates/default/layout/html/script_setup.erb +4 -0
  303. data/yard-0.9.44/templates/default/layout/html/search.erb +13 -0
  304. data/yard-0.9.44/templates/default/layout/html/setup.rb +89 -0
  305. data/yard-0.9.44/templates/default/method/html/header.erb +17 -0
  306. data/yard-0.9.44/templates/default/method/setup.rb +4 -0
  307. data/yard-0.9.44/templates/default/method/text/header.erb +1 -0
  308. data/yard-0.9.44/templates/default/method_details/html/header.erb +3 -0
  309. data/yard-0.9.44/templates/default/method_details/html/method_signature.erb +25 -0
  310. data/yard-0.9.44/templates/default/method_details/html/source.erb +10 -0
  311. data/yard-0.9.44/templates/default/method_details/setup.rb +11 -0
  312. data/yard-0.9.44/templates/default/method_details/text/header.erb +10 -0
  313. data/yard-0.9.44/templates/default/method_details/text/method_signature.erb +12 -0
  314. data/yard-0.9.44/templates/default/method_details/text/setup.rb +11 -0
  315. data/yard-0.9.44/templates/default/module/dot/child.erb +1 -0
  316. data/yard-0.9.44/templates/default/module/dot/dependencies.erb +3 -0
  317. data/yard-0.9.44/templates/default/module/dot/header.erb +6 -0
  318. data/yard-0.9.44/templates/default/module/dot/info.erb +14 -0
  319. data/yard-0.9.44/templates/default/module/dot/setup.rb +15 -0
  320. data/yard-0.9.44/templates/default/module/html/attribute_details.erb +10 -0
  321. data/yard-0.9.44/templates/default/module/html/attribute_summary.erb +8 -0
  322. data/yard-0.9.44/templates/default/module/html/box_info.erb +43 -0
  323. data/yard-0.9.44/templates/default/module/html/children.erb +8 -0
  324. data/yard-0.9.44/templates/default/module/html/constant_summary.erb +17 -0
  325. data/yard-0.9.44/templates/default/module/html/defines.erb +3 -0
  326. data/yard-0.9.44/templates/default/module/html/header.erb +5 -0
  327. data/yard-0.9.44/templates/default/module/html/inherited_attributes.erb +14 -0
  328. data/yard-0.9.44/templates/default/module/html/inherited_constants.erb +8 -0
  329. data/yard-0.9.44/templates/default/module/html/inherited_methods.erb +20 -0
  330. data/yard-0.9.44/templates/default/module/html/item_summary.erb +40 -0
  331. data/yard-0.9.44/templates/default/module/html/method_details_list.erb +9 -0
  332. data/yard-0.9.44/templates/default/module/html/method_summary.erb +22 -0
  333. data/yard-0.9.44/templates/default/module/html/methodmissing.erb +12 -0
  334. data/yard-0.9.44/templates/default/module/html/pre_docstring.erb +1 -0
  335. data/yard-0.9.44/templates/default/module/setup.rb +187 -0
  336. data/yard-0.9.44/templates/default/module/text/children.erb +10 -0
  337. data/yard-0.9.44/templates/default/module/text/class_meths_list.erb +8 -0
  338. data/yard-0.9.44/templates/default/module/text/extends.erb +8 -0
  339. data/yard-0.9.44/templates/default/module/text/header.erb +7 -0
  340. data/yard-0.9.44/templates/default/module/text/includes.erb +8 -0
  341. data/yard-0.9.44/templates/default/module/text/instance_meths_list.erb +8 -0
  342. data/yard-0.9.44/templates/default/module/text/setup.rb +13 -0
  343. data/yard-0.9.44/templates/default/onefile/html/files.erb +5 -0
  344. data/yard-0.9.44/templates/default/onefile/html/headers.erb +8 -0
  345. data/yard-0.9.44/templates/default/onefile/html/layout.erb +16 -0
  346. data/yard-0.9.44/templates/default/onefile/html/readme.erb +3 -0
  347. data/yard-0.9.44/templates/default/onefile/html/setup.rb +62 -0
  348. data/yard-0.9.44/templates/default/root/dot/child.erb +3 -0
  349. data/yard-0.9.44/templates/default/root/dot/setup.rb +6 -0
  350. data/yard-0.9.44/templates/default/root/html/setup.rb +2 -0
  351. data/yard-0.9.44/templates/default/tags/html/example.erb +11 -0
  352. data/yard-0.9.44/templates/default/tags/html/index.erb +3 -0
  353. data/yard-0.9.44/templates/default/tags/html/option.erb +24 -0
  354. data/yard-0.9.44/templates/default/tags/html/overload.erb +14 -0
  355. data/yard-0.9.44/templates/default/tags/html/see.erb +8 -0
  356. data/yard-0.9.44/templates/default/tags/html/tag.erb +20 -0
  357. data/yard-0.9.44/templates/default/tags/setup.rb +57 -0
  358. data/yard-0.9.44/templates/default/tags/text/example.erb +12 -0
  359. data/yard-0.9.44/templates/default/tags/text/index.erb +1 -0
  360. data/yard-0.9.44/templates/default/tags/text/option.erb +20 -0
  361. data/yard-0.9.44/templates/default/tags/text/overload.erb +19 -0
  362. data/yard-0.9.44/templates/default/tags/text/see.erb +11 -0
  363. data/yard-0.9.44/templates/default/tags/text/tag.erb +13 -0
  364. data/yard-0.9.44/templates/guide/class/html/setup.rb +2 -0
  365. data/yard-0.9.44/templates/guide/docstring/html/setup.rb +2 -0
  366. data/yard-0.9.44/templates/guide/fulldoc/html/css/style.css +358 -0
  367. data/yard-0.9.44/templates/guide/fulldoc/html/js/app.js +61 -0
  368. data/yard-0.9.44/templates/guide/fulldoc/html/setup.rb +74 -0
  369. data/yard-0.9.44/templates/guide/layout/html/layout.erb +78 -0
  370. data/yard-0.9.44/templates/guide/layout/html/setup.rb +25 -0
  371. data/yard-0.9.44/templates/guide/method/html/header.erb +18 -0
  372. data/yard-0.9.44/templates/guide/method/html/setup.rb +22 -0
  373. data/yard-0.9.44/templates/guide/module/html/header.erb +7 -0
  374. data/yard-0.9.44/templates/guide/module/html/method_list.erb +5 -0
  375. data/yard-0.9.44/templates/guide/module/html/setup.rb +27 -0
  376. data/yard-0.9.44/templates/guide/onefile/html/files.erb +4 -0
  377. data/yard-0.9.44/templates/guide/onefile/html/setup.rb +6 -0
  378. data/yard-0.9.44/templates/guide/onefile/html/toc.erb +3 -0
  379. data/yard-0.9.44/templates/guide/tags/html/setup.rb +9 -0
  380. metadata +419 -0
@@ -0,0 +1,617 @@
1
+ # frozen_string_literal: true
2
+ module YARD
3
+ module Handlers
4
+ # Raise this error when a handler should exit before completing.
5
+ # The exception will be silenced, allowing the next handler(s) in the
6
+ # queue to be executed.
7
+ # @since 0.8.4
8
+ class HandlerAborted < ::RuntimeError; end
9
+
10
+ # Raised during processing phase when a handler needs to perform
11
+ # an operation on an object's namespace but the namespace could
12
+ # not be resolved.
13
+ class NamespaceMissingError < Parser::UndocumentableError
14
+ # The object the error occurred on
15
+ # @return [CodeObjects::Base] a code object
16
+ attr_accessor :object
17
+
18
+ def initialize(object) @object = object end
19
+ end
20
+
21
+ # Handlers are pluggable semantic parsers for YARD's code generation
22
+ # phase. They allow developers to control what information gets
23
+ # generated by YARD, giving them the ability to, for instance, document
24
+ # any Ruby DSLs that a customized framework may use. A good example
25
+ # of this would be the ability to document and generate meta data for
26
+ # the 'describe' declaration of the RSpec testing framework by simply
27
+ # adding a handler for such a keyword. Similarly, any Ruby API that
28
+ # takes advantage of class level declarations could add these to the
29
+ # documentation in a very explicit format by treating them as first-
30
+ # class objects in any outputted documentation.
31
+ #
32
+ # == Overview of a Typical Handler Scenario
33
+ #
34
+ # Generally, a handler class will declare a set of statements which
35
+ # it will handle using the {handles} class declaration. It will then
36
+ # implement the {#process} method to do the work. The processing would
37
+ # usually involve the manipulation of the {#namespace}, {#owner}
38
+ # {CodeObjects::Base code objects} or the creation of new ones, in
39
+ # which case they should be registered by {#register}, a method that
40
+ # sets some basic attributes for the new objects.
41
+ #
42
+ # Handlers are usually simple and take up to a page of code to process
43
+ # and register a new object or add new attributes to the current +namespace+.
44
+ #
45
+ # == Setting up a Handler for Use
46
+ #
47
+ # A Handler is automatically registered when it is subclassed from the
48
+ # base class. The only other thing that needs to be done is to specify
49
+ # which statement the handler will process. This is done with the +handles+
50
+ # declaration, taking either a {Parser::Ruby::Legacy::RubyToken}, {String} or `Regexp`.
51
+ # Here is a simple example which processes module statements.
52
+ #
53
+ # class MyModuleHandler < YARD::Handlers::Base
54
+ # handles TkMODULE
55
+ #
56
+ # def process
57
+ # # do something
58
+ # end
59
+ # end
60
+ #
61
+ # == Processing Handler Data
62
+ #
63
+ # The goal of a specific handler is really up to the developer, and as
64
+ # such there is no real guideline on how to process the data. However,
65
+ # it is important to know where the data is coming from to be able to use
66
+ # it.
67
+ #
68
+ # === +statement+ Attribute
69
+ #
70
+ # The +statement+ attribute pertains to the {Parser::Ruby::Legacy::Statement} object
71
+ # containing a set of tokens parsed in by the parser. This is the main set
72
+ # of data to be analyzed and processed. The comments attached to the statement
73
+ # can be accessed by the {Parser::Ruby::Legacy::Statement#comments} method, but generally
74
+ # the data to be processed will live in the +tokens+ attribute. This list
75
+ # can be converted to a +String+ using +#to_s+ to parse the data with
76
+ # regular expressions (or other text processing mechanisms), if needed.
77
+ #
78
+ # === +namespace+ Attribute
79
+ #
80
+ # The +namespace+ attribute is a {CodeObjects::NamespaceObject namespace object}
81
+ # which represents the current namespace that the parser is in. For instance:
82
+ #
83
+ # module SomeModule
84
+ # class MyClass
85
+ # def mymethod; end
86
+ # end
87
+ # end
88
+ #
89
+ # If a handler was to parse the 'class MyClass' statement, it would
90
+ # be necessary to know that it belonged inside the SomeModule module.
91
+ # This is the value that +namespace+ would return when processing such
92
+ # a statement. If the class was then entered and another handler was
93
+ # called on the method, the +namespace+ would be set to the 'MyClass'
94
+ # code object.
95
+ #
96
+ # === +owner+ Attribute
97
+ #
98
+ # The +owner+ attribute is similar to the +namespace+ attribute in that
99
+ # it also follows the scope of the code during parsing. However, a namespace
100
+ # object is loosely defined as a module or class and YARD has the ability
101
+ # to parse beyond module and class blocks (inside methods, for instance),
102
+ # so the +owner+ attribute would not be limited to modules and classes.
103
+ #
104
+ # To put this into context, the example from above will be used. If a method
105
+ # handler was added to the mix and decided to parse inside the method body,
106
+ # the +owner+ would be set to the method object but the namespace would remain
107
+ # set to the class. This would allow the developer to process any method
108
+ # definitions set inside a method (def x; def y; 2 end end) by adding them
109
+ # to the correct namespace (the class, not the method).
110
+ #
111
+ # In summary, the distinction between +namespace+ and +owner+ can be thought
112
+ # of as the difference between first-class Ruby objects (namespaces) and
113
+ # second-class Ruby objects (methods).
114
+ #
115
+ # === +visibility+ and +scope+ Attributes
116
+ #
117
+ # Mainly needed for parsing methods, the +visibility+ and +scope+ attributes
118
+ # refer to the public/protected/private and class/instance values (respectively)
119
+ # of the current parsing position.
120
+ #
121
+ # == Parsing Blocks in Statements
122
+ #
123
+ # In addition to parsing a statement and creating new objects, some
124
+ # handlers may wish to continue parsing the code inside the statement's
125
+ # block (if there is one). In this context, a block means the inside
126
+ # of any statement, be it class definition, module definition, if
127
+ # statement or classic 'Ruby block'.
128
+ #
129
+ # For example, a class statement would be "class MyClass" and the block
130
+ # would be a list of statements including the method definitions inside
131
+ # the class. For a class handler, the programmer would execute the
132
+ # {#parse_block} method to continue parsing code inside the block, with
133
+ # the +namespace+ now pointing to the class object the handler created.
134
+ #
135
+ # YARD has the ability to continue into any block: class, module, method,
136
+ # even if statements. For this reason, the block parsing method must be
137
+ # invoked explicitly out of efficiency sake.
138
+ #
139
+ # @abstract Subclass this class to provide a handler for YARD to use
140
+ # during the processing phase.
141
+ #
142
+ # @see CodeObjects::Base
143
+ # @see CodeObjects::NamespaceObject
144
+ # @see handles
145
+ # @see #namespace
146
+ # @see #owner
147
+ # @see #register
148
+ # @see #parse_block
149
+ class Base
150
+ # For accessing convenience, eg. "MethodObject"
151
+ # instead of the full qualified namespace
152
+ include YARD::CodeObjects
153
+
154
+ include Parser
155
+
156
+ class << self
157
+ # Clear all registered subclasses. Testing purposes only
158
+ # @return [void]
159
+ def clear_subclasses
160
+ @@subclasses = []
161
+ end
162
+
163
+ # Returns all registered handler subclasses.
164
+ # @return [Array<Base>] a list of handlers
165
+ def subclasses
166
+ @@subclasses ||= []
167
+ end
168
+
169
+ def inherited(subclass)
170
+ @@subclasses ||= []
171
+ @@subclasses << subclass
172
+ end
173
+
174
+ # Declares the statement type which will be processed
175
+ # by this handler.
176
+ #
177
+ # A match need not be unique to a handler. Multiple
178
+ # handlers can process the same statement. However,
179
+ # in this case, care should be taken to make sure that
180
+ # {#parse_block} would only be executed by one of
181
+ # the handlers, otherwise the same code will be parsed
182
+ # multiple times and slow YARD down.
183
+ #
184
+ # @param [Parser::Ruby::Legacy::RubyToken, Symbol, String, Regexp] matches
185
+ # statements that match the declaration will be
186
+ # processed by this handler. A {String} match is
187
+ # equivalent to a +/\Astring/+ regular expression
188
+ # (match from the beginning of the line), and all
189
+ # token matches match only the first token of the
190
+ # statement.
191
+ #
192
+ def handles(*matches)
193
+ (@handlers ||= []).concat(matches)
194
+ end
195
+
196
+ # This class is implemented by {Ruby::Base} and {Ruby::Legacy::Base}.
197
+ # To implement a base handler class for another language, implement
198
+ # this method to return true if the handler should process the given
199
+ # statement object. Use {handlers} to enumerate the matchers declared
200
+ # for the handler class.
201
+ #
202
+ # @param statement a statement object or node (depends on language type)
203
+ # @return [Boolean] whether or not this handler object should process
204
+ # the given statement
205
+ def handles?(statement) # rubocop:disable Lint/UnusedMethodArgument
206
+ raise NotImplementedError, "override #handles? in a subclass"
207
+ end
208
+
209
+ # @return [Array] a list of matchers for the handler object.
210
+ # @see handles?
211
+ def handlers
212
+ @handlers ||= []
213
+ end
214
+
215
+ # Declares that the handler should only be called when inside a
216
+ # {CodeObjects::NamespaceObject}, not a method body.
217
+ #
218
+ # @return [void]
219
+ def namespace_only
220
+ @namespace_only = true
221
+ end
222
+
223
+ # @return [Boolean] whether the handler should only be processed inside
224
+ # a namespace.
225
+ def namespace_only?
226
+ @namespace_only ||= false
227
+ end
228
+
229
+ # Declares that a handler should only be called when inside a filename
230
+ # by its basename or a regex match for the full path.
231
+ #
232
+ # @param [String, Regexp] filename a matching filename or regex
233
+ # @return [void]
234
+ # @since 0.6.2
235
+ def in_file(filename)
236
+ (@in_files ||= []) << filename
237
+ end
238
+
239
+ # @return [Boolean] whether the filename matches the declared file
240
+ # match for a handler. If no file match is specified, returns true.
241
+ # @since 0.6.2
242
+ def matches_file?(filename)
243
+ @in_files ||= nil # avoid ruby warnings
244
+ return true unless @in_files
245
+ @in_files.any? do |in_file|
246
+ case in_file
247
+ when String
248
+ File.basename(filename) == in_file
249
+ when Regexp
250
+ filename =~ in_file
251
+ else
252
+ true
253
+ end
254
+ end
255
+ end
256
+
257
+ # Generates a +process+ method, equivalent to +def process; ... end+.
258
+ # Blocks defined with this syntax will be wrapped inside an anonymous
259
+ # module so that the handler class can be extended with mixins that
260
+ # override the +process+ method without alias chaining.
261
+ #
262
+ # @!macro yard.handlers.process
263
+ # @!method process
264
+ # Main processing callback
265
+ # @return [void]
266
+ # @see #process
267
+ # @return [void]
268
+ # @since 0.5.4
269
+ def process(&block)
270
+ mod = Module.new
271
+ mod.send(:define_method, :process, &block)
272
+ include mod
273
+ end
274
+ end
275
+
276
+ def initialize(source_parser, stmt)
277
+ @parser = source_parser
278
+ @statement = stmt
279
+ end
280
+
281
+ # The main handler method called by the parser on a statement
282
+ # that matches the {handles} declaration.
283
+ #
284
+ # Subclasses should override this method to provide the handling
285
+ # functionality for the class.
286
+ #
287
+ # @return [Array<CodeObjects::Base>, CodeObjects::Base, Object]
288
+ # If this method returns a code object (or a list of them),
289
+ # they are passed to the +#register+ method which adds basic
290
+ # attributes. It is not necessary to return any objects and in
291
+ # some cases you may want to explicitly avoid the returning of
292
+ # any objects for post-processing by the register method.
293
+ #
294
+ # @see handles
295
+ # @see #register
296
+ #
297
+ def process
298
+ raise NotImplementedError, "#{self} did not implement a #process method for handling."
299
+ end
300
+
301
+ # Parses the semantic "block" contained in the statement node.
302
+ #
303
+ # @abstract Subclasses should call {Processor#process parser.process}
304
+ def parse_block(*)
305
+ raise NotImplementedError, "#{self} did not implement a #parse_block method for handling"
306
+ end
307
+
308
+ # @return [Processor] the processor object that manages all global state
309
+ # during handling.
310
+ attr_reader :parser
311
+
312
+ # @return [Object] the statement object currently being processed. Usually
313
+ # refers to one semantic language statement, though the strict definition
314
+ # depends on the parser used.
315
+ attr_reader :statement
316
+
317
+ # (see Processor#owner)
318
+ attr_accessor :owner
319
+
320
+ # (see Processor#namespace)
321
+ attr_accessor :namespace
322
+
323
+ # (see Processor#visibility)
324
+ attr_accessor :visibility
325
+
326
+ # (see Processor#scope)
327
+ attr_accessor :scope
328
+
329
+ # (see Processor#globals)
330
+ attr_reader :globals
331
+
332
+ # (see Processor#extra_state)
333
+ attr_reader :extra_state
334
+
335
+ undef owner, owner=, namespace, namespace=
336
+ undef visibility, visibility=, scope, scope=
337
+ undef globals, extra_state
338
+
339
+ def owner; parser.owner end
340
+ def owner=(v) parser.owner = v end
341
+ def namespace; parser.namespace end
342
+ def namespace=(v); parser.namespace = v end
343
+ def visibility; parser.visibility end
344
+ def visibility=(v); parser.visibility = v end
345
+ def scope; parser.scope end
346
+ def scope=(v); parser.scope = v end
347
+ def globals; parser.globals end
348
+ def extra_state; parser.extra_state end
349
+
350
+ # Aborts a handler by raising {Handlers::HandlerAborted}.
351
+ # An exception will only be logged in debugging mode for
352
+ # this kind of handler exit.
353
+ #
354
+ # @since 0.8.4
355
+ def abort!
356
+ raise Handlers::HandlerAborted
357
+ end
358
+
359
+ # Executes a given block with specific state values for {#owner},
360
+ # {#namespace} and {#scope}.
361
+ #
362
+ # @option opts [CodeObjects::NamespaceObject] :namespace (value of #namespace)
363
+ # the namespace object that {#namespace} will be equal to for the
364
+ # duration of the block.
365
+ # @option opts [Symbol] :scope (:instance)
366
+ # the scope for the duration of the block.
367
+ # @option opts [CodeObjects::Base] :owner (value of #owner)
368
+ # the owner object (method) for the duration of the block
369
+ # @yield a block to execute with the given state values.
370
+ def push_state(opts = {})
371
+ opts = {
372
+ :namespace => namespace,
373
+ :scope => :instance,
374
+ :owner => owner || namespace,
375
+ :visibility => nil
376
+ }.update(opts)
377
+
378
+ ns = namespace
379
+ vis = visibility
380
+ sc = scope
381
+ oo = owner
382
+ self.namespace = opts[:namespace]
383
+ self.visibility = opts[:visibility] || :public
384
+ self.scope = opts[:scope]
385
+ self.owner = opts[:owner]
386
+
387
+ yield
388
+
389
+ self.namespace = ns
390
+ self.visibility = vis
391
+ self.scope = sc
392
+ self.owner = oo
393
+ end
394
+
395
+ # Do some post processing on a list of code objects.
396
+ # Adds basic attributes to the list of objects like
397
+ # the filename, line number, {CodeObjects::Base#dynamic},
398
+ # source code and {CodeObjects::Base#docstring},
399
+ # but only if they don't exist.
400
+ #
401
+ # @param [Array<CodeObjects::Base>] objects
402
+ # the list of objects to post-process.
403
+ #
404
+ # @return [CodeObjects::Base, Array<CodeObjects::Base>]
405
+ # returns whatever is passed in, for chainability.
406
+ #
407
+ def register(*objects)
408
+ objects.flatten.each do |object|
409
+ next unless object.is_a?(CodeObjects::Base)
410
+ register_ensure_loaded(object)
411
+ yield(object) if block_given?
412
+ register_file_info(object)
413
+ register_source(object)
414
+ register_visibility(object)
415
+ register_docstring(object)
416
+ register_group(object)
417
+ register_dynamic(object)
418
+ register_module_function(object)
419
+ end
420
+ objects.size == 1 ? objects.first : objects
421
+ end
422
+
423
+ # Ensures that the object's namespace is loaded before attaching it
424
+ # to the namespace.
425
+ #
426
+ # @param [CodeObjects::Base] object the object to register
427
+ # @return [void]
428
+ # @since 0.8.0
429
+ def register_ensure_loaded(object)
430
+ ensure_loaded!(object.namespace)
431
+ object.namespace.children << object
432
+ rescue NamespaceMissingError
433
+ nil # noop
434
+ end
435
+
436
+ # Registers the file/line of the declaration with the object
437
+ #
438
+ # @param [CodeObjects::Base] object the object to register
439
+ # @return [void]
440
+ # @since 0.8.0
441
+ def register_file_info(object, file = parser.file, line = statement.line, comments = statement.comments)
442
+ object.add_file(file, line, comments)
443
+ end
444
+
445
+ # Registers any docstring found for the object and expands macros
446
+ #
447
+ # @param [CodeObjects::Base] object the object to register
448
+ # @return [void]
449
+ # @since 0.8.0
450
+ def register_docstring(object, docstring = statement.comments, stmt = statement)
451
+ docstring = docstring.join("\n") if Array === docstring
452
+ parser = Docstring.parser
453
+ parser.parse(docstring || "", object, self)
454
+
455
+ if object && docstring
456
+ object.docstring = parser.to_docstring
457
+
458
+ # Add hash_flag/line_range
459
+ if stmt
460
+ object.docstring.hash_flag = stmt.comments_hash_flag
461
+ object.docstring.line_range = stmt.comments_range
462
+ end
463
+ end
464
+
465
+ if docstring.is_a?(String)
466
+ if (m = docstring.match(/^\s*@!?visibility\s+(public|private|protected)\b/m))
467
+ vis_sym = m[1].to_sym
468
+
469
+ if object.nil?
470
+ globals.visibility_origin = :directive
471
+ elsif object.is_a?(CodeObjects::MethodObject)
472
+ object.visibility = vis_sym
473
+ end
474
+ end
475
+ end
476
+
477
+ register_transitive_tags(object)
478
+ end
479
+
480
+ # Registers the object as being inside a specific group
481
+ #
482
+ # @param [CodeObjects::Base] object the object to register
483
+ # @return [void]
484
+ # @since 0.8.0
485
+ def register_group(object, group = extra_state.group)
486
+ if group
487
+ unless object.namespace.is_a?(Proxy)
488
+ object.namespace.groups |= [group]
489
+ end
490
+ object.group = group
491
+ end
492
+ end
493
+
494
+ # Registers any transitive tags from the namespace on the object
495
+ #
496
+ # @param [CodeObjects::Base, nil] object the object to register
497
+ # @return [void]
498
+ # @since 0.8.0
499
+ def register_transitive_tags(object)
500
+ return unless object && !object.namespace.is_a?(Proxy)
501
+ Tags::Library.transitive_tags.each do |tag|
502
+ next unless object.namespace.has_tag?(tag)
503
+ next if object.has_tag?(tag)
504
+ object.add_tag(*object.namespace.tags(tag))
505
+ end
506
+ end
507
+
508
+ # @param [CodeObjects::Base] object the object to register
509
+ # @return [void]
510
+ # @since 0.8.0
511
+ def register_source(object, source = statement, type = parser.parser_type)
512
+ return unless object.is_a?(MethodObject)
513
+ object.source ||= source
514
+ object.source_type = type
515
+ end
516
+
517
+ # Registers visibility on a method object. If the object does not
518
+ # respond to setting visibility, nothing is done.
519
+ #
520
+ # @param [#visibility=] object the object to register
521
+ # @param [Symbol] visibility the visibility to set on the object
522
+ # @since 0.8.0
523
+ def register_visibility(object, visibility = self.visibility)
524
+ return unless object.respond_to?(:visibility=)
525
+ return if object.is_a?(NamespaceObject)
526
+
527
+ if object.is_a?(CodeObjects::MethodObject)
528
+ origin = globals.visibility_origin
529
+ if origin == :keyword
530
+ object.visibility = visibility if object.scope == scope
531
+ else
532
+ object.visibility = visibility
533
+ end
534
+ else
535
+ object.visibility = visibility
536
+ end
537
+ end
538
+
539
+ # Registers the same method information on the module function, if
540
+ # the object was defined as a module function.
541
+ #
542
+ # @param [CodeObjects::Base] object the possible module function object
543
+ # to copy data for
544
+ # @since 0.8.0
545
+ def register_module_function(object)
546
+ return unless object.is_a?(MethodObject)
547
+ return unless object.module_function?
548
+ modobj = MethodObject.new(object.namespace, object.name)
549
+ object.copy_to(modobj)
550
+ modobj.visibility = :private # rubocop:disable Lint/UselessSetterCall
551
+ end
552
+
553
+ # Registers the object as dynamic if the object is defined inside
554
+ # a method or block (owner != namespace)
555
+ #
556
+ # @param [CodeObjects::Base] object the object to register
557
+ # @return [void]
558
+ # @since 0.8.0
559
+ def register_dynamic(object)
560
+ object.dynamic = true if owner != namespace
561
+ end
562
+
563
+ # Ensures that a specific +object+ has been parsed and loaded into the
564
+ # registry. This is necessary when adding data to a namespace, for instance,
565
+ # since the namespace may not have been processed yet (it can be located
566
+ # in a file that has not been handled).
567
+ #
568
+ # Calling this method defers the handler until all other files have been
569
+ # processed. If the object gets resolved, the rest of the handler continues,
570
+ # otherwise an exception is raised.
571
+ #
572
+ # @example Adding a mixin to the String class programmatically
573
+ # ensure_loaded! P('String')
574
+ # # "String" is now guaranteed to be loaded
575
+ # P('String').mixins << P('MyMixin')
576
+ #
577
+ # @param [Proxy, CodeObjects::Base] object the object to resolve.
578
+ # @param [Integer] max_retries the number of times to defer the handler
579
+ # before raising a +NamespaceMissingError+.
580
+ # @raise [NamespaceMissingError] if the object is not resolved within
581
+ # +max_retries+ attempts, this exception is raised and the handler
582
+ # finishes processing.
583
+ def ensure_loaded!(object, max_retries = 1)
584
+ return if object.root?
585
+ return object unless object.is_a?(Proxy)
586
+
587
+ retries = 0
588
+ while object.is_a?(Proxy)
589
+ raise NamespaceMissingError, object if retries > max_retries
590
+ log.debug "Missing object #{object} in file `#{parser.file}', moving it to the back of the line."
591
+ parser.parse_remaining_files
592
+ retries += 1
593
+ end
594
+ object
595
+ end
596
+
597
+ # @group Macro Support
598
+
599
+ # @abstract Implement this method to return the parameters in a method call
600
+ # statement. It should return an empty list if the statement is not a
601
+ # method call.
602
+ # @return [Array<String>] a list of argument names
603
+ def call_params
604
+ raise NotImplementedError
605
+ end
606
+
607
+ # @abstract Implement this method to return the method being called in
608
+ # a method call. It should return nil if the statement is not a method
609
+ # call.
610
+ # @return [String] the method name being called
611
+ # @return [nil] if the statement is not a method call
612
+ def caller_method
613
+ raise NotImplementedError
614
+ end
615
+ end
616
+ end
617
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+ class YARD::Handlers::C::AliasHandler < YARD::Handlers::C::Base
3
+ MATCH = /rb_define_alias
4
+ \s*\(\s*([\w\.]+),
5
+ \s*"([^"]+)",
6
+ \s*"([^"]+)"\s*\)/xm
7
+ handles MATCH
8
+ statement_class BodyStatement
9
+
10
+ process do
11
+ statement.source.scan(MATCH) do |var_name, new_name, old_name|
12
+ var_name = "rb_cObject" if var_name == "rb_mKernel"
13
+ handle_alias(var_name, new_name, old_name)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+ class YARD::Handlers::C::AttributeHandler < YARD::Handlers::C::Base
3
+ MATCH = /rb_define_attr\s*\(\s*([\w\.]+),\s*"([^"]+)",\s*(0|1)\s*,\s*(0|1)\s*\)/
4
+ handles MATCH
5
+
6
+ process do
7
+ return if ToplevelStatement == statement
8
+ return if Comment === statement && statement.type != :multi
9
+ statement.source.scan(MATCH) do |var_name, name, read, write|
10
+ handle_attribute(var_name, name, read, write)
11
+ end
12
+ end
13
+ end