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,420 @@
1
+ # frozen_string_literal: true
2
+ require 'erb'
3
+
4
+ module YARD
5
+ module Templates
6
+ module Template
7
+ attr_accessor :class, :section
8
+ attr_reader :options
9
+
10
+ class << self
11
+ # Extra includes are mixins that are included after a template is created. These
12
+ # mixins can be registered by plugins to operate on templates and override behaviour.
13
+ #
14
+ # Note that this array can be filled with modules or proc objects. If a proc object
15
+ # is given, the proc will be called with the {Template#options} hash containing
16
+ # relevant template information like the object, format, and more. The proc should
17
+ # return a module or nil if there is none.
18
+ #
19
+ # @example Adding in extra mixins to include on a template
20
+ # Template.extra_includes << MyHelper
21
+ # @example Conditionally including a mixin if the format is html
22
+ # Template.extra_includes << proc {|opts| MyHelper if opts.format == :html }
23
+ # @return [Array<Module, Proc>] a list of modules to be automatically included
24
+ # into any new template module
25
+ attr_accessor :extra_includes
26
+
27
+ # @!parse extend ClassMethods
28
+ # @private
29
+ def included(klass)
30
+ klass.extend(ClassMethods)
31
+ end
32
+
33
+ # Includes the {extra_includes} modules into the template object.
34
+ #
35
+ # @param [Template] template the template object to mixin the extra includes.
36
+ # @param [SymbolHash] options the options hash containing all template information
37
+ # @return [void]
38
+ def include_extra(template, options)
39
+ extra_includes.each do |mod|
40
+ mod = mod.call(options) if mod.is_a?(Proc)
41
+ next unless mod.is_a?(Module)
42
+ template.extend(mod)
43
+ end
44
+ end
45
+ end
46
+
47
+ self.extra_includes = [
48
+ proc do |options|
49
+ {:html => Helpers::HtmlHelper,
50
+ :text => Helpers::TextHelper,
51
+ :dot => Helpers::UMLHelper}[options.format]
52
+ end
53
+ ]
54
+
55
+ include ErbCache
56
+ include Helpers::BaseHelper
57
+ include Helpers::MethodHelper
58
+
59
+ module ClassMethods
60
+ attr_accessor :path, :full_path
61
+
62
+ # @return [Array<String>] a list of full paths
63
+ # @note This method caches path results. Paths should not be modified
64
+ # after this method is called; call {#reset_full_paths} to reset cache.
65
+ def full_paths
66
+ reset_full_paths unless defined? @cached_included_modules
67
+ return @full_paths if included_modules == @cached_included_modules
68
+
69
+ @cached_included_modules = included_modules
70
+ @full_paths = included_modules.inject([full_path]) do |paths, mod|
71
+ paths |= mod.full_paths if mod.respond_to?(:full_paths)
72
+ paths
73
+ end
74
+ end
75
+
76
+ # Resets cache for {#full_paths}
77
+ def reset_full_paths
78
+ @cached_included_modules = nil
79
+ end
80
+
81
+ def initialize(path, full_paths)
82
+ full_path = full_paths.shift
83
+ self.path = path
84
+ self.full_path = full_path
85
+ include_inherited(full_paths)
86
+ include_parent
87
+ load_setup_rb
88
+ end
89
+
90
+ # Searches for a file identified by +basename+ in the template's
91
+ # path as well as any mixed in template paths. Equivalent to calling
92
+ # {ClassMethods#find_nth_file} with index of 1.
93
+ #
94
+ # @param [String] basename the filename to search for
95
+ # @return [String] the full path of a file on disk with filename
96
+ # +basename+ in one of the template's paths.
97
+ # @see find_nth_file
98
+ def find_file(basename)
99
+ find_nth_file(basename)
100
+ end
101
+
102
+ # Searches for the nth file (where n = +index+) identified
103
+ # by basename in the template's path and any mixed in template paths.
104
+ #
105
+ # @param [String] basename the filename to search for
106
+ # @param [Fixnum] index the nth existing file to return
107
+ # @return [String] the full path of the nth file on disk with
108
+ # filename +basename+ in one of the template paths
109
+ def find_nth_file(basename, index = 1)
110
+ n = 1
111
+ full_paths.each do |path|
112
+ file = File.join(path, basename)
113
+ if File.file?(file)
114
+ return file if index == n
115
+ n += 1
116
+ end
117
+ end
118
+
119
+ nil
120
+ end
121
+
122
+ def is_a?(klass)
123
+ return true if klass == Template
124
+ super(klass)
125
+ end
126
+
127
+ # Creates a new template object to be rendered with {Template#run}
128
+ def new(*args)
129
+ obj = Object.new.extend(self)
130
+ obj.class = self
131
+ obj.send(:initialize, *args)
132
+ obj
133
+ end
134
+
135
+ def run(*args)
136
+ new(*args).run
137
+ end
138
+
139
+ # rubocop:disable Style/MethodName
140
+
141
+ # Alias for creating {Engine.template}.
142
+ def T(*path)
143
+ Engine.template(*path)
144
+ end
145
+
146
+ # Alias for creating a {Section} with arguments
147
+ # @see Section#initialize
148
+ # @since 0.6.0
149
+ def S(*args)
150
+ Section.new(*args)
151
+ end
152
+
153
+ # rubocop:enable Style/MethodName
154
+
155
+ private
156
+
157
+ def include_parent
158
+ pc = path.to_s.split('/')
159
+ if pc.size > 1
160
+ pc.pop
161
+ pc = pc.join('/')
162
+ begin
163
+ include Engine.template(pc)
164
+ rescue ArgumentError
165
+ include Engine.template!(pc, full_path.gsub(%r{/[^/]+$}, ''))
166
+ end
167
+ end
168
+ end
169
+
170
+ def include_inherited(full_paths)
171
+ full_paths.reverse.each do |full_path|
172
+ include Engine.template!(path, full_path)
173
+ end
174
+ end
175
+
176
+ def load_setup_rb
177
+ setup_file = File.join(full_path, 'setup.rb')
178
+ if File.file? setup_file
179
+ setup_code = File.read(setup_file)
180
+ setup_code.taint if setup_code.respond_to?(:taint)
181
+ module_eval(setup_code, setup_file, 1)
182
+ end
183
+ end
184
+ end
185
+
186
+ def initialize(opts = TemplateOptions.new)
187
+ opts_class = opts.class
188
+ opts_class = TemplateOptions if opts_class == Hash
189
+ @cache = {}
190
+ @cache_filename = {}
191
+ @sections = []
192
+ @options = opts_class.new
193
+ add_options(opts)
194
+ Template.include_extra(self, options)
195
+ init
196
+ end
197
+
198
+ # Loads a template specified by path. If +:template+ or +:format+ is
199
+ # specified in the {#options} hash, they are prepended and appended
200
+ # to the path respectively.
201
+ #
202
+ # @param [Array<String, Symbol>] path the path of the template
203
+ # @return [Template] the loaded template module
204
+ def T(*path) # rubocop:disable Style/MethodName
205
+ path.unshift(options.template) if options.template
206
+ path.push(options.format) if options.format
207
+ self.class.T(*path)
208
+ end
209
+
210
+ # Sets the sections (and subsections) to be rendered for the template
211
+ #
212
+ # @example Sets a set of erb sections
213
+ # sections :a, :b, :c # searches for a.erb, b.erb, c.erb
214
+ # @example Sets a set of method and erb sections
215
+ # sections :a, :b, :c # a is a method, the rest are erb files
216
+ # @example Sections with subsections
217
+ # sections :header, [:name, :children]
218
+ # # the above will call header.erb and only renders the subsections
219
+ # # if they are yielded by the template (see #yieldall)
220
+ # @param [Array<Symbol, String, Template, Array>] args the sections
221
+ # to use to render the template. For symbols and strings, the
222
+ # section will be executed as a method (if one exists), or rendered
223
+ # from the file "name.erb" where name is the section name. For
224
+ # templates, they will have {Template::ClassMethods#run} called on them.
225
+ # Any subsections can be yielded to using yield or {#yieldall}
226
+ def sections(*args)
227
+ @sections = Section.new(nil, *args) unless args.empty?
228
+ @sections
229
+ end
230
+
231
+ # Initialization called on the template. Override this in a 'setup.rb'
232
+ # file in the template's path to implement a template
233
+ #
234
+ # @example A default set of sections
235
+ # def init
236
+ # sections :section1, :section2, [:subsection1, :etc]
237
+ # end
238
+ # @see #sections
239
+ def init
240
+ end
241
+
242
+ # Runs a template on +sects+ using extra options. This method should
243
+ # not be called directly. Instead, call the class method {ClassMethods#run}
244
+ #
245
+ # @param [Hash, nil] opts any extra options to apply to sections
246
+ # @param [Section, Array] sects a section list of sections to render
247
+ # @param [Fixnum] start_at the index in the section list to start from
248
+ # @param [Boolean] break_first if true, renders only the first section
249
+ # @yield [opts] calls for the subsections to be rendered
250
+ # @yieldparam [Hash] opts any extra options to yield
251
+ # @return [String] the rendered sections joined together
252
+ def run(opts = nil, sects = sections, start_at = 0, break_first = false, &block)
253
+ out = String.new("")
254
+ return out if sects.nil?
255
+ sects = sects[start_at..-1] if start_at > 0
256
+ sects = Section.new(nil, sects) unless sects.is_a?(Section)
257
+ add_options(opts) do
258
+ sects.each do |s|
259
+ self.section = s
260
+ subsection_index = 0
261
+ value = render_section(section) do |*args|
262
+ value = with_section do
263
+ run(args.first, section, subsection_index, true, &block)
264
+ end
265
+ subsection_index += 1
266
+ value
267
+ end
268
+ out << (value || "")
269
+ break if break_first
270
+ end
271
+ end
272
+ out
273
+ end
274
+
275
+ # Yields all subsections with any extra options
276
+ #
277
+ # @param [Hash] opts extra options to be applied to subsections
278
+ def yieldall(opts = nil, &block)
279
+ with_section { run(opts, section, &block) }
280
+ end
281
+
282
+ # @param [String, Symbol] section the section name
283
+ # @yield calls subsections to be rendered
284
+ # @return [String] the contents of the ERB rendered section
285
+ def erb(section, &block)
286
+ method_name = ErbCache.method_for(cache_filename(section)) do
287
+ erb_with(cache(section), cache_filename(section))
288
+ end
289
+ send(method_name, &block)
290
+ end
291
+
292
+ # Returns the contents of a file. If +allow_inherited+ is set to +true+,
293
+ # use +{{{__super__}}}+ inside the file contents to insert the contents
294
+ # of the file from an inherited template. For instance, if +templates/b+
295
+ # inherits from +templates/a+ and file "test.css" exists in both directories,
296
+ # both file contents can be retrieved by having +templates/b/test.css+ look
297
+ # like:
298
+ #
299
+ # {{{__super__}}}
300
+ # ...
301
+ # body { css styles here }
302
+ # p.class { other styles }
303
+ #
304
+ # @param [String] basename the name of the file
305
+ # @param [Boolean] allow_inherited whether inherited templates can
306
+ # be inserted with +{{{__super__}}}+
307
+ # @return [String] the contents of a file identified by +basename+. All
308
+ # template paths (including any mixed in templates) are searched for
309
+ # the file
310
+ # @see ClassMethods#find_file
311
+ # @see ClassMethods#find_nth_file
312
+ def file(basename, allow_inherited = false)
313
+ file = self.class.find_file(basename)
314
+ raise ArgumentError, "no file for '#{basename}' in #{self.class.path}" unless file
315
+
316
+ data = IO.read(file)
317
+ if allow_inherited
318
+ superfile = self.class.find_nth_file(basename, 2)
319
+ data.gsub!('{{{__super__}}}', superfile ? IO.read(superfile) : "")
320
+ end
321
+
322
+ data
323
+ end
324
+
325
+ # Calls the ERB file from the last inherited template with {#section}.erb
326
+ #
327
+ # @param [Symbol, String] sect if provided, uses a specific section name
328
+ # @return [String] the rendered ERB file in any of the inherited template
329
+ # paths.
330
+ def superb(sect = section, &block)
331
+ filename = self.class.find_nth_file(erb_file_for(sect), 2)
332
+ return "" unless filename
333
+ method_name = ErbCache.method_for(filename) { erb_with(IO.read(filename), filename) }
334
+ send(method_name, &block)
335
+ end
336
+
337
+ def options=(value)
338
+ @options = value
339
+ set_ivars
340
+ end
341
+
342
+ def inspect
343
+ "Template(#{self.class.path}) [section=#{section.name}]"
344
+ end
345
+
346
+ protected
347
+
348
+ def erb_file_for(section)
349
+ "#{section}.erb"
350
+ end
351
+
352
+ def erb_with(content, filename = nil)
353
+ erb = if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
354
+ ERB.new(content, :trim_mode => options.format == :text ? '<>' : nil)
355
+ else
356
+ ERB.new(content, nil, options.format == :text ? '<>' : nil)
357
+ end
358
+ erb.filename = filename if filename
359
+ erb
360
+ end
361
+
362
+ private
363
+
364
+ def render_section(section, &block)
365
+ section = section.name if section.is_a?(Section)
366
+ case section
367
+ when Section, String, Symbol
368
+ if respond_to?(section)
369
+ send(section, &block)
370
+ else
371
+ erb(section, &block)
372
+ end
373
+ when Module, Template
374
+ section.run(options, &block) if section.is_a?(Template)
375
+ end || ""
376
+ end
377
+
378
+ def cache(section)
379
+ content = @cache[section.to_sym]
380
+ return content if content
381
+
382
+ file = cache_filename(section)
383
+ @cache_filename[section.to_sym] = file
384
+ raise ArgumentError, "no template for section '#{section}' in #{self.class.path}" unless file
385
+ @cache[section.to_sym] = IO.read(file)
386
+ end
387
+
388
+ def cache_filename(section)
389
+ @cache_filename[section.to_sym] ||=
390
+ self.class.find_file(erb_file_for(section))
391
+ end
392
+
393
+ def set_ivars
394
+ options.each do |k, v|
395
+ instance_variable_set("@#{k}", v)
396
+ end
397
+ end
398
+
399
+ def add_options(opts = nil)
400
+ return(yield) if opts.nil? && block_given?
401
+ cur_opts = options if block_given?
402
+
403
+ self.options = options.merge(opts)
404
+
405
+ if block_given?
406
+ value = yield
407
+ self.options = cur_opts
408
+ value
409
+ end
410
+ end
411
+
412
+ def with_section
413
+ sect = section
414
+ value = yield
415
+ self.section = sect
416
+ value
417
+ end
418
+ end
419
+ end
420
+ end
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YARD
4
+ module Templates
5
+ # An Options class containing default options for base template rendering. For
6
+ # options specific to generation of HTML output, see {CLI::YardocOptions}.
7
+ #
8
+ # @see CLI::YardocOptions
9
+ class TemplateOptions < YARD::Options
10
+ # @return [Symbol] the template output format
11
+ default_attr :format, :text
12
+
13
+ # @return [Symbol] the template name used to render output
14
+ default_attr :template, :default
15
+
16
+ # @return [Symbol] the markup format to use when parsing docstrings
17
+ default_attr :markup, :rdoc # default is :rdoc but falls back on :none
18
+
19
+ # @return [String] the default return type for a method with no return tags
20
+ default_attr :default_return, "Object"
21
+
22
+ # @return [Boolean] whether void methods should show "void" in their signature
23
+ default_attr :hide_void_return, false
24
+
25
+ # @return [Boolean] whether code blocks should be syntax highlighted
26
+ default_attr :highlight, true
27
+
28
+ # @return [Class] the markup provider class for the markup format
29
+ attr_accessor :markup_provider
30
+
31
+ # @return [OpenStruct] an open struct containing any global state across all
32
+ # generated objects in a template.
33
+ default_attr :globals, lambda { OpenStruct.new }
34
+ alias __globals globals
35
+
36
+ # @return [CodeObjects::Base] the main object being generated in the template
37
+ attr_accessor :object
38
+
39
+ # @return [CodeObjects::Base] the owner of the generated object
40
+ attr_accessor :owner
41
+
42
+ # @return [Symbol] the template type used to generate output
43
+ attr_accessor :type
44
+
45
+ # @return [Boolean] whether serialization should be performed
46
+ default_attr :serialize, true
47
+
48
+ # @return [Serializers::Base] the serializer used to generate links and serialize
49
+ # output. Serialization output only occurs if {#serialize} is +true+.
50
+ attr_accessor :serializer
51
+
52
+ # @deprecated use {#highlight} instead.
53
+ # @return [Boolean] whether highlighting should be ignored
54
+ attr_reader :no_highlight
55
+ undef no_highlight
56
+ def no_highlight; !highlight end
57
+ def no_highlight=(value) self.highlight = !value end
58
+
59
+ # @return [String] the title of a given page
60
+ attr_accessor :page_title
61
+
62
+ # @return [Boolean] whether the page is the "index"
63
+ attr_accessor :index
64
+
65
+ # @example A list of mixin path names (including wildcards)
66
+ # opts.embed_mixins #=> ['ClassMethods', '*Helper', 'YARD::*']
67
+ # @return [Array<String>] an array of module name wildcards to embed into
68
+ # class documentation as if their methods were defined directly in the class.
69
+ # Useful for modules like ClassMethods. If the name contains '::', the module
70
+ # is matched against the full mixin path, otherwise only the module name is used.
71
+ default_attr :embed_mixins, lambda { [] }
72
+
73
+ # @param [CodeObjects::Base] mixin accepts any code object, but returns
74
+ # nil unless the object is a module.
75
+ # @return [Boolean] whether a mixin matches the embed_mixins list
76
+ # @return [nil] if the mixin is not a module object
77
+ def embed_mixins_match?(mixin)
78
+ return true if mixin == object # the method is not inherited
79
+ return nil unless mixin.is_a?(CodeObjects::ModuleObject)
80
+ embed_mixins.any? do |embed_mixin|
81
+ re = /\A#{Regexp.quote(embed_mixin).gsub('\*', '.*')}\Z/
82
+ matchstr = embed_mixin.include?("::") ? mixin.path : mixin.name
83
+ re.match(matchstr.to_s)
84
+ end
85
+ end
86
+
87
+ # @return [Verifier] the verifier object
88
+ attr_accessor :verifier
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,151 @@
1
+ # frozen_string_literal: true
2
+ module YARD
3
+ # Similar to a Proc, but runs a set of Ruby expressions using a small
4
+ # DSL to make tag lookups easier.
5
+ #
6
+ # The syntax is as follows:
7
+ # * All syntax is Ruby compatible
8
+ # * +object+ (+o+ for short) exist to access the object being verified
9
+ # * +@TAGNAME+ is translated into +object.tag('TAGNAME')+
10
+ # * +@@TAGNAME+ is translated into +object.tags('TAGNAME')+
11
+ # * +object+ can be omitted as target for method calls (it is implied)
12
+ #
13
+ # @example Create a verifier to check for objects that don't have @private tags
14
+ # verifier = Verifier.new('!@private')
15
+ # verifier.call(object) # => true (no @private tag)
16
+ # @example Create a verifier to find any return tag with an empty description
17
+ # Verifier.new('@return.text.empty?')
18
+ # # Equivalent to:
19
+ # Verifier.new('object.tag(:return).text.empty?')
20
+ # @example Check if there are any @param tags
21
+ # Verifier.new('@@param.empty?')
22
+ # # Equivalent to:
23
+ # Verifier.new('object.tags(:param).empty?')
24
+ # @example Using +object+ or +o+ to look up object attributes directly
25
+ # Verifier.new('object.docstring == "hello world"')
26
+ # # Equivalent to:
27
+ # Verifier.new('o.docstring == "hello world"')
28
+ # @example Without using +object+ or +o+
29
+ # Verifier.new('tag(:return).size == 1 || has_tag?(:author)')
30
+ # @example Specifying multiple expressions
31
+ # Verifier.new('@return', '@param', '@yield')
32
+ # # Equivalent to:
33
+ # Verifier.new('@return && @param && @yield')
34
+ class Verifier
35
+ # @return [Array<String>] a list of all expressions the verifier checks for
36
+ # @since 0.5.6
37
+ attr_reader :expressions
38
+
39
+ def expressions=(value)
40
+ @expressions = value
41
+ create_method_from_expressions
42
+ end
43
+
44
+ # Creates a verifier from a set of expressions
45
+ #
46
+ # @param [Array<String>] expressions a list of Ruby expressions to
47
+ # parse.
48
+ def initialize(*expressions)
49
+ @expressions = []
50
+ add_expressions(*expressions)
51
+ end
52
+
53
+ # Adds a set of expressions and recompiles the verifier
54
+ #
55
+ # @param [Array<String>] expressions a list of expressions
56
+ # @return [void]
57
+ # @since 0.5.6
58
+ def add_expressions(*expressions)
59
+ self.expressions += expressions.flatten
60
+ end
61
+
62
+ # Passes any method calls to the object from the {#call}
63
+ def method_missing(sym, *args, &block)
64
+ if object.respond_to?(sym)
65
+ object.send(sym, *args, &block)
66
+ else
67
+ super
68
+ end
69
+ end
70
+
71
+ # Tests the expressions on the object.
72
+ #
73
+ # @note If the object is a {CodeObjects::Proxy} the result will always be true.
74
+ # @param [CodeObjects::Base] object the object to verify
75
+ # @return [Boolean] the result of the expressions
76
+ def call(object)
77
+ return true if object.is_a?(CodeObjects::Proxy)
78
+ modify_nilclass
79
+ @object = object
80
+ retval = __execute ? true : false
81
+ unmodify_nilclass
82
+ retval
83
+ end
84
+
85
+ # Runs a list of objects against the verifier and returns the subset
86
+ # of verified objects.
87
+ #
88
+ # @param [Array<CodeObjects::Base>] list a list of code objects
89
+ # @return [Array<CodeObjects::Base>] a list of code objects that match
90
+ # the verifier.
91
+ def run(list)
92
+ list.reject {|item| call(item).is_a?(FalseClass) }
93
+ end
94
+
95
+ protected
96
+
97
+ # @return [CodeObjects::Base] the current object being tested
98
+ attr_reader :object
99
+ alias o object
100
+
101
+ private
102
+
103
+ # @private
104
+ NILCLASS_METHODS = [:type, :method_missing]
105
+
106
+ # Modifies nil to not throw NoMethodErrors. This allows
107
+ # syntax like object.tag(:return).text to work if the #tag
108
+ # call returns nil, which means users don't need to perform
109
+ # stringent nil checking
110
+ #
111
+ # @return [void]
112
+ def modify_nilclass
113
+ NILCLASS_METHODS.each do |meth|
114
+ NilClass.send(:define_method, meth) {|*args| }
115
+ end
116
+ end
117
+
118
+ # Returns the state of NilClass back to normal
119
+ # @return [void]
120
+ def unmodify_nilclass
121
+ NILCLASS_METHODS.each do |meth|
122
+ next unless nil.respond_to?(meth)
123
+ NilClass.send(:remove_method, meth)
124
+ end
125
+ end
126
+
127
+ # Creates the +__execute+ method by evaluating the expressions
128
+ # as Ruby code
129
+ # @return [void]
130
+ def create_method_from_expressions
131
+ expr = expressions.map {|e| "(#{parse_expression(e)})" }.join(" && ")
132
+
133
+ instance_eval(<<-eof, __FILE__, __LINE__ + 1)
134
+ begin; undef __execute; rescue NameError; end
135
+ def __execute; #{expr}; end
136
+ eof
137
+ end
138
+
139
+ # Parses a single expression, handling some of the DSL syntax.
140
+ #
141
+ # The syntax "@tag" should be turned into object.tag(:tag),
142
+ # and "@@tag" should be turned into object.tags(:tag)
143
+ #
144
+ # @return [String] the parsed expression
145
+ def parse_expression(expr)
146
+ expr = expr.gsub(/@@(?:(\w+)|\{([\w\.]+)\})/, 'object.tags("\1\2")')
147
+ expr = expr.gsub(/@(?:(\w+)|\{([\w\.]+)\})/, 'object.tag("\1\2")')
148
+ expr
149
+ end
150
+ end
151
+ end
@@ -0,0 +1,6 @@
1
+
2
+ # frozen_string_literal: true
3
+
4
+ module YARD
5
+ VERSION = '0.9.44'
6
+ end