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,559 @@
1
+ # frozen_string_literal: true
2
+ module YARD
3
+ module Parser
4
+ module Ruby
5
+ # Builds and s-expression by creating {AstNode} objects with
6
+ # the type provided by the first argument.
7
+ #
8
+ # @example An implicit list of keywords
9
+ # ast = s(s(:kw, "if"), s(:kw, "else"))
10
+ # ast.type # => :list
11
+ # @example A method call
12
+ # s(:command, s(:var_ref, "mymethod"))
13
+ #
14
+ # @overload s(*nodes, opts = {})
15
+ # @param [Array<AstNode>] nodes a list of nodes.
16
+ # @param [Hash] opts any extra options (docstring, file, source) to
17
+ # set on the object
18
+ # @return [AstNode] an implicit node where node.type == +:list+
19
+ # @overload s(type, *children, opts = {})
20
+ # @param [Symbol] type the node type
21
+ # @param [Array<AstNode>] children any child nodes inside this one
22
+ # @param [Hash] opts any extra options to set on the object
23
+ # @return [AstNode] a node of type +type+.
24
+ # @see AstNode#initialize
25
+ def s(*args)
26
+ type = Symbol === args.first ? args.shift : :list
27
+ opts = Hash === args.last ? args.pop : {}
28
+ AstNode.node_class_for(type).new(type, args, opts)
29
+ end
30
+
31
+ # An AST node is characterized by a type and a list of children. It
32
+ # is most easily represented by the s-expression {#s} such as:
33
+ # # AST for "if true; 5 end":
34
+ # s(s(:if, s(:var_ref, s(:kw, "true")), s(s(:int, "5")), nil))
35
+ #
36
+ # The node type is not considered part of the list, only its children.
37
+ # So +ast[0]+ does not refer to the type, but rather the first child
38
+ # (or object). Items that are not +AstNode+ objects can be part of the
39
+ # list, like Strings or Symbols representing names. To return only
40
+ # the AstNode children of the node, use {#children}.
41
+ class AstNode < Array
42
+ attr_accessor :docstring_hash_flag
43
+ attr_accessor :docstring, :docstring_range, :source
44
+
45
+ # @deprecated Groups are now defined by directives
46
+ # @see Tags::GroupDirective
47
+ attr_accessor :group
48
+
49
+ attr_writer :source_range, :line_range, :file, :full_source
50
+ alias comments docstring
51
+ alias comments_range docstring_range
52
+ alias comments_hash_flag docstring_hash_flag
53
+ alias to_s source
54
+
55
+ # @return [Symbol] the node's unique symbolic type
56
+ attr_accessor :type
57
+
58
+ # @return [AstNode, nil] the node's parent or nil if it is a root node.
59
+ attr_accessor :parent
60
+
61
+ # @return [Range] the character range in {#full_source} represented
62
+ # by the node
63
+ def source_range
64
+ reset_line_info unless @source_range
65
+ @source_range
66
+ end
67
+
68
+ # @return [Range] the line range in {#full_source} represented
69
+ # by the node
70
+ def line_range
71
+ reset_line_info unless @line_range
72
+ @line_range
73
+ end
74
+
75
+ # @return [String] the filename the node was parsed from
76
+ def file
77
+ return parent.file if parent
78
+ @file
79
+ end
80
+
81
+ # @return [String] the full source that the node was parsed from
82
+ def full_source
83
+ return parent.full_source if parent
84
+ return @full_source if @full_source
85
+ return IO.read(@file) if file && File.exist?(file)
86
+ end
87
+
88
+ # @return [String] the parse of {#full_source} that the node represents
89
+ def source
90
+ return parent.full_source[source_range] if parent
91
+ full_source
92
+ end
93
+
94
+ # List of all known keywords
95
+ # @return [Hash]
96
+ KEYWORDS = {:class => true, :alias => true, :lambda => true, :do_block => true,
97
+ :def => true, :defs => true, :begin => true, :rescue => true, :rescue_mod => true,
98
+ :if => true, :if_mod => true, :else => true, :elsif => true, :case => true,
99
+ :when => true, :next => true, :break => true, :retry => true, :redo => true,
100
+ :return => true, :throw => true, :catch => true, :until => true, :until_mod => true,
101
+ :while => true, :while_mod => true, :yield => true, :yield0 => true, :zsuper => true,
102
+ :unless => true, :unless_mod => true, :for => true, :super => true, :return0 => true}
103
+
104
+ # @group Creating an AstNode
105
+
106
+ # Finds the node subclass that should be instantiated for a specific
107
+ # node type
108
+ #
109
+ # @param [Symbol] type the node type to find a subclass for
110
+ # @return [Class] a subclass of AstNode to instantiate the node with.
111
+ def self.node_class_for(type)
112
+ case type
113
+ when :params
114
+ ParameterNode
115
+ when :call, :fcall, :vcall, :command, :command_call
116
+ MethodCallNode
117
+ when :if, :elsif, :if_mod, :unless, :unless_mod
118
+ ConditionalNode
119
+ when :for, :while, :while_mod, :until, :until_mod
120
+ LoopNode
121
+ when :def, :defs
122
+ MethodDefinitionNode
123
+ when :class, :sclass
124
+ ClassNode
125
+ when :module
126
+ ModuleNode
127
+ else
128
+ if type.to_s =~ /_ref\Z/
129
+ ReferenceNode
130
+ elsif type.to_s =~ /_literal\Z/
131
+ LiteralNode
132
+ elsif KEYWORDS.key?(type)
133
+ KeywordNode
134
+ else
135
+ AstNode
136
+ end
137
+ end
138
+ end
139
+
140
+ # Creates a new AST node
141
+ #
142
+ # @param [Symbol] type the type of node being created
143
+ # @param [Array<AstNode>] arr the child nodes
144
+ # @param [Hash] opts any extra line options
145
+ # @option opts [Fixnum] :line (nil) the line the node starts on in source
146
+ # @option opts [String] :char (nil) the character number the node starts on
147
+ # in source
148
+ # @option opts [Fixnum] :listline (nil) a special key like :line but for
149
+ # list nodes
150
+ # @option opts [Fixnum] :listchar (nil) a special key like :char but for
151
+ # list nodes
152
+ # @option opts [Boolean] :token (nil) whether the node represents a token
153
+ def initialize(type, arr, opts = {})
154
+ super(arr)
155
+ self.type = type
156
+ self.line_range = opts[:line]
157
+ self.source_range = opts[:char]
158
+ @fallback_line = opts[:listline]
159
+ @fallback_source = opts[:listchar]
160
+ @token = true if opts[:token]
161
+ @docstring = nil
162
+ end
163
+
164
+ # @return [Boolean] whether the node is equal to another by checking
165
+ # the list and type
166
+ # @private
167
+ def ==(other)
168
+ super && type == other.type
169
+ end
170
+
171
+ # @group Traversing a Node
172
+
173
+ # Searches through the node and all descendants and returns the
174
+ # first node with a type matching any of +node_types+, otherwise
175
+ # returns the original node (self).
176
+ #
177
+ # @example Returns the first method definition in a block of code
178
+ # ast = YARD.parse_string("if true; def x; end end").ast
179
+ # ast.jump(:def)
180
+ # # => s(:def, s(:ident, "x"), s(:params, nil, nil, nil, nil,
181
+ # # nil), s(s(:void_stmt, )))
182
+ # @example Returns first 'def' or 'class' statement
183
+ # ast = YARD.parse_string("class X; def y; end end")
184
+ # ast.jump(:def, :class).first
185
+ # # =>
186
+ # @example If the node types are not present in the AST
187
+ # ast = YARD.parse("def x; end")
188
+ # ast.jump(:def)
189
+ #
190
+ # @param [Array<Symbol>] node_types a set of node types to match
191
+ # @return [AstNode] the matching node, if one was found
192
+ # @return [self] if no node was found
193
+ def jump(*node_types)
194
+ traverse {|child| return(child) if node_types.include?(child.type) }
195
+ self
196
+ end
197
+
198
+ # @return [Array<AstNode>] the {AstNode} children inside the node
199
+ def children
200
+ @children ||= select {|e| AstNode === e }
201
+ end
202
+
203
+ # Traverses the object and yields each node (including descendants) in order.
204
+ #
205
+ # @yield each descendant node in order
206
+ # @yieldparam [AstNode] self, or a child/descendant node
207
+ # @return [void]
208
+ def traverse
209
+ nodes = [self]
210
+ until nodes.empty?
211
+ node = nodes.pop
212
+ yield node
213
+ nodes += node.children.reverse unless node.children.empty?
214
+ end
215
+ end
216
+
217
+ # @group Node Meta Types
218
+
219
+ # @return [Boolean] whether the node is a token
220
+ def token?
221
+ @token
222
+ end
223
+
224
+ # @return [Boolean] whether the node is a reference (variable,
225
+ # constant name)
226
+ def ref?
227
+ false
228
+ end
229
+
230
+ # @return [Boolean] whether the node is a literal value
231
+ def literal?
232
+ false
233
+ end
234
+
235
+ # @return [Boolean] whether the node is a keyword
236
+ def kw?
237
+ false
238
+ end
239
+
240
+ # @return [Boolean] whether the node is a method call
241
+ def call?
242
+ false
243
+ end
244
+
245
+ # @return [Boolean] whether the node is a method definition
246
+ def def?
247
+ false
248
+ end
249
+
250
+ # @return [Boolean] whether the node is a if/elsif/else condition
251
+ def condition?
252
+ false
253
+ end
254
+
255
+ # @return [Boolean] whether the node is a loop
256
+ def loop?
257
+ false
258
+ end
259
+
260
+ # @return [Boolean] whether the node has a block
261
+ def block?
262
+ respond_to?(:block) || condition?
263
+ end
264
+
265
+ # @group Getting Line Information
266
+
267
+ # @return [Boolean] whether the node has a {#line_range} set
268
+ def has_line?
269
+ @line_range ? true : false
270
+ end
271
+
272
+ # @return [Fixnum] the starting line number of the node
273
+ def line
274
+ line_range && (line_range.begin || line_range.end)
275
+ end
276
+
277
+ # @return [String] the first line of source represented by the node.
278
+ def first_line
279
+ full_source.split(/\r?\n/)[line - 1].strip
280
+ end
281
+
282
+ # @group Printing a Node
283
+
284
+ # @return [String] the first line of source the node represents
285
+ def show
286
+ "\t#{line}: #{first_line}"
287
+ end
288
+
289
+ # @return [nil] pretty prints the node
290
+ def pretty_print(q)
291
+ objs = dup + [:__last__]
292
+ objs.unshift(type) if type && type != :list
293
+
294
+ options = []
295
+ options << ['docstring', docstring] if @docstring
296
+ if @source_range || @line_range
297
+ options << ['line', line_range]
298
+ options << ['source', source_range]
299
+ end
300
+ objs.pop if options.empty?
301
+
302
+ q.group(3, 's(', ')') do
303
+ q.seplist(objs, nil, :each) do |v|
304
+ if v == :__last__
305
+ q.seplist(options, nil, :each) do |arr|
306
+ k, v2 = *arr
307
+ q.group(3) do
308
+ q.text k
309
+ q.group(3) do
310
+ q.text ': '
311
+ q.pp v2
312
+ end
313
+ end
314
+ end
315
+ else
316
+ q.pp v
317
+ end
318
+ end
319
+ end
320
+ end
321
+
322
+ # @return [String] inspects the object
323
+ def inspect
324
+ typeinfo = type && type != :list ? ':' + type.to_s + ', ' : ''
325
+ 's(' + typeinfo + map(&:inspect).join(", ") + ')'
326
+ end
327
+
328
+ # @group Managing node state
329
+
330
+ # Resets node state in tree
331
+ def unfreeze
332
+ @children = nil
333
+ end
334
+
335
+ # @endgroup
336
+
337
+ private
338
+
339
+ # Resets line information
340
+ # @return [void]
341
+ def reset_line_info
342
+ if size == 0
343
+ self.line_range = @fallback_line
344
+ self.source_range = @fallback_source
345
+ elsif !children.empty?
346
+ f = children.first
347
+ l = children.last
348
+ self.line_range = Range.new(f.line_range.begin, l.line_range.end)
349
+ self.source_range = Range.new(f.source_range.begin, l.source_range.end)
350
+ elsif @fallback_line || @fallback_source
351
+ self.line_range = @fallback_line
352
+ self.source_range = @fallback_source
353
+ else
354
+ self.line_range = 0...0
355
+ self.source_range = 0...0
356
+ end
357
+ end
358
+ end
359
+
360
+ class ReferenceNode < AstNode
361
+ def ref?; true end
362
+
363
+ def path
364
+ Array.new flatten
365
+ end
366
+
367
+ def namespace
368
+ Array.new flatten[0...-1]
369
+ end
370
+ end
371
+
372
+ class LiteralNode < AstNode
373
+ def literal?; true end
374
+ end
375
+
376
+ class KeywordNode < AstNode
377
+ def kw?; true end
378
+ end
379
+
380
+ class ParameterNode < AstNode
381
+ def unnamed_required_params
382
+ self[0]
383
+ end
384
+
385
+ def unnamed_optional_params
386
+ return @unnamed_optional_params if defined?(@unnamed_optional_params)
387
+
388
+ params = self[1] || []
389
+ if self[-3] && self[-3][0] && self[-3][0].type == :unnamed_optional_arg
390
+ params += self[-3]
391
+ end
392
+
393
+ @unnamed_optional_params = params.empty? ? nil : params
394
+ end
395
+
396
+ def named_params
397
+ return @named_params if defined?(@named_params)
398
+
399
+ if YARD.ruby2? && self[-3] && self[-3][0] && self[-3][0].type == :named_arg
400
+ @named_params = self[-3]
401
+ else
402
+ @named_params = nil
403
+ end
404
+ end
405
+
406
+ def splat_param
407
+ self[2] ? self[2][0] : nil
408
+ end
409
+
410
+ def unnamed_end_params
411
+ self[3]
412
+ end
413
+
414
+ def double_splat_param
415
+ return nil unless YARD.ruby2?
416
+ if (node = self[-2]).is_a?(AstNode)
417
+ if node.type == :ident
418
+ node
419
+ elsif node.type == :kwrest_param
420
+ # See https://bugs.ruby-lang.org/issues/12387
421
+ node.last
422
+ end
423
+ end
424
+ end
425
+
426
+ def block_param
427
+ self[-1] ? self[-1][0] : nil
428
+ end
429
+
430
+ def args_forward
431
+ # shape is (required, optional, rest, more, keyword, keyword_rest, block)
432
+ # Ruby 3.1 moves :args_forward from rest to keyword_rest
433
+ args_index = YARD.ruby31? ? -2 : 2
434
+ node = self[args_index]
435
+ node.is_a?(AstNode) && node.type == :args_forward
436
+ end
437
+ end
438
+
439
+ class MethodCallNode < AstNode
440
+ def call?; true end
441
+ def namespace; first if index_adjust > 0 end
442
+
443
+ def method_name(name_only = false)
444
+ name = self[index_adjust]
445
+ if name == :call
446
+ nil
447
+ elsif name_only && Array === name
448
+ name.jump(:ident).first.to_sym
449
+ else
450
+ name
451
+ end
452
+ end
453
+
454
+ def parameters(include_block_param = true)
455
+ return [] if type == :vcall
456
+ params = self[1 + index_adjust]
457
+ return [] unless params
458
+ params = call_has_paren? ? params.first : params
459
+ return [] unless params
460
+ include_block_param ? params : params[0...-1]
461
+ end
462
+
463
+ def block_param; parameters.last end
464
+
465
+ def block
466
+ last.type == :do_block || last.type == :brace_block ? last : nil
467
+ end
468
+
469
+ private
470
+
471
+ def index_adjust
472
+ [:call, :command_call].include?(type) ? 2 : 0
473
+ end
474
+
475
+ def call_has_paren?
476
+ [:fcall, :call].include?(type)
477
+ end
478
+ end
479
+
480
+ class MethodDefinitionNode < AstNode
481
+ def kw?; true end
482
+ def def?; true end
483
+ def namespace; first if index_adjust > 0 end
484
+
485
+ def method_name(name_only = false)
486
+ name = self[index_adjust]
487
+ name_only ? name.jump(:ident).first.to_sym : name
488
+ end
489
+
490
+ def parameters(include_block_param = true)
491
+ return unless params = self[1 + index_adjust]
492
+ params = params[0] if params.type == :paren
493
+ include_block_param ? params : params[0...-1]
494
+ end
495
+
496
+ def signature
497
+ params_src = ''
498
+ params = self[1 + index_adjust]
499
+ if params and params.first
500
+ params_src = params.type == :paren ? '' : ' '
501
+ params_src += params.source.gsub(/\s+(\s|\))/m, '\1')
502
+ end
503
+
504
+ "def #{method_name(true)}#{params_src}"
505
+ end
506
+
507
+ alias block last
508
+
509
+ private
510
+
511
+ def index_adjust
512
+ type == :defs ? 2 : 0
513
+ end
514
+ end
515
+
516
+ class ConditionalNode < KeywordNode
517
+ def condition?; true end
518
+ def condition; first end
519
+ def then_block; self[1] end
520
+
521
+ def else_block
522
+ return unless self[2] && !cmod?
523
+ self[2].type == :elsif ? self[2] : self[2][0]
524
+ end
525
+
526
+ private
527
+
528
+ def cmod?; type =~ /_mod$/ end
529
+ end
530
+
531
+ class ClassNode < KeywordNode
532
+ def class_name; first end
533
+ def superclass; type == :sclass ? nil : self[1] end
534
+ def block; last end
535
+ end
536
+
537
+ class ModuleNode < KeywordNode
538
+ def module_name; first end
539
+ def block; last end
540
+ end
541
+
542
+ class LoopNode < KeywordNode
543
+ def loop?; true end
544
+ def condition; type == :for ? s(self[0], self[1]) : first end
545
+ def block; last end
546
+ end
547
+
548
+ # Represents a lone comment block in source
549
+ class CommentNode < AstNode
550
+ def docstring; first end
551
+ def docstring=(value) end
552
+ alias comments docstring
553
+
554
+ def source; "" end
555
+ def first_line; "" end
556
+ end
557
+ end
558
+ end
559
+ end