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,626 @@
1
+ # frozen_string_literal: true
2
+ module YARD
3
+ module CodeObjects
4
+ # A list of code objects. This array acts like a set (no unique items)
5
+ # but also disallows any {Proxy} objects from being added.
6
+ class CodeObjectList < Array
7
+ # Creates a new object list associated with a namespace
8
+ #
9
+ # @param [NamespaceObject] owner the namespace the list should be associated with
10
+ # @return [CodeObjectList]
11
+ def initialize(owner = Registry.root)
12
+ @owner = owner
13
+ end
14
+
15
+ # Adds a new value to the list
16
+ #
17
+ # @param [Base] value a code object to add
18
+ # @return [CodeObjectList] self
19
+ def push(value)
20
+ value = Proxy.new(@owner, value) if value.is_a?(String) || value.is_a?(Symbol)
21
+ if value.is_a?(CodeObjects::Base) || value.is_a?(Proxy)
22
+ super(value) unless include?(value)
23
+ else
24
+ raise ArgumentError, "#{value.class} is not a valid CodeObject"
25
+ end
26
+ self
27
+ end
28
+ alias << push
29
+ end
30
+
31
+ extend NamespaceMapper
32
+
33
+ # Namespace separator
34
+ NSEP = '::'
35
+
36
+ # Regex-quoted namespace separator
37
+ NSEPQ = NSEP
38
+
39
+ # Instance method separator
40
+ ISEP = '#'
41
+
42
+ # Regex-quoted instance method separator
43
+ ISEPQ = ISEP
44
+
45
+ # Class method separator
46
+ CSEP = '.'
47
+
48
+ # Regex-quoted class method separator
49
+ CSEPQ = Regexp.quote CSEP
50
+
51
+ # Regular expression to match constant name
52
+ CONSTANTMATCH = /[A-Z]\w*/
53
+
54
+ # Regular expression to match the beginning of a constant
55
+ CONSTANTSTART = /^[A-Z]/
56
+
57
+ # Regular expression to match namespaces (const A or complex path A::B)
58
+ NAMESPACEMATCH = /(?:(?:#{NSEPQ}\s*)?#{CONSTANTMATCH})+/
59
+
60
+ # Regular expression to match a method name
61
+ METHODNAMEMATCH = %r{[a-zA-Z_]\w*[!?=]?|[-+~]\@|<<|>>|=~|===?|![=~]?|<=>|[<>]=?|\*\*|[-/+%^&*~`|]|\[\]=?}
62
+
63
+ # Regular expression to match a fully qualified method def (self.foo, Class.foo).
64
+ METHODMATCH = /(?:(?:#{NAMESPACEMATCH}|[a-z]\w*)\s*(?:#{CSEPQ}|#{NSEPQ})\s*)?#{METHODNAMEMATCH}/
65
+
66
+ # All builtin Ruby exception classes for inheritance tree.
67
+ BUILTIN_EXCEPTIONS = ["ArgumentError", "ClosedQueueError", "EncodingError",
68
+ "EOFError", "Exception", "FiberError", "FloatDomainError", "IndexError",
69
+ "Interrupt", "IOError", "KeyError", "LoadError", "LocalJumpError",
70
+ "NameError", "NoMemoryError", "NoMethodError", "NotImplementedError",
71
+ "RangeError", "RegexpError", "RuntimeError", "ScriptError", "SecurityError",
72
+ "SignalException", "StandardError", "StopIteration", "SyntaxError",
73
+ "SystemCallError", "SystemExit", "SystemStackError", "ThreadError",
74
+ "TypeError", "UncaughtThrowError", "ZeroDivisionError"]
75
+
76
+ # All builtin Ruby classes for inheritance tree.
77
+ # @note MatchingData is a 1.8.x legacy class
78
+ BUILTIN_CLASSES = ["Array", "Bignum", "Binding", "Class", "Complex",
79
+ "ConditionVariable", "Data", "Dir", "Encoding", "Enumerator", "FalseClass",
80
+ "Fiber", "File", "Fixnum", "Float", "Hash", "IO", "Integer", "MatchData",
81
+ "Method", "Module", "NilClass", "Numeric", "Object", "Proc", "Queue",
82
+ "Random", "Range", "Rational", "Regexp", "RubyVM", "SizedQueue", "String",
83
+ "Struct", "Symbol", "Thread", "ThreadGroup", "Time", "TracePoint",
84
+ "TrueClass", "UnboundMethod"] + BUILTIN_EXCEPTIONS
85
+
86
+ # All builtin Ruby modules for mixin handling.
87
+ BUILTIN_MODULES = ["Comparable", "Enumerable", "Errno", "FileTest", "GC",
88
+ "Kernel", "Marshal", "Math", "ObjectSpace", "Precision", "Process", "Signal"]
89
+
90
+ # All builtin Ruby classes and modules.
91
+ BUILTIN_ALL = BUILTIN_CLASSES + BUILTIN_MODULES
92
+
93
+ # Hash of {BUILTIN_EXCEPTIONS} as keys and true as value (for O(1) lookups)
94
+ BUILTIN_EXCEPTIONS_HASH = BUILTIN_EXCEPTIONS.inject({}) {|h, n| h.update(n => true) }
95
+
96
+ # +Base+ is the superclass of all code objects recognized by YARD. A code
97
+ # object is any entity in the Ruby language (class, method, module). A
98
+ # DSL might subclass +Base+ to create a new custom object representing
99
+ # a new entity type.
100
+ #
101
+ # == Registry Integration
102
+ # Any created object associated with a namespace is immediately registered
103
+ # with the registry. This allows the Registry to act as an identity map
104
+ # to ensure that no object is represented by more than one Ruby object
105
+ # in memory. A unique {#path} is essential for this identity map to work
106
+ # correctly.
107
+ #
108
+ # == Custom Attributes
109
+ # Code objects allow arbitrary custom attributes to be set using the
110
+ # {#[]=} assignment method.
111
+ #
112
+ # == Namespaces
113
+ # There is a special type of object called a "namespace". These are subclasses
114
+ # of the {NamespaceObject} and represent Ruby entities that can have
115
+ # objects defined within them. Classically these are modules and classes,
116
+ # though a DSL might create a custom {NamespaceObject} to describe a
117
+ # specific set of objects.
118
+ #
119
+ # == Separators
120
+ # Custom classes with different separator tokens should define their own
121
+ # separators using the {NamespaceMapper.register_separator} method. The
122
+ # standard Ruby separators have already been defined ('::', '#', '.', etc).
123
+ #
124
+ # @abstract This class should not be used directly. Instead, create a
125
+ # subclass that implements {#path}, {#sep} or {#type}. You might also
126
+ # need to register custom separators if {#sep} uses alternate separator
127
+ # tokens.
128
+ # @see Registry
129
+ # @see #path
130
+ # @see #[]=
131
+ # @see NamespaceObject
132
+ # @see NamespaceMapper.register_separator
133
+ class Base
134
+ # The files the object was defined in. To add a file, use {#add_file}.
135
+ # @return [Array<Array(String, Integer)>] a list of files
136
+ # @see #add_file
137
+ attr_reader :files
138
+
139
+ # The namespace the object is defined in. If the object is in the
140
+ # top level namespace, this is {Registry.root}
141
+ # @return [NamespaceObject] the namespace object
142
+ attr_reader :namespace
143
+
144
+ # The source code associated with the object
145
+ # @return [String, nil] source, if present, or nil
146
+ attr_reader :source
147
+
148
+ # Language of the source code associated with the object. Defaults to
149
+ # +:ruby+.
150
+ #
151
+ # @return [Symbol] the language type
152
+ attr_accessor :source_type
153
+
154
+ # The one line signature representing an object. For a method, this will
155
+ # be of the form "def meth(arguments...)". This is usually the first
156
+ # source line.
157
+ #
158
+ # @return [String] a line of source
159
+ attr_accessor :signature
160
+
161
+ # The non-localized documentation string associated with the object
162
+ # @return [Docstring] the documentation string
163
+ # @since 0.8.4
164
+ attr_reader :base_docstring
165
+ undef base_docstring
166
+ def base_docstring; @docstring end
167
+
168
+ # Marks whether or not the method is conditionally defined at runtime
169
+ # @return [Boolean] true if the method is conditionally defined at runtime
170
+ attr_accessor :dynamic
171
+
172
+ # @return [String] the group this object is associated with
173
+ # @since 0.6.0
174
+ attr_accessor :group
175
+
176
+ # Is the object defined conditionally at runtime?
177
+ # @see #dynamic
178
+ def dynamic?; @dynamic end
179
+
180
+ # @return [Symbol] the visibility of an object (:public, :private, :protected)
181
+ attr_accessor :visibility
182
+ undef visibility=
183
+ def visibility=(v) @visibility = v.to_sym end
184
+
185
+ class << self
186
+ # Allocates a new code object
187
+ # @return [Base]
188
+ # @see #initialize
189
+ def new(namespace, name, *args, &block)
190
+ raise ArgumentError, "invalid empty object name" if name.to_s.empty?
191
+ if namespace.is_a?(ConstantObject)
192
+ unless namespace.value =~ /\A#{NAMESPACEMATCH}\Z/
193
+ raise Parser::UndocumentableError, "constant mapping"
194
+ end
195
+
196
+ namespace = Proxy.new(namespace.namespace, namespace.value)
197
+ end
198
+
199
+ if name.to_s[0, 2] == NSEP
200
+ name = name.to_s[2..-1]
201
+ namespace = Registry.root
202
+ end
203
+
204
+ if name =~ /(?:#{NSEPQ})([^:]+)$/
205
+ return new(Proxy.new(namespace, $`), $1, *args, &block)
206
+ end
207
+
208
+ obj = super(namespace, name, *args)
209
+ existing_obj = Registry.at(obj.path)
210
+ obj = existing_obj if existing_obj && existing_obj.class == self
211
+ yield(obj) if block_given?
212
+ obj
213
+ end
214
+
215
+ # Compares the class with subclasses
216
+ #
217
+ # @param [Object] other the other object to compare classes with
218
+ # @return [Boolean] true if other is a subclass of self
219
+ def ===(other)
220
+ other.is_a?(self)
221
+ end
222
+ end
223
+
224
+ # Creates a new code object
225
+ #
226
+ # @example Create a method in the root namespace
227
+ # CodeObjects::Base.new(:root, '#method') # => #<yardoc method #method>
228
+ # @example Create class Z inside namespace X::Y
229
+ # CodeObjects::Base.new(P("X::Y"), :Z) # or
230
+ # CodeObjects::Base.new(Registry.root, "X::Y")
231
+ # @param [NamespaceObject, :root, nil] namespace the namespace the object belongs in,
232
+ # {Registry.root} or :root should be provided if it is associated with
233
+ # the top level namespace.
234
+ # @param [Symbol, String] name the name (or complex path) of the object.
235
+ # @yield [self] a block to perform any extra initialization on the object
236
+ # @yieldparam [Base] self the newly initialized code object
237
+ # @return [Base] the newly created object
238
+ def initialize(namespace, name, *)
239
+ if namespace && namespace != :root &&
240
+ !namespace.is_a?(NamespaceObject) && !namespace.is_a?(Proxy)
241
+ raise ArgumentError, "Invalid namespace object: #{namespace}"
242
+ end
243
+
244
+ @files = []
245
+ @current_file_has_comments = false
246
+ @name = name.to_sym
247
+ @source_type = :ruby
248
+ @visibility = :public
249
+ @tags = []
250
+ @docstrings = {}
251
+ @docstring = Docstring.new!('', [], self)
252
+ @namespace = nil
253
+ self.namespace = namespace
254
+ yield(self) if block_given?
255
+ end
256
+
257
+ # Copies all data in this object to another code object, except for
258
+ # uniquely identifying information (path, namespace, name, scope).
259
+ #
260
+ # @param [Base] other the object to copy data to
261
+ # @return [Base] the other object
262
+ # @since 0.8.0
263
+ def copy_to(other)
264
+ copyable_attributes.each do |ivar|
265
+ ivar = "@#{ivar}"
266
+ other.instance_variable_set(ivar, instance_variable_get(ivar))
267
+ end
268
+ other.docstring = @docstring.to_raw
269
+ other
270
+ end
271
+
272
+ # The name of the object
273
+ # @param [Boolean] prefix whether to show a prefix. Implement
274
+ # this in a subclass to define how the prefix is showed.
275
+ # @return [Symbol] if prefix is false, the symbolized name
276
+ # @return [String] if prefix is true, prefix + the name as a String.
277
+ # This must be implemented by the subclass.
278
+ def name(prefix = false)
279
+ prefix ? @name.to_s : (defined?(@name) && @name)
280
+ end
281
+
282
+ # Associates a file with a code object, optionally adding the line where it was defined.
283
+ # By convention, '<stdin>' should be used to associate code that comes form standard input.
284
+ #
285
+ # @param [String] file the filename ('<stdin>' for standard input)
286
+ # @param [Fixnum, nil] line the line number where the object lies in the file
287
+ # @param [Boolean] has_comments whether or not the definition has comments associated. This
288
+ # will allow {#file} to return the definition where the comments were made instead
289
+ # of any empty definitions that might have been parsed before (module namespaces for instance).
290
+ def add_file(file, line = nil, has_comments = false)
291
+ raise(ArgumentError, "file cannot be nil or empty") if file.nil? || file == ''
292
+ obj = [file.to_s, line]
293
+ return if files.include?(obj)
294
+ if has_comments && !@current_file_has_comments
295
+ @current_file_has_comments = true
296
+ @files.unshift(obj)
297
+ else
298
+ @files << obj # back of the line
299
+ end
300
+ end
301
+
302
+ # Returns the filename the object was first parsed at, taking
303
+ # definitions with docstrings first.
304
+ #
305
+ # @return [String] a filename
306
+ # @return [nil] if there is no file associated with the object
307
+ def file
308
+ @files.first ? @files.first[0] : nil
309
+ end
310
+
311
+ # Returns the line the object was first parsed at (or nil)
312
+ #
313
+ # @return [Fixnum] the line where the object was first defined.
314
+ # @return [nil] if there is no line associated with the object
315
+ def line
316
+ @files.first ? @files.first[1] : nil
317
+ end
318
+
319
+ # Tests if another object is equal to this, including a proxy
320
+ # @param [Base, Proxy] other if other is a {Proxy}, tests if
321
+ # the paths are equal
322
+ # @return [Boolean] whether or not the objects are considered the same
323
+ def equal?(other)
324
+ if other.is_a?(Base) || other.is_a?(Proxy)
325
+ path == other.path
326
+ else
327
+ super
328
+ end
329
+ end
330
+ alias == equal?
331
+ alias eql? equal?
332
+
333
+ # @return [Integer] the object's hash value (for equality checking)
334
+ def hash; path.hash end
335
+
336
+ # @return [nil] this object does not turn into an array
337
+ def to_ary; nil end
338
+
339
+ # Accesses a custom attribute on the object
340
+ # @param [#to_s] key the name of the custom attribute
341
+ # @return [Object, nil] the custom attribute or nil if not found.
342
+ # @see #[]=
343
+ def [](key)
344
+ if respond_to?(key)
345
+ send(key)
346
+ elsif instance_variable_defined?("@#{key}")
347
+ instance_variable_get("@#{key}")
348
+ end
349
+ end
350
+
351
+ # Sets a custom attribute on the object
352
+ # @param [#to_s] key the name of the custom attribute
353
+ # @param [Object] value the value to associate
354
+ # @return [void]
355
+ # @see #[]
356
+ def []=(key, value)
357
+ if respond_to?("#{key}=")
358
+ send("#{key}=", value)
359
+ else
360
+ instance_variable_set("@#{key}", value)
361
+ end
362
+ end
363
+
364
+ # @overload dynamic_attr_name
365
+ # @return the value of attribute named by the method attribute name
366
+ # @raise [NoMethodError] if no method or custom attribute exists by
367
+ # the attribute name
368
+ # @see #[]
369
+ # @overload dynamic_attr_name=(value)
370
+ # @param value a value to set
371
+ # @return +value+
372
+ # @see #[]=
373
+ def method_missing(meth, *args, &block)
374
+ if meth.to_s =~ /=$/
375
+ self[meth.to_s[0..-2]] = args.first
376
+ elsif instance_variable_get("@#{meth}")
377
+ self[meth]
378
+ else
379
+ super
380
+ end
381
+ end
382
+
383
+ # Attaches source code to a code object with an optional file location
384
+ #
385
+ # @param [#source, String] statement
386
+ # the +Parser::Statement+ holding the source code or the raw source
387
+ # as a +String+ for the definition of the code object only (not the block)
388
+ def source=(statement)
389
+ if statement.respond_to?(:source)
390
+ @source = format_source(statement.source.strip)
391
+ else
392
+ @source = format_source(statement.to_s)
393
+ end
394
+
395
+ if statement.respond_to?(:signature)
396
+ self.signature = statement.signature
397
+ end
398
+ end
399
+
400
+ # The documentation string associated with the object
401
+ #
402
+ # @param [String, I18n::Locale] locale (I18n::Locale.default)
403
+ # the locale of the documentation string.
404
+ # @return [Docstring] the documentation string
405
+ def docstring(locale = I18n::Locale.default)
406
+ if locale.nil?
407
+ @docstring.resolve_reference
408
+ return @docstring
409
+ end
410
+
411
+ if locale.is_a?(String)
412
+ locale_name = locale
413
+ locale = nil
414
+ else
415
+ locale_name = locale.name
416
+ end
417
+ @docstrings[locale_name] ||=
418
+ translate_docstring(locale || Registry.locale(locale_name))
419
+ end
420
+
421
+ # Attaches a docstring to a code object by parsing the comments attached to the statement
422
+ # and filling the {#tags} and {#docstring} methods with the parsed information.
423
+ #
424
+ # @param [String, Array<String>, Docstring] comments
425
+ # the comments attached to the code object to be parsed
426
+ # into a docstring and meta tags.
427
+ def docstring=(comments)
428
+ @docstrings.clear
429
+ @docstring = Docstring === comments ?
430
+ comments : Docstring.new(comments, self)
431
+ end
432
+
433
+ # Default type is the lowercase class name without the "Object" suffix.
434
+ # Override this method to provide a custom object type
435
+ #
436
+ # @return [Symbol] the type of code object this represents
437
+ def type
438
+ obj_name = self.class.name.split('::').last
439
+ obj_name.gsub!(/Object$/, '')
440
+ obj_name.downcase!
441
+ obj_name.to_sym
442
+ end
443
+
444
+ # Represents the unique path of the object. The default implementation
445
+ # joins the path of {#namespace} with {#name} via the value of {#sep}.
446
+ # Custom code objects should ensure that the path is unique to the code
447
+ # object by either overriding {#sep} or this method.
448
+ #
449
+ # @example The path of an instance method
450
+ # MethodObject.new(P("A::B"), :c).path # => "A::B#c"
451
+ # @return [String] the unique path of the object
452
+ # @see #sep
453
+ def path
454
+ @path ||= if parent && !parent.root?
455
+ [parent.path, name.to_s].join(sep)
456
+ else
457
+ name.to_s
458
+ end
459
+ end
460
+ alias to_s path
461
+
462
+ # @note
463
+ # Override this method if your object has a special title that does
464
+ # not match the {#path} attribute value. This title will be used
465
+ # when linking or displaying the object.
466
+ # @return [String] the display title for an object
467
+ # @see 0.8.4
468
+ def title
469
+ path
470
+ end
471
+
472
+ # @param [Base, String] other another code object (or object path)
473
+ # @return [String] the shortest relative path from this object to +other+
474
+ # @since 0.5.3
475
+ def relative_path(other)
476
+ other = Registry.at(other) if String === other && Registry.at(other)
477
+ same_parent = false
478
+ if other.respond_to?(:path)
479
+ same_parent = other.parent == parent
480
+ other = other.path
481
+ end
482
+ return other unless namespace
483
+ common = [path, other].join(" ").match(/^(\S*)\S*(?: \1\S*)*$/)[1]
484
+ common = path unless common =~ /(\.|::|#)$/
485
+ common = common.sub(/(\.|::|#)[^:#\.]*?$/, '') if same_parent
486
+ suffix = %w(. :).include?(common[-1, 1]) || other[common.size, 1] == '#' ?
487
+ '' : '(::|\.)'
488
+ result = other.sub(/^#{Regexp.quote common}#{suffix}/, '')
489
+ result.empty? ? other : result
490
+ end
491
+
492
+ # Renders the object using the {Templates::Engine templating system}.
493
+ #
494
+ # @example Formats a class in plaintext
495
+ # puts P('MyClass').format
496
+ # @example Formats a method in html with rdoc markup
497
+ # puts P('MyClass#meth').format(:format => :html, :markup => :rdoc)
498
+ # @param [Hash] options a set of options to pass to the template
499
+ # @option options [Symbol] :format (:text) :html, :text or another output format
500
+ # @option options [Symbol] :template (:default) a specific template to use
501
+ # @option options [Symbol] :markup (nil) the markup type (:rdoc, :markdown, :textile)
502
+ # @option options [Serializers::Base] :serializer (nil) see Serializers
503
+ # @return [String] the rendered template
504
+ # @see Templates::Engine#render
505
+ def format(options = {})
506
+ options = options.merge(:object => self)
507
+ options = options.merge(:type => type) unless options[:type]
508
+ Templates::Engine.render(options)
509
+ end
510
+
511
+ # Inspects the object, returning the type and path
512
+ # @return [String] a string describing the object
513
+ def inspect
514
+ "#<yardoc #{type} #{path}>"
515
+ end
516
+
517
+ # Sets the namespace the object is defined in.
518
+ #
519
+ # @param [NamespaceObject, :root, nil] obj the new namespace (:root
520
+ # for {Registry.root}). If obj is nil, the object is unregistered
521
+ # from the Registry.
522
+ def namespace=(obj)
523
+ if @namespace
524
+ @namespace.children.delete(self)
525
+ Registry.delete(self)
526
+ end
527
+
528
+ @namespace = (obj == :root ? Registry.root : obj)
529
+
530
+ if @namespace
531
+ reg_obj = Registry.at(path)
532
+ return if reg_obj && reg_obj.class == self.class
533
+
534
+ unless @namespace.is_a?(Proxy)
535
+ # remove prior objects from obj's children that match this one
536
+ @namespace.children.delete_if {|o| o.path == path }
537
+ @namespace.children << self
538
+ end
539
+ Registry.register(self)
540
+ end
541
+ end
542
+
543
+ alias parent namespace
544
+ alias parent= namespace=
545
+
546
+ # Gets a tag from the {#docstring}
547
+ # @see Docstring#tag
548
+ def tag(name); docstring.tag(name) end
549
+
550
+ # Gets a list of tags from the {#docstring}
551
+ # @see Docstring#tags
552
+ def tags(name = nil); docstring.tags(name) end
553
+
554
+ # Tests if the {#docstring} has a tag
555
+ # @see Docstring#has_tag?
556
+ def has_tag?(name); docstring.has_tag?(name) end
557
+
558
+ # Add tags to the {#docstring}
559
+ # @see Docstring#add_tag
560
+ # @since 0.8.4
561
+ def add_tag(*tags)
562
+ @docstrings.clear
563
+ @docstring.add_tag(*tags)
564
+ end
565
+
566
+ # @return whether or not this object is a RootObject
567
+ def root?; false end
568
+
569
+ # Override this method with a custom component separator. For instance,
570
+ # {MethodObject} implements sep as '#' or '.' (depending on if the
571
+ # method is instance or class respectively). {#path} depends on this
572
+ # value to generate the full path in the form: namespace.path + sep + name
573
+ #
574
+ # @return [String] the component that separates the namespace path
575
+ # and the name (default is {NSEP})
576
+ def sep; NSEP end
577
+
578
+ protected
579
+
580
+ # Override this method if your code object subclass does not allow
581
+ # copying of certain attributes.
582
+ #
583
+ # @return [Array<String>] the list of instance variable names (without
584
+ # "@" prefix) that should be copied when {#copy_to} is called
585
+ # @see #copy_to
586
+ # @since 0.8.0
587
+ def copyable_attributes
588
+ vars = instance_variables.map {|ivar| ivar.to_s[1..-1] }
589
+ vars -= %w(docstring docstrings namespace name path)
590
+ vars
591
+ end
592
+
593
+ private
594
+
595
+ # Formats source code by removing leading indentation
596
+ #
597
+ # @param [String] source the source code to format
598
+ # @return [String] formatted source
599
+ def format_source(source)
600
+ source = source.chomp
601
+ last = source.split(/\r?\n/).last
602
+ indent = last ? last[/^([ \t]*)/, 1].length : 0
603
+ source.gsub(/^[ \t]{#{indent}}/, '')
604
+ end
605
+
606
+ def translate_docstring(locale)
607
+ @docstring.resolve_reference
608
+ return @docstring if locale.nil?
609
+
610
+ text = I18n::Text.new(@docstring)
611
+ localized_text = text.translate(locale)
612
+ docstring = Docstring.new(localized_text, self)
613
+ @docstring.tags.each do |tag|
614
+ if tag.is_a?(Tags::Tag)
615
+ localized_tag = tag.clone
616
+ localized_tag.text = I18n::Text.new(tag.text).translate(locale)
617
+ docstring.add_tag(localized_tag)
618
+ else
619
+ docstring.add_tag(tag)
620
+ end
621
+ end
622
+ docstring
623
+ end
624
+ end
625
+ end
626
+ end