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,72 @@
1
+ # frozen_string_literal: true
2
+ module YARD
3
+ module Tags
4
+ class OverloadTag < Tag
5
+ attr_reader :signature, :parameters, :docstring
6
+
7
+ def initialize(tag_name, text)
8
+ super(tag_name, nil)
9
+ parse_tag(text)
10
+ parse_signature
11
+ end
12
+
13
+ def tag(name) docstring.tag(name) end
14
+ def tags(name = nil) docstring.tags(name) end
15
+ def has_tag?(name) docstring.has_tag?(name) end
16
+
17
+ def object=(value)
18
+ super(value)
19
+ docstring.object = value
20
+ docstring.tags.each {|tag| tag.object = value }
21
+ end
22
+
23
+ def name(prefix = false)
24
+ return @name unless prefix
25
+ object.scope == :class ? @name.to_s : "#{object.send(:sep)}#{@name}"
26
+ end
27
+
28
+ def method_missing(*args, &block)
29
+ object.send(*args, &block)
30
+ end
31
+
32
+ def type
33
+ object.type
34
+ end
35
+
36
+ def is_a?(other)
37
+ object.is_a?(other) || self.class >= other.class || false
38
+ end
39
+ alias kind_of? is_a?
40
+
41
+ private
42
+
43
+ def parse_tag(text)
44
+ @signature, text = *text.split(/\r?\n/, 2)
45
+ @signature.strip!
46
+ text ||= String.new("")
47
+ numspaces = text[/\A(\s*)/, 1].length
48
+ text.gsub!(/^[ \t]{#{numspaces}}/, '')
49
+ text.strip!
50
+ @docstring = Docstring.new(text, nil)
51
+ end
52
+
53
+ def parse_signature
54
+ if signature =~ /^(?:def\s)?\s*(#{CodeObjects::METHODMATCH})(?:(?:\s+|\s*\()(.*)(?:\)\s*$)?)?/m
55
+ meth = $1
56
+ args = $2
57
+ meth.gsub!(/\s+/, '')
58
+ # FIXME: refactor this code to not make use of the Handlers::Base class (tokval_list should be moved)
59
+ toks = YARD::Parser::Ruby::Legacy::TokenList.new(args)
60
+ args = YARD::Handlers::Ruby::Legacy::Base.new(nil, nil).send(:tokval_list, toks, :all)
61
+ args = args.map do |a|
62
+ k, v = *a.split(/:|=/, 2)
63
+ v.strip! if v
64
+ [k.strip.to_s + (a[k.size, 1] == ':' ? ':' : ''), (v && v.empty? ? nil : v)]
65
+ end if args
66
+ @name = meth.to_sym
67
+ @parameters = args
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+ module YARD
3
+ module Tags
4
+ module RefTag
5
+ attr_accessor :owner
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+ module YARD
3
+ module Tags
4
+ class RefTagList
5
+ attr_accessor :owner, :tag_name, :name
6
+
7
+ def initialize(tag_name, owner, name = nil)
8
+ @owner = CodeObjects::Proxy === owner ? owner : P(owner)
9
+ @tag_name = tag_name.to_s
10
+ @name = name
11
+ end
12
+
13
+ def tags
14
+ if owner.is_a?(CodeObjects::Base)
15
+ o = owner.tags(tag_name)
16
+ o = o.select {|t| t.name.to_s == name.to_s } if name
17
+ o.each do |t|
18
+ t.extend(RefTag)
19
+ t.owner = owner
20
+ end
21
+ o
22
+ else
23
+ []
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+ module YARD
3
+ module Tags
4
+ # Represents a metadata tag value (+@tag+). Tags can have any combination of
5
+ # {#types}, {#name} and {#text}, or none of the above.
6
+ #
7
+ # @example Programmatic tag creation
8
+ # # The following docstring syntax:
9
+ # # @param [String, nil] arg an argument
10
+ # #
11
+ # # is equivalent to:
12
+ # Tag.new(:param, 'an argument', ['String', 'nil'], 'arg')
13
+ class Tag
14
+ # @return [String] the name of the tag
15
+ attr_accessor :tag_name
16
+
17
+ # @return [String] the tag text associated with the tag
18
+ # @return [nil] if no tag text is supplied
19
+ attr_accessor :text
20
+
21
+ # @return [Array<String>] a list of types associated with the tag
22
+ # @return [nil] if no types are associated with the tag
23
+ attr_accessor :types
24
+
25
+ # @return [String] a name associated with the tag
26
+ # @return [nil] if no tag name is supplied
27
+ attr_accessor :name
28
+
29
+ # @return [CodeObjects::Base] the associated object
30
+ attr_accessor :object
31
+
32
+ # Creates a new tag object with a tag name and text. Optionally, formally declared types
33
+ # and a key name can be specified.
34
+ #
35
+ # Types are mainly for meta tags that rely on type information, such as +param+, +return+, etc.
36
+ #
37
+ # Key names are for tags that declare meta data for a specific key or name, such as +param+,
38
+ # +raise+, etc.
39
+ #
40
+ # @param [#to_s] tag_name the tag name to create the tag for
41
+ # @param [String, nil] text the descriptive text for this tag, or nil if none provided
42
+ # @param [Array<String>] types optional type list of formally declared types
43
+ # for the tag
44
+ # @param [String] name optional key name which the tag refers to
45
+ def initialize(tag_name, text, types = nil, name = nil)
46
+ @tag_name = tag_name.to_s
47
+ @text = text
48
+ @name = name
49
+ @types = (types ? [types].flatten.compact : nil)
50
+ end
51
+
52
+ # Convenience method to access the first type specified. This should mainly
53
+ # be used for tags that only specify one type.
54
+ #
55
+ # @return [String] the first of the list of specified types
56
+ # @see #types
57
+ def type
58
+ types.first
59
+ end
60
+
61
+ # Provides a plain English summary of the type specification, or nil
62
+ # if no types are provided or parsable.
63
+ #
64
+ # @return [String] a plain English description of the associated types
65
+ # @return [nil] if no types are provided or not parsable
66
+ def explain_types
67
+ return nil if !types || types.empty?
68
+ TypesExplainer.explain(*types)
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ module YARD
3
+ module Tags
4
+ class TagFormatError < RuntimeError
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,288 @@
1
+ # frozen_string_literal: true
2
+ require 'strscan'
3
+
4
+ module YARD
5
+ module Tags
6
+ class TypesExplainer
7
+ # Regular expression to match symbol and string literals
8
+ LITERALMATCH = /:\w+|'[^']*'|"[^"]*"/
9
+
10
+ # (see Tag#explain_types)
11
+ # @param types [Array<String>] a list of types to parse and summarize
12
+ def self.explain(*types)
13
+ explain!(*types)
14
+ rescue SyntaxError
15
+ nil
16
+ end
17
+
18
+ # (see explain)
19
+ # @raise [SyntaxError] if the types are not parsable
20
+ def self.explain!(*types)
21
+ Parser.parse(types.join(", ")).join("; ")
22
+ end
23
+
24
+ class << self
25
+ private :new
26
+ end
27
+
28
+ # @private
29
+ class Type
30
+ attr_accessor :name
31
+
32
+ def initialize(name)
33
+ @name = name
34
+ end
35
+
36
+ def to_s(singular = true)
37
+ if name[0, 1] =~ /[A-Z]/
38
+ singular ? "a#{name[0, 1] =~ /[aeiou]/i ? 'n' : ''} " + name : "#{name}#{name[-1, 1] =~ /[A-Z]/ ? "'" : ''}s"
39
+ else
40
+ name
41
+ end
42
+ end
43
+
44
+ protected
45
+
46
+ def list_join(list, with: "or")
47
+ index = 0
48
+ list.inject(String.new) do |acc, el|
49
+ acc << el.to_s
50
+ acc << ", " if index < list.size - 2
51
+ acc << " #{with} " if index == list.size - 2
52
+ index += 1
53
+ acc
54
+ end
55
+ end
56
+ end
57
+
58
+ # @private
59
+ class LiteralType < Type
60
+ def to_s(_singular = true)
61
+ "a literal value #{name}"
62
+ end
63
+ end
64
+
65
+ # @private
66
+ class DuckType < Type
67
+ def to_s(singular = true)
68
+ (singular ? "an object that responds to " : "objects that respond to ") + list_join(name.split(/ *& */), with: "and")
69
+ end
70
+ end
71
+
72
+ # @private
73
+ class CollectionType < Type
74
+ attr_accessor :types
75
+
76
+ def initialize(name, types)
77
+ @name = name
78
+ @types = types
79
+ end
80
+
81
+ def to_s(_singular = true)
82
+ "a#{name[0, 1] =~ /[aeiou]/i ? 'n' : ''} #{name} of (" + list_join(types.map {|t| t.to_s(false) }) + ")"
83
+ end
84
+ end
85
+
86
+ # @private
87
+ class FixedCollectionType < CollectionType
88
+ def to_s(_singular = true)
89
+ "a#{name[0, 1] =~ /[aeiou]/i ? 'n' : ''} #{name} containing (" + types.map(&:to_s).join(" followed by ") + ")"
90
+ end
91
+ end
92
+
93
+ # @private
94
+ class HashCollectionType < Type
95
+ attr_accessor :key_value_pairs
96
+
97
+ def initialize(name, key_types_or_pairs, value_types = nil)
98
+ @name = name
99
+
100
+ if value_types.nil?
101
+ # New signature: (name, key_value_pairs)
102
+ @key_value_pairs = key_types_or_pairs || []
103
+ else
104
+ # Old signature: (name, key_types, value_types)
105
+ @key_value_pairs = [[key_types_or_pairs, value_types]]
106
+ end
107
+ end
108
+
109
+ # Backward compatibility accessors
110
+ def key_types
111
+ return [] if @key_value_pairs.empty?
112
+ @key_value_pairs.first[0] || []
113
+ end
114
+
115
+ def key_types=(types)
116
+ if @key_value_pairs.empty?
117
+ @key_value_pairs = [[types, []]]
118
+ else
119
+ @key_value_pairs[0][0] = types
120
+ end
121
+ end
122
+
123
+ def value_types
124
+ return [] if @key_value_pairs.empty?
125
+ @key_value_pairs.first[1] || []
126
+ end
127
+
128
+ def value_types=(types)
129
+ if @key_value_pairs.empty?
130
+ @key_value_pairs = [[[], types]]
131
+ else
132
+ @key_value_pairs[0][1] = types
133
+ end
134
+ end
135
+
136
+ def to_s(_singular = true)
137
+ return "a#{name[0, 1] =~ /[aeiou]/i ? 'n' : ''} #{name}" if @key_value_pairs.empty?
138
+
139
+ result = "a#{name[0, 1] =~ /[aeiou]/i ? 'n' : ''} #{name} with "
140
+ parts = @key_value_pairs.map do |keys, values|
141
+ "keys made of (" + list_join(keys.map {|t| t.to_s(false) }) +
142
+ ") and values of (" + list_join(values.map {|t| t.to_s(false) }) + ")"
143
+ end
144
+ result + parts.join(" and ")
145
+ end
146
+ end
147
+
148
+ # @private
149
+ class Parser
150
+ include CodeObjects
151
+
152
+ TOKENS = {
153
+ :collection_start => /</,
154
+ :collection_end => />/,
155
+ :fixed_collection_start => /\(/,
156
+ :fixed_collection_end => /\)/,
157
+ :type_name => /#{ISEP}#{METHODNAMEMATCH}|#{NAMESPACEMATCH}|#{LITERALMATCH}|\w+/,
158
+ :symbol => /:#{METHODNAMEMATCH}/,
159
+ :type_next => /[,]/,
160
+ :whitespace => /\s+/,
161
+ :hash_collection_start => /\{/,
162
+ :hash_collection_value => /=>/,
163
+ :hash_collection_value_end => /;/,
164
+ :hash_collection_end => /\}/,
165
+ # :symbol_start => /:/,
166
+ :parse_end => nil
167
+ }
168
+
169
+ def self.parse(string)
170
+ new(string).parse
171
+ end
172
+
173
+ def initialize(string)
174
+ @scanner = StringScanner.new(string)
175
+ end
176
+
177
+ # @return [Array(Boolean, Array<Type>)] - finished, types
178
+ def parse(until_tokens: [:parse_end])
179
+ current_parsed_types = []
180
+ type = nil
181
+ name = nil
182
+ finished = false
183
+ parse_with_handlers do |token_type, token|
184
+ case token_type
185
+ when *until_tokens
186
+ raise SyntaxError, "expecting name, got '#{token}'" if name.nil?
187
+ type = create_type(name) unless type
188
+ current_parsed_types << type
189
+ finished = true
190
+ when :type_name
191
+ raise SyntaxError, "expecting END, got name '#{token}'" if name
192
+ name = token
193
+ when :type_next
194
+ raise SyntaxError, "expecting name, got '#{token}' at #{@scanner.pos}" if name.nil?
195
+ type = create_type(name) unless type
196
+ current_parsed_types << type
197
+ name = nil
198
+ type = nil
199
+ when :fixed_collection_start, :collection_start
200
+ name ||= "Array"
201
+ klass = token_type == :collection_start ? CollectionType : FixedCollectionType
202
+ type = klass.new(name, parse(until_tokens: [:fixed_collection_end, :collection_end, :parse_end]))
203
+ when :hash_collection_start
204
+ name ||= "Hash"
205
+ type = parse_hash_collection(name)
206
+ end
207
+
208
+ [finished, current_parsed_types]
209
+ end
210
+ end
211
+
212
+ private
213
+
214
+ # @return [Array<Type>]
215
+ def parse_with_handlers
216
+ loop do
217
+ found = false
218
+ TOKENS.each do |token_type, match|
219
+ # TODO: cleanup this code.
220
+ # rubocop:disable Lint/AssignmentInCondition
221
+ next unless (match.nil? && @scanner.eos?) || (match && token = @scanner.scan(match))
222
+ found = true
223
+ # @type [Array<Type>]
224
+ finished, types = yield(token_type, token)
225
+ return types if finished
226
+ break
227
+ end
228
+ raise SyntaxError, "invalid character at #{@scanner.peek(1)}" unless found
229
+ end
230
+ nil
231
+ end
232
+
233
+ def parse_hash_collection(name)
234
+ key_value_pairs = []
235
+ current_keys = []
236
+ finished = false
237
+
238
+ parse_with_handlers do |token_type, token|
239
+ case token_type
240
+ when :type_name
241
+ current_keys << create_type(token)
242
+ when :type_next
243
+ # Comma - continue collecting keys unless we just processed a value
244
+ # In that case, start a new key group
245
+ when :hash_collection_value
246
+ # => - current keys map to the next value(s)
247
+ raise SyntaxError, "no keys before =>" if current_keys.empty?
248
+ values = parse(until_tokens: [:hash_collection_value_end, :parse_end])
249
+ key_value_pairs << [current_keys, values]
250
+ current_keys = []
251
+ when :hash_collection_end, :parse_end
252
+ # End of hash
253
+ finished = true
254
+ when :whitespace
255
+ # Ignore whitespace
256
+ end
257
+
258
+ [finished, HashCollectionType.new(name, key_value_pairs)]
259
+ end
260
+ end
261
+
262
+ private
263
+
264
+ def create_type(name)
265
+ if name[0, 1] == ":" || (name[0, 1] =~ /['"]/ && name[-1, 1] =~ /['"]/)
266
+ LiteralType.new(name)
267
+ elsif name[0, 1] == "#"
268
+ DuckType.new(name)
269
+ else
270
+ Type.new(name)
271
+ end
272
+ end
273
+
274
+ private
275
+
276
+ def create_type(name)
277
+ if name[0, 1] == ":" || (name[0, 1] =~ /['"]/ && name[-1, 1] =~ /['"]/)
278
+ LiteralType.new(name)
279
+ elsif name[0, 1] == "#"
280
+ DuckType.new(name)
281
+ else
282
+ Type.new(name)
283
+ end
284
+ end
285
+ end
286
+ end
287
+ end
288
+ end
@@ -0,0 +1,185 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YARD
4
+ module Templates
5
+ # This module manages all creation, handling and rendering of {Template}
6
+ # objects.
7
+ #
8
+ # * To create a template object at a path, use {template}.
9
+ # * To render a template, call {render}.
10
+ # * To register a template path in the lookup paths, call {register_template_path}.
11
+ module Engine
12
+ class << self
13
+ # @return [Array<String>] the list of registered template paths
14
+ attr_accessor :template_paths
15
+
16
+ # Registers a new template path in {template_paths}
17
+ #
18
+ # @param [String] path a new template path
19
+ # @return [void]
20
+ def register_template_path(path)
21
+ template_paths.push(path) unless template_paths.include?(path)
22
+ end
23
+
24
+ # Creates a template module representing the path. Searches on disk
25
+ # for the first directory named +path+ (joined by '/') within the
26
+ # template paths and builds a template module for. All other matching
27
+ # directories in other template paths will be included in the
28
+ # generated module as mixins (for overriding).
29
+ #
30
+ # @param [Array<String, Symbol>] path a list of path components
31
+ # @raise [ArgumentError] if the path does not exist within one of the
32
+ # {template_paths} on disk.
33
+ # @return [Template] the module representing the template
34
+ def template(*path)
35
+ from_template = nil
36
+ from_template = path.shift if path.first.is_a?(Template)
37
+ path = path.join('/')
38
+ full_paths = find_template_paths(from_template, path)
39
+
40
+ path = File.cleanpath(path).gsub('../', '')
41
+ raise ArgumentError, "No such template for #{path}" if full_paths.empty?
42
+ mod = template!(path, full_paths)
43
+
44
+ mod
45
+ end
46
+
47
+ # Forces creation of a template at +path+ within a +full_path+.
48
+ #
49
+ # @param [String] path the path name of the template
50
+ # @param [Array<String>] full_paths the full path on disk of the template
51
+ # @return [Template] the template module representing the +path+
52
+ def template!(path, full_paths = nil)
53
+ full_paths ||= [path]
54
+ full_paths = [full_paths] unless full_paths.is_a?(Array)
55
+ name = template_module_name(full_paths.first)
56
+ begin; return const_get(name); rescue NameError; nil end
57
+
58
+ mod = const_set(name, Module.new)
59
+ mod.send(:include, Template)
60
+ mod.send(:initialize, path, full_paths)
61
+ mod
62
+ end
63
+
64
+ # Renders a template on a {CodeObjects::Base code object} using
65
+ # a set of default (overridable) options. Either the +:object+
66
+ # or +:type+ keys must be provided.
67
+ #
68
+ # If a +:serializer+ key is provided and +:serialize+ is not set to
69
+ # false, the rendered contents will be serialized through the {Serializers::Base}
70
+ # object. See {with_serializer}.
71
+ #
72
+ # @example Renders an object with html formatting
73
+ # Engine.render(:format => :html, :object => obj)
74
+ # @example Renders without an object
75
+ # Engine.render(:type => :fulldoc, :otheropts => somevalue)
76
+ # @param [Hash] options the options hash
77
+ # @option options [Symbol] :format (:text) the default format
78
+ # @option options [Symbol] :type (nil) the :object's type.
79
+ # @option options [Symbol] :template (:default) the default template
80
+ # @return [String] the rendered template
81
+ def render(options = {})
82
+ options = set_default_options(options)
83
+ mod = template(options.template, options.type, options.format)
84
+
85
+ if options.serializer && options.serialize != false
86
+ with_serializer(options.object, options.serializer) { mod.run(options) }
87
+ else
88
+ mod.run(options)
89
+ end
90
+ end
91
+
92
+ # Passes a set of objects to the +:fulldoc+ template for full documentation generation.
93
+ # This is called by {CLI::Yardoc} to most commonly perform HTML
94
+ # documentation generation.
95
+ #
96
+ # @param [Array<CodeObjects::Base>] objects a list of {CodeObjects::Base}
97
+ # objects to pass to the template
98
+ # @param [Hash] options (see {render})
99
+ # @return [void]
100
+ def generate(objects, options = {})
101
+ options = set_default_options(options)
102
+ options.objects = objects
103
+ options.object = Registry.root
104
+ template(options.template, :fulldoc, options.format).run(options)
105
+ end
106
+
107
+ # Serializes the results of a block with a +serializer+ object.
108
+ #
109
+ # @param [CodeObjects::Base] object the code object to serialize
110
+ # @param [Serializers::Base] serializer the serializer object
111
+ # @yield a block whose result will be serialize
112
+ # @yieldreturn [String] the contents to serialize
113
+ # @see Serializers::Base
114
+ def with_serializer(object, serializer)
115
+ output = nil
116
+ filename = serializer.serialized_path(object)
117
+ if serializer.respond_to?(:basepath)
118
+ filename = File.join(serializer.basepath, filename)
119
+ end
120
+ log.capture("Generating #{filename}", nil) do
121
+ serializer.before_serialize if serializer
122
+ output = yield
123
+ if serializer
124
+ serializer.serialize(object, output)
125
+ serializer.after_serialize(output)
126
+ end
127
+ end
128
+ output
129
+ end
130
+
131
+ private
132
+
133
+ # Sets default options on the options hash
134
+ #
135
+ # @param [Hash] options the options hash
136
+ # @option options [Symbol] :format (:text) the default format
137
+ # @option options [Symbol] :type (nil) the :object's type, if provided
138
+ # @option options [Symbol] :template (:default) the default template
139
+ # @return [void]
140
+ def set_default_options(options = {})
141
+ if options.is_a?(Hash)
142
+ options = TemplateOptions.new.tap do |o|
143
+ o.reset_defaults
144
+ o.update(options)
145
+ end
146
+ end
147
+ options.type ||= options.object.type if options.object
148
+ options
149
+ end
150
+
151
+ # Searches through the registered {template_paths} and returns
152
+ # all full directories that have the +path+ within them on disk.
153
+ #
154
+ # @param [Template] from_template if provided, allows a relative
155
+ # path to be specified from this template's full path.
156
+ # @param [String] path the path component to search for in the
157
+ # {template_paths}
158
+ # @return [Array<String>] a list of full paths that are existing
159
+ # candidates for a template module
160
+ def find_template_paths(from_template, path)
161
+ paths = template_paths.dup
162
+ paths = from_template.full_paths + paths if from_template
163
+
164
+ paths.inject([]) do |acc, tp|
165
+ full_path = File.cleanpath(File.join(tp, path))
166
+ acc.unshift(full_path) if File.directory?(full_path)
167
+ acc
168
+ end.uniq
169
+ end
170
+
171
+ # The name of the module that represents a +path+
172
+ #
173
+ # @param [String] path the path to generate a module name for
174
+ # @return [String] the module name
175
+ def template_module_name(path)
176
+ 'Template_' + path.to_s.gsub(/[^a-z0-9]/i, '_')
177
+ end
178
+ end
179
+
180
+ self.template_paths = []
181
+ end
182
+
183
+ Engine.register_template_path(File.join(YARD::ROOT, '..', 'templates'))
184
+ end
185
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+ module YARD
3
+ module Templates
4
+ # @since 0.5.4
5
+ module ErbCache
6
+ def self.method_for(filename)
7
+ @methods ||= {}
8
+ return @methods[filename] if @methods[filename]
9
+ @methods[filename] = name = "_erb_cache_#{@methods.size}"
10
+ erb = yield.src
11
+ encoding = erb[/\A(#coding[:=].*\r?\n)/, 1] || ''
12
+ module_eval "#{encoding}def #{name}; #{erb}; end", filename
13
+
14
+ name
15
+ end
16
+
17
+ def self.clear!
18
+ return unless defined?(@methods) && @methods
19
+ @methods.clear
20
+ end
21
+ end
22
+ end
23
+ end