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,146 @@
1
+ # frozen_string_literal: true
2
+ module YARD::CodeObjects
3
+ register_separator NSEP, :class
4
+
5
+ # A ClassObject represents a Ruby class in source code. It is a {ModuleObject}
6
+ # with extra inheritance semantics through the superclass.
7
+ class ClassObject < NamespaceObject
8
+ # The {ClassObject} that this class object inherits from in Ruby source.
9
+ # @return [ClassObject] a class object that is the superclass of this one
10
+ attr_reader :superclass
11
+
12
+ # Creates a new class object in +namespace+ with +name+
13
+ #
14
+ # @see Base.new
15
+ def initialize(namespace, name, *args, &block)
16
+ super
17
+
18
+ if is_exception?
19
+ self.superclass ||= "::Exception" unless P(namespace, name) == P(:Exception)
20
+ else
21
+ case P(namespace, name).path
22
+ when "BasicObject"
23
+ nil
24
+ when "Object"
25
+ self.superclass ||= "::BasicObject"
26
+ else
27
+ self.superclass ||= "::Object"
28
+ end
29
+ end
30
+ end
31
+
32
+ # Whether or not the class is a Ruby Exception
33
+ #
34
+ # @return [Boolean] whether the object represents a Ruby exception
35
+ def is_exception?
36
+ inheritance_tree.reverse.any? {|o| BUILTIN_EXCEPTIONS_HASH.key? o.path }
37
+ end
38
+
39
+ # Returns the inheritance tree of the object including self.
40
+ #
41
+ # @param [Boolean] include_mods whether or not to include mixins in the
42
+ # inheritance tree.
43
+ # @return [Array<NamespaceObject>] the list of code objects that make up
44
+ # the inheritance tree.
45
+ def inheritance_tree(include_mods = false)
46
+ list = (include_mods ? mixins(:instance, :class) : [])
47
+ if superclass.is_a?(Proxy) || superclass.respond_to?(:inheritance_tree)
48
+ list += [superclass] unless superclass == P(:Object) || superclass == P(:BasicObject)
49
+ end
50
+ [self] + list.map do |m|
51
+ next m if m == self
52
+ next m unless m.respond_to?(:inheritance_tree)
53
+ m.inheritance_tree(include_mods)
54
+ end.flatten.uniq
55
+ end
56
+
57
+ # Returns the list of methods matching the options hash. Returns
58
+ # all methods if hash is empty.
59
+ #
60
+ # @param [Hash] opts the options hash to match
61
+ # @option opts [Boolean] :inherited (true) whether inherited methods should be
62
+ # included in the list
63
+ # @option opts [Boolean] :included (true) whether mixed in methods should be
64
+ # included in the list
65
+ # @return [Array<MethodObject>] the list of methods that matched
66
+ def meths(opts = {})
67
+ opts = SymbolHash[:inherited => true].update(opts)
68
+ list = super(opts)
69
+ list += inherited_meths(opts).reject do |o|
70
+ next(false) if opts[:all]
71
+ list.find {|o2| o2.name == o.name && o2.scope == o.scope }
72
+ end if opts[:inherited]
73
+ list
74
+ end
75
+
76
+ # Returns only the methods that were inherited.
77
+ #
78
+ # @return [Array<MethodObject>] the list of inherited method objects
79
+ def inherited_meths(opts = {})
80
+ inheritance_tree[1..-1].inject([]) do |list, superclass|
81
+ if superclass.is_a?(Proxy)
82
+ list
83
+ else
84
+ list += superclass.meths(opts).reject do |o|
85
+ next(false) if opts[:all]
86
+ child(:name => o.name, :scope => o.scope) ||
87
+ list.find {|o2| o2.name == o.name && o2.scope == o.scope }
88
+ end
89
+ end
90
+ end
91
+ end
92
+
93
+ # Returns the list of constants matching the options hash.
94
+ #
95
+ # @param [Hash] opts the options hash to match
96
+ # @option opts [Boolean] :inherited (true) whether inherited constant should be
97
+ # included in the list
98
+ # @option opts [Boolean] :included (true) whether mixed in constant should be
99
+ # included in the list
100
+ # @return [Array<ConstantObject>] the list of constant that matched
101
+ def constants(opts = {})
102
+ opts = SymbolHash[:inherited => true].update(opts)
103
+ super(opts) + (opts[:inherited] ? inherited_constants : [])
104
+ end
105
+
106
+ # Returns only the constants that were inherited.
107
+ #
108
+ # @return [Array<ConstantObject>] the list of inherited constant objects
109
+ def inherited_constants
110
+ inheritance_tree[1..-1].inject([]) do |list, superclass|
111
+ if superclass.is_a?(Proxy)
112
+ list
113
+ else
114
+ list += superclass.constants.reject do |o|
115
+ child(:name => o.name) || list.find {|o2| o2.name == o.name }
116
+ end
117
+ end
118
+ end
119
+ end
120
+
121
+ # Sets the superclass of the object
122
+ #
123
+ # @param [Base, Proxy, String, Symbol, nil] object the superclass value
124
+ # @return [void]
125
+ def superclass=(object)
126
+ case object
127
+ when Base, Proxy, NilClass
128
+ @superclass = object
129
+ when String, Symbol
130
+ @superclass = Proxy.new(namespace, object)
131
+ else
132
+ raise ArgumentError, "superclass must be CodeObject, Proxy, String or Symbol"
133
+ end
134
+
135
+ if name == @superclass.name && namespace != YARD::Registry.root && !object.is_a?(Base)
136
+ @superclass = Proxy.new(namespace.namespace, object)
137
+ end
138
+
139
+ if @superclass == self
140
+ msg = "superclass #{@superclass.inspect} cannot be the same as the declared class #{inspect}"
141
+ @superclass = P("::Object")
142
+ raise ArgumentError, msg
143
+ end
144
+ end
145
+ end
146
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+ module YARD::CodeObjects
3
+ register_separator NSEP, :class_variable
4
+
5
+ # Represents a class variable inside a namespace. The path is expressed
6
+ # in the form "A::B::@@classvariable"
7
+ class ClassVariableObject < Base
8
+ # @return [String] the class variable's value
9
+ attr_accessor :value
10
+ end
11
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+ module YARD::CodeObjects
3
+ register_separator NSEP, :constant
4
+
5
+ # A +ConstantObject+ represents a Ruby constant (not a module or class).
6
+ # To access the constant's (source code) value, use {#value}.
7
+ class ConstantObject < Base
8
+ # The source code representing the constant's value
9
+ # @return [String] the value the constant is set to
10
+ attr_reader :value
11
+
12
+ def value=(value)
13
+ @value = format_source(value)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+ module YARD::CodeObjects
3
+ # Represents an instance method of a module that was mixed into the class
4
+ # scope of another namespace.
5
+ #
6
+ # @see MethodObject
7
+ class ExtendedMethodObject
8
+ instance_methods.each {|m| undef_method(m) unless m =~ /^__/ || m.to_sym == :object_id }
9
+
10
+ # @return [Symbol] always +:class+
11
+ def scope; :class end
12
+
13
+ # Sets up a delegate for {MethodObject} obj.
14
+ #
15
+ # @param [MethodObject] obj the instance method to treat as a mixed in
16
+ # class method on another namespace.
17
+ def initialize(obj) @del = obj end
18
+
19
+ # Sends all methods to the {MethodObject} assigned in {#initialize}
20
+ # @see #initialize
21
+ # @see MethodObject
22
+ def method_missing(sym, *args, &block) @del.__send__(sym, *args, &block) end
23
+ end
24
+ end
@@ -0,0 +1,135 @@
1
+ # frozen_string_literal: true
2
+ module YARD::CodeObjects
3
+ # An ExtraFileObject represents an extra documentation file (README or other
4
+ # file). It is not strictly a CodeObject (does not inherit from `Base`) although
5
+ # it implements `path`, `name` and `type`, and therefore should be structurally
6
+ # compatible with most CodeObject interfaces.
7
+ class ExtraFileObject
8
+ attr_accessor :filename
9
+ attr_writer :attributes
10
+ attr_accessor :name
11
+ # @since 0.8.3
12
+ attr_reader :locale
13
+
14
+ # Creates a new extra file object.
15
+ # @param [String] filename the location on disk of the file
16
+ # @param [String] contents the file contents. If not set, the contents
17
+ # will be read from disk using the +filename+.
18
+ def initialize(filename, contents = nil)
19
+ self.filename = filename
20
+ self.name = File.basename(filename).gsub(/\.[^.]+$/, '')
21
+ self.attributes = SymbolHash.new(false)
22
+ @original_contents = contents
23
+ @parsed = false
24
+ @locale = nil
25
+ ensure_parsed
26
+ end
27
+
28
+ alias path name
29
+
30
+ def attributes
31
+ ensure_parsed
32
+ @attributes
33
+ end
34
+
35
+ def title
36
+ attributes[:title] || name
37
+ end
38
+
39
+ def contents
40
+ ensure_parsed
41
+ @contents
42
+ end
43
+
44
+ def contents=(contents)
45
+ @original_contents = contents
46
+ @parsed = false
47
+ end
48
+
49
+ # @param [String] locale the locale name to be translated.
50
+ # @return [void]
51
+ # @since 0.8.3
52
+ def locale=(locale)
53
+ @locale = locale
54
+ @parsed = false
55
+ end
56
+
57
+ def inspect
58
+ "#<yardoc #{type} #{filename} attrs=#{attributes.inspect}>"
59
+ end
60
+ alias to_s inspect
61
+
62
+ def type; :extra_file end
63
+
64
+ def ==(other)
65
+ return false unless self.class === other
66
+ other.filename == filename
67
+ end
68
+ alias eql? ==
69
+ alias equal? ==
70
+ def hash; filename.hash end
71
+
72
+ private
73
+
74
+ def ensure_parsed
75
+ return if @parsed
76
+ @parsed = true
77
+ @contents = parse_contents(@original_contents || File.read(@filename))
78
+ end
79
+
80
+ # @param [String] data the file contents
81
+ def parse_contents(data)
82
+ retried = false
83
+ cut_index = 0
84
+ data = translate(data)
85
+ data = data.split("\n")
86
+ data.each_with_index do |line, index|
87
+ case line
88
+ when /^#!(\S+)\s*$/
89
+ if index == 0
90
+ attributes[:markup] = $1
91
+ else
92
+ cut_index = index
93
+ break
94
+ end
95
+ when /^\s*#\s*@(\S+)\s*(.+?)\s*$/
96
+ attributes[$1] = $2
97
+ when /^\s*<!--\s*$/, /^\s*-->\s*$/
98
+ # Ignore HTML comments
99
+ else
100
+ cut_index = index
101
+ break
102
+ end
103
+ end
104
+ data = data[cut_index..-1] if cut_index > 0
105
+ contents = data.join("\n")
106
+
107
+ if contents.respond_to?(:force_encoding) && attributes[:encoding]
108
+ begin
109
+ contents.force_encoding(attributes[:encoding])
110
+ rescue ArgumentError
111
+ log.warn "Invalid encoding `#{attributes[:encoding]}' in #{filename}"
112
+ end
113
+ end
114
+ contents
115
+ rescue ArgumentError => e
116
+ raise unless e.message =~ /invalid byte sequence/
117
+
118
+ if retried
119
+ # This should never happen.
120
+ log.warn "Could not read #{filename}, #{e.message}. You probably want to set `--charset`."
121
+ return ''
122
+ else
123
+ data.force_encoding('binary') if data.respond_to?(:force_encoding)
124
+ retried = true
125
+ retry
126
+ end
127
+ end
128
+
129
+ def translate(data)
130
+ return data if locale.nil?
131
+ text = YARD::I18n::Text.new(data, :have_header => true)
132
+ text.translate(YARD::Registry.locale(locale))
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,171 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YARD
4
+ module CodeObjects
5
+ # A MacroObject represents a docstring defined through +@!macro NAME+ and can be
6
+ # reused by specifying the tag +@!macro NAME+. You can also provide the
7
+ # +attached+ type flag to the macro definition to have it attached to the
8
+ # specific DSL method so it will be implicitly reused.
9
+ #
10
+ # Macros are fully described in the {file:docs/Tags.md#macro Tags Overview}
11
+ # document.
12
+ #
13
+ # @example Creating a basic named macro
14
+ # # @!macro prop
15
+ # # @!method $1(${3-})
16
+ # # @return [$2] the value of the $0
17
+ # property :foo, String, :a, :b
18
+ #
19
+ # # @!macro prop
20
+ # property :bar, Numeric, :value
21
+ #
22
+ # @example Creating a macro that is attached to the method call
23
+ # # @!macro [attach] prop2
24
+ # # @!method $1(value)
25
+ # property :foo
26
+ #
27
+ # # Extra data added to docstring
28
+ # property :bar
29
+ class MacroObject < Base
30
+ MACRO_MATCH = /(\\)?\$(?:\{(-?\d+|\*)(-)?(-?\d+)?\}|(-?\d+|\*))/
31
+
32
+ class << self
33
+ # Creates a new macro and fills in the relevant properties.
34
+ # @param [String] macro_name the name of the macro, must be unique.
35
+ # @param [String] data the data the macro should expand when re-used
36
+ # @param [CodeObjects::Base] method_object an object to attach this
37
+ # macro to. If supplied, {#attached?} will be true
38
+ # @return [MacroObject] the newly created object
39
+ def create(macro_name, data, method_object = nil)
40
+ obj = new(:root, macro_name)
41
+ obj.macro_data = data
42
+ obj.method_object = method_object
43
+ obj
44
+ end
45
+
46
+ # Finds a macro using +macro_name+
47
+ # @param [#to_s] macro_name the name of the macro
48
+ # @return [MacroObject] if a macro is found
49
+ # @return [nil] if there is no registered macro by that name
50
+ def find(macro_name)
51
+ Registry.at('.macro.' + macro_name.to_s)
52
+ end
53
+
54
+ # Parses a given docstring and determines if the macro is "new" or
55
+ # not. If the macro has $variable names or if it has a @!macro tag
56
+ # with the [new] or [attached] flag, it is considered new.
57
+ #
58
+ # If a new macro is found, the macro is created and registered. Otherwise
59
+ # the macro name is searched and returned. If a macro is not found,
60
+ # nil is returned.
61
+ #
62
+ # @param [#to_s] macro_name the name of the macro
63
+ # @param [CodeObjects::Base] method_object an optional method to attach
64
+ # the macro to. Only used if the macro is being created, otherwise
65
+ # this argument is ignored.
66
+ # @return [MacroObject] the newly created or existing macro, depending
67
+ # on whether the @!macro tag was a new tag or not.
68
+ # @return [nil] if the +data+ has no macro tag or if the macro is
69
+ # not new and no macro by the macro name is found.
70
+ def find_or_create(macro_name, data, method_object = nil)
71
+ find(name) || create(macro_name, data, method_object)
72
+ end
73
+ alias create_docstring find_or_create
74
+
75
+ # Expands +macro_data+ using the interpolation parameters.
76
+ #
77
+ # Interpolation rules:
78
+ # * $0, $1, $2, ... = the Nth parameter in +call_params+
79
+ # * $* = the full statement source (excluding block)
80
+ # * Also supports $!{N-M} ranges, as well as negative indexes on N or M
81
+ # * Use \$ to escape the variable name in a macro.
82
+ #
83
+ # @!macro [new] macro.expand
84
+ # @param [Array<String>] call_params the method name and parameters
85
+ # to the method call. These arguments will fill \$0-N
86
+ # @param [String] full_source the full source line (excluding block)
87
+ # interpolated as \$*
88
+ # @param [String] block_source Currently unused. Will support
89
+ # interpolating the block data as a variable.
90
+ # @return [String] the expanded macro data
91
+ # @param [String] macro_data the macro data to expand (taken from {#macro_data})
92
+ def expand(macro_data, call_params = [], full_source = '', block_source = '') # rubocop:disable Lint/UnusedMethodArgument
93
+ macro_data = macro_data.all if macro_data.is_a?(Docstring)
94
+ macro_data.gsub(MACRO_MATCH) do
95
+ escape = $1
96
+ first = $2 || $5
97
+ last = $4
98
+ rng = $3 ? true : false
99
+ next $&[1..-1] if escape
100
+ if first == '*'
101
+ last ? $& : full_source
102
+ else
103
+ first_i = first.to_i
104
+ last_i = (last ? last.to_i : call_params.size)
105
+ last_i = first_i unless rng
106
+ params = call_params[first_i..last_i]
107
+ params ? params.join(", ") : ''
108
+ end
109
+ end
110
+ end
111
+
112
+ # Applies a macro on a docstring by creating any macro data inside of
113
+ # the docstring first. Equivalent to calling {find_or_create} and {apply_macro}
114
+ # on the new macro object.
115
+ #
116
+ # @param [Docstring] docstring the docstring to create a macro out of
117
+ # @!macro macro.expand
118
+ # @see find_or_create
119
+ def apply(docstring, call_params = [], full_source = '', block_source = '', _method_object = nil) # rubocop:disable Lint/UnusedMethodArgument
120
+ docstring = docstring.all if Docstring === docstring
121
+ parser = Docstring.parser
122
+ handler = OpenStruct.new
123
+ handler.call_params = call_params[1..-1]
124
+ handler.caller_method = call_params.first
125
+ handler.statement = OpenStruct.new(:source => full_source)
126
+ parser.parse(docstring, nil, handler).to_docstring.to_raw
127
+ end
128
+
129
+ # Applies a macro to a docstring, interpolating the macro's data on the
130
+ # docstring and appending any extra local docstring data that was in
131
+ # the original +docstring+ object.
132
+ #
133
+ # @param [MacroObject] macro the macro object
134
+ # @!macro macro.expand
135
+ def apply_macro(macro, docstring, call_params = [], full_source = '', block_source = '') # rubocop:disable Lint/UnusedMethodArgument
136
+ apply(docstring, call_params, full_source, block_source)
137
+ end
138
+ end
139
+
140
+ # @return [String] the macro data stored on the object
141
+ attr_accessor :macro_data
142
+
143
+ # @return [CodeObjects::Base] the method object that this macro is
144
+ # attached to.
145
+ attr_accessor :method_object
146
+
147
+ # @return [Boolean] whether this macro is attached to a method
148
+ def attached?; method_object ? true : false end
149
+
150
+ # Overrides {Base#path} so the macro path is ".macro.MACRONAME"
151
+ def path; '.macro.' + name.to_s end
152
+
153
+ # Overrides the separator to be '.'
154
+ def sep; '.' end
155
+
156
+ # Expands the macro using
157
+ # @param [Array<String>] call_params a list of tokens that are passed
158
+ # to the method call
159
+ # @param [String] full_source the full method call (not including the block)
160
+ # @param [String] block_source the source passed in the block of the method
161
+ # call, if there is a block.
162
+ # @example Expanding a Macro
163
+ # macro.expand(%w(property foo bar), 'property :foo, :bar', '') #=>
164
+ # "...macro data interpolating this line of code..."
165
+ # @see expand
166
+ def expand(call_params = [], full_source = '', block_source = '')
167
+ self.class.expand(macro_data, call_params, full_source, block_source)
168
+ end
169
+ end
170
+ end
171
+ end
@@ -0,0 +1,196 @@
1
+ # frozen_string_literal: true
2
+ module YARD::CodeObjects
3
+ register_separator CSEP, :method
4
+ register_separator ISEP, :method
5
+
6
+ # Represents a Ruby method in source
7
+ class MethodObject < Base
8
+ # The scope of the method (+:class+ or +:instance+)
9
+ #
10
+ # @return [Symbol] the scope
11
+ attr_reader :scope
12
+
13
+ # Whether the object is explicitly defined in source or whether it was
14
+ # inferred by a handler. For instance, attribute methods are generally
15
+ # inferred and therefore not explicitly defined in source.
16
+ #
17
+ # @return [Boolean] whether the object is explicitly defined in source.
18
+ attr_accessor :explicit
19
+
20
+ # Returns the list of parameters parsed out of the method signature
21
+ # with their default values.
22
+ #
23
+ # @return [Array<Array(String, String)>] a list of parameter names followed
24
+ # by their default values (or nil)
25
+ attr_accessor :parameters
26
+
27
+ # Creates a new method object in +namespace+ with +name+ and an instance
28
+ # or class +scope+
29
+ #
30
+ # If scope is +:module+, this object is instantiated as a public
31
+ # method in +:class+ scope, but also creates a new (empty) method
32
+ # as a private +:instance+ method on the same class or module.
33
+ #
34
+ # @param [NamespaceObject] namespace the namespace
35
+ # @param [String, Symbol] name the method name
36
+ # @param [Symbol] scope +:instance+, +:class+, or +:module+
37
+ def initialize(namespace, name, scope = :instance, &block)
38
+ @module_function = false
39
+ @scope = nil
40
+
41
+ # handle module function
42
+ if scope == :module
43
+ other = self.class.new(namespace, name, &block)
44
+ other.visibility = :private
45
+ scope = :class
46
+ @module_function = true
47
+ end
48
+
49
+ @visibility = :public
50
+ self.scope = scope
51
+ self.parameters = []
52
+
53
+ super
54
+ end
55
+
56
+ # Changes the scope of an object from :instance or :class
57
+ # @param [Symbol] v the new scope
58
+ def scope=(v)
59
+ reregister = @scope ? true : false
60
+
61
+ # handle module function
62
+ if v == :module
63
+ other = self.class.new(namespace, name)
64
+ other.visibility = :private
65
+ @visibility = :public
66
+ @module_function = true
67
+ @path = nil
68
+ end
69
+
70
+ YARD::Registry.delete(self)
71
+ @path = nil
72
+ @scope = v.to_sym
73
+ @scope = :class if @scope == :module
74
+ YARD::Registry.register(self) if reregister
75
+ end
76
+
77
+ # @return whether or not the method is the #initialize constructor method
78
+ def constructor?
79
+ name == :initialize && scope == :instance && namespace.is_a?(ClassObject)
80
+ end
81
+
82
+ # @return [Boolean] whether or not this method was created as a module
83
+ # function
84
+ # @since 0.8.0
85
+ def module_function?
86
+ @module_function
87
+ end
88
+
89
+ # Returns the read/writer info for the attribute if it is one
90
+ # @return [SymbolHash] if there is information about the attribute
91
+ # @return [nil] if the method is not an attribute
92
+ # @since 0.5.3
93
+ def attr_info
94
+ return nil unless namespace.is_a?(NamespaceObject)
95
+ namespace.attributes[scope][name.to_s.gsub(/=$/, '')]
96
+ end
97
+
98
+ # @return [Boolean] whether the method is a writer attribute
99
+ # @since 0.5.3
100
+ def writer?
101
+ info = attr_info
102
+ info && info[:write] == self ? true : false
103
+ end
104
+
105
+ # @return [Boolean] whether the method is a reader attribute
106
+ # @since 0.5.3
107
+ def reader?
108
+ info = attr_info
109
+ info && info[:read] == self ? true : false
110
+ end
111
+
112
+ # Tests if the object is defined as an attribute in the namespace
113
+ # @return [Boolean] whether the object is an attribute
114
+ def is_attribute?
115
+ info = attr_info
116
+ if info
117
+ read_or_write = name.to_s =~ /=$/ ? :write : :read
118
+ info[read_or_write] ? true : false
119
+ else
120
+ false
121
+ end
122
+ end
123
+
124
+ # Tests if the object is defined as an alias of another method
125
+ # @return [Boolean] whether the object is an alias
126
+ def is_alias?
127
+ return false unless namespace.is_a?(NamespaceObject)
128
+ namespace.aliases.key? self
129
+ end
130
+
131
+ # Tests boolean {#explicit} value.
132
+ #
133
+ # @return [Boolean] whether the method is explicitly defined in source
134
+ def is_explicit?
135
+ explicit ? true : false
136
+ end
137
+
138
+ # @return [MethodObject] the object that this method overrides
139
+ # @return [nil] if it does not override a method
140
+ # @since 0.6.0
141
+ def overridden_method
142
+ return nil if namespace.is_a?(Proxy)
143
+ meths = namespace.meths(:all => true)
144
+ meths.find {|m| m.path != path && m.name == name && m.scope == scope }
145
+ end
146
+
147
+ # Returns all alias names of the object
148
+ # @return [Array<MethodObject>] the alias names
149
+ def aliases
150
+ list = []
151
+ return list unless namespace.is_a?(NamespaceObject)
152
+ namespace.aliases.each do |o, aname|
153
+ list << o if aname == name && o.scope == scope
154
+ end
155
+ list
156
+ end
157
+
158
+ # Override path handling for instance methods in the root namespace
159
+ # (they should still have a separator as a prefix).
160
+ # @return [String] the path of a method
161
+ def path
162
+ @path ||= !namespace || namespace.path == "" ? sep + super : super
163
+ end
164
+
165
+ # Returns the name of the object.
166
+ #
167
+ # @example The name of an instance method (with prefix)
168
+ # an_instance_method.name(true) # => "#mymethod"
169
+ # @example The name of a class method (with prefix)
170
+ # a_class_method.name(true) # => "mymethod"
171
+ # @param [Boolean] prefix whether or not to show the prefix
172
+ # @return [String] returns {#sep} + +name+ for an instance method if
173
+ # prefix is true
174
+ # @return [Symbol] the name without {#sep} if prefix is set to false
175
+ def name(prefix = false)
176
+ prefix ? (sep == ISEP ? "#{sep}#{super}" : super.to_s) : super
177
+ end
178
+
179
+ # Override separator to differentiate between class and instance
180
+ # methods.
181
+ # @return [String] "#" for an instance method, "." for class
182
+ def sep
183
+ if scope == :class
184
+ namespace && namespace != YARD::Registry.root ? CSEP : NSEP
185
+ else
186
+ ISEP
187
+ end
188
+ end
189
+
190
+ protected
191
+
192
+ def copyable_attributes
193
+ super - %w(scope module_function)
194
+ end
195
+ end
196
+ end