docspring 3.0.0 → 3.1.0

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 (523) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/Gemfile.lock +4 -4
  4. data/README.md +11 -5
  5. data/docs/CreateHtmlSubmissionData.md +3 -1
  6. data/docs/CreatePdfSubmissionData.md +3 -1
  7. data/docs/PDFApi.md +156 -10
  8. data/docs/PublishVersionData.md +20 -0
  9. data/docs/RestoreVersionData.md +18 -0
  10. data/docs/Submission.md +4 -0
  11. data/docs/SubmissionPreview.md +4 -0
  12. data/docs/Template.md +15 -1
  13. data/docs/TemplateDeleteResponse.md +24 -0
  14. data/docs/TemplatePreview.md +13 -1
  15. data/docs/TemplatePublishVersionResponse.md +22 -0
  16. data/lib/docspring/api/pdf_api.rb +152 -5
  17. data/lib/docspring/api_client.rb +1 -1
  18. data/lib/docspring/models/combined_submission_action.rb +1 -5
  19. data/lib/docspring/models/create_html_submission_data.rb +13 -4
  20. data/lib/docspring/models/create_pdf_submission_data.rb +13 -4
  21. data/lib/docspring/models/publish_version_data.rb +230 -0
  22. data/lib/docspring/models/restore_version_data.rb +221 -0
  23. data/lib/docspring/models/submission.rb +41 -1
  24. data/lib/docspring/models/submission_data_request_event.rb +1 -5
  25. data/lib/docspring/models/submission_preview.rb +41 -1
  26. data/lib/docspring/models/template.rb +106 -4
  27. data/lib/docspring/models/template_delete_response.rb +287 -0
  28. data/lib/docspring/models/template_preview.rb +88 -4
  29. data/lib/docspring/models/template_publish_version_response.rb +282 -0
  30. data/lib/docspring/version.rb +1 -1
  31. data/lib/docspring.rb +4 -0
  32. data/spec/api/pdf_api_spec.rb +27 -2
  33. data/spec/models/create_html_submission_data_spec.rb +6 -0
  34. data/spec/models/create_pdf_submission_data_spec.rb +6 -0
  35. data/spec/models/publish_version_data_spec.rb +42 -0
  36. data/spec/models/restore_version_data_spec.rb +36 -0
  37. data/spec/models/submission_preview_spec.rb +16 -0
  38. data/spec/models/submission_spec.rb +16 -0
  39. data/spec/models/template_delete_response_spec.rb +58 -0
  40. data/spec/models/template_preview_spec.rb +40 -0
  41. data/spec/models/template_publish_version_response_spec.rb +52 -0
  42. data/spec/models/template_spec.rb +46 -0
  43. data/vendor/bundle/ruby/3.3.0/bin/irb +29 -0
  44. data/vendor/bundle/ruby/3.3.0/bin/rdbg +29 -0
  45. data/vendor/bundle/ruby/3.3.0/bin/rdoc +29 -0
  46. data/vendor/bundle/ruby/3.3.0/bin/ri +29 -0
  47. data/vendor/bundle/ruby/3.3.0/cache/ast-2.4.3.gem +0 -0
  48. data/vendor/bundle/ruby/3.3.0/cache/debug-1.10.0.gem +0 -0
  49. data/vendor/bundle/ruby/3.3.0/cache/io-console-0.8.0.gem +0 -0
  50. data/vendor/bundle/ruby/3.3.0/cache/irb-1.15.1.gem +0 -0
  51. data/vendor/bundle/ruby/3.3.0/cache/parser-3.3.7.2.gem +0 -0
  52. data/vendor/bundle/ruby/3.3.0/cache/pp-0.6.2.gem +0 -0
  53. data/vendor/bundle/ruby/3.3.0/cache/prettyprint-0.2.0.gem +0 -0
  54. data/vendor/bundle/ruby/3.3.0/cache/rdoc-6.12.0.gem +0 -0
  55. data/vendor/bundle/ruby/3.3.0/cache/reline-0.6.0.gem +0 -0
  56. data/vendor/bundle/ruby/3.3.0/extensions/arm64-darwin-24/3.3.0/debug-1.10.0/debug/debug.bundle +0 -0
  57. data/vendor/bundle/ruby/3.3.0/extensions/arm64-darwin-24/3.3.0/debug-1.10.0/gem.build_complete +0 -0
  58. data/vendor/bundle/ruby/3.3.0/extensions/arm64-darwin-24/3.3.0/debug-1.10.0/gem_make.out +19 -0
  59. data/vendor/bundle/ruby/3.3.0/extensions/arm64-darwin-24/3.3.0/io-console-0.8.0/gem.build_complete +0 -0
  60. data/vendor/bundle/ruby/3.3.0/extensions/arm64-darwin-24/3.3.0/io-console-0.8.0/gem_make.out +31 -0
  61. data/vendor/bundle/ruby/3.3.0/extensions/arm64-darwin-24/3.3.0/io-console-0.8.0/io/console.bundle +0 -0
  62. data/vendor/bundle/ruby/3.3.0/extensions/arm64-darwin-24/3.3.0/io-console-0.8.0/mkmf.log +447 -0
  63. data/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/LICENSE.MIT +20 -0
  64. data/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/README.YARD.md +12 -0
  65. data/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast/node.rb +268 -0
  66. data/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast/processor/mixin.rb +288 -0
  67. data/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast/processor.rb +12 -0
  68. data/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast/sexp.rb +30 -0
  69. data/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast.rb +17 -0
  70. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/CONTRIBUTING.md +573 -0
  71. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/Gemfile +10 -0
  72. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/LICENSE.txt +22 -0
  73. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/README.md +970 -0
  74. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/Rakefile +57 -0
  75. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/TODO.md +23 -0
  76. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/debug.gemspec +33 -0
  77. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/exe/rdbg +53 -0
  78. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/ext/debug/Makefile +270 -0
  79. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/ext/debug/debug.c +228 -0
  80. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/ext/debug/debug_version.h +1 -0
  81. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/ext/debug/extconf.rb +27 -0
  82. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/ext/debug/iseq_collector.c +93 -0
  83. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/abbrev_command.rb +77 -0
  84. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/breakpoint.rb +556 -0
  85. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/client.rb +263 -0
  86. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/color.rb +123 -0
  87. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/config.rb +590 -0
  88. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/console.rb +213 -0
  89. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/dap_custom/traceInspector.rb +336 -0
  90. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/debug.bundle +0 -0
  91. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/frame_info.rb +188 -0
  92. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/irb_integration.rb +37 -0
  93. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/local.rb +115 -0
  94. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/open.rb +13 -0
  95. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/open_nonstop.rb +15 -0
  96. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/prelude.rb +50 -0
  97. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/server.rb +534 -0
  98. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/server_cdp.rb +1348 -0
  99. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/server_dap.rb +1108 -0
  100. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/session.rb +2659 -0
  101. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/source_repository.rb +150 -0
  102. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/start.rb +5 -0
  103. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/thread_client.rb +1455 -0
  104. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/tracer.rb +241 -0
  105. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug/version.rb +5 -0
  106. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/lib/debug.rb +9 -0
  107. data/vendor/bundle/ruby/3.3.0/gems/debug-1.10.0/misc/README.md.erb +636 -0
  108. data/vendor/bundle/ruby/3.3.0/gems/io-console-0.8.0/.document +5 -0
  109. data/vendor/bundle/ruby/3.3.0/gems/io-console-0.8.0/BSDL +22 -0
  110. data/vendor/bundle/ruby/3.3.0/gems/io-console-0.8.0/COPYING +56 -0
  111. data/vendor/bundle/ruby/3.3.0/gems/io-console-0.8.0/README.md +46 -0
  112. data/vendor/bundle/ruby/3.3.0/gems/io-console-0.8.0/ext/io/console/Makefile +272 -0
  113. data/vendor/bundle/ruby/3.3.0/gems/io-console-0.8.0/ext/io/console/console.c +1969 -0
  114. data/vendor/bundle/ruby/3.3.0/gems/io-console-0.8.0/ext/io/console/extconf.rb +61 -0
  115. data/vendor/bundle/ruby/3.3.0/gems/io-console-0.8.0/ext/io/console/win32_vk.inc +1390 -0
  116. data/vendor/bundle/ruby/3.3.0/gems/io-console-0.8.0/lib/io/console/size.rb +23 -0
  117. data/vendor/bundle/ruby/3.3.0/gems/io-console-0.8.0/lib/io/console.bundle +0 -0
  118. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/Gemfile +29 -0
  119. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/LICENSE.txt +22 -0
  120. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/README.md +125 -0
  121. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/Rakefile +52 -0
  122. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/bin/console +6 -0
  123. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/bin/setup +6 -0
  124. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/doc/irb/irb-tools.rd.ja +184 -0
  125. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/doc/irb/irb.rd.ja +425 -0
  126. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/exe/irb +9 -0
  127. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/irb.gemspec +46 -0
  128. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/cmd/nop.rb +4 -0
  129. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/color.rb +263 -0
  130. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/color_printer.rb +56 -0
  131. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/backtrace.rb +17 -0
  132. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/base.rb +60 -0
  133. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/break.rb +17 -0
  134. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/catch.rb +17 -0
  135. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/cd.rb +51 -0
  136. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/chws.rb +40 -0
  137. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/context.rb +16 -0
  138. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/continue.rb +17 -0
  139. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/copy.rb +73 -0
  140. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/debug.rb +73 -0
  141. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/delete.rb +17 -0
  142. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/disable_irb.rb +19 -0
  143. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/edit.rb +63 -0
  144. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/exit.rb +18 -0
  145. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/finish.rb +17 -0
  146. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/force_exit.rb +18 -0
  147. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/help.rb +83 -0
  148. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/history.rb +45 -0
  149. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/info.rb +17 -0
  150. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/internal_helpers.rb +27 -0
  151. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/irb_info.rb +33 -0
  152. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/load.rb +91 -0
  153. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/ls.rb +167 -0
  154. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/measure.rb +49 -0
  155. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/next.rb +17 -0
  156. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/pushws.rb +65 -0
  157. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/show_doc.rb +51 -0
  158. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/show_source.rb +74 -0
  159. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/step.rb +17 -0
  160. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/subirb.rb +123 -0
  161. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command/whereami.rb +23 -0
  162. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/command.rb +23 -0
  163. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/completion.rb +504 -0
  164. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/context.rb +751 -0
  165. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/debug/ui.rb +101 -0
  166. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/debug.rb +127 -0
  167. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/default_commands.rb +279 -0
  168. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/easter-egg.rb +152 -0
  169. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/ext/change-ws.rb +37 -0
  170. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/ext/eval_history.rb +149 -0
  171. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/ext/loader.rb +127 -0
  172. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/ext/multi-irb.rb +258 -0
  173. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/ext/tracer.rb +39 -0
  174. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/ext/use-loader.rb +67 -0
  175. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/ext/workspaces.rb +36 -0
  176. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/frame.rb +80 -0
  177. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/help.rb +28 -0
  178. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/helper_method/base.rb +16 -0
  179. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/helper_method/conf.rb +11 -0
  180. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/helper_method.rb +29 -0
  181. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/history.rb +116 -0
  182. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/init.rb +540 -0
  183. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/input-method.rb +515 -0
  184. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/inspector.rb +136 -0
  185. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/lc/error.rb +52 -0
  186. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/lc/help-message +55 -0
  187. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/lc/ja/error.rb +53 -0
  188. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/lc/ja/help-message +58 -0
  189. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/locale.rb +153 -0
  190. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/nesting_parser.rb +239 -0
  191. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/notifier.rb +230 -0
  192. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/output-method.rb +80 -0
  193. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/pager.rb +213 -0
  194. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/ruby-lex.rb +476 -0
  195. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/ruby_logo.aa +118 -0
  196. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/source_finder.rb +138 -0
  197. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/statement.rb +101 -0
  198. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/version.rb +11 -0
  199. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/workspace.rb +171 -0
  200. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/ws-for-case-2.rb +9 -0
  201. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb/xmp.rb +164 -0
  202. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/lib/irb.rb +736 -0
  203. data/vendor/bundle/ruby/3.3.0/gems/irb-1.15.1/man/irb.1 +292 -0
  204. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/LICENSE.txt +26 -0
  205. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/bin/ruby-parse +7 -0
  206. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/bin/ruby-rewrite +7 -0
  207. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/gauntlet_parser.rb +123 -0
  208. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/all.rb +17 -0
  209. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/ast/node.rb +40 -0
  210. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/ast/processor.rb +293 -0
  211. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/base.rb +291 -0
  212. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/builders/default.rb +2338 -0
  213. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/clobbering_error.rb +13 -0
  214. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/color.rb +32 -0
  215. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/context.rb +51 -0
  216. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/current.rb +137 -0
  217. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/current_arg_stack.rb +46 -0
  218. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/deprecation.rb +13 -0
  219. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/diagnostic/engine.rb +104 -0
  220. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/diagnostic.rb +163 -0
  221. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/lexer/dedenter.rb +88 -0
  222. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/lexer/explanation.rb +55 -0
  223. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/lexer/literal.rb +284 -0
  224. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/lexer/stack_state.rb +49 -0
  225. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/lexer-F0.rb +12922 -0
  226. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/lexer-F1.rb +14875 -0
  227. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/lexer-strings.rb +5424 -0
  228. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/macruby.rb +9634 -0
  229. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/max_numparam_stack.rb +56 -0
  230. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/messages.rb +125 -0
  231. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/meta.rb +48 -0
  232. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/rewriter.rb +105 -0
  233. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/ruby18.rb +9272 -0
  234. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/ruby19.rb +9558 -0
  235. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/ruby20.rb +10229 -0
  236. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/ruby21.rb +10203 -0
  237. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/ruby22.rb +10302 -0
  238. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/ruby23.rb +10322 -0
  239. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/ruby24.rb +10454 -0
  240. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/ruby25.rb +10374 -0
  241. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/ruby26.rb +10352 -0
  242. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/ruby27.rb +11947 -0
  243. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/ruby30.rb +12243 -0
  244. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/ruby31.rb +12716 -0
  245. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/ruby32.rb +12704 -0
  246. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/ruby33.rb +12589 -0
  247. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/ruby34.rb +12596 -0
  248. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/rubymotion.rb +9515 -0
  249. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/runner/ruby_parse.rb +157 -0
  250. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/runner/ruby_rewrite.rb +101 -0
  251. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/runner.rb +299 -0
  252. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/buffer.rb +369 -0
  253. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/comment/associator.rb +233 -0
  254. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/comment.rb +134 -0
  255. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/map/collection.rb +18 -0
  256. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/map/condition.rb +21 -0
  257. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/map/constant.rb +32 -0
  258. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/map/definition.rb +23 -0
  259. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/map/for.rb +19 -0
  260. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/map/heredoc.rb +19 -0
  261. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/map/index.rb +33 -0
  262. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/map/keyword.rb +20 -0
  263. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/map/method_definition.rb +25 -0
  264. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/map/objc_kwarg.rb +19 -0
  265. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/map/operator.rb +17 -0
  266. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/map/rescue_body.rb +21 -0
  267. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/map/send.rb +36 -0
  268. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/map/ternary.rb +18 -0
  269. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/map/variable.rb +31 -0
  270. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/map.rb +186 -0
  271. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/range.rb +326 -0
  272. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/rewriter/action.rb +44 -0
  273. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/rewriter.rb +513 -0
  274. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/tree_rewriter/action.rb +243 -0
  275. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/source/tree_rewriter.rb +431 -0
  276. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/static_environment.rb +134 -0
  277. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/syntax_error.rb +21 -0
  278. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/tree_rewriter.rb +133 -0
  279. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/unknown_encoding_in_magic_comment_error.rb +15 -0
  280. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/variables_stack.rb +36 -0
  281. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser/version.rb +5 -0
  282. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/lib/parser.rb +91 -0
  283. data/vendor/bundle/ruby/3.3.0/gems/parser-3.3.7.2/parser.gemspec +43 -0
  284. data/vendor/bundle/ruby/3.3.0/gems/pp-0.6.2/BSDL +22 -0
  285. data/vendor/bundle/ruby/3.3.0/gems/pp-0.6.2/COPYING +56 -0
  286. data/vendor/bundle/ruby/3.3.0/gems/pp-0.6.2/lib/pp.rb +699 -0
  287. data/vendor/bundle/ruby/3.3.0/gems/pp-0.6.2/pp.gemspec +35 -0
  288. data/vendor/bundle/ruby/3.3.0/gems/prettyprint-0.2.0/.github/dependabot.yml +6 -0
  289. data/vendor/bundle/ruby/3.3.0/gems/prettyprint-0.2.0/.github/workflows/test.yml +41 -0
  290. data/vendor/bundle/ruby/3.3.0/gems/prettyprint-0.2.0/.gitignore +8 -0
  291. data/vendor/bundle/ruby/3.3.0/gems/prettyprint-0.2.0/Gemfile +4 -0
  292. data/vendor/bundle/ruby/3.3.0/gems/prettyprint-0.2.0/LICENSE.txt +22 -0
  293. data/vendor/bundle/ruby/3.3.0/gems/prettyprint-0.2.0/README.md +43 -0
  294. data/vendor/bundle/ruby/3.3.0/gems/prettyprint-0.2.0/Rakefile +10 -0
  295. data/vendor/bundle/ruby/3.3.0/gems/prettyprint-0.2.0/bin/console +14 -0
  296. data/vendor/bundle/ruby/3.3.0/gems/prettyprint-0.2.0/bin/setup +8 -0
  297. data/vendor/bundle/ruby/3.3.0/gems/prettyprint-0.2.0/lib/prettyprint.rb +558 -0
  298. data/vendor/bundle/ruby/3.3.0/gems/prettyprint-0.2.0/prettyprint.gemspec +29 -0
  299. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/CONTRIBUTING.rdoc +219 -0
  300. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/CVE-2013-0256.rdoc +49 -0
  301. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/ExampleMarkdown.md +39 -0
  302. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/ExampleRDoc.rdoc +210 -0
  303. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/History.rdoc +1668 -0
  304. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/LEGAL.rdoc +50 -0
  305. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/LICENSE.rdoc +59 -0
  306. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/README.rdoc +142 -0
  307. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/RI.md +842 -0
  308. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/TODO.rdoc +60 -0
  309. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/exe/rdoc +43 -0
  310. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/exe/ri +12 -0
  311. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/alias.rb +111 -0
  312. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/anon_class.rb +10 -0
  313. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/any_method.rb +379 -0
  314. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/attr.rb +175 -0
  315. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/class_module.rb +871 -0
  316. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/constant.rb +186 -0
  317. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/context/section.rb +175 -0
  318. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/context.rb +1264 -0
  319. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/extend.rb +9 -0
  320. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/ghost_method.rb +6 -0
  321. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/include.rb +9 -0
  322. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/meta_method.rb +6 -0
  323. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/method_attr.rb +430 -0
  324. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/mixin.rb +120 -0
  325. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/normal_class.rb +92 -0
  326. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/normal_module.rb +73 -0
  327. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/require.rb +51 -0
  328. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/single_class.rb +30 -0
  329. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object/top_level.rb +291 -0
  330. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_object.rb +426 -0
  331. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/code_objects.rb +5 -0
  332. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/comment.rb +239 -0
  333. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/cross_reference.rb +228 -0
  334. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/encoding.rb +120 -0
  335. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/erb_partial.rb +18 -0
  336. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/erbio.rb +37 -0
  337. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/darkfish.rb +824 -0
  338. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/json_index.rb +300 -0
  339. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/markup.rb +159 -0
  340. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/pot/message_extractor.rb +68 -0
  341. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/pot/po.rb +84 -0
  342. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/pot/po_entry.rb +141 -0
  343. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/pot.rb +99 -0
  344. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/ri.rb +30 -0
  345. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/_footer.rhtml +5 -0
  346. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/_head.rhtml +43 -0
  347. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +19 -0
  348. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +34 -0
  349. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +15 -0
  350. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +9 -0
  351. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +15 -0
  352. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +15 -0
  353. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +21 -0
  354. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml +11 -0
  355. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +32 -0
  356. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +6 -0
  357. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +14 -0
  358. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +11 -0
  359. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +39 -0
  360. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
  361. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/class.rhtml +206 -0
  362. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/css/fonts.css +167 -0
  363. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/css/rdoc.css +668 -0
  364. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf +0 -0
  365. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf +0 -0
  366. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf +0 -0
  367. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf +0 -0
  368. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
  369. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
  370. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/add.png +0 -0
  371. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
  372. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
  373. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
  374. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
  375. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
  376. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
  377. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
  378. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
  379. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/delete.png +0 -0
  380. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
  381. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
  382. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
  383. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
  384. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
  385. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
  386. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
  387. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
  388. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
  389. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/tag_blue.png +0 -0
  390. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
  391. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/transparent.png +0 -0
  392. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
  393. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
  394. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
  395. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/index.rhtml +23 -0
  396. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/js/darkfish.js +120 -0
  397. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/js/search.js +110 -0
  398. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/page.rhtml +18 -0
  399. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +20 -0
  400. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +65 -0
  401. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +70 -0
  402. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/json_index/js/navigation.js +105 -0
  403. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator/template/json_index/js/searcher.js +229 -0
  404. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/generator.rb +51 -0
  405. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/i18n/locale.rb +102 -0
  406. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/i18n/text.rb +126 -0
  407. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/i18n.rb +10 -0
  408. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/known_classes.rb +74 -0
  409. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markdown/entities.rb +2131 -0
  410. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markdown/literals.kpeg +21 -0
  411. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markdown/literals.rb +454 -0
  412. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markdown.kpeg +1244 -0
  413. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markdown.rb +16793 -0
  414. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/attr_changer.rb +22 -0
  415. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/attr_span.rb +35 -0
  416. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/attribute_manager.rb +405 -0
  417. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/attributes.rb +70 -0
  418. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/blank_line.rb +27 -0
  419. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/block_quote.rb +14 -0
  420. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/document.rb +164 -0
  421. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/formatter.rb +272 -0
  422. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/hard_break.rb +31 -0
  423. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/heading.rb +78 -0
  424. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/include.rb +42 -0
  425. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/indented_paragraph.rb +47 -0
  426. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/list.rb +101 -0
  427. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/list_item.rb +99 -0
  428. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/paragraph.rb +28 -0
  429. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/parser.rb +585 -0
  430. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/pre_process.rb +318 -0
  431. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/raw.rb +69 -0
  432. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/regexp_handling.rb +40 -0
  433. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/rule.rb +20 -0
  434. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/table.rb +56 -0
  435. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/to_ansi.rb +93 -0
  436. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/to_bs.rb +102 -0
  437. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/to_html.rb +452 -0
  438. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/to_html_crossref.rb +226 -0
  439. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/to_html_snippet.rb +287 -0
  440. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/to_joined_paragraph.rb +46 -0
  441. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/to_label.rb +74 -0
  442. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/to_markdown.rb +191 -0
  443. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/to_rdoc.rb +352 -0
  444. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/to_table_of_contents.rb +88 -0
  445. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/to_test.rb +69 -0
  446. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/to_tt_only.rb +120 -0
  447. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup/verbatim.rb +83 -0
  448. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/markup.rb +240 -0
  449. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/options.rb +1397 -0
  450. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/parser/c.rb +1260 -0
  451. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/parser/changelog.rb +350 -0
  452. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/parser/markdown.rb +22 -0
  453. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/parser/prism_ruby.rb +1099 -0
  454. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/parser/rd.rb +22 -0
  455. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/parser/ripper_state_lex.rb +302 -0
  456. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/parser/ruby.rb +2381 -0
  457. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/parser/ruby_tools.rb +165 -0
  458. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/parser/simple.rb +61 -0
  459. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/parser/text.rb +11 -0
  460. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/parser.rb +297 -0
  461. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/rd/block_parser.rb +1706 -0
  462. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/rd/block_parser.ry +643 -0
  463. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/rd/inline.rb +71 -0
  464. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/rd/inline_parser.rb +1854 -0
  465. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/rd/inline_parser.ry +593 -0
  466. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/rd.rb +99 -0
  467. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/rdoc.rb +566 -0
  468. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/ri/driver.rb +1558 -0
  469. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/ri/formatter.rb +6 -0
  470. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/ri/paths.rb +171 -0
  471. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/ri/store.rb +6 -0
  472. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/ri/task.rb +71 -0
  473. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/ri.rb +20 -0
  474. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/rubygems_hook.rb +330 -0
  475. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/servlet.rb +451 -0
  476. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/stats/normal.rb +58 -0
  477. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/stats/quiet.rb +59 -0
  478. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/stats/verbose.rb +44 -0
  479. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/stats.rb +461 -0
  480. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/store.rb +1001 -0
  481. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/task.rb +354 -0
  482. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/text.rb +322 -0
  483. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/token_stream.rb +118 -0
  484. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/tom_doc.rb +257 -0
  485. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc/version.rb +10 -0
  486. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rdoc.rb +211 -0
  487. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/lib/rubygems_plugin.rb +23 -0
  488. data/vendor/bundle/ruby/3.3.0/gems/rdoc-6.12.0/man/ri.1 +247 -0
  489. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/BSDL +22 -0
  490. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/COPYING +56 -0
  491. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/README.md +94 -0
  492. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/config.rb +373 -0
  493. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/face.rb +199 -0
  494. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/history.rb +76 -0
  495. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/io/ansi.rb +325 -0
  496. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/io/dumb.rb +120 -0
  497. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/io/windows.rb +530 -0
  498. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/io.rb +55 -0
  499. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/key_actor/base.rb +37 -0
  500. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/key_actor/composite.rb +17 -0
  501. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/key_actor/emacs.rb +517 -0
  502. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/key_actor/vi_command.rb +518 -0
  503. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/key_actor/vi_insert.rb +517 -0
  504. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/key_actor.rb +8 -0
  505. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/key_stroke.rb +119 -0
  506. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/kill_ring.rb +125 -0
  507. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/line_editor.rb +2382 -0
  508. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/unicode/east_asian_width.rb +1267 -0
  509. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/unicode.rb +415 -0
  510. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline/version.rb +3 -0
  511. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/lib/reline.rb +519 -0
  512. data/vendor/bundle/ruby/3.3.0/gems/reline-0.6.0/license_of_rb-readline +25 -0
  513. data/vendor/bundle/ruby/3.3.0/plugins/rdoc_plugin.rb +1 -0
  514. data/vendor/bundle/ruby/3.3.0/specifications/ast-2.4.3.gemspec +29 -0
  515. data/vendor/bundle/ruby/3.3.0/specifications/debug-1.10.0.gemspec +32 -0
  516. data/vendor/bundle/ruby/3.3.0/specifications/io-console-0.8.0.gemspec +25 -0
  517. data/vendor/bundle/ruby/3.3.0/specifications/irb-1.15.1.gemspec +31 -0
  518. data/vendor/bundle/ruby/3.3.0/specifications/parser-3.3.7.2.gemspec +37 -0
  519. data/vendor/bundle/ruby/3.3.0/specifications/pp-0.6.2.gemspec +27 -0
  520. data/vendor/bundle/ruby/3.3.0/specifications/prettyprint-0.2.0.gemspec +23 -0
  521. data/vendor/bundle/ruby/3.3.0/specifications/rdoc-6.12.0.gemspec +31 -0
  522. data/vendor/bundle/ruby/3.3.0/specifications/reline-0.6.0.gemspec +26 -0
  523. metadata +499 -3
@@ -0,0 +1,1099 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'prism'
4
+ require_relative 'ripper_state_lex'
5
+
6
+ # Unlike lib/rdoc/parser/ruby.rb, this file is not based on rtags and does not contain code from
7
+ # rtags.rb -
8
+ # ruby-lex.rb - ruby lexcal analyzer
9
+ # ruby-token.rb - ruby tokens
10
+
11
+ # Parse and collect document from Ruby source code.
12
+ # RDoc::Parser::PrismRuby is compatible with RDoc::Parser::Ruby and aims to replace it.
13
+
14
+ class RDoc::Parser::PrismRuby < RDoc::Parser
15
+
16
+ parse_files_matching(/\.rbw?$/) if ENV['RDOC_USE_PRISM_PARSER']
17
+
18
+ attr_accessor :visibility
19
+ attr_reader :container, :singleton
20
+
21
+ def initialize(top_level, content, options, stats)
22
+ super
23
+
24
+ content = handle_tab_width(content)
25
+
26
+ @size = 0
27
+ @token_listeners = nil
28
+ content = RDoc::Encoding.remove_magic_comment content
29
+ @content = content
30
+ @markup = @options.markup
31
+ @track_visibility = :nodoc != @options.visibility
32
+ @encoding = @options.encoding
33
+
34
+ @module_nesting = [[top_level, false]]
35
+ @container = top_level
36
+ @visibility = :public
37
+ @singleton = false
38
+ @in_proc_block = false
39
+ end
40
+
41
+ # Suppress `extend` and `include` within block
42
+ # because they might be a metaprogramming block
43
+ # example: `Module.new { include M }` `M.module_eval { include N }`
44
+
45
+ def with_in_proc_block
46
+ @in_proc_block = true
47
+ yield
48
+ @in_proc_block = false
49
+ end
50
+
51
+ # Dive into another container
52
+
53
+ def with_container(container, singleton: false)
54
+ old_container = @container
55
+ old_visibility = @visibility
56
+ old_singleton = @singleton
57
+ old_in_proc_block = @in_proc_block
58
+ @visibility = :public
59
+ @container = container
60
+ @singleton = singleton
61
+ @in_proc_block = false
62
+ unless singleton
63
+ # Need to update module parent chain to emulate Module.nesting.
64
+ # This mechanism is inaccurate and needs to be fixed.
65
+ container.parent = old_container
66
+ end
67
+ @module_nesting.push([container, singleton])
68
+ yield container
69
+ ensure
70
+ @container = old_container
71
+ @visibility = old_visibility
72
+ @singleton = old_singleton
73
+ @in_proc_block = old_in_proc_block
74
+ @module_nesting.pop
75
+ end
76
+
77
+ # Records the location of this +container+ in the file for this parser and
78
+ # adds it to the list of classes and modules in the file.
79
+
80
+ def record_location container # :nodoc:
81
+ case container
82
+ when RDoc::ClassModule then
83
+ @top_level.add_to_classes_or_modules container
84
+ end
85
+
86
+ container.record_location @top_level
87
+ end
88
+
89
+ # Scans this Ruby file for Ruby constructs
90
+
91
+ def scan
92
+ @tokens = RDoc::Parser::RipperStateLex.parse(@content)
93
+ @lines = @content.lines
94
+ result = Prism.parse(@content)
95
+ @program_node = result.value
96
+ @line_nodes = {}
97
+ prepare_line_nodes(@program_node)
98
+ prepare_comments(result.comments)
99
+ return if @top_level.done_documenting
100
+
101
+ @first_non_meta_comment = nil
102
+ if (_line_no, start_line, rdoc_comment = @unprocessed_comments.first)
103
+ @first_non_meta_comment = rdoc_comment if start_line < @program_node.location.start_line
104
+ end
105
+
106
+ @program_node.accept(RDocVisitor.new(self, @top_level, @store))
107
+ process_comments_until(@lines.size + 1)
108
+ end
109
+
110
+ def should_document?(code_object) # :nodoc:
111
+ return true unless @track_visibility
112
+ return false if code_object.parent&.document_children == false
113
+ code_object.document_self
114
+ end
115
+
116
+ # Assign AST node to a line.
117
+ # This is used to show meta-method source code in the documentation.
118
+
119
+ def prepare_line_nodes(node) # :nodoc:
120
+ case node
121
+ when Prism::CallNode, Prism::DefNode
122
+ @line_nodes[node.location.start_line] ||= node
123
+ end
124
+ node.compact_child_nodes.each do |child|
125
+ prepare_line_nodes(child)
126
+ end
127
+ end
128
+
129
+ # Prepares comments for processing. Comments are grouped into consecutive.
130
+ # Consecutive comment is linked to the next non-blank line.
131
+ #
132
+ # Example:
133
+ # 01| class A # modifier comment 1
134
+ # 02| def foo; end # modifier comment 2
135
+ # 03|
136
+ # 04| # consecutive comment 1 start_line: 4
137
+ # 05| # consecutive comment 1 linked to line: 7
138
+ # 06|
139
+ # 07| # consecutive comment 2 start_line: 7
140
+ # 08| # consecutive comment 2 linked to line: 10
141
+ # 09|
142
+ # 10| def bar; end # consecutive comment 2 linked to this line
143
+ # 11| end
144
+
145
+ def prepare_comments(comments)
146
+ current = []
147
+ consecutive_comments = [current]
148
+ @modifier_comments = {}
149
+ comments.each do |comment|
150
+ if comment.is_a? Prism::EmbDocComment
151
+ consecutive_comments << [comment] << (current = [])
152
+ elsif comment.location.start_line_slice.match?(/\S/)
153
+ @modifier_comments[comment.location.start_line] = RDoc::Comment.new(comment.slice, @top_level, :ruby)
154
+ elsif current.empty? || current.last.location.end_line + 1 == comment.location.start_line
155
+ current << comment
156
+ else
157
+ consecutive_comments << (current = [comment])
158
+ end
159
+ end
160
+ consecutive_comments.reject!(&:empty?)
161
+
162
+ # Example: line_no = 5, start_line = 2, comment_text = "# comment_start_line\n# comment\n"
163
+ # 1| class A
164
+ # 2| # comment_start_line
165
+ # 3| # comment
166
+ # 4|
167
+ # 5| def f; end # comment linked to this line
168
+ # 6| end
169
+ @unprocessed_comments = consecutive_comments.map! do |comments|
170
+ start_line = comments.first.location.start_line
171
+ line_no = comments.last.location.end_line + (comments.last.location.end_column == 0 ? 0 : 1)
172
+ texts = comments.map do |c|
173
+ c.is_a?(Prism::EmbDocComment) ? c.slice.lines[1...-1].join : c.slice
174
+ end
175
+ text = RDoc::Encoding.change_encoding(texts.join("\n"), @encoding) if @encoding
176
+ line_no += 1 while @lines[line_no - 1]&.match?(/\A\s*$/)
177
+ comment = RDoc::Comment.new(text, @top_level, :ruby)
178
+ comment.line = start_line
179
+ [line_no, start_line, comment]
180
+ end
181
+
182
+ # The first comment is special. It defines markup for the rest of the comments.
183
+ _, first_comment_start_line, first_comment_text = @unprocessed_comments.first
184
+ if first_comment_text && @lines[0...first_comment_start_line - 1].all? { |l| l.match?(/\A\s*$/) }
185
+ comment = RDoc::Comment.new(first_comment_text.text, @top_level, :ruby)
186
+ handle_consecutive_comment_directive(@container, comment)
187
+ @markup = comment.format
188
+ end
189
+ @unprocessed_comments.each do |_, _, comment|
190
+ comment.format = @markup
191
+ end
192
+ end
193
+
194
+ # Creates an RDoc::Method on +container+ from +comment+ if there is a
195
+ # Signature section in the comment
196
+
197
+ def parse_comment_tomdoc(container, comment, line_no, start_line)
198
+ return unless signature = RDoc::TomDoc.signature(comment)
199
+
200
+ name, = signature.split %r%[ \(]%, 2
201
+
202
+ meth = RDoc::GhostMethod.new comment.text, name
203
+ record_location(meth)
204
+ meth.line = start_line
205
+ meth.call_seq = signature
206
+ return unless meth.name
207
+
208
+ meth.start_collecting_tokens
209
+ node = @line_nodes[line_no]
210
+ tokens = node ? visible_tokens_from_location(node.location) : [file_line_comment_token(start_line)]
211
+ tokens.each { |token| meth.token_stream << token }
212
+
213
+ container.add_method meth
214
+ comment.remove_private
215
+ comment.normalize
216
+ meth.comment = comment
217
+ @stats.add_method meth
218
+ end
219
+
220
+ def has_modifier_nodoc?(line_no) # :nodoc:
221
+ @modifier_comments[line_no]&.text&.match?(/\A#\s*:nodoc:/)
222
+ end
223
+
224
+ def handle_modifier_directive(code_object, line_no) # :nodoc:
225
+ comment = @modifier_comments[line_no]
226
+ @preprocess.handle(comment.text, code_object) if comment
227
+ end
228
+
229
+ def handle_consecutive_comment_directive(code_object, comment) # :nodoc:
230
+ return unless comment
231
+ @preprocess.handle(comment, code_object) do |directive, param|
232
+ case directive
233
+ when 'method', 'singleton-method',
234
+ 'attr', 'attr_accessor', 'attr_reader', 'attr_writer' then
235
+ # handled elsewhere
236
+ ''
237
+ when 'section' then
238
+ @container.set_current_section(param, comment.dup)
239
+ comment.text = ''
240
+ break
241
+ end
242
+ end
243
+ comment.remove_private
244
+ end
245
+
246
+ def call_node_name_arguments(call_node) # :nodoc:
247
+ return [] unless call_node.arguments
248
+ call_node.arguments.arguments.map do |arg|
249
+ case arg
250
+ when Prism::SymbolNode
251
+ arg.value
252
+ when Prism::StringNode
253
+ arg.unescaped
254
+ end
255
+ end || []
256
+ end
257
+
258
+ # Handles meta method comments
259
+
260
+ def handle_meta_method_comment(comment, node)
261
+ is_call_node = node.is_a?(Prism::CallNode)
262
+ singleton_method = false
263
+ visibility = @visibility
264
+ attributes = rw = line_no = method_name = nil
265
+
266
+ processed_comment = comment.dup
267
+ @preprocess.handle(processed_comment, @container) do |directive, param, line|
268
+ case directive
269
+ when 'attr', 'attr_reader', 'attr_writer', 'attr_accessor'
270
+ attributes = [param] if param
271
+ attributes ||= call_node_name_arguments(node) if is_call_node
272
+ rw = directive == 'attr_writer' ? 'W' : directive == 'attr_accessor' ? 'RW' : 'R'
273
+ ''
274
+ when 'method'
275
+ method_name = param
276
+ line_no = line
277
+ ''
278
+ when 'singleton-method'
279
+ method_name = param
280
+ line_no = line
281
+ singleton_method = true
282
+ visibility = :public
283
+ ''
284
+ when 'section' then
285
+ @container.set_current_section(param, comment.dup)
286
+ return # If the comment contains :section:, it is not a meta method comment
287
+ end
288
+ end
289
+
290
+ if attributes
291
+ attributes.each do |attr|
292
+ a = RDoc::Attr.new(@container, attr, rw, processed_comment)
293
+ a.store = @store
294
+ a.line = line_no
295
+ a.singleton = @singleton
296
+ record_location(a)
297
+ @container.add_attribute(a)
298
+ a.visibility = visibility
299
+ end
300
+ elsif line_no || node
301
+ method_name ||= call_node_name_arguments(node).first if is_call_node
302
+ meth = RDoc::AnyMethod.new(@container, method_name)
303
+ meth.singleton = @singleton || singleton_method
304
+ handle_consecutive_comment_directive(meth, comment)
305
+ comment.normalize
306
+ comment.extract_call_seq(meth)
307
+ meth.comment = comment
308
+ if node
309
+ tokens = visible_tokens_from_location(node.location)
310
+ line_no = node.location.start_line
311
+ else
312
+ tokens = [file_line_comment_token(line_no)]
313
+ end
314
+ internal_add_method(
315
+ @container,
316
+ meth,
317
+ line_no: line_no,
318
+ visibility: visibility,
319
+ singleton: @singleton || singleton_method,
320
+ params: '()',
321
+ calls_super: false,
322
+ block_params: nil,
323
+ tokens: tokens
324
+ )
325
+ end
326
+ end
327
+
328
+ def normal_comment_treat_as_ghost_method_for_now?(comment_text, line_no) # :nodoc:
329
+ # Meta method comment should start with `##` but some comments does not follow this rule.
330
+ # For now, RDoc accepts them as a meta method comment if there is no node linked to it.
331
+ !@line_nodes[line_no] && comment_text.match?(/^#\s+:(method|singleton-method|attr|attr_reader|attr_writer|attr_accessor):/)
332
+ end
333
+
334
+ def handle_standalone_consecutive_comment_directive(comment, line_no, start_line) # :nodoc:
335
+ if @markup == 'tomdoc'
336
+ parse_comment_tomdoc(@container, comment, line_no, start_line)
337
+ return
338
+ end
339
+
340
+ if comment.text =~ /\A#\#$/ && comment != @first_non_meta_comment
341
+ node = @line_nodes[line_no]
342
+ handle_meta_method_comment(comment, node)
343
+ elsif normal_comment_treat_as_ghost_method_for_now?(comment.text, line_no) && comment != @first_non_meta_comment
344
+ handle_meta_method_comment(comment, nil)
345
+ else
346
+ handle_consecutive_comment_directive(@container, comment)
347
+ end
348
+ end
349
+
350
+ # Processes consecutive comments that were not linked to any documentable code until the given line number
351
+
352
+ def process_comments_until(line_no_until)
353
+ while !@unprocessed_comments.empty? && @unprocessed_comments.first[0] <= line_no_until
354
+ line_no, start_line, rdoc_comment = @unprocessed_comments.shift
355
+ handle_standalone_consecutive_comment_directive(rdoc_comment, line_no, start_line)
356
+ end
357
+ end
358
+
359
+ # Skips all undocumentable consecutive comments until the given line number.
360
+ # Undocumentable comments are comments written inside `def` or inside undocumentable class/module
361
+
362
+ def skip_comments_until(line_no_until)
363
+ while !@unprocessed_comments.empty? && @unprocessed_comments.first[0] <= line_no_until
364
+ @unprocessed_comments.shift
365
+ end
366
+ end
367
+
368
+ # Returns consecutive comment linked to the given line number
369
+
370
+ def consecutive_comment(line_no)
371
+ if @unprocessed_comments.first&.first == line_no
372
+ @unprocessed_comments.shift.last
373
+ end
374
+ end
375
+
376
+ def slice_tokens(start_pos, end_pos) # :nodoc:
377
+ start_index = @tokens.bsearch_index { |t| ([t.line_no, t.char_no] <=> start_pos) >= 0 }
378
+ end_index = @tokens.bsearch_index { |t| ([t.line_no, t.char_no] <=> end_pos) >= 0 }
379
+ tokens = @tokens[start_index...end_index]
380
+ tokens.pop if tokens.last&.kind == :on_nl
381
+ tokens
382
+ end
383
+
384
+ def file_line_comment_token(line_no) # :nodoc:
385
+ position_comment = RDoc::Parser::RipperStateLex::Token.new(line_no - 1, 0, :on_comment)
386
+ position_comment[:text] = "# File #{@top_level.relative_name}, line #{line_no}"
387
+ position_comment
388
+ end
389
+
390
+ # Returns tokens from the given location
391
+
392
+ def visible_tokens_from_location(location)
393
+ position_comment = file_line_comment_token(location.start_line)
394
+ newline_token = RDoc::Parser::RipperStateLex::Token.new(0, 0, :on_nl, "\n")
395
+ indent_token = RDoc::Parser::RipperStateLex::Token.new(location.start_line, 0, :on_sp, ' ' * location.start_character_column)
396
+ tokens = slice_tokens(
397
+ [location.start_line, location.start_character_column],
398
+ [location.end_line, location.end_character_column]
399
+ )
400
+ [position_comment, newline_token, indent_token, *tokens]
401
+ end
402
+
403
+ # Handles `public :foo, :bar` `private :foo, :bar` and `protected :foo, :bar`
404
+
405
+ def change_method_visibility(names, visibility, singleton: @singleton)
406
+ new_methods = []
407
+ @container.methods_matching(names, singleton) do |m|
408
+ if m.parent != @container
409
+ m = m.dup
410
+ record_location(m)
411
+ new_methods << m
412
+ else
413
+ m.visibility = visibility
414
+ end
415
+ end
416
+ new_methods.each do |method|
417
+ case method
418
+ when RDoc::AnyMethod then
419
+ @container.add_method(method)
420
+ when RDoc::Attr then
421
+ @container.add_attribute(method)
422
+ end
423
+ method.visibility = visibility
424
+ end
425
+ end
426
+
427
+ # Handles `module_function :foo, :bar`
428
+
429
+ def change_method_to_module_function(names)
430
+ @container.set_visibility_for(names, :private, false)
431
+ new_methods = []
432
+ @container.methods_matching(names) do |m|
433
+ s_m = m.dup
434
+ record_location(s_m)
435
+ s_m.singleton = true
436
+ new_methods << s_m
437
+ end
438
+ new_methods.each do |method|
439
+ case method
440
+ when RDoc::AnyMethod then
441
+ @container.add_method(method)
442
+ when RDoc::Attr then
443
+ @container.add_attribute(method)
444
+ end
445
+ method.visibility = :public
446
+ end
447
+ end
448
+
449
+ # Handles `alias foo bar` and `alias_method :foo, :bar`
450
+
451
+ def add_alias_method(old_name, new_name, line_no)
452
+ comment = consecutive_comment(line_no)
453
+ handle_consecutive_comment_directive(@container, comment)
454
+ visibility = @container.find_method(old_name, @singleton)&.visibility || :public
455
+ a = RDoc::Alias.new(nil, old_name, new_name, comment, @singleton)
456
+ a.comment = comment
457
+ handle_modifier_directive(a, line_no)
458
+ a.store = @store
459
+ a.line = line_no
460
+ record_location(a)
461
+ if should_document?(a)
462
+ @container.add_alias(a)
463
+ @container.find_method(new_name, @singleton)&.visibility = visibility
464
+ end
465
+ end
466
+
467
+ # Handles `attr :a, :b`, `attr_reader :a, :b`, `attr_writer :a, :b` and `attr_accessor :a, :b`
468
+
469
+ def add_attributes(names, rw, line_no)
470
+ comment = consecutive_comment(line_no)
471
+ handle_consecutive_comment_directive(@container, comment)
472
+ return unless @container.document_children
473
+
474
+ names.each do |symbol|
475
+ a = RDoc::Attr.new(nil, symbol.to_s, rw, comment)
476
+ a.store = @store
477
+ a.line = line_no
478
+ a.singleton = @singleton
479
+ record_location(a)
480
+ handle_modifier_directive(a, line_no)
481
+ @container.add_attribute(a) if should_document?(a)
482
+ a.visibility = visibility # should set after adding to container
483
+ end
484
+ end
485
+
486
+ def add_includes_extends(names, rdoc_class, line_no) # :nodoc:
487
+ return if @in_proc_block
488
+ comment = consecutive_comment(line_no)
489
+ handle_consecutive_comment_directive(@container, comment)
490
+ names.each do |name|
491
+ ie = @container.add(rdoc_class, name, '')
492
+ ie.store = @store
493
+ ie.line = line_no
494
+ ie.comment = comment
495
+ record_location(ie)
496
+ end
497
+ end
498
+
499
+ # Handle `include Foo, Bar`
500
+
501
+ def add_includes(names, line_no) # :nodoc:
502
+ add_includes_extends(names, RDoc::Include, line_no)
503
+ end
504
+
505
+ # Handle `extend Foo, Bar`
506
+
507
+ def add_extends(names, line_no) # :nodoc:
508
+ add_includes_extends(names, RDoc::Extend, line_no)
509
+ end
510
+
511
+ # Adds a method defined by `def` syntax
512
+
513
+ def add_method(name, receiver_name:, receiver_fallback_type:, visibility:, singleton:, params:, calls_super:, block_params:, tokens:, start_line:, args_end_line:, end_line:)
514
+ return if @in_proc_block
515
+
516
+ receiver = receiver_name ? find_or_create_module_path(receiver_name, receiver_fallback_type) : @container
517
+ meth = RDoc::AnyMethod.new(nil, name)
518
+ if (comment = consecutive_comment(start_line))
519
+ handle_consecutive_comment_directive(@container, comment)
520
+ handle_consecutive_comment_directive(meth, comment)
521
+
522
+ comment.normalize
523
+ comment.extract_call_seq(meth)
524
+ meth.comment = comment
525
+ end
526
+ handle_modifier_directive(meth, start_line)
527
+ handle_modifier_directive(meth, args_end_line)
528
+ handle_modifier_directive(meth, end_line)
529
+ return unless should_document?(meth)
530
+
531
+ internal_add_method(
532
+ receiver,
533
+ meth,
534
+ line_no: start_line,
535
+ visibility: visibility,
536
+ singleton: singleton,
537
+ params: params,
538
+ calls_super: calls_super,
539
+ block_params: block_params,
540
+ tokens: tokens
541
+ )
542
+
543
+ # Rename after add_method to register duplicated 'new' and 'initialize'
544
+ # defined in c and ruby just like the old parser did.
545
+ if meth.name == 'initialize' && !singleton
546
+ if meth.dont_rename_initialize
547
+ meth.visibility = :protected
548
+ else
549
+ meth.name = 'new'
550
+ meth.singleton = true
551
+ meth.visibility = :public
552
+ end
553
+ end
554
+ end
555
+
556
+ private def internal_add_method(container, meth, line_no:, visibility:, singleton:, params:, calls_super:, block_params:, tokens:) # :nodoc:
557
+ meth.name ||= meth.call_seq[/\A[^()\s]+/] if meth.call_seq
558
+ meth.name ||= 'unknown'
559
+ meth.store = @store
560
+ meth.line = line_no
561
+ meth.singleton = singleton
562
+ container.add_method(meth) # should add after setting singleton and before setting visibility
563
+ meth.visibility = visibility
564
+ meth.params ||= params
565
+ meth.calls_super = calls_super
566
+ meth.block_params ||= block_params if block_params
567
+ record_location(meth)
568
+ meth.start_collecting_tokens
569
+ tokens.each do |token|
570
+ meth.token_stream << token
571
+ end
572
+ end
573
+
574
+ # Find or create module or class from a given module name.
575
+ # If module or class does not exist, creates a module or a class according to `create_mode` argument.
576
+
577
+ def find_or_create_module_path(module_name, create_mode)
578
+ root_name, *path, name = module_name.split('::')
579
+ add_module = ->(mod, name, mode) {
580
+ case mode
581
+ when :class
582
+ mod.add_class(RDoc::NormalClass, name, 'Object').tap { |m| m.store = @store }
583
+ when :module
584
+ mod.add_module(RDoc::NormalModule, name).tap { |m| m.store = @store }
585
+ end
586
+ }
587
+ if root_name.empty?
588
+ mod = @top_level
589
+ else
590
+ @module_nesting.reverse_each do |nesting, singleton|
591
+ next if singleton
592
+ mod = nesting.find_module_named(root_name)
593
+ break if mod
594
+ # If a constant is found and it is not a module or class, RDoc can't document about it.
595
+ # Return an anonymous module to avoid wrong document creation.
596
+ return RDoc::NormalModule.new(nil) if nesting.find_constant_named(root_name)
597
+ end
598
+ last_nesting, = @module_nesting.reverse_each.find { |_, singleton| !singleton }
599
+ return mod || add_module.call(last_nesting, root_name, create_mode) unless name
600
+ mod ||= add_module.call(last_nesting, root_name, :module)
601
+ end
602
+ path.each do |name|
603
+ mod = mod.find_module_named(name) || add_module.call(mod, name, :module)
604
+ end
605
+ mod.find_module_named(name) || add_module.call(mod, name, create_mode)
606
+ end
607
+
608
+ # Resolves constant path to a full path by searching module nesting
609
+
610
+ def resolve_constant_path(constant_path)
611
+ owner_name, path = constant_path.split('::', 2)
612
+ return constant_path if owner_name.empty? # ::Foo, ::Foo::Bar
613
+ mod = nil
614
+ @module_nesting.reverse_each do |nesting, singleton|
615
+ next if singleton
616
+ mod = nesting.find_module_named(owner_name)
617
+ break if mod
618
+ end
619
+ mod ||= @top_level.find_module_named(owner_name)
620
+ [mod.full_name, path].compact.join('::') if mod
621
+ end
622
+
623
+ # Returns a pair of owner module and constant name from a given constant path.
624
+ # Creates owner module if it does not exist.
625
+
626
+ def find_or_create_constant_owner_name(constant_path)
627
+ const_path, colon, name = constant_path.rpartition('::')
628
+ if colon.empty? # class Foo
629
+ # Within `class C` or `module C`, owner is C(== current container)
630
+ # Within `class <<C`, owner is C.singleton_class
631
+ # but RDoc don't track constants of a singleton class of module
632
+ [(@singleton ? nil : @container), name]
633
+ elsif const_path.empty? # class ::Foo
634
+ [@top_level, name]
635
+ else # `class Foo::Bar` or `class ::Foo::Bar`
636
+ [find_or_create_module_path(const_path, :module), name]
637
+ end
638
+ end
639
+
640
+ # Adds a constant
641
+
642
+ def add_constant(constant_name, rhs_name, start_line, end_line)
643
+ comment = consecutive_comment(start_line)
644
+ handle_consecutive_comment_directive(@container, comment)
645
+ owner, name = find_or_create_constant_owner_name(constant_name)
646
+ return unless owner
647
+
648
+ constant = RDoc::Constant.new(name, rhs_name, comment)
649
+ constant.store = @store
650
+ constant.line = start_line
651
+ record_location(constant)
652
+ handle_modifier_directive(constant, start_line)
653
+ handle_modifier_directive(constant, end_line)
654
+ owner.add_constant(constant)
655
+ mod =
656
+ if rhs_name =~ /^::/
657
+ @store.find_class_or_module(rhs_name)
658
+ else
659
+ @container.find_module_named(rhs_name)
660
+ end
661
+ if mod && constant.document_self
662
+ a = @container.add_module_alias(mod, rhs_name, constant, @top_level)
663
+ a.store = @store
664
+ a.line = start_line
665
+ record_location(a)
666
+ end
667
+ end
668
+
669
+ # Adds module or class
670
+
671
+ def add_module_or_class(module_name, start_line, end_line, is_class: false, superclass_name: nil, superclass_expr: nil)
672
+ comment = consecutive_comment(start_line)
673
+ handle_consecutive_comment_directive(@container, comment)
674
+ return unless @container.document_children
675
+
676
+ owner, name = find_or_create_constant_owner_name(module_name)
677
+ return unless owner
678
+
679
+ if is_class
680
+ # RDoc::NormalClass resolves superclass name despite of the lack of module nesting information.
681
+ # We need to fix it when RDoc::NormalClass resolved to a wrong constant name
682
+ if superclass_name
683
+ superclass_full_path = resolve_constant_path(superclass_name)
684
+ superclass = @store.find_class_or_module(superclass_full_path) if superclass_full_path
685
+ superclass_full_path ||= superclass_name
686
+ superclass_full_path = superclass_full_path.sub(/^::/, '')
687
+ end
688
+ # add_class should be done after resolving superclass
689
+ mod = owner.classes_hash[name] || owner.add_class(RDoc::NormalClass, name, superclass_name || superclass_expr || '::Object')
690
+ if superclass_name
691
+ if superclass
692
+ mod.superclass = superclass
693
+ elsif (mod.superclass.is_a?(String) || mod.superclass.name == 'Object') && mod.superclass != superclass_full_path
694
+ mod.superclass = superclass_full_path
695
+ end
696
+ end
697
+ else
698
+ mod = owner.modules_hash[name] || owner.add_module(RDoc::NormalModule, name)
699
+ end
700
+
701
+ mod.store = @store
702
+ mod.line = start_line
703
+ record_location(mod)
704
+ handle_modifier_directive(mod, start_line)
705
+ handle_modifier_directive(mod, end_line)
706
+ mod.add_comment(comment, @top_level) if comment
707
+ mod
708
+ end
709
+
710
+ class RDocVisitor < Prism::Visitor # :nodoc:
711
+ def initialize(scanner, top_level, store)
712
+ @scanner = scanner
713
+ @top_level = top_level
714
+ @store = store
715
+ end
716
+
717
+ def visit_if_node(node)
718
+ if node.end_keyword
719
+ super
720
+ else
721
+ # Visit with the order in text representation to handle this method comment
722
+ # # comment
723
+ # def f
724
+ # end if call_node
725
+ node.statements.accept(self)
726
+ node.predicate.accept(self)
727
+ end
728
+ end
729
+ alias visit_unless_node visit_if_node
730
+
731
+ def visit_call_node(node)
732
+ @scanner.process_comments_until(node.location.start_line - 1)
733
+ if node.receiver.nil?
734
+ case node.name
735
+ when :attr
736
+ _visit_call_attr_reader_writer_accessor(node, 'R')
737
+ when :attr_reader
738
+ _visit_call_attr_reader_writer_accessor(node, 'R')
739
+ when :attr_writer
740
+ _visit_call_attr_reader_writer_accessor(node, 'W')
741
+ when :attr_accessor
742
+ _visit_call_attr_reader_writer_accessor(node, 'RW')
743
+ when :include
744
+ _visit_call_include(node)
745
+ when :extend
746
+ _visit_call_extend(node)
747
+ when :public
748
+ _visit_call_public_private_protected(node, :public) { super }
749
+ when :private
750
+ _visit_call_public_private_protected(node, :private) { super }
751
+ when :protected
752
+ _visit_call_public_private_protected(node, :protected) { super }
753
+ when :private_constant
754
+ _visit_call_private_constant(node)
755
+ when :public_constant
756
+ _visit_call_public_constant(node)
757
+ when :require
758
+ _visit_call_require(node)
759
+ when :alias_method
760
+ _visit_call_alias_method(node)
761
+ when :module_function
762
+ _visit_call_module_function(node) { super }
763
+ when :public_class_method
764
+ _visit_call_public_private_class_method(node, :public) { super }
765
+ when :private_class_method
766
+ _visit_call_public_private_class_method(node, :private) { super }
767
+ else
768
+ node.arguments&.accept(self)
769
+ super
770
+ end
771
+ else
772
+ super
773
+ end
774
+ end
775
+
776
+ def visit_block_node(node)
777
+ @scanner.with_in_proc_block do
778
+ # include, extend and method definition inside block are not documentable
779
+ super
780
+ end
781
+ end
782
+
783
+ def visit_alias_method_node(node)
784
+ @scanner.process_comments_until(node.location.start_line - 1)
785
+ return unless node.old_name.is_a?(Prism::SymbolNode) && node.new_name.is_a?(Prism::SymbolNode)
786
+ @scanner.add_alias_method(node.old_name.value.to_s, node.new_name.value.to_s, node.location.start_line)
787
+ end
788
+
789
+ def visit_module_node(node)
790
+ node.constant_path.accept(self)
791
+ @scanner.process_comments_until(node.location.start_line - 1)
792
+ module_name = constant_path_string(node.constant_path)
793
+ mod = @scanner.add_module_or_class(module_name, node.location.start_line, node.location.end_line) if module_name
794
+ if mod
795
+ @scanner.with_container(mod) do
796
+ node.body&.accept(self)
797
+ @scanner.process_comments_until(node.location.end_line)
798
+ end
799
+ else
800
+ @scanner.skip_comments_until(node.location.end_line)
801
+ end
802
+ end
803
+
804
+ def visit_class_node(node)
805
+ node.constant_path.accept(self)
806
+ node.superclass&.accept(self)
807
+ @scanner.process_comments_until(node.location.start_line - 1)
808
+ superclass_name = constant_path_string(node.superclass) if node.superclass
809
+ superclass_expr = node.superclass.slice if node.superclass && !superclass_name
810
+ class_name = constant_path_string(node.constant_path)
811
+ klass = @scanner.add_module_or_class(class_name, node.location.start_line, node.location.end_line, is_class: true, superclass_name: superclass_name, superclass_expr: superclass_expr) if class_name
812
+ if klass
813
+ @scanner.with_container(klass) do
814
+ node.body&.accept(self)
815
+ @scanner.process_comments_until(node.location.end_line)
816
+ end
817
+ else
818
+ @scanner.skip_comments_until(node.location.end_line)
819
+ end
820
+ end
821
+
822
+ def visit_singleton_class_node(node)
823
+ @scanner.process_comments_until(node.location.start_line - 1)
824
+
825
+ if @scanner.has_modifier_nodoc?(node.location.start_line)
826
+ # Skip visiting inside the singleton class. Also skips creation of node.expression as a module
827
+ @scanner.skip_comments_until(node.location.end_line)
828
+ return
829
+ end
830
+
831
+ expression = node.expression
832
+ expression = expression.body.body.first if expression.is_a?(Prism::ParenthesesNode) && expression.body&.body&.size == 1
833
+
834
+ case expression
835
+ when Prism::ConstantWriteNode
836
+ # Accept `class << (NameErrorCheckers = Object.new)` as a module which is not actually a module
837
+ mod = @scanner.container.add_module(RDoc::NormalModule, expression.name.to_s)
838
+ when Prism::ConstantPathNode, Prism::ConstantReadNode
839
+ expression_name = constant_path_string(expression)
840
+ # If a constant_path does not exist, RDoc creates a module
841
+ mod = @scanner.find_or_create_module_path(expression_name, :module) if expression_name
842
+ when Prism::SelfNode
843
+ mod = @scanner.container if @scanner.container != @top_level
844
+ end
845
+ expression.accept(self)
846
+ if mod
847
+ @scanner.with_container(mod, singleton: true) do
848
+ node.body&.accept(self)
849
+ @scanner.process_comments_until(node.location.end_line)
850
+ end
851
+ else
852
+ @scanner.skip_comments_until(node.location.end_line)
853
+ end
854
+ end
855
+
856
+ def visit_def_node(node)
857
+ start_line = node.location.start_line
858
+ args_end_line = node.parameters&.location&.end_line || start_line
859
+ end_line = node.location.end_line
860
+ @scanner.process_comments_until(start_line - 1)
861
+
862
+ case node.receiver
863
+ when Prism::NilNode, Prism::TrueNode, Prism::FalseNode
864
+ visibility = :public
865
+ singleton = false
866
+ receiver_name =
867
+ case node.receiver
868
+ when Prism::NilNode
869
+ 'NilClass'
870
+ when Prism::TrueNode
871
+ 'TrueClass'
872
+ when Prism::FalseNode
873
+ 'FalseClass'
874
+ end
875
+ receiver_fallback_type = :class
876
+ when Prism::SelfNode
877
+ # singleton method of a singleton class is not documentable
878
+ return if @scanner.singleton
879
+ visibility = :public
880
+ singleton = true
881
+ when Prism::ConstantReadNode, Prism::ConstantPathNode
882
+ visibility = :public
883
+ singleton = true
884
+ receiver_name = constant_path_string(node.receiver)
885
+ receiver_fallback_type = :module
886
+ return unless receiver_name
887
+ when nil
888
+ visibility = @scanner.visibility
889
+ singleton = @scanner.singleton
890
+ else
891
+ # `def (unknown expression).method_name` is not documentable
892
+ return
893
+ end
894
+ name = node.name.to_s
895
+ params, block_params, calls_super = MethodSignatureVisitor.scan_signature(node)
896
+ tokens = @scanner.visible_tokens_from_location(node.location)
897
+
898
+ @scanner.add_method(
899
+ name,
900
+ receiver_name: receiver_name,
901
+ receiver_fallback_type: receiver_fallback_type,
902
+ visibility: visibility,
903
+ singleton: singleton,
904
+ params: params,
905
+ block_params: block_params,
906
+ calls_super: calls_super,
907
+ tokens: tokens,
908
+ start_line: start_line,
909
+ args_end_line: args_end_line,
910
+ end_line: end_line
911
+ )
912
+ ensure
913
+ @scanner.skip_comments_until(end_line)
914
+ end
915
+
916
+ def visit_constant_path_write_node(node)
917
+ @scanner.process_comments_until(node.location.start_line - 1)
918
+ path = constant_path_string(node.target)
919
+ return unless path
920
+
921
+ @scanner.add_constant(
922
+ path,
923
+ constant_path_string(node.value) || node.value.slice,
924
+ node.location.start_line,
925
+ node.location.end_line
926
+ )
927
+ @scanner.skip_comments_until(node.location.end_line)
928
+ # Do not traverse rhs not to document `A::B = Struct.new{def undocumentable_method; end}`
929
+ end
930
+
931
+ def visit_constant_write_node(node)
932
+ @scanner.process_comments_until(node.location.start_line - 1)
933
+ @scanner.add_constant(
934
+ node.name.to_s,
935
+ constant_path_string(node.value) || node.value.slice,
936
+ node.location.start_line,
937
+ node.location.end_line
938
+ )
939
+ @scanner.skip_comments_until(node.location.end_line)
940
+ # Do not traverse rhs not to document `A = Struct.new{def undocumentable_method; end}`
941
+ end
942
+
943
+ private
944
+
945
+ def constant_arguments_names(call_node)
946
+ return unless call_node.arguments
947
+ names = call_node.arguments.arguments.map { |arg| constant_path_string(arg) }
948
+ names.all? ? names : nil
949
+ end
950
+
951
+ def symbol_arguments(call_node)
952
+ arguments_node = call_node.arguments
953
+ return unless arguments_node && arguments_node.arguments.all? { |arg| arg.is_a?(Prism::SymbolNode)}
954
+ arguments_node.arguments.map { |arg| arg.value.to_sym }
955
+ end
956
+
957
+ def visibility_method_arguments(call_node, singleton:)
958
+ arguments_node = call_node.arguments
959
+ return unless arguments_node
960
+ symbols = symbol_arguments(call_node)
961
+ if symbols
962
+ # module_function :foo, :bar
963
+ return symbols.map(&:to_s)
964
+ else
965
+ return unless arguments_node.arguments.size == 1
966
+ arg = arguments_node.arguments.first
967
+ return unless arg.is_a?(Prism::DefNode)
968
+
969
+ if singleton
970
+ # `private_class_method def foo; end` `private_class_method def not_self.foo; end` should be ignored
971
+ return unless arg.receiver.is_a?(Prism::SelfNode)
972
+ else
973
+ # `module_function def something.foo` should be ignored
974
+ return if arg.receiver
975
+ end
976
+ # `module_function def foo; end` or `private_class_method def self.foo; end`
977
+ [arg.name.to_s]
978
+ end
979
+ end
980
+
981
+ def constant_path_string(node)
982
+ case node
983
+ when Prism::ConstantReadNode
984
+ node.name.to_s
985
+ when Prism::ConstantPathNode
986
+ parent_name = node.parent ? constant_path_string(node.parent) : ''
987
+ "#{parent_name}::#{node.name}" if parent_name
988
+ end
989
+ end
990
+
991
+ def _visit_call_require(call_node)
992
+ return unless call_node.arguments&.arguments&.size == 1
993
+ arg = call_node.arguments.arguments.first
994
+ return unless arg.is_a?(Prism::StringNode)
995
+ @scanner.container.add_require(RDoc::Require.new(arg.unescaped, nil))
996
+ end
997
+
998
+ def _visit_call_module_function(call_node)
999
+ yield
1000
+ return if @scanner.singleton
1001
+ names = visibility_method_arguments(call_node, singleton: false)&.map(&:to_s)
1002
+ @scanner.change_method_to_module_function(names) if names
1003
+ end
1004
+
1005
+ def _visit_call_public_private_class_method(call_node, visibility)
1006
+ yield
1007
+ return if @scanner.singleton
1008
+ names = visibility_method_arguments(call_node, singleton: true)
1009
+ @scanner.change_method_visibility(names, visibility, singleton: true) if names
1010
+ end
1011
+
1012
+ def _visit_call_public_private_protected(call_node, visibility)
1013
+ arguments_node = call_node.arguments
1014
+ if arguments_node.nil? # `public` `private`
1015
+ @scanner.visibility = visibility
1016
+ else # `public :foo, :bar`, `private def foo; end`
1017
+ yield
1018
+ names = visibility_method_arguments(call_node, singleton: false)
1019
+ @scanner.change_method_visibility(names, visibility) if names
1020
+ end
1021
+ end
1022
+
1023
+ def _visit_call_alias_method(call_node)
1024
+ new_name, old_name, *rest = symbol_arguments(call_node)
1025
+ return unless old_name && new_name && rest.empty?
1026
+ @scanner.add_alias_method(old_name.to_s, new_name.to_s, call_node.location.start_line)
1027
+ end
1028
+
1029
+ def _visit_call_include(call_node)
1030
+ names = constant_arguments_names(call_node)
1031
+ line_no = call_node.location.start_line
1032
+ return unless names
1033
+
1034
+ if @scanner.singleton
1035
+ @scanner.add_extends(names, line_no)
1036
+ else
1037
+ @scanner.add_includes(names, line_no)
1038
+ end
1039
+ end
1040
+
1041
+ def _visit_call_extend(call_node)
1042
+ names = constant_arguments_names(call_node)
1043
+ @scanner.add_extends(names, call_node.location.start_line) if names && !@scanner.singleton
1044
+ end
1045
+
1046
+ def _visit_call_public_constant(call_node)
1047
+ return if @scanner.singleton
1048
+ names = symbol_arguments(call_node)
1049
+ @scanner.container.set_constant_visibility_for(names.map(&:to_s), :public) if names
1050
+ end
1051
+
1052
+ def _visit_call_private_constant(call_node)
1053
+ return if @scanner.singleton
1054
+ names = symbol_arguments(call_node)
1055
+ @scanner.container.set_constant_visibility_for(names.map(&:to_s), :private) if names
1056
+ end
1057
+
1058
+ def _visit_call_attr_reader_writer_accessor(call_node, rw)
1059
+ names = symbol_arguments(call_node)
1060
+ @scanner.add_attributes(names.map(&:to_s), rw, call_node.location.start_line) if names
1061
+ end
1062
+ class MethodSignatureVisitor < Prism::Visitor # :nodoc:
1063
+ class << self
1064
+ def scan_signature(def_node)
1065
+ visitor = new
1066
+ def_node.body&.accept(visitor)
1067
+ params = "(#{def_node.parameters&.slice})"
1068
+ block_params = visitor.yields.first
1069
+ [params, block_params, visitor.calls_super]
1070
+ end
1071
+ end
1072
+
1073
+ attr_reader :params, :yields, :calls_super
1074
+
1075
+ def initialize
1076
+ @params = nil
1077
+ @calls_super = false
1078
+ @yields = []
1079
+ end
1080
+
1081
+ def visit_def_node(node)
1082
+ # stop traverse inside nested def
1083
+ end
1084
+
1085
+ def visit_yield_node(node)
1086
+ @yields << (node.arguments&.slice || '')
1087
+ end
1088
+
1089
+ def visit_super_node(node)
1090
+ @calls_super = true
1091
+ super
1092
+ end
1093
+
1094
+ def visit_forwarding_super_node(node)
1095
+ @calls_super = true
1096
+ end
1097
+ end
1098
+ end
1099
+ end