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,631 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YARD
4
+ module Tags
5
+ # The base directive class. Subclass this class to create a custom
6
+ # directive, registering it with {Library.define_directive}. Directive
7
+ # classes are executed via the {#call} method, which perform all directive
8
+ # processing on the object.
9
+ #
10
+ # If processing occurs within a handler, the {#handler} attribute is
11
+ # available to access more information about parsing context and state.
12
+ # Handlers are only available when parsing from {Parser::SourceParser},
13
+ # not when parsing directly from {DocstringParser}. If the docstring is
14
+ # attached to an object declaration, {#object} will be set and available
15
+ # to modify the generated code object directly. Note that both of these
16
+ # attributes may be nil, and directives should test their existence
17
+ # before attempting to use them.
18
+ #
19
+ # @abstract Subclasses should implement {#call}.
20
+ # @see Library.define_directive
21
+ # @since 0.8.0
22
+ class Directive
23
+ # @return [Tag] the meta-data tag containing data input to the directive
24
+ attr_accessor :tag
25
+
26
+ # Set this field to replace the directive definition inside of a docstring
27
+ # with arbitrary text. For instance, the {MacroDirective} uses this field
28
+ # to expand its macro data in place of the call to a +@!macro+.
29
+ #
30
+ # @return [String] the text to expand in the original docstring in place
31
+ # of this directive definition.
32
+ # @return [nil] if no expansion should take place for this directive
33
+ attr_accessor :expanded_text
34
+
35
+ # @return [DocstringParser] the parser that is parsing all tag
36
+ # information out of the docstring
37
+ attr_accessor :parser
38
+
39
+ # @!attribute [r] object
40
+ # @return [CodeObjects::Base, nil] the object the parent docstring is
41
+ # attached to. May be nil.
42
+ def object; parser.object end
43
+
44
+ # @!attribute [r] handler
45
+ # @return [Handlers::Base, nil] the handler object the docstring parser
46
+ # might be attached to. May be nil. Only available when parsing
47
+ # through {Parser::SourceParser}.
48
+ def handler; parser.handler end
49
+
50
+ # @!endgroup
51
+
52
+ # @param [Tag] tag the meta-data tag containing all input to the docstring
53
+ # @param [DocstringParser] parser the docstring parser object
54
+ def initialize(tag, parser)
55
+ self.tag = tag
56
+ self.parser = parser
57
+ self.expanded_text = nil
58
+ end
59
+
60
+ # @!group Parser callbacks
61
+
62
+ # Called when processing the directive. Subclasses should implement
63
+ # this method to perform all functionality of the directive.
64
+ #
65
+ # @abstract implement this method to perform all data processing for
66
+ # the directive.
67
+ # @return [void]
68
+ def call; raise NotImplementedError end
69
+
70
+ # Called after parsing all directives and tags in the docstring. Used
71
+ # to perform any cleanup after all directives perform their main task.
72
+ # @return [void]
73
+ def after_parse; end
74
+
75
+ protected :parser
76
+
77
+ protected
78
+
79
+ def inside_directive?
80
+ return true if parser.state.inside_directive
81
+ parser.directives.any? { |d| d.is_a?(MethodDirective) && d.tag.text.empty? }
82
+ end
83
+ end
84
+
85
+ # Ends a group listing definition. Group definition automatically end
86
+ # when class or module blocks are closed, and defining a new group overrides
87
+ # the last group definition, but occasionally you need to end the current
88
+ # group to return to the default listing. Use {tag:!group} to begin a
89
+ # group listing.
90
+ #
91
+ # @example
92
+ # class Controller
93
+ # # @!group Callbacks
94
+ #
95
+ # def before_filter; end
96
+ # def after_filter; end
97
+ #
98
+ # # @!endgroup
99
+ #
100
+ # def index; end
101
+ # end
102
+ # @see tag:!group
103
+ # @since 0.6.0
104
+ class EndGroupDirective < Directive
105
+ def call
106
+ return unless handler
107
+ handler.extra_state.group = nil
108
+ end
109
+ end
110
+
111
+ # Defines a group listing. All methods (and attributes) seen after this
112
+ # directive are placed into a group with the given description as the
113
+ # group name. The group listing is used by templates to organize methods
114
+ # and attributes into respective logical groups. To end a group listing
115
+ # use {tag:!endgroup}.
116
+ #
117
+ # @note A group definition only applies to the scope it is defined in.
118
+ # If a new class or module is opened after the directive, this directive
119
+ # will not apply to methods in that class or module.
120
+ # @example
121
+ # # @!group Callbacks
122
+ #
123
+ # def before_filter; end
124
+ # def after_filter; end
125
+ # @see tag:!endgroup
126
+ # @since 0.6.0
127
+ class GroupDirective < Directive
128
+ def call
129
+ return unless handler
130
+ handler.extra_state.group = tag.text
131
+ end
132
+ end
133
+
134
+ # Defines a block of text to be expanded whenever the macro is called by name
135
+ # in subsequent docstrings. The macro data can be any arbitrary text data, be
136
+ # it regular documentation, meta-data tags or directives.
137
+ #
138
+ # == Defining a Macro
139
+ #
140
+ # A macro must first be defined in order to be used. Note that a macro is also
141
+ # expanded upon definition if it defined on an object (the docstring of a
142
+ # method, class, module or constant object as opposed to a free standing
143
+ # comment). To define a macro, use the "new" or "attach" identifier in the
144
+ # types specifier list. A macro will also automatically be created if an
145
+ # indented macro data block is given, so the keywords are not strictly needed.
146
+ #
147
+ # === Anonymous Macros
148
+ #
149
+ # In addition to standard named macros, macros can be defined anonymously if
150
+ # no name is given. In this case, they can not be re-used in future docstrings,
151
+ # but they will expand in the first definition. This is useful when needing
152
+ # to take advantage of the macro expansion variables (described below).
153
+ #
154
+ # == Using a Macro
155
+ #
156
+ # To re-use a macro in another docstring after it is defined, simply use
157
+ # <tt>@!macro the_name</tt> with no indented block of macro data. The resulting
158
+ # data will be expanded in place.
159
+ #
160
+ # == Attaching a Macro to a DSL Method
161
+ #
162
+ # Macros can be defined to auto-expand on DSL-style class method calls. To
163
+ # define a macro to be auto expanded in this way, use the "attach" keyword
164
+ # in the type specifier list ("new" is implied).
165
+ #
166
+ # Attached macros can also be attached directly on the class method declaration
167
+ # that provides the DSL method to its subclasses. The syntax in either case
168
+ # is the same.
169
+ #
170
+ # == Macro Expansion Variables
171
+ #
172
+ # In the case of using macros on DSL-style method calls, a number of expansion
173
+ # variables can be used for interpolation inside of the macro data. The variables,
174
+ # similar in syntax to Ruby's global variables, are as follows:
175
+ #
176
+ # * $0 - the method name being called
177
+ # * $1, $2, $3, ... - the Nth argument in the method call
178
+ # * $& - the full source line
179
+ #
180
+ # The following example shows what the expansion variables might hold for a given
181
+ # DSL method call:
182
+ #
183
+ # property :foo, :a, :b, :c, String
184
+ # # $0 => "property"
185
+ # # $1 => "foo"
186
+ # # $2 => "a"
187
+ # # $& => "property :foo, :a, :b, :c, String"
188
+ #
189
+ # === Ranges
190
+ #
191
+ # Ranges are also acceptable with the syntax <tt>${N-M}</tt>. Negative values
192
+ # on either N or M are valid, and refer to indexes from the end of the list.
193
+ # Consider a DSL method that creates a method using the first argument with
194
+ # argument names following, ending with the return type of the method. This
195
+ # could be documented as:
196
+ #
197
+ # # @!macro dsl_method
198
+ # # @!method $1(${2--2})
199
+ # # @return [${-1}] the return value of $0
200
+ # create_method_with_args :foo, :a, :b, :c, String
201
+ #
202
+ # As described, the method is using the signature <tt>foo(a, b, c)</tt> and the return
203
+ # type from the last argument, +String+. When using ranges, tokens are joined
204
+ # with commas. Note that this includes using $0:
205
+ #
206
+ # !!!plain
207
+ # $0-1 # => Interpolates to "create_method_with_args, foo"
208
+ #
209
+ # If you want to separate them with spaces, use <tt>$1 $2 $3 $4 ...</tt>. Note that
210
+ # if the token cannot be expanded, it will return the empty string (not an error),
211
+ # so it would be safe to list <tt>$1 $2 ... $10</tt>, for example.
212
+ #
213
+ # === Escaping Interpolation
214
+ #
215
+ # Interpolation can be escaped by prefixing the +$+ with +\\\+, like so:
216
+ #
217
+ # # @!macro foo
218
+ # # I have \$2.00 USD.
219
+ #
220
+ # @example Defining a simple macro
221
+ # # @!macro [new] returnself
222
+ # # @return [self] returns itself
223
+ # @example Using a simple macro in multiple docstrings
224
+ # # Documentation for map
225
+ # # ...
226
+ # # @macro returnself
227
+ # def map; end
228
+ #
229
+ # # Documentation for filter
230
+ # # ...
231
+ # # @macro returnself
232
+ # def filter; end
233
+ # @example Attaching a macro to a class method (for DSL usage)
234
+ # class Resource
235
+ # # Defines a new property
236
+ # # @param [String] name the property name
237
+ # # @param [Class] type the property's type
238
+ # # @!macro [attach] property
239
+ # # @return [$2] the $1 property
240
+ # def self.property(name, type) end
241
+ # end
242
+ #
243
+ # class Post < Resource
244
+ # property :title, String
245
+ # property :view_count, Integer
246
+ # end
247
+ # @example Attaching a macro directly to a DSL method
248
+ # class Post < Resource
249
+ # # @!macro [attach] property
250
+ # # @return [$2] the $1 property
251
+ # property :title, String
252
+ #
253
+ # # Macro will expand on this definition too
254
+ # property :view_count, Integer
255
+ # end
256
+ # @since 0.7.0
257
+ class MacroDirective < Directive
258
+ def call
259
+ raise TagFormatError if tag.name.nil? && tag.text.to_s.empty?
260
+ macro_data = find_or_create
261
+ unless macro_data
262
+ warn
263
+ return
264
+ end
265
+
266
+ self.expanded_text = expand(macro_data)
267
+ end
268
+
269
+ private
270
+
271
+ def new?
272
+ (tag.types && tag.types.include?('new')) ||
273
+ (tag.text && !tag.text.strip.empty?)
274
+ end
275
+
276
+ def attach?
277
+ new? && # must have data or there is nothing to attach
278
+ class_method? || # always attach to class methods
279
+ (tag.types && tag.types.include?('attach'))
280
+ end
281
+
282
+ def class_method?
283
+ object && object.is_a?(CodeObjects::MethodObject) &&
284
+ object.scope == :class
285
+ end
286
+
287
+ def anonymous?
288
+ tag.name.nil? || tag.name.empty?
289
+ end
290
+
291
+ def expand(macro_data)
292
+ return if attach? && class_method?
293
+ return if !anonymous? && new? &&
294
+ (!handler || handler.statement.source.empty?)
295
+ call_params = []
296
+ caller_method = nil
297
+ full_source = ''
298
+ if handler
299
+ call_params = handler.call_params
300
+ caller_method = handler.caller_method
301
+ full_source = handler.statement.source
302
+ end
303
+ all_params = ([caller_method] + call_params).compact
304
+ CodeObjects::MacroObject.expand(macro_data, all_params, full_source)
305
+ end
306
+
307
+ def find_or_create
308
+ if new? || attach?
309
+ if handler && attach?
310
+ if object && object.is_a?(CodeObjects::NamespaceObject)
311
+ log.warn "Attaching macros to non-methods is unsupported, ignoring: " \
312
+ "#{object.path} (#{handler.parser.file}:#{handler.statement.line})"
313
+ obj = nil
314
+ else
315
+ obj = object ? object :
316
+ P("#{handler.namespace}.#{handler.caller_method}")
317
+ end
318
+ else
319
+ obj = nil
320
+ end
321
+
322
+ return tag.text || "" if anonymous? # anonymous macro
323
+ macro = CodeObjects::MacroObject.create(tag.name, tag.text, obj)
324
+ else
325
+ macro = CodeObjects::MacroObject.find(tag.name)
326
+ end
327
+
328
+ macro ? macro.macro_data : nil
329
+ end
330
+
331
+ def warn
332
+ if object && handler
333
+ log.warn "Invalid/missing macro name for " \
334
+ "#{object.path} (#{handler.parser.file}:#{handler.statement.line})"
335
+ end
336
+ end
337
+ end
338
+
339
+ # Defines a method object with a given method signature, using indented
340
+ # block data as the method's docstring. The signature is similar to the
341
+ # {tag:overload} tag. The comment containing this directive does not need
342
+ # to be attached to any source, but if it is, that source code will be
343
+ # used as the method's source.
344
+ #
345
+ # To define an attribute method, see {tag:!attribute}
346
+ #
347
+ # @note This directive should only be used if there is no explicit
348
+ # declaration for the method in any source files (i.e., the method
349
+ # is declared dynamically via meta-programming). In all other cases, add
350
+ # documentation to the method definition itself.
351
+ # @note For backwards compatibility support, you do not need to indent
352
+ # the method's docstring text. If a +@!method+ directive is seen with
353
+ # no indented block, the entire docstring is used as the new method's
354
+ # docstring text.
355
+ # @example Defining a simple method
356
+ # # @!method quit(username, message = "Quit")
357
+ # # Sends a quit message to the server for a +username+.
358
+ # # @param [String] username the username to quit
359
+ # # @param [String] message the quit message
360
+ # quit_message_method
361
+ # @example Attaching multiple methods to the same source
362
+ # # @!method method1
363
+ # # @!method method2
364
+ # create_methods :method1, :method2
365
+ # @see tag:!attribute
366
+ # @since 0.7.0
367
+ class MethodDirective < Directive
368
+ SCOPE_MATCH = /\A\s*self\s*\.\s*/
369
+
370
+ def call; end
371
+
372
+ def after_parse
373
+ return unless handler
374
+ use_indented_text
375
+ create_object
376
+ end
377
+
378
+ protected
379
+
380
+ def method_name
381
+ sig = sanitized_tag_signature
382
+ if sig && sig =~ /^#{CodeObjects::METHODNAMEMATCH}(\s|\(|$)/
383
+ sig[/\A\s*([^\(; \t]+)/, 1]
384
+ else
385
+ handler.call_params.first
386
+ end
387
+ end
388
+
389
+ def method_signature
390
+ "def #{sanitized_tag_signature || method_name}"
391
+ end
392
+
393
+ def sanitized_tag_signature
394
+ if tag.name && tag.name =~ SCOPE_MATCH
395
+ parser.state.scope = :class
396
+ $'
397
+ else
398
+ tag.name
399
+ end
400
+ end
401
+
402
+ def use_indented_text
403
+ return if tag.text.empty?
404
+ handler = parser.handler
405
+ object = parser.object
406
+ self.parser = parser.class.new(parser.library)
407
+ parser.state.inside_directive = true
408
+ parser.parse(tag.text, object, handler)
409
+ parser.state.inside_directive = false
410
+ end
411
+
412
+ def create_object
413
+ name = method_name
414
+ scope = parser.state.scope || handler.scope
415
+ visibility = parser.state.visibility || handler.visibility
416
+ ns = CodeObjects::NamespaceObject === object ? object : handler.namespace
417
+ obj = CodeObjects::MethodObject.new(ns, name, scope)
418
+ handler.register_file_info(obj)
419
+ handler.register_source(obj)
420
+ handler.register_visibility(obj, visibility)
421
+ handler.register_group(obj)
422
+ obj.signature = method_signature
423
+ obj.parameters = OverloadTag.new(:overload, method_signature).parameters
424
+ obj.docstring = Docstring.new!(parser.text, parser.tags, obj,
425
+ parser.raw_text, parser.reference)
426
+ handler.register_module_function(obj)
427
+ old_obj = parser.object
428
+ parser.object = obj
429
+ parser.post_process
430
+ parser.object = old_obj
431
+ obj
432
+ end
433
+ end
434
+
435
+ # Defines an attribute with a given name, using indented block data as the
436
+ # attribute's docstring. If the type specifier is supplied with "r", "w", or
437
+ # "rw", the attribute is made readonly, writeonly or readwrite respectively.
438
+ # A readwrite attribute is the default, if no type is specified. The comment
439
+ # containing this directive does not need to be attached to any source, but
440
+ # if it is, that source code will be used as the method's source.
441
+ #
442
+ # To define a regular method, see {tag:!method}
443
+ #
444
+ # @note This directive should only be used if there is no explicit +attr_*+
445
+ # declaration for the attribute in any source files (i.e., the attribute
446
+ # is declared dynamically via meta-programming). In all other cases, add
447
+ # documentation to the attribute declaration itself.
448
+ # @note For backwards compatibility support, you do not need to indent
449
+ # the attribute's docstring text. If an +@!attribute+ directive is seen with
450
+ # no indented block, the entire docstring is used as the new attribute's
451
+ # docstring text.
452
+ # @example Defining a simple readonly attribute
453
+ # # @!attribute [r] count
454
+ # # @return [Fixnum] the size of the list
455
+ # @example Defining a simple readwrite attribute
456
+ # # @!attribute name
457
+ # # @return [String] the name of the user
458
+ # @see tag:!method
459
+ # @since 0.7.0
460
+ class AttributeDirective < MethodDirective
461
+ def after_parse
462
+ return unless handler
463
+ use_indented_text
464
+ create_attribute_data(create_object)
465
+ end
466
+
467
+ protected
468
+
469
+ def method_name
470
+ name = sanitized_tag_signature || handler.call_params.first
471
+ name += '=' unless readable?
472
+ name
473
+ end
474
+
475
+ def method_signature
476
+ if readable?
477
+ "def #{method_name}"
478
+ else
479
+ "def #{method_name}(value)"
480
+ end
481
+ end
482
+
483
+ private
484
+
485
+ def create_attribute_data(object)
486
+ return unless object
487
+ clean_name = object.name.to_s.sub(/=$/, '')
488
+ attrs = object.namespace.attributes[object.scope]
489
+ attrs[clean_name] ||= SymbolHash[:read => nil, :write => nil]
490
+ attrs[clean_name][:read] = object if readable?
491
+ if writable?
492
+ if object.name.to_s[-1, 1] == '='
493
+ writer = object
494
+ writer.parameters = [['value', nil]]
495
+ else
496
+ writer = CodeObjects::MethodObject.new(object.namespace,
497
+ object.name.to_s + '=', object.scope)
498
+ writer.signature = "def #{object.name}=(value)"
499
+ writer.visibility = object.visibility
500
+ writer.dynamic = object.dynamic
501
+ writer.source = object.source
502
+ writer.group = object.group
503
+ writer.parameters = [['value', nil]]
504
+ writer.docstring = object.base_docstring
505
+ handler.register_file_info(writer)
506
+ end
507
+ attrs[clean_name][:write] = writer
508
+ end
509
+ end
510
+
511
+ def writable?
512
+ !tag.types || tag.types.join.include?('w')
513
+ end
514
+
515
+ def readable?
516
+ !tag.types || tag.types.join =~ /(?!w)r/
517
+ end
518
+ end
519
+
520
+ # Parses a block of code as if it were present in the source file at that
521
+ # location. This directive is useful if a class has dynamic meta-programmed
522
+ # behaviour that cannot be recognized by YARD.
523
+ #
524
+ # You can specify the language of the code block using the types
525
+ # specification list. By default, the code language is "ruby".
526
+ #
527
+ # @example Documenting dynamic module inclusion
528
+ # class User
529
+ # # includes "UserMixin" and extends "UserMixin::ClassMethods"
530
+ # # using the UserMixin.included callback.
531
+ # # @!parse include UserMixin
532
+ # # @!parse extend UserMixin::ClassMethods
533
+ # end
534
+ # @example Declaring a method as an attribute
535
+ # # This should really be an attribute
536
+ # # @!parse attr_reader :foo
537
+ # def object; @parent.object end
538
+ # @example Parsing C code
539
+ # # @!parse [c]
540
+ # # void Init_Foo() {
541
+ # # rb_define_method(rb_cFoo, "method", method, 0);
542
+ # # }
543
+ # @since 0.8.0
544
+ class ParseDirective < Directive
545
+ def call
546
+ existing = YARD::Registry.all.lazy.map(&:path).to_set if handler
547
+ lang = tag.types ? tag.types.first.to_sym :
548
+ (handler ? handler.parser.parser_type : :ruby)
549
+ if handler && lang == handler.parser.parser_type
550
+ pclass = Parser::SourceParser.parser_types[handler.parser.parser_type]
551
+ pobj = pclass.new(tag.text, handler.parser.file)
552
+ pobj.parse
553
+ handler.parser.process(pobj.enumerator)
554
+ else # initialize a new parse chain
555
+ src_parser = Parser::SourceParser.new(lang, handler ? handler.globals : nil)
556
+ src_parser.file = handler.parser.file if handler
557
+ src_parser.parse(StringIO.new(tag.text))
558
+ end
559
+ return unless handler
560
+ YARD::Registry.all.each do |obj|
561
+ next if existing.include? obj.path
562
+ obj.files.each { |entry| entry[1] = handler.statement.line if entry[0] == handler.parser.file.to_s }
563
+ obj.source = handler.statement.source
564
+ end
565
+ end
566
+ end
567
+
568
+ # Modifies the current parsing scope (class or instance). If this
569
+ # directive is defined on a docstring attached to an object definition,
570
+ # it is applied only to that object. Otherwise, it applies the scope
571
+ # to all future objects in the namespace.
572
+ #
573
+ # @example Modifying the scope of a DSL method
574
+ # # @!scope class
575
+ # cattr_accessor :subclasses
576
+ # @example Modifying the scope of a set of methods
577
+ # # @!scope class
578
+ #
579
+ # # Documentation for method1
580
+ # def method1; end
581
+ #
582
+ # # Documentation for method2
583
+ # def method2; end
584
+ # @since 0.7.0
585
+ class ScopeDirective < Directive
586
+ def call
587
+ if %w(class instance module).include?(tag.text)
588
+ if object.is_a?(CodeObjects::MethodObject)
589
+ object.scope = tag.text.to_sym
590
+ elsif handler && !inside_directive?
591
+ handler.scope = tag.text.to_sym
592
+ else
593
+ parser.state.scope = tag.text.to_sym
594
+ end
595
+ end
596
+ end
597
+ end
598
+
599
+ # Modifies the current parsing visibility (public, protected, or private).
600
+ # If this directive is defined on a docstring attached to an object
601
+ # definition, it is applied only to that object. Otherwise, it applies
602
+ # the visibility to all future objects in the namespace.
603
+ #
604
+ # @example Modifying the visibility of a DSL method
605
+ # # @!visibility private
606
+ # cattr_accessor :subclasses
607
+ # @example Modifying the visibility of a set of methods
608
+ # # Note that Ruby's "protected" is recommended over this directive
609
+ # # @!visibility protected
610
+ #
611
+ # # Documentation for method1
612
+ # def method1; end
613
+ #
614
+ # # Documentation for method2
615
+ # def method2; end
616
+ # @since 0.7.0
617
+ class VisibilityDirective < Directive
618
+ def call
619
+ if %w(public protected private).include?(tag.text)
620
+ if object.is_a?(CodeObjects::Base)
621
+ object.visibility = tag.text.to_sym
622
+ elsif handler && !inside_directive?
623
+ handler.visibility = tag.text.to_sym
624
+ else
625
+ parser.state.visibility = tag.text.to_sym
626
+ end
627
+ end
628
+ end
629
+ end
630
+ end
631
+ end