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,26 @@
1
+ # frozen_string_literal: true
2
+ # Handles RBS class, module, and interface declarations by registering
3
+ # the corresponding namespace code objects and recursing into their bodies.
4
+ class YARD::Handlers::RBS::NamespaceHandler < YARD::Handlers::RBS::Base
5
+ handles :class, :module, :interface
6
+ namespace_only
7
+
8
+ process do
9
+ name = statement.name
10
+ type = statement.type
11
+
12
+ obj = case type
13
+ when :class
14
+ klass = register ClassObject.new(namespace, name)
15
+ if (sc = statement.superclass) && !sc.strip.empty?
16
+ klass.superclass = P(namespace, sc)
17
+ klass.superclass.type = :class if klass.superclass.is_a?(Proxy)
18
+ end
19
+ klass
20
+ when :module, :interface
21
+ register ModuleObject.new(namespace, name)
22
+ end
23
+
24
+ parse_block(:namespace => obj)
25
+ end
26
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+ # Handles alias and alias_method calls
3
+ class YARD::Handlers::Ruby::AliasHandler < YARD::Handlers::Ruby::Base
4
+ handles :alias, method_call(:alias_method)
5
+ namespace_only
6
+
7
+ process do
8
+ names = []
9
+ if statement.type == :alias
10
+ nodes = [:ident, :op, :kw, :const, :tstring_content, :string_content]
11
+ names = statement.map {|o| o.jump(*nodes).source }
12
+ elsif statement.call?
13
+ statement.parameters(false).each do |obj|
14
+ case obj.type
15
+ when :symbol_literal
16
+ names << obj.jump(:ident, :op, :kw, :const).source
17
+ when :string_literal, :dyna_symbol
18
+ names << obj.jump(:string_content, :tstring_content).source
19
+ end
20
+ end
21
+ end
22
+ raise YARD::Parser::UndocumentableError, "alias/alias_method" if names.size != 2
23
+
24
+ new_meth = names[0].to_sym
25
+ old_meth = names[1].to_sym
26
+ old_obj = namespace.child(:name => old_meth, :scope => scope)
27
+ new_obj = register MethodObject.new(namespace, new_meth, scope) do |o|
28
+ o.add_file(parser.file, statement.line)
29
+ end
30
+ namespace.aliases[new_obj] = old_meth
31
+
32
+ if old_obj
33
+ new_obj.signature = old_obj.signature
34
+ new_obj.source = old_obj.source
35
+ comments = [old_obj.docstring.to_raw, statement.comments].join("\n")
36
+ doc = YARD::Docstring.parser.parse(comments, new_obj, self)
37
+ new_obj.docstring = doc.to_docstring
38
+ new_obj.docstring.line_range = statement.comments_range
39
+ new_obj.docstring.hash_flag = statement.comments_hash_flag
40
+ new_obj.docstring.object = new_obj
41
+ else
42
+ new_obj.signature = "def #{new_meth}" # this is all we know.
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,90 @@
1
+ # frozen_string_literal: true
2
+ # Handles +attr_*+ statements in modules/classes
3
+ class YARD::Handlers::Ruby::AttributeHandler < YARD::Handlers::Ruby::Base
4
+ handles method_call(:attr)
5
+ handles method_call(:attr_reader)
6
+ handles method_call(:attr_writer)
7
+ handles method_call(:attr_accessor)
8
+ namespace_only
9
+
10
+ process do
11
+ return if statement.type == :var_ref || statement.type == :vcall
12
+ read = true
13
+ write = false
14
+ params = statement.parameters(false).dup
15
+
16
+ # Change read/write based on attr_reader/writer/accessor
17
+ case statement.method_name(true)
18
+ when :attr
19
+ # In the case of 'attr', the second parameter (if given) isn't a symbol.
20
+ if params.size == 2
21
+ write = true if params.pop == s(:var_ref, s(:kw, "true"))
22
+ end
23
+ when :attr_accessor
24
+ write = true
25
+ when :attr_reader
26
+ # change nothing
27
+ when :attr_writer
28
+ read = false
29
+ write = true
30
+ end
31
+
32
+ # Add all attributes
33
+ validated_attribute_names(params).each do |name|
34
+ # Show their methods as well
35
+ {:read => name, :write => "#{name}="}.each do |type, meth|
36
+ if type == :read ? read : write
37
+ o = MethodObject.new(namespace, meth, scope)
38
+ if type == :write
39
+ o.parameters = [['value', nil]]
40
+ src = "def #{meth}(value)"
41
+ full_src = "#{src}\n @#{name} = value\nend"
42
+ doc = "Sets the attribute #{name}\n@param value the value to set the attribute #{name} to."
43
+ else
44
+ src = "def #{meth}"
45
+ full_src = "#{src}\n @#{name}\nend"
46
+ doc = "Returns the value of attribute #{name}."
47
+ end
48
+ o.source ||= full_src
49
+ o.signature ||= src
50
+ register(o)
51
+ o.docstring = doc if o.docstring.blank?(false)
52
+
53
+ # Register the object explicitly.
54
+ # Use o.scope rather than scope: register() may have changed o.scope
55
+ # via a @!scope directive, so the attribute must be stored under the
56
+ # method's final scope to keep attr_info's lookup consistent.
57
+ namespace.attributes[o.scope][name] ||= SymbolHash[:read => nil, :write => nil]
58
+ namespace.attributes[o.scope][name][type] = o
59
+ else
60
+ obj = namespace.children.find {|other| other.name == meth.to_sym && other.scope == scope }
61
+
62
+ # register an existing method as attribute
63
+ namespace.attributes[scope][name] ||= SymbolHash[:read => nil, :write => nil]
64
+ namespace.attributes[scope][name][type] = obj if obj
65
+ end
66
+ end
67
+ end
68
+ end
69
+
70
+ protected
71
+
72
+ # Strips out any non-essential arguments from the attr statement.
73
+ #
74
+ # @param [Array<Parser::Ruby::AstNode>] params a list of the parameters
75
+ # in the attr call.
76
+ # @return [Array<String>] the validated attribute names
77
+ # @raise [Parser::UndocumentableError] if the arguments are not valid.
78
+ def validated_attribute_names(params)
79
+ params.map do |obj|
80
+ case obj.type
81
+ when :symbol_literal
82
+ obj.jump(:ident, :op, :kw, :const).source
83
+ when :string_literal
84
+ obj.jump(:string_content).source
85
+ else
86
+ raise YARD::Parser::UndocumentableError, obj.source
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,165 @@
1
+ # frozen_string_literal: true
2
+ module YARD
3
+ module Handlers
4
+ module Ruby
5
+ # To implement a custom handler matcher, subclass this class and implement
6
+ # {#matches?} to return whether a node matches the handler.
7
+ #
8
+ # @example A Custom Handler Matcher Extension
9
+ # # Implements a handler that checks for a specific string
10
+ # # in the node's source.
11
+ # class MyExtension < HandlesExtension
12
+ # def matches?(node) node.source.include?(name) end
13
+ # end
14
+ #
15
+ # # This handler will handle any node where the source includes 'foo'
16
+ # class MyHandler < Handlers::Ruby::Base
17
+ # handles MyExtension.new('foo')
18
+ # end
19
+ class HandlesExtension
20
+ # Creates a new extension with a specific matcher value +name+
21
+ # @param [Object] name the matcher value to check against {#matches?}
22
+ def initialize(name) @name = name end
23
+
24
+ # Tests if the node matches the handler
25
+ # @param [Parser::Ruby::AstNode] node a Ruby node
26
+ # @return [Boolean] whether the +node+ matches the handler
27
+ def matches?(node) # rubocop:disable Lint/UnusedMethodArgument
28
+ raise NotImplementedError
29
+ end
30
+
31
+ protected
32
+
33
+ # @return [String] the extension matcher value
34
+ attr_reader :name
35
+ end
36
+
37
+ class MethodCallWrapper < HandlesExtension
38
+ def matches?(node)
39
+ case node.type
40
+ when :var_ref
41
+ if !node.parent || node.parent.type == :list
42
+ return true if node[0].type == :ident && (name.nil? || node[0][0] == name)
43
+ end
44
+ when :fcall, :command, :vcall
45
+ return true if name.nil? || node[0][0] == name
46
+ when :call, :command_call
47
+ return true if name.nil? || node[2][0] == name
48
+ end
49
+ false
50
+ end
51
+ end
52
+
53
+ class TestNodeWrapper < HandlesExtension
54
+ def matches?(node) !node.send(name).is_a?(FalseClass) end
55
+ end
56
+
57
+ # This is the base handler class for the new-style (1.9) Ruby parser.
58
+ # All handlers that subclass this base class will be used when the
59
+ # new-style parser is used. For implementing legacy handlers, see
60
+ # {Legacy::Base}.
61
+ #
62
+ # @abstract See {Handlers::Base} for subclassing information.
63
+ # @see Handlers::Base
64
+ # @see Legacy::Base
65
+ class Base < Handlers::Base
66
+ class << self
67
+ include Parser::Ruby
68
+
69
+ # @group Statement Matcher Extensions
70
+
71
+ # Matcher for handling any type of method call. Method calls can
72
+ # be expressed by many {AstNode} types depending on the syntax
73
+ # with which it is called, so YARD allows you to use this matcher
74
+ # to simplify matching a method call.
75
+ #
76
+ # @example Match the "describe" method call
77
+ # handles method_call(:describe)
78
+ #
79
+ # # The following will be matched:
80
+ # # describe(...)
81
+ # # object.describe(...)
82
+ # # describe "argument" do ... end
83
+ #
84
+ # @param [#to_s] name matches the method call of this name
85
+ # @return [void]
86
+ def method_call(name = nil)
87
+ MethodCallWrapper.new(name ? name.to_s : nil)
88
+ end
89
+
90
+ # Matcher for handling a node with a specific meta-type. An {AstNode}
91
+ # has a {AstNode#type} to define its type but can also be associated
92
+ # with a set of types. For instance, +:if+ and +:unless+ are both
93
+ # of the meta-type +:condition+.
94
+ #
95
+ # A meta-type is any method on the {AstNode} class ending in "?",
96
+ # though you should not include the "?" suffix in your declaration.
97
+ # Some examples are: "condition", "call", "literal", "kw", "token",
98
+ # "ref".
99
+ #
100
+ # @example Handling any conditional statement (if, unless)
101
+ # handles meta_type(:condition)
102
+ # @param [Symbol] type the meta-type to match. A meta-type can be
103
+ # any method name + "?" that {AstNode} responds to.
104
+ # @return [void]
105
+ def meta_type(type)
106
+ TestNodeWrapper.new(type.to_s + "?")
107
+ end
108
+
109
+ # @group Testing for a Handler
110
+
111
+ # @return [Boolean] whether or not an {AstNode} object should be
112
+ # handled by this handler
113
+ def handles?(node)
114
+ handlers.any? do |a_handler|
115
+ case a_handler
116
+ when Symbol
117
+ a_handler == node.type
118
+ when String
119
+ node.source == a_handler
120
+ when Regexp
121
+ node.source =~ a_handler
122
+ when Parser::Ruby::AstNode
123
+ a_handler == node
124
+ when HandlesExtension
125
+ a_handler.matches?(node)
126
+ end
127
+ end
128
+ end
129
+ end
130
+
131
+ include Parser::Ruby
132
+
133
+ # @group Parsing an Inner Block
134
+
135
+ def parse_block(inner_node, opts = {})
136
+ push_state(opts) do
137
+ nodes = inner_node.type == :list ? inner_node.children : [inner_node]
138
+ parser.process(nodes)
139
+ end
140
+ end
141
+
142
+ # @group Macro Handling
143
+
144
+ def call_params
145
+ return [] unless statement.respond_to?(:parameters)
146
+ statement.parameters(false).compact.map do |param|
147
+ if param.type == :list
148
+ param.map {|n| n.jump(:ident, :kw, :tstring_content).source }
149
+ else
150
+ param.jump(:ident, :kw, :tstring_content).source
151
+ end
152
+ end.flatten
153
+ end
154
+
155
+ def caller_method
156
+ if statement.call? || statement.def?
157
+ statement.method_name(true).to_s
158
+ elsif statement.type == :var_ref || statement.type == :vcall
159
+ statement[0].jump(:ident, :kw).source
160
+ end
161
+ end
162
+ end
163
+ end
164
+ end
165
+ end
@@ -0,0 +1,92 @@
1
+ # frozen_string_literal: true
2
+ # Matches if/unless conditions inside classes and attempts to process only
3
+ # one branch (by evaluating the condition if possible).
4
+ #
5
+ # @example A simple class conditional
6
+ # class Foo
7
+ # if 0
8
+ # # This method is ignored
9
+ # def xyz; end
10
+ # end
11
+ # end
12
+ class YARD::Handlers::Ruby::ClassConditionHandler < YARD::Handlers::Ruby::Base
13
+ handles meta_type(:condition)
14
+ namespace_only
15
+
16
+ process do
17
+ condition = parse_condition
18
+ if condition.nil?
19
+ # Parse both blocks if we're unsure of the condition
20
+ parse_then_block
21
+ parse_else_block
22
+ elsif condition
23
+ parse_then_block
24
+ else
25
+ parse_else_block
26
+ end
27
+ end
28
+
29
+ protected
30
+
31
+ # Parses the condition part of the if/unless statement
32
+ #
33
+ # @return [true, false, nil] true if the condition can be definitely
34
+ # parsed to true, false if not, and nil if the condition cannot be
35
+ # parsed with certainty (it's dynamic)
36
+ def parse_condition
37
+ condition = nil
38
+
39
+ # Right now we can handle very simple unary conditions like:
40
+ # if true
41
+ # if false
42
+ # if 0
43
+ # if 100 (not 0)
44
+ # if defined? SOME_CONSTANT
45
+ #
46
+ # The last case will do a lookup in the registry and then one
47
+ # in the Ruby world (using eval).
48
+ case statement.condition.type
49
+ when :int
50
+ condition = statement.condition[0] != "0"
51
+ when :defined
52
+ # defined? keyword used, let's see if we can look up the name
53
+ # in the registry, then we'll try using Ruby's powers. eval() is not
54
+ # *too* dangerous here since code is not actually executed.
55
+ arg = statement.condition.first
56
+
57
+ if arg.type == :var_ref
58
+ name = arg.source
59
+ obj = YARD::Registry.resolve(namespace, name, true)
60
+
61
+ begin
62
+ condition = true if obj || (name && Object.instance_eval("defined? #{name}"))
63
+ rescue SyntaxError, NameError
64
+ condition = false
65
+ end
66
+ end
67
+ when :var_ref
68
+ var = statement.condition[0]
69
+ if var == s(:kw, "true")
70
+ condition = true
71
+ elsif var == s(:kw, "false")
72
+ condition = false
73
+ end
74
+ end
75
+
76
+ # Invert an unless condition
77
+ if statement.type == :unless || statement.type == :unless_mod
78
+ condition = !condition unless condition.nil?
79
+ end
80
+ condition
81
+ end
82
+
83
+ def parse_then_block
84
+ parse_block(statement.then_block, :visibility => visibility)
85
+ end
86
+
87
+ def parse_else_block
88
+ if statement.else_block
89
+ parse_block(statement.else_block, :visibility => visibility)
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,119 @@
1
+ # frozen_string_literal: true
2
+ # Handles class declarations
3
+ class YARD::Handlers::Ruby::ClassHandler < YARD::Handlers::Ruby::Base
4
+ include YARD::Handlers::Ruby::StructHandlerMethods
5
+ handles :class, :sclass
6
+ namespace_only
7
+
8
+ process do
9
+ classname = statement[0].source.gsub(/\s/, '')
10
+ if statement.type == :class
11
+ superclass = parse_superclass(statement[1])
12
+ if superclass == "Struct"
13
+ is_a_struct = true
14
+ superclass = struct_superclass_name(statement[1]) # refine the superclass if possible
15
+ create_struct_superclass(superclass, statement[1])
16
+ end
17
+ undocsuper = statement[1] && superclass.nil?
18
+ klass = register ClassObject.new(namespace, classname) do |o|
19
+ o.superclass = superclass if superclass
20
+ o.superclass.type = :class if o.superclass.is_a?(Proxy)
21
+ end
22
+ if is_a_struct
23
+ parse_struct_superclass(klass, statement[1])
24
+ elsif klass
25
+ create_attributes(klass, members_from_tags(klass))
26
+ end
27
+ parse_block(statement[2], :namespace => klass)
28
+
29
+ if undocsuper
30
+ raise YARD::Parser::UndocumentableError, 'superclass (class was added without superclass)'
31
+ end
32
+ elsif statement.type == :sclass
33
+ if statement[0] == s(:var_ref, s(:kw, "self"))
34
+ parse_block(statement[1], :namespace => namespace, :scope => :class)
35
+ else
36
+ proxy = Proxy.new(namespace, classname)
37
+
38
+ # Allow constants to reference class names
39
+ if ConstantObject === proxy
40
+ if proxy.value =~ /\A#{NAMESPACEMATCH}\Z/
41
+ proxy = Proxy.new(namespace, proxy.value)
42
+ else
43
+ raise YARD::Parser::UndocumentableError, "constant class reference '#{classname}'"
44
+ end
45
+ end
46
+
47
+ if classname[0, 1] =~ /[A-Z]/
48
+ register ClassObject.new(namespace, classname) if Proxy === proxy
49
+ parse_block(statement[1], :namespace => proxy, :scope => :class)
50
+ else
51
+ raise YARD::Parser::UndocumentableError, "class '#{classname}'"
52
+ end
53
+ end
54
+ else
55
+ sig_end = (statement[1] ? statement[1].source_end : statement[0].source_end) - statement.source_start
56
+ raise YARD::Parser::UndocumentableError, "class: #{statement.source[0..sig_end]}"
57
+ end
58
+ end
59
+
60
+ private
61
+
62
+ # Extract the parameters from the Struct.new AST node, returning them as a list
63
+ # of strings
64
+ #
65
+ # @param [MethodCallNode] superclass the AST node for the Struct.new call
66
+ # @return [Array<String>] the member names to generate methods for
67
+ def extract_parameters(superclass)
68
+ members = superclass.parameters.select {|x| x && x.type == :symbol_literal }
69
+ members.map! {|x| x.source.strip[1..-1] }
70
+ members
71
+ end
72
+
73
+ def create_struct_superclass(superclass, superclass_def)
74
+ return if superclass == "Struct"
75
+ the_super = register ClassObject.new(P("Struct"), superclass[8..-1]) do |o|
76
+ o.superclass = "Struct"
77
+ end
78
+ parse_struct_superclass(the_super, superclass_def)
79
+ the_super
80
+ end
81
+
82
+ def struct_superclass_name(superclass)
83
+ if superclass.call?
84
+ first = superclass.parameters.first
85
+ if first.type == :string_literal && first[0].type == :string_content && first[0].size == 1
86
+ return "Struct::#{first[0][0][0]}"
87
+ end
88
+ end
89
+ "Struct"
90
+ end
91
+
92
+ def parse_struct_superclass(klass, superclass)
93
+ return unless superclass.call? && superclass.parameters
94
+ members = extract_parameters(superclass)
95
+ create_attributes(klass, members)
96
+ end
97
+
98
+ def parse_superclass(superclass)
99
+ return nil unless superclass
100
+
101
+ case superclass.type
102
+ when :var_ref
103
+ return namespace.path if superclass.first == s(:kw, "self")
104
+ return superclass.source if superclass.first.type == :const
105
+ when :const, :const_ref, :const_path_ref, :top_const_ref
106
+ return superclass.source
107
+ when :fcall, :command
108
+ methname = superclass.method_name.source
109
+ return superclass.parameters.first.source if methname == "DelegateClass"
110
+ return methname if superclass.method_name.type == :const
111
+ when :call, :command_call
112
+ cname = superclass.namespace.source
113
+ if cname =~ /^O?Struct$/ && superclass.method_name(true) == :new
114
+ return cname
115
+ end
116
+ end
117
+ nil
118
+ end
119
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+ # Handles a class variable (@@variable)
3
+ class YARD::Handlers::Ruby::ClassVariableHandler < YARD::Handlers::Ruby::Base
4
+ handles :assign
5
+ namespace_only
6
+
7
+ process do
8
+ if statement[0].type == :var_field && statement[0][0].type == :cvar
9
+ name = statement[0][0][0]
10
+ value = statement[1].source
11
+ register ClassVariableObject.new(namespace, name) do |o|
12
+ o.source = statement
13
+ o.value = value
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ # Handles any lone comment statement in a Ruby file
3
+ class YARD::Handlers::Ruby::CommentHandler < YARD::Handlers::Ruby::Base
4
+ handles :comment, :void_stmt
5
+ namespace_only
6
+
7
+ process do
8
+ register_docstring(nil)
9
+ end
10
+ end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+ # Handles any constant assignment
3
+ class YARD::Handlers::Ruby::ConstantHandler < YARD::Handlers::Ruby::Base
4
+ include YARD::Handlers::Ruby::StructHandlerMethods
5
+ handles :assign
6
+ namespace_only
7
+
8
+ process do
9
+ if statement[1].call? && statement[1][0][0] == s(:const, "Struct") &&
10
+ statement[1][2] == s(:ident, "new")
11
+ process_structclass(statement)
12
+ elsif statement[1].call? && statement[1][0][0] == s(:const, "Data") &&
13
+ statement[1][2] == s(:ident, "define")
14
+ process_dataclass(statement)
15
+ elsif statement[0].type == :var_field && statement[0][0].type == :const
16
+ process_constant(statement)
17
+ elsif statement[0].type == :const_path_field
18
+ process_constant(statement)
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def process_constant(statement)
25
+ name = statement[0].source
26
+ value = statement[1].source
27
+ obj = P(namespace, name)
28
+ if obj.is_a?(NamespaceObject) && obj.namespace == namespace
29
+ raise YARD::Parser::UndocumentableError, "constant for existing #{obj.type} #{obj}"
30
+ else
31
+ ensure_loaded! obj.parent
32
+ register ConstantObject.new(namespace, name) {|o| o.source = statement; o.value = value.strip }
33
+ end
34
+ end
35
+
36
+ def process_structclass(statement)
37
+ lhs = statement[0]
38
+ if (lhs.type == :var_field && lhs[0].type == :const) || lhs.type == :const_path_field
39
+ klass = create_class(lhs.source, P(:Struct))
40
+ create_attributes(klass, extract_parameters(statement[1]))
41
+ parse_block(statement[1].block[1], :namespace => klass) unless statement[1].block.nil?
42
+ else
43
+ raise YARD::Parser::UndocumentableError, "Struct assignment to #{lhs.source}"
44
+ end
45
+ end
46
+
47
+ def process_dataclass(statement)
48
+ lhs = statement[0]
49
+ if (lhs.type == :var_field && lhs[0].type == :const) || lhs.type == :const_path_field
50
+ klass = create_class(lhs.source, P(:Data))
51
+ extract_parameters(statement[1]).each do |member|
52
+ next if klass.attributes[:instance][member]
53
+ klass.attributes[:instance][member] = SymbolHash[:read => nil, :write => nil]
54
+ create_reader(klass, member)
55
+ end
56
+ parse_block(statement[1].block[1], :namespace => klass) unless statement[1].block.nil?
57
+ else
58
+ raise YARD::Parser::UndocumentableError, "Data assignment to #{lhs.source}"
59
+ end
60
+ end
61
+
62
+ # Extract the parameters from the Struct.new or Data.define AST node, returning them as a list
63
+ # of strings
64
+ #
65
+ # @param [MethodCallNode] superclass the AST node for the Struct.new or Data.define call
66
+ # @return [Array<String>] the member names to generate methods for
67
+ def extract_parameters(superclass)
68
+ return [] unless superclass.parameters
69
+ members = superclass.parameters.select {|x| x && x.type == :symbol_literal }
70
+ members.map! {|x| x.source.strip[1..-1] }
71
+ members
72
+ end
73
+ end