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.
- checksums.yaml +7 -0
- data/hyper-pro-gem.gemspec +12 -0
- data/yard-0.9.44/CHANGELOG.md +983 -0
- data/yard-0.9.44/LEGAL +94 -0
- data/yard-0.9.44/LICENSE +22 -0
- data/yard-0.9.44/README.md +329 -0
- data/yard-0.9.44/bin/yard +13 -0
- data/yard-0.9.44/bin/yardoc +13 -0
- data/yard-0.9.44/bin/yri +13 -0
- data/yard-0.9.44/docs/CodeObjects.md +115 -0
- data/yard-0.9.44/docs/GettingStarted.md +705 -0
- data/yard-0.9.44/docs/Handlers.md +152 -0
- data/yard-0.9.44/docs/Overview.md +61 -0
- data/yard-0.9.44/docs/Parser.md +166 -0
- data/yard-0.9.44/docs/Tags.md +304 -0
- data/yard-0.9.44/docs/TagsArch.md +123 -0
- data/yard-0.9.44/docs/Templates.md +497 -0
- data/yard-0.9.44/docs/WhatsNew.md +1297 -0
- data/yard-0.9.44/docs/images/code-objects-class-diagram.png +0 -0
- data/yard-0.9.44/docs/images/handlers-class-diagram.png +0 -0
- data/yard-0.9.44/docs/images/overview-class-diagram.png +0 -0
- data/yard-0.9.44/docs/images/parser-class-diagram.png +0 -0
- data/yard-0.9.44/docs/images/tags-class-diagram.png +0 -0
- data/yard-0.9.44/docs/templates/default/fulldoc/html/full_list_tag.erb +9 -0
- data/yard-0.9.44/docs/templates/default/fulldoc/html/setup.rb +6 -0
- data/yard-0.9.44/docs/templates/default/layout/html/setup.rb +9 -0
- data/yard-0.9.44/docs/templates/default/layout/html/tag_list.erb +11 -0
- data/yard-0.9.44/docs/templates/default/yard_tags/html/list.erb +18 -0
- data/yard-0.9.44/docs/templates/default/yard_tags/html/setup.rb +26 -0
- data/yard-0.9.44/docs/templates/plugin.rb +70 -0
- data/yard-0.9.44/lib/rubygems_plugin.rb +9 -0
- data/yard-0.9.44/lib/yard/autoload.rb +328 -0
- data/yard-0.9.44/lib/yard/cli/command.rb +85 -0
- data/yard-0.9.44/lib/yard/cli/command_parser.rb +93 -0
- data/yard-0.9.44/lib/yard/cli/config.rb +198 -0
- data/yard-0.9.44/lib/yard/cli/diff.rb +278 -0
- data/yard-0.9.44/lib/yard/cli/display.rb +69 -0
- data/yard-0.9.44/lib/yard/cli/gems.rb +84 -0
- data/yard-0.9.44/lib/yard/cli/graph.rb +125 -0
- data/yard-0.9.44/lib/yard/cli/help.rb +20 -0
- data/yard-0.9.44/lib/yard/cli/i18n.rb +70 -0
- data/yard-0.9.44/lib/yard/cli/list.rb +23 -0
- data/yard-0.9.44/lib/yard/cli/markup_types.rb +32 -0
- data/yard-0.9.44/lib/yard/cli/server.rb +266 -0
- data/yard-0.9.44/lib/yard/cli/stats.rb +234 -0
- data/yard-0.9.44/lib/yard/cli/yardoc.rb +791 -0
- data/yard-0.9.44/lib/yard/cli/yardopts_command.rb +110 -0
- data/yard-0.9.44/lib/yard/cli/yri.rb +215 -0
- data/yard-0.9.44/lib/yard/code_objects/base.rb +626 -0
- data/yard-0.9.44/lib/yard/code_objects/class_object.rb +146 -0
- data/yard-0.9.44/lib/yard/code_objects/class_variable_object.rb +11 -0
- data/yard-0.9.44/lib/yard/code_objects/constant_object.rb +16 -0
- data/yard-0.9.44/lib/yard/code_objects/extended_method_object.rb +24 -0
- data/yard-0.9.44/lib/yard/code_objects/extra_file_object.rb +135 -0
- data/yard-0.9.44/lib/yard/code_objects/macro_object.rb +171 -0
- data/yard-0.9.44/lib/yard/code_objects/method_object.rb +196 -0
- data/yard-0.9.44/lib/yard/code_objects/module_object.rb +21 -0
- data/yard-0.9.44/lib/yard/code_objects/namespace_mapper.rb +141 -0
- data/yard-0.9.44/lib/yard/code_objects/namespace_object.rb +200 -0
- data/yard-0.9.44/lib/yard/code_objects/proxy.rb +245 -0
- data/yard-0.9.44/lib/yard/code_objects/root_object.rb +19 -0
- data/yard-0.9.44/lib/yard/config.rb +274 -0
- data/yard-0.9.44/lib/yard/core_ext/array.rb +16 -0
- data/yard-0.9.44/lib/yard/core_ext/file.rb +69 -0
- data/yard-0.9.44/lib/yard/core_ext/hash.rb +16 -0
- data/yard-0.9.44/lib/yard/core_ext/insertion.rb +63 -0
- data/yard-0.9.44/lib/yard/core_ext/module.rb +11 -0
- data/yard-0.9.44/lib/yard/core_ext/string.rb +68 -0
- data/yard-0.9.44/lib/yard/core_ext/symbol_hash.rb +75 -0
- data/yard-0.9.44/lib/yard/docstring.rb +386 -0
- data/yard-0.9.44/lib/yard/docstring_parser.rb +344 -0
- data/yard-0.9.44/lib/yard/gem_index.rb +29 -0
- data/yard-0.9.44/lib/yard/globals.rb +22 -0
- data/yard-0.9.44/lib/yard/handlers/base.rb +617 -0
- data/yard-0.9.44/lib/yard/handlers/c/alias_handler.rb +16 -0
- data/yard-0.9.44/lib/yard/handlers/c/attribute_handler.rb +13 -0
- data/yard-0.9.44/lib/yard/handlers/c/base.rb +164 -0
- data/yard-0.9.44/lib/yard/handlers/c/class_handler.rb +27 -0
- data/yard-0.9.44/lib/yard/handlers/c/constant_handler.rb +13 -0
- data/yard-0.9.44/lib/yard/handlers/c/handler_methods.rb +212 -0
- data/yard-0.9.44/lib/yard/handlers/c/init_handler.rb +20 -0
- data/yard-0.9.44/lib/yard/handlers/c/method_handler.rb +45 -0
- data/yard-0.9.44/lib/yard/handlers/c/mixin_handler.rb +21 -0
- data/yard-0.9.44/lib/yard/handlers/c/module_handler.rb +17 -0
- data/yard-0.9.44/lib/yard/handlers/c/override_comment_handler.rb +31 -0
- data/yard-0.9.44/lib/yard/handlers/c/path_handler.rb +11 -0
- data/yard-0.9.44/lib/yard/handlers/c/struct_handler.rb +13 -0
- data/yard-0.9.44/lib/yard/handlers/c/symbol_handler.rb +8 -0
- data/yard-0.9.44/lib/yard/handlers/common/method_handler.rb +19 -0
- data/yard-0.9.44/lib/yard/handlers/processor.rb +200 -0
- data/yard-0.9.44/lib/yard/handlers/rbs/attribute_handler.rb +79 -0
- data/yard-0.9.44/lib/yard/handlers/rbs/base.rb +38 -0
- data/yard-0.9.44/lib/yard/handlers/rbs/constant_handler.rb +18 -0
- data/yard-0.9.44/lib/yard/handlers/rbs/method_handler.rb +327 -0
- data/yard-0.9.44/lib/yard/handlers/rbs/mixin_handler.rb +20 -0
- data/yard-0.9.44/lib/yard/handlers/rbs/namespace_handler.rb +26 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/alias_handler.rb +45 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/attribute_handler.rb +90 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/base.rb +165 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/class_condition_handler.rb +92 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/class_handler.rb +119 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/class_variable_handler.rb +17 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/comment_handler.rb +10 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/constant_handler.rb +73 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/decorator_handler_methods.rb +123 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/dsl_handler.rb +15 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/dsl_handler_methods.rb +96 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/exception_handler.rb +27 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/extend_handler.rb +22 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/alias_handler.rb +37 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/attribute_handler.rb +65 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/base.rb +245 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/class_condition_handler.rb +83 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/class_handler.rb +113 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/class_variable_handler.rb +15 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/comment_handler.rb +10 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/constant_handler.rb +29 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/dsl_handler.rb +17 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/exception_handler.rb +13 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/extend_handler.rb +21 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/method_handler.rb +90 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/mixin_handler.rb +39 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/module_function_handler.rb +19 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/module_handler.rb +12 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/private_class_method_handler.rb +22 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/private_constant_handler.rb +22 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/visibility_handler.rb +18 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/legacy/yield_handler.rb +29 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/method_condition_handler.rb +9 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/method_handler.rb +104 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/mixin_handler.rb +61 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/module_function_handler.rb +39 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/module_handler.rb +12 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/private_class_method_handler.rb +14 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/private_constant_handler.rb +43 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/public_class_method_handler.rb +14 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/struct_handler_methods.rb +143 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/visibility_handler.rb +35 -0
- data/yard-0.9.44/lib/yard/handlers/ruby/yield_handler.rb +31 -0
- data/yard-0.9.44/lib/yard/i18n/locale.rb +67 -0
- data/yard-0.9.44/lib/yard/i18n/message.rb +57 -0
- data/yard-0.9.44/lib/yard/i18n/messages.rb +56 -0
- data/yard-0.9.44/lib/yard/i18n/po_parser.rb +61 -0
- data/yard-0.9.44/lib/yard/i18n/pot_generator.rb +290 -0
- data/yard-0.9.44/lib/yard/i18n/text.rb +173 -0
- data/yard-0.9.44/lib/yard/logging.rb +260 -0
- data/yard-0.9.44/lib/yard/open_struct.rb +67 -0
- data/yard-0.9.44/lib/yard/options.rb +217 -0
- data/yard-0.9.44/lib/yard/parser/base.rb +57 -0
- data/yard-0.9.44/lib/yard/parser/c/c_parser.rb +235 -0
- data/yard-0.9.44/lib/yard/parser/c/comment_parser.rb +134 -0
- data/yard-0.9.44/lib/yard/parser/c/statement.rb +66 -0
- data/yard-0.9.44/lib/yard/parser/rbs/rbs_parser.rb +325 -0
- data/yard-0.9.44/lib/yard/parser/rbs/statement.rb +75 -0
- data/yard-0.9.44/lib/yard/parser/ruby/ast_node.rb +559 -0
- data/yard-0.9.44/lib/yard/parser/ruby/legacy/irb/slex.rb +294 -0
- data/yard-0.9.44/lib/yard/parser/ruby/legacy/ruby_lex.rb +1360 -0
- data/yard-0.9.44/lib/yard/parser/ruby/legacy/ruby_parser.rb +32 -0
- data/yard-0.9.44/lib/yard/parser/ruby/legacy/statement.rb +68 -0
- data/yard-0.9.44/lib/yard/parser/ruby/legacy/statement_list.rb +394 -0
- data/yard-0.9.44/lib/yard/parser/ruby/legacy/token_list.rb +74 -0
- data/yard-0.9.44/lib/yard/parser/ruby/ruby_parser.rb +792 -0
- data/yard-0.9.44/lib/yard/parser/ruby/token_resolver.rb +158 -0
- data/yard-0.9.44/lib/yard/parser/source_parser.rb +526 -0
- data/yard-0.9.44/lib/yard/rake/yardoc_task.rb +81 -0
- data/yard-0.9.44/lib/yard/registry.rb +439 -0
- data/yard-0.9.44/lib/yard/registry_resolver.rb +225 -0
- data/yard-0.9.44/lib/yard/registry_store.rb +342 -0
- data/yard-0.9.44/lib/yard/rubygems/backports/LICENSE.txt +57 -0
- data/yard-0.9.44/lib/yard/rubygems/backports/MIT.txt +20 -0
- data/yard-0.9.44/lib/yard/rubygems/backports/gem.rb +10 -0
- data/yard-0.9.44/lib/yard/rubygems/backports/source_index.rb +365 -0
- data/yard-0.9.44/lib/yard/rubygems/backports.rb +10 -0
- data/yard-0.9.44/lib/yard/rubygems/doc_manager.rb +90 -0
- data/yard-0.9.44/lib/yard/rubygems/hook.rb +197 -0
- data/yard-0.9.44/lib/yard/rubygems/specification.rb +50 -0
- data/yard-0.9.44/lib/yard/serializers/base.rb +83 -0
- data/yard-0.9.44/lib/yard/serializers/file_system_serializer.rb +123 -0
- data/yard-0.9.44/lib/yard/serializers/process_serializer.rb +24 -0
- data/yard-0.9.44/lib/yard/serializers/stdout_serializer.rb +34 -0
- data/yard-0.9.44/lib/yard/serializers/yardoc_serializer.rb +152 -0
- data/yard-0.9.44/lib/yard/server/adapter.rb +100 -0
- data/yard-0.9.44/lib/yard/server/commands/base.rb +203 -0
- data/yard-0.9.44/lib/yard/server/commands/display_file_command.rb +29 -0
- data/yard-0.9.44/lib/yard/server/commands/display_object_command.rb +65 -0
- data/yard-0.9.44/lib/yard/server/commands/frames_command.rb +16 -0
- data/yard-0.9.44/lib/yard/server/commands/library_command.rb +187 -0
- data/yard-0.9.44/lib/yard/server/commands/library_index_command.rb +28 -0
- data/yard-0.9.44/lib/yard/server/commands/list_command.rb +25 -0
- data/yard-0.9.44/lib/yard/server/commands/root_request_command.rb +15 -0
- data/yard-0.9.44/lib/yard/server/commands/search_command.rb +79 -0
- data/yard-0.9.44/lib/yard/server/commands/static_file_command.rb +23 -0
- data/yard-0.9.44/lib/yard/server/commands/static_file_helpers.rb +60 -0
- data/yard-0.9.44/lib/yard/server/doc_server_helper.rb +91 -0
- data/yard-0.9.44/lib/yard/server/doc_server_serializer.rb +39 -0
- data/yard-0.9.44/lib/yard/server/http_utils.rb +512 -0
- data/yard-0.9.44/lib/yard/server/library_version.rb +277 -0
- data/yard-0.9.44/lib/yard/server/rack_adapter.rb +97 -0
- data/yard-0.9.44/lib/yard/server/router.rb +187 -0
- data/yard-0.9.44/lib/yard/server/static_caching.rb +77 -0
- data/yard-0.9.44/lib/yard/server/templates/default/fulldoc/html/css/custom.css +207 -0
- data/yard-0.9.44/lib/yard/server/templates/default/fulldoc/html/images/processing.gif +0 -0
- data/yard-0.9.44/lib/yard/server/templates/default/fulldoc/html/js/autocomplete.js +203 -0
- data/yard-0.9.44/lib/yard/server/templates/default/layout/html/breadcrumb.erb +21 -0
- data/yard-0.9.44/lib/yard/server/templates/default/layout/html/script_setup.erb +7 -0
- data/yard-0.9.44/lib/yard/server/templates/default/layout/html/setup.rb +8 -0
- data/yard-0.9.44/lib/yard/server/templates/default/method_details/html/permalink.erb +6 -0
- data/yard-0.9.44/lib/yard/server/templates/default/method_details/html/setup.rb +5 -0
- data/yard-0.9.44/lib/yard/server/templates/doc_server/library_list/html/headers.erb +8 -0
- data/yard-0.9.44/lib/yard/server/templates/doc_server/library_list/html/library_list.erb +13 -0
- data/yard-0.9.44/lib/yard/server/templates/doc_server/library_list/html/listing.erb +13 -0
- data/yard-0.9.44/lib/yard/server/templates/doc_server/library_list/html/setup.rb +6 -0
- data/yard-0.9.44/lib/yard/server/templates/doc_server/library_list/html/title.erb +2 -0
- data/yard-0.9.44/lib/yard/server/templates/doc_server/processing/html/processing.erb +58 -0
- data/yard-0.9.44/lib/yard/server/templates/doc_server/processing/html/setup.rb +4 -0
- data/yard-0.9.44/lib/yard/server/templates/doc_server/search/html/search.erb +18 -0
- data/yard-0.9.44/lib/yard/server/templates/doc_server/search/html/setup.rb +9 -0
- data/yard-0.9.44/lib/yard/server/webrick_adapter.rb +45 -0
- data/yard-0.9.44/lib/yard/server.rb +13 -0
- data/yard-0.9.44/lib/yard/tags/default_factory.rb +192 -0
- data/yard-0.9.44/lib/yard/tags/default_tag.rb +13 -0
- data/yard-0.9.44/lib/yard/tags/directives.rb +631 -0
- data/yard-0.9.44/lib/yard/tags/library.rb +633 -0
- data/yard-0.9.44/lib/yard/tags/option_tag.rb +13 -0
- data/yard-0.9.44/lib/yard/tags/overload_tag.rb +72 -0
- data/yard-0.9.44/lib/yard/tags/ref_tag.rb +8 -0
- data/yard-0.9.44/lib/yard/tags/ref_tag_list.rb +28 -0
- data/yard-0.9.44/lib/yard/tags/tag.rb +72 -0
- data/yard-0.9.44/lib/yard/tags/tag_format_error.rb +7 -0
- data/yard-0.9.44/lib/yard/tags/types_explainer.rb +288 -0
- data/yard-0.9.44/lib/yard/templates/engine.rb +185 -0
- data/yard-0.9.44/lib/yard/templates/erb_cache.rb +23 -0
- data/yard-0.9.44/lib/yard/templates/helpers/base_helper.rb +215 -0
- data/yard-0.9.44/lib/yard/templates/helpers/filter_helper.rb +27 -0
- data/yard-0.9.44/lib/yard/templates/helpers/html_helper.rb +688 -0
- data/yard-0.9.44/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +83 -0
- data/yard-0.9.44/lib/yard/templates/helpers/markup/html_entities.rb +2140 -0
- data/yard-0.9.44/lib/yard/templates/helpers/markup/hybrid_markdown.rb +2131 -0
- data/yard-0.9.44/lib/yard/templates/helpers/markup/rdoc_markdown.rb +23 -0
- data/yard-0.9.44/lib/yard/templates/helpers/markup/rdoc_markup.rb +112 -0
- data/yard-0.9.44/lib/yard/templates/helpers/markup_helper.rb +175 -0
- data/yard-0.9.44/lib/yard/templates/helpers/method_helper.rb +77 -0
- data/yard-0.9.44/lib/yard/templates/helpers/module_helper.rb +21 -0
- data/yard-0.9.44/lib/yard/templates/helpers/text_helper.rb +112 -0
- data/yard-0.9.44/lib/yard/templates/helpers/uml_helper.rb +47 -0
- data/yard-0.9.44/lib/yard/templates/section.rb +103 -0
- data/yard-0.9.44/lib/yard/templates/template.rb +420 -0
- data/yard-0.9.44/lib/yard/templates/template_options.rb +91 -0
- data/yard-0.9.44/lib/yard/verifier.rb +151 -0
- data/yard-0.9.44/lib/yard/version.rb +6 -0
- data/yard-0.9.44/lib/yard.rb +75 -0
- data/yard-0.9.44/po/ja.po +31108 -0
- data/yard-0.9.44/templates/default/class/dot/setup.rb +7 -0
- data/yard-0.9.44/templates/default/class/dot/superklass.erb +3 -0
- data/yard-0.9.44/templates/default/class/html/constructor_details.erb +8 -0
- data/yard-0.9.44/templates/default/class/html/setup.rb +2 -0
- data/yard-0.9.44/templates/default/class/html/subclasses.erb +4 -0
- data/yard-0.9.44/templates/default/class/setup.rb +36 -0
- data/yard-0.9.44/templates/default/class/text/setup.rb +12 -0
- data/yard-0.9.44/templates/default/class/text/subclasses.erb +5 -0
- data/yard-0.9.44/templates/default/constant/text/header.erb +11 -0
- data/yard-0.9.44/templates/default/constant/text/setup.rb +4 -0
- data/yard-0.9.44/templates/default/docstring/html/abstract.erb +4 -0
- data/yard-0.9.44/templates/default/docstring/html/deprecated.erb +1 -0
- data/yard-0.9.44/templates/default/docstring/html/index.erb +5 -0
- data/yard-0.9.44/templates/default/docstring/html/note.erb +6 -0
- data/yard-0.9.44/templates/default/docstring/html/private.erb +4 -0
- data/yard-0.9.44/templates/default/docstring/html/returns_void.erb +1 -0
- data/yard-0.9.44/templates/default/docstring/html/text.erb +1 -0
- data/yard-0.9.44/templates/default/docstring/html/todo.erb +6 -0
- data/yard-0.9.44/templates/default/docstring/setup.rb +52 -0
- data/yard-0.9.44/templates/default/docstring/text/abstract.erb +2 -0
- data/yard-0.9.44/templates/default/docstring/text/deprecated.erb +2 -0
- data/yard-0.9.44/templates/default/docstring/text/index.erb +2 -0
- data/yard-0.9.44/templates/default/docstring/text/note.erb +4 -0
- data/yard-0.9.44/templates/default/docstring/text/private.erb +2 -0
- data/yard-0.9.44/templates/default/docstring/text/returns_void.erb +1 -0
- data/yard-0.9.44/templates/default/docstring/text/text.erb +1 -0
- data/yard-0.9.44/templates/default/docstring/text/todo.erb +4 -0
- data/yard-0.9.44/templates/default/fulldoc/html/css/common.css +1 -0
- data/yard-0.9.44/templates/default/fulldoc/html/css/full_list.css +206 -0
- data/yard-0.9.44/templates/default/fulldoc/html/css/style.css +1089 -0
- data/yard-0.9.44/templates/default/fulldoc/html/frames.erb +22 -0
- data/yard-0.9.44/templates/default/fulldoc/html/full_list.erb +40 -0
- data/yard-0.9.44/templates/default/fulldoc/html/full_list_class.erb +2 -0
- data/yard-0.9.44/templates/default/fulldoc/html/full_list_file.erb +7 -0
- data/yard-0.9.44/templates/default/fulldoc/html/full_list_method.erb +10 -0
- data/yard-0.9.44/templates/default/fulldoc/html/js/app.js +801 -0
- data/yard-0.9.44/templates/default/fulldoc/html/js/full_list.js +334 -0
- data/yard-0.9.44/templates/default/fulldoc/html/js/jquery.js +4 -0
- data/yard-0.9.44/templates/default/fulldoc/html/setup.rb +249 -0
- data/yard-0.9.44/templates/default/layout/dot/header.erb +6 -0
- data/yard-0.9.44/templates/default/layout/dot/setup.rb +15 -0
- data/yard-0.9.44/templates/default/layout/html/breadcrumb.erb +11 -0
- data/yard-0.9.44/templates/default/layout/html/files.erb +11 -0
- data/yard-0.9.44/templates/default/layout/html/footer.erb +5 -0
- data/yard-0.9.44/templates/default/layout/html/headers.erb +15 -0
- data/yard-0.9.44/templates/default/layout/html/index.erb +2 -0
- data/yard-0.9.44/templates/default/layout/html/layout.erb +26 -0
- data/yard-0.9.44/templates/default/layout/html/listing.erb +4 -0
- data/yard-0.9.44/templates/default/layout/html/objects.erb +32 -0
- data/yard-0.9.44/templates/default/layout/html/script_setup.erb +4 -0
- data/yard-0.9.44/templates/default/layout/html/search.erb +13 -0
- data/yard-0.9.44/templates/default/layout/html/setup.rb +89 -0
- data/yard-0.9.44/templates/default/method/html/header.erb +17 -0
- data/yard-0.9.44/templates/default/method/setup.rb +4 -0
- data/yard-0.9.44/templates/default/method/text/header.erb +1 -0
- data/yard-0.9.44/templates/default/method_details/html/header.erb +3 -0
- data/yard-0.9.44/templates/default/method_details/html/method_signature.erb +25 -0
- data/yard-0.9.44/templates/default/method_details/html/source.erb +10 -0
- data/yard-0.9.44/templates/default/method_details/setup.rb +11 -0
- data/yard-0.9.44/templates/default/method_details/text/header.erb +10 -0
- data/yard-0.9.44/templates/default/method_details/text/method_signature.erb +12 -0
- data/yard-0.9.44/templates/default/method_details/text/setup.rb +11 -0
- data/yard-0.9.44/templates/default/module/dot/child.erb +1 -0
- data/yard-0.9.44/templates/default/module/dot/dependencies.erb +3 -0
- data/yard-0.9.44/templates/default/module/dot/header.erb +6 -0
- data/yard-0.9.44/templates/default/module/dot/info.erb +14 -0
- data/yard-0.9.44/templates/default/module/dot/setup.rb +15 -0
- data/yard-0.9.44/templates/default/module/html/attribute_details.erb +10 -0
- data/yard-0.9.44/templates/default/module/html/attribute_summary.erb +8 -0
- data/yard-0.9.44/templates/default/module/html/box_info.erb +43 -0
- data/yard-0.9.44/templates/default/module/html/children.erb +8 -0
- data/yard-0.9.44/templates/default/module/html/constant_summary.erb +17 -0
- data/yard-0.9.44/templates/default/module/html/defines.erb +3 -0
- data/yard-0.9.44/templates/default/module/html/header.erb +5 -0
- data/yard-0.9.44/templates/default/module/html/inherited_attributes.erb +14 -0
- data/yard-0.9.44/templates/default/module/html/inherited_constants.erb +8 -0
- data/yard-0.9.44/templates/default/module/html/inherited_methods.erb +20 -0
- data/yard-0.9.44/templates/default/module/html/item_summary.erb +40 -0
- data/yard-0.9.44/templates/default/module/html/method_details_list.erb +9 -0
- data/yard-0.9.44/templates/default/module/html/method_summary.erb +22 -0
- data/yard-0.9.44/templates/default/module/html/methodmissing.erb +12 -0
- data/yard-0.9.44/templates/default/module/html/pre_docstring.erb +1 -0
- data/yard-0.9.44/templates/default/module/setup.rb +187 -0
- data/yard-0.9.44/templates/default/module/text/children.erb +10 -0
- data/yard-0.9.44/templates/default/module/text/class_meths_list.erb +8 -0
- data/yard-0.9.44/templates/default/module/text/extends.erb +8 -0
- data/yard-0.9.44/templates/default/module/text/header.erb +7 -0
- data/yard-0.9.44/templates/default/module/text/includes.erb +8 -0
- data/yard-0.9.44/templates/default/module/text/instance_meths_list.erb +8 -0
- data/yard-0.9.44/templates/default/module/text/setup.rb +13 -0
- data/yard-0.9.44/templates/default/onefile/html/files.erb +5 -0
- data/yard-0.9.44/templates/default/onefile/html/headers.erb +8 -0
- data/yard-0.9.44/templates/default/onefile/html/layout.erb +16 -0
- data/yard-0.9.44/templates/default/onefile/html/readme.erb +3 -0
- data/yard-0.9.44/templates/default/onefile/html/setup.rb +62 -0
- data/yard-0.9.44/templates/default/root/dot/child.erb +3 -0
- data/yard-0.9.44/templates/default/root/dot/setup.rb +6 -0
- data/yard-0.9.44/templates/default/root/html/setup.rb +2 -0
- data/yard-0.9.44/templates/default/tags/html/example.erb +11 -0
- data/yard-0.9.44/templates/default/tags/html/index.erb +3 -0
- data/yard-0.9.44/templates/default/tags/html/option.erb +24 -0
- data/yard-0.9.44/templates/default/tags/html/overload.erb +14 -0
- data/yard-0.9.44/templates/default/tags/html/see.erb +8 -0
- data/yard-0.9.44/templates/default/tags/html/tag.erb +20 -0
- data/yard-0.9.44/templates/default/tags/setup.rb +57 -0
- data/yard-0.9.44/templates/default/tags/text/example.erb +12 -0
- data/yard-0.9.44/templates/default/tags/text/index.erb +1 -0
- data/yard-0.9.44/templates/default/tags/text/option.erb +20 -0
- data/yard-0.9.44/templates/default/tags/text/overload.erb +19 -0
- data/yard-0.9.44/templates/default/tags/text/see.erb +11 -0
- data/yard-0.9.44/templates/default/tags/text/tag.erb +13 -0
- data/yard-0.9.44/templates/guide/class/html/setup.rb +2 -0
- data/yard-0.9.44/templates/guide/docstring/html/setup.rb +2 -0
- data/yard-0.9.44/templates/guide/fulldoc/html/css/style.css +358 -0
- data/yard-0.9.44/templates/guide/fulldoc/html/js/app.js +61 -0
- data/yard-0.9.44/templates/guide/fulldoc/html/setup.rb +74 -0
- data/yard-0.9.44/templates/guide/layout/html/layout.erb +78 -0
- data/yard-0.9.44/templates/guide/layout/html/setup.rb +25 -0
- data/yard-0.9.44/templates/guide/method/html/header.erb +18 -0
- data/yard-0.9.44/templates/guide/method/html/setup.rb +22 -0
- data/yard-0.9.44/templates/guide/module/html/header.erb +7 -0
- data/yard-0.9.44/templates/guide/module/html/method_list.erb +5 -0
- data/yard-0.9.44/templates/guide/module/html/setup.rb +27 -0
- data/yard-0.9.44/templates/guide/onefile/html/files.erb +4 -0
- data/yard-0.9.44/templates/guide/onefile/html/setup.rb +6 -0
- data/yard-0.9.44/templates/guide/onefile/html/toc.erb +3 -0
- data/yard-0.9.44/templates/guide/tags/html/setup.rb +9 -0
- metadata +419 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module YARD
|
|
4
|
+
module Handlers
|
|
5
|
+
# Iterates over all statements in a file and delegates them to the
|
|
6
|
+
# {Handlers::Base} objects that are registered to handle the statement.
|
|
7
|
+
#
|
|
8
|
+
# This class is passed to each handler and keeps overall processing state.
|
|
9
|
+
# For example, if the {#visibility} is set in a handler, all following
|
|
10
|
+
# statements will have access to this state. This allows "public",
|
|
11
|
+
# "protected" and "private" statements to be handled in classes and modules.
|
|
12
|
+
# In addition, the {#namespace} can be set during parsing to control
|
|
13
|
+
# where objects are being created from. You can also access extra stateful
|
|
14
|
+
# properties that any handler can set during the duration of the post
|
|
15
|
+
# processing of a file from {#extra_state}. If you need to access state
|
|
16
|
+
# across different files, look at {#globals}.
|
|
17
|
+
#
|
|
18
|
+
# @see Handlers::Base
|
|
19
|
+
class Processor
|
|
20
|
+
class << self
|
|
21
|
+
# Registers a new namespace for handlers of the given type.
|
|
22
|
+
# @since 0.6.0
|
|
23
|
+
def register_handler_namespace(type, ns)
|
|
24
|
+
namespace_for_handler[type] = ns
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# @return [Hash] a list of registered parser type extensions
|
|
28
|
+
# @private
|
|
29
|
+
# @since 0.6.0
|
|
30
|
+
attr_reader :namespace_for_handler
|
|
31
|
+
undef namespace_for_handler
|
|
32
|
+
def namespace_for_handler; @@parser_type_extensions ||= {} end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
register_handler_namespace :ruby, Ruby
|
|
36
|
+
register_handler_namespace :ruby18, Ruby::Legacy
|
|
37
|
+
register_handler_namespace :c, C
|
|
38
|
+
register_handler_namespace :rbs, RBS
|
|
39
|
+
|
|
40
|
+
# @return [String] the filename
|
|
41
|
+
attr_accessor :file
|
|
42
|
+
|
|
43
|
+
# @return [CodeObjects::NamespaceObject] the current namespace
|
|
44
|
+
attr_accessor :namespace
|
|
45
|
+
|
|
46
|
+
# @return [Symbol] the current visibility (public, private, protected)
|
|
47
|
+
attr_accessor :visibility
|
|
48
|
+
|
|
49
|
+
# @return [Symbol] the current scope (class, instance)
|
|
50
|
+
attr_accessor :scope
|
|
51
|
+
|
|
52
|
+
# @return [CodeObjects::Base, nil] unlike the namespace, the owner
|
|
53
|
+
# is a non-namespace object that should be stored between statements.
|
|
54
|
+
# For instance, when parsing a method body, the {CodeObjects::MethodObject}
|
|
55
|
+
# is set as the owner, in case any extra method information is processed.
|
|
56
|
+
attr_accessor :owner
|
|
57
|
+
|
|
58
|
+
# @return [Symbol] the parser type (:ruby, :ruby18, :c)
|
|
59
|
+
attr_accessor :parser_type
|
|
60
|
+
|
|
61
|
+
# Handlers can share state for the entire post processing stage through
|
|
62
|
+
# this attribute. Note that post processing stage spans multiple files.
|
|
63
|
+
# To share state only within a single file, use {#extra_state}
|
|
64
|
+
#
|
|
65
|
+
# @example Sharing state among two handlers
|
|
66
|
+
# class Handler1 < YARD::Handlers::Ruby::Base
|
|
67
|
+
# handles :class
|
|
68
|
+
# process { globals.foo = :bar }
|
|
69
|
+
# end
|
|
70
|
+
#
|
|
71
|
+
# class Handler2 < YARD::Handlers::Ruby::Base
|
|
72
|
+
# handles :method
|
|
73
|
+
# process { puts globals.foo }
|
|
74
|
+
# end
|
|
75
|
+
# @return [OpenStruct] global shared state for post-processing stage
|
|
76
|
+
# @see #extra_state
|
|
77
|
+
attr_accessor :globals
|
|
78
|
+
|
|
79
|
+
# Share state across different handlers inside of a file.
|
|
80
|
+
# This attribute is similar to {#visibility}, {#scope}, {#namespace}
|
|
81
|
+
# and {#owner}, in that they all maintain state across all handlers
|
|
82
|
+
# for the entire source file. Use this attribute to store any data
|
|
83
|
+
# your handler might need to save during the parsing of a file. If
|
|
84
|
+
# you need to save state across files, see {#globals}.
|
|
85
|
+
#
|
|
86
|
+
# @return [OpenStruct] an open structure that can store arbitrary data
|
|
87
|
+
# @see #globals
|
|
88
|
+
attr_accessor :extra_state
|
|
89
|
+
|
|
90
|
+
# Creates a new Processor for a +file+.
|
|
91
|
+
# @param [Parser::SourceParser] parser the parser used to initialize the processor
|
|
92
|
+
def initialize(parser)
|
|
93
|
+
@file = parser.file || "(stdin)"
|
|
94
|
+
@namespace = YARD::Registry.root
|
|
95
|
+
@visibility = :public
|
|
96
|
+
@scope = :instance
|
|
97
|
+
@owner = @namespace
|
|
98
|
+
@parser_type = parser.parser_type
|
|
99
|
+
@handlers_loaded = {}
|
|
100
|
+
@globals = parser.globals || OpenStruct.new
|
|
101
|
+
@extra_state = OpenStruct.new
|
|
102
|
+
load_handlers
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Processes a list of statements by finding handlers to process each
|
|
106
|
+
# one.
|
|
107
|
+
#
|
|
108
|
+
# @param [Array] statements a list of statements
|
|
109
|
+
# @return [void]
|
|
110
|
+
def process(statements)
|
|
111
|
+
statements.each_with_index do |stmt, _index|
|
|
112
|
+
find_handlers(stmt).each do |handler|
|
|
113
|
+
begin
|
|
114
|
+
handler.new(self, stmt).process
|
|
115
|
+
rescue HandlerAborted
|
|
116
|
+
log.debug "#{handler} cancelled from #{caller.last}"
|
|
117
|
+
log.debug "\tin file '#{file}':#{stmt.line}:\n\n" + stmt.show + "\n"
|
|
118
|
+
rescue NamespaceMissingError => missingerr
|
|
119
|
+
log.warn "The #{missingerr.object.type} #{missingerr.object.path} has not yet been recognized.\n" \
|
|
120
|
+
"If this class/method is part of your source tree, this will affect your documentation results.\n" \
|
|
121
|
+
"You can correct this issue by loading the source file for this object before `#{file}'\n"
|
|
122
|
+
rescue Parser::UndocumentableError => undocerr
|
|
123
|
+
log.warn "in #{handler}: Undocumentable #{undocerr.message}\n" \
|
|
124
|
+
"\tin file '#{file}':#{stmt.line}:\n\n" + stmt.show + "\n"
|
|
125
|
+
rescue => e
|
|
126
|
+
log.error "Unhandled exception in #{handler}:\n" \
|
|
127
|
+
" in `#{file}`:#{stmt.line}:\n\n#{stmt.show}\n"
|
|
128
|
+
log.backtrace(e)
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Continue parsing the remainder of the files in the +globals.ordered_parser+
|
|
135
|
+
# object. After the remainder of files are parsed, processing will continue
|
|
136
|
+
# on the current file.
|
|
137
|
+
#
|
|
138
|
+
# @return [void]
|
|
139
|
+
# @see Parser::OrderedParser
|
|
140
|
+
def parse_remaining_files
|
|
141
|
+
if globals.ordered_parser
|
|
142
|
+
globals.ordered_parser.parse
|
|
143
|
+
log.debug("Re-processing #{@file}...")
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Searches for all handlers in {Base.subclasses} that match the +statement+
|
|
148
|
+
#
|
|
149
|
+
# @param statement the statement object to match.
|
|
150
|
+
# @return [Array<Base>] a list of handlers to process the statement with.
|
|
151
|
+
def find_handlers(statement)
|
|
152
|
+
Base.subclasses.find_all do |handler|
|
|
153
|
+
handler_base_class > handler &&
|
|
154
|
+
(handler.namespace_only? ? owner.is_a?(CodeObjects::NamespaceObject) : true) &&
|
|
155
|
+
handles?(handler, statement)
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
private
|
|
160
|
+
|
|
161
|
+
def handles?(handler, statement)
|
|
162
|
+
return false unless handler.matches_file?(file)
|
|
163
|
+
if handler.method(:handles?).arity == 1
|
|
164
|
+
handler.handles?(statement)
|
|
165
|
+
elsif [-1, 2].include?(handler.method(:handles?).arity)
|
|
166
|
+
handler.handles?(statement, self)
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# Returns the handler base class
|
|
171
|
+
# @return [Base] the base class
|
|
172
|
+
def handler_base_class
|
|
173
|
+
handler_base_namespace.const_get(:Base)
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# The module holding the handlers to be loaded
|
|
177
|
+
#
|
|
178
|
+
# @return [Module] the module containing the handlers depending on
|
|
179
|
+
# {#parser_type}.
|
|
180
|
+
def handler_base_namespace
|
|
181
|
+
self.class.namespace_for_handler[parser_type]
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Loads handlers from {#handler_base_namespace}. This ensures that
|
|
185
|
+
# Ruby1.9 handlers are never loaded into 1.8; also lowers the amount
|
|
186
|
+
# of modules that are loaded
|
|
187
|
+
# @return [void]
|
|
188
|
+
def load_handlers
|
|
189
|
+
return if @handlers_loaded[parser_type]
|
|
190
|
+
handler_base_namespace.constants.each do |c|
|
|
191
|
+
const = handler_base_namespace.const_get(c)
|
|
192
|
+
unless Handlers::Base.subclasses.include?(const)
|
|
193
|
+
Handlers::Base.subclasses << const
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
@handlers_loaded[parser_type] = true
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Handles RBS attr_reader, attr_writer, and attr_accessor declarations.
|
|
3
|
+
#
|
|
4
|
+
# Registers one or two {YARD::CodeObjects::MethodObject} instances (reader
|
|
5
|
+
# and/or writer) with @return / @param tags derived from the RBS type.
|
|
6
|
+
class YARD::Handlers::RBS::AttributeHandler < YARD::Handlers::RBS::Base
|
|
7
|
+
handles :attr_reader, :attr_writer, :attr_accessor
|
|
8
|
+
|
|
9
|
+
process do
|
|
10
|
+
attr_name = statement.name
|
|
11
|
+
rbs_type = statement.attr_rbs_type
|
|
12
|
+
yard_types = rbs_type ? YARD::Handlers::RBS::MethodHandler.rbs_type_to_yard_types(rbs_type) : nil
|
|
13
|
+
mscope = statement.visibility == :class ? :class : :instance
|
|
14
|
+
|
|
15
|
+
case statement.type
|
|
16
|
+
when :attr_reader
|
|
17
|
+
register_reader(attr_name, yard_types, mscope)
|
|
18
|
+
register_existing_attribute_method(attr_name, "#{attr_name}=", :write, mscope)
|
|
19
|
+
when :attr_writer
|
|
20
|
+
register_existing_attribute_method(attr_name, attr_name, :read, mscope)
|
|
21
|
+
register_writer(attr_name, yard_types, mscope)
|
|
22
|
+
when :attr_accessor
|
|
23
|
+
register_reader(attr_name, yard_types, mscope)
|
|
24
|
+
register_writer(attr_name, yard_types, mscope)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def register_reader(name, types, scope)
|
|
31
|
+
obj = MethodObject.new(namespace, name, scope)
|
|
32
|
+
obj.source ||= "def #{name}\n @#{name}\nend"
|
|
33
|
+
obj.signature ||= "def #{name}"
|
|
34
|
+
obj = register(obj)
|
|
35
|
+
obj.docstring = "Returns the value of attribute #{name}." if obj.docstring.blank?(false)
|
|
36
|
+
apply_tag_types(obj, :return, types)
|
|
37
|
+
namespace.attributes[obj.scope][name] ||= SymbolHash[:read => nil, :write => nil]
|
|
38
|
+
namespace.attributes[obj.scope][name][:read] = obj
|
|
39
|
+
obj
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def register_writer(name, types, scope)
|
|
43
|
+
obj = MethodObject.new(namespace, "#{name}=", scope)
|
|
44
|
+
obj.parameters = [['value', nil]]
|
|
45
|
+
obj.source ||= "def #{name}=(value)\n @#{name} = value\nend"
|
|
46
|
+
obj.signature ||= "def #{name}=(value)"
|
|
47
|
+
obj = register(obj)
|
|
48
|
+
obj.docstring = "Sets the attribute #{name}\n@param value the value to set the attribute #{name} to." if obj.docstring.blank?(false)
|
|
49
|
+
apply_tag_types(obj, :param, types, "value")
|
|
50
|
+
namespace.attributes[obj.scope][name] ||= SymbolHash[:read => nil, :write => nil]
|
|
51
|
+
namespace.attributes[obj.scope][name][:write] = obj
|
|
52
|
+
obj
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def register_existing_attribute_method(attr_name, meth_name, type, scope)
|
|
56
|
+
namespace.attributes[scope][attr_name] ||= SymbolHash[:read => nil, :write => nil]
|
|
57
|
+
return if namespace.attributes[scope][attr_name][type]
|
|
58
|
+
|
|
59
|
+
obj = namespace.children.find do |other|
|
|
60
|
+
other.name == meth_name.to_sym && other.scope == scope
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
namespace.attributes[scope][attr_name][type] = obj if obj
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def apply_tag_types(obj, tag_name, types, tag_param_name = nil)
|
|
67
|
+
return unless types
|
|
68
|
+
|
|
69
|
+
tag = obj.tags(tag_name).find do |existing_tag|
|
|
70
|
+
existing_tag.name == tag_param_name
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
if tag
|
|
74
|
+
tag.types ||= types
|
|
75
|
+
else
|
|
76
|
+
obj.add_tag YARD::Tags::Tag.new(tag_name, '', types, tag_param_name)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module YARD
|
|
3
|
+
module Handlers
|
|
4
|
+
# Handlers for RBS (Ruby type signature) files.
|
|
5
|
+
module RBS
|
|
6
|
+
# Base class for all RBS handlers.
|
|
7
|
+
# Handlers match on the {Parser::RBS::Statement#type} symbol of the
|
|
8
|
+
# current statement and process it to create or annotate code objects.
|
|
9
|
+
class Base < Handlers::Base
|
|
10
|
+
# @return [Boolean] whether this handler matches the given statement
|
|
11
|
+
def self.handles?(statement, _processor)
|
|
12
|
+
handlers.any? do |matcher|
|
|
13
|
+
case matcher
|
|
14
|
+
when Symbol
|
|
15
|
+
statement.type == matcher
|
|
16
|
+
when String
|
|
17
|
+
statement.type.to_s == matcher
|
|
18
|
+
when Regexp
|
|
19
|
+
(statement.source || '') =~ matcher
|
|
20
|
+
else
|
|
21
|
+
false
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Recurse into the body of a namespace statement.
|
|
27
|
+
# @param opts [Hash] state overrides
|
|
28
|
+
# @see #push_state
|
|
29
|
+
def parse_block(opts = {})
|
|
30
|
+
return if statement.block.nil? || statement.block.empty?
|
|
31
|
+
push_state(opts) do
|
|
32
|
+
parser.process(statement.block)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Handles RBS constant declarations: `Name: Type`
|
|
3
|
+
class YARD::Handlers::RBS::ConstantHandler < YARD::Handlers::RBS::Base
|
|
4
|
+
handles :constant
|
|
5
|
+
|
|
6
|
+
process do
|
|
7
|
+
obj = register ConstantObject.new(namespace, statement.name)
|
|
8
|
+
if statement.attr_rbs_type && !obj.has_tag?(:return)
|
|
9
|
+
obj.add_tag YARD::Tags::Tag.new(:return, '', rbs_types(statement.attr_rbs_type))
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
private
|
|
14
|
+
|
|
15
|
+
def rbs_types(type_str)
|
|
16
|
+
YARD::Handlers::RBS::MethodHandler.rbs_type_to_yard_types(type_str)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Handles RBS method definitions (def name: signature).
|
|
3
|
+
#
|
|
4
|
+
# Creates a {YARD::CodeObjects::MethodObject} for each declaration
|
|
5
|
+
# and infers @param, @return, @yield, and @yieldparam tags from the
|
|
6
|
+
# RBS type signature when those tags are absent from the docstring.
|
|
7
|
+
class YARD::Handlers::RBS::MethodHandler < YARD::Handlers::RBS::Base
|
|
8
|
+
handles :method_def
|
|
9
|
+
|
|
10
|
+
process do
|
|
11
|
+
meth_scope = statement.visibility == :class ? :class : :instance
|
|
12
|
+
obj = register MethodObject.new(namespace, statement.name, meth_scope)
|
|
13
|
+
apply_signature_tags(obj, statement.signatures)
|
|
14
|
+
|
|
15
|
+
# For initialize, ensure the return type is the class, not void.
|
|
16
|
+
if statement.name == 'initialize'
|
|
17
|
+
ret_tags = obj.tags(:return)
|
|
18
|
+
if ret_tags.none? || (ret_tags.length == 1 && ret_tags.first.types == ['void'])
|
|
19
|
+
obj.docstring.delete_tags(:return)
|
|
20
|
+
obj.add_tag YARD::Tags::Tag.new(:return, "a new instance of #{namespace.name}",
|
|
21
|
+
[namespace.name.to_s])
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Convert an RBS type string to an array of YARD type strings.
|
|
27
|
+
#
|
|
28
|
+
# @param rbs [String] e.g. "String | Integer", "Array[String]", "bool"
|
|
29
|
+
# @return [Array<String>]
|
|
30
|
+
def self.rbs_type_to_yard_types(rbs)
|
|
31
|
+
rbs = rbs.strip
|
|
32
|
+
return ['void'] if rbs == 'void'
|
|
33
|
+
return ['Boolean'] if rbs == 'bool'
|
|
34
|
+
return ['Object'] if rbs == 'untyped'
|
|
35
|
+
return ['nil'] if rbs == 'nil'
|
|
36
|
+
|
|
37
|
+
# Strip outer parentheses: `(String | Integer)` → recurse on inner.
|
|
38
|
+
if rbs.start_with?('(') && rbs.end_with?(')') && bracket_depth(rbs[1..-2]) == 0
|
|
39
|
+
return rbs_type_to_yard_types(rbs[1..-2])
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# `Type?` is shorthand for `Type | nil` when the ? is outermost.
|
|
43
|
+
if rbs =~ /\A(.+)\?\z/ && bracket_depth($1) == 0
|
|
44
|
+
return rbs_type_to_yard_types($1) + ['nil']
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
split_on_pipe(rbs).map { |t| t.strip }
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
private
|
|
51
|
+
|
|
52
|
+
# Apply tags from all overload signatures to the method object.
|
|
53
|
+
def apply_signature_tags(obj, sigs)
|
|
54
|
+
return if sigs.nil? || sigs.empty?
|
|
55
|
+
|
|
56
|
+
if sigs.length == 1
|
|
57
|
+
# Single signature: add @param and @return directly.
|
|
58
|
+
add_param_return_tags(obj, sigs.first)
|
|
59
|
+
else
|
|
60
|
+
# Multiple signatures: add @overload tags.
|
|
61
|
+
sigs.each { |sig| add_overload_tag(obj, statement.name, sig) }
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Add @param / @return / @yield / @yieldparam from a single overload sig.
|
|
66
|
+
def add_param_return_tags(obj, sig)
|
|
67
|
+
parsed = parse_function_type(sig)
|
|
68
|
+
|
|
69
|
+
parsed[:params].each do |p|
|
|
70
|
+
next if p[:block] # block param handled via @yield below
|
|
71
|
+
tag_name = p[:name] ? p[:name].to_s : nil
|
|
72
|
+
next if tag_name && obj.tags(:param).any? { |t| t.name == tag_name }
|
|
73
|
+
obj.add_tag YARD::Tags::Tag.new(:param, '', p[:types], tag_name)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
if (blk = parsed[:block_param])
|
|
77
|
+
add_yield_tags(obj, blk)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
unless obj.has_tag?(:return)
|
|
81
|
+
obj.add_tag YARD::Tags::Tag.new(:return, '', parsed[:return_types])
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Add an @overload tag for one signature overload.
|
|
86
|
+
def add_overload_tag(obj, meth_name, sig)
|
|
87
|
+
parsed = parse_function_type(sig)
|
|
88
|
+
param_sigs = parsed[:params].reject { |p| p[:block] }.map.with_index do |p, idx|
|
|
89
|
+
p[:name] || "arg#{idx}"
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Build the overload tag text: signature line + nested @param/@return lines.
|
|
93
|
+
lines = ["#{meth_name}(#{param_sigs.join(', ')})"]
|
|
94
|
+
parsed[:params].reject { |p| p[:block] }.each_with_index do |p, idx|
|
|
95
|
+
pname = p[:name] || "arg#{idx}"
|
|
96
|
+
lines << " @param #{pname} [#{p[:types].join(', ')}]"
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
if (blk = parsed[:block_param])
|
|
100
|
+
add_yield_tags(obj, blk)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
lines << " @return [#{parsed[:return_types].join(', ')}]"
|
|
104
|
+
obj.add_tag YARD::Tags::OverloadTag.new(:overload, lines.join("\n"))
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Add @yield and @yieldparam tags from a parsed block type.
|
|
108
|
+
def add_yield_tags(obj, blk)
|
|
109
|
+
return if obj.has_tag?(:yield) && obj.has_tag?(:yieldparam)
|
|
110
|
+
obj.add_tag YARD::Tags::Tag.new(:yield, '') unless obj.has_tag?(:yield)
|
|
111
|
+
blk[:params].each_with_index do |p, idx|
|
|
112
|
+
pname = p[:name] || "arg#{idx}"
|
|
113
|
+
next if obj.tags(:yieldparam).any? { |t| t.name == pname }
|
|
114
|
+
obj.add_tag YARD::Tags::Tag.new(:yieldparam, '', p[:types], pname)
|
|
115
|
+
end
|
|
116
|
+
unless obj.has_tag?(:yieldreturn)
|
|
117
|
+
obj.add_tag YARD::Tags::Tag.new(:yieldreturn, '', self.class.rbs_type_to_yard_types(blk[:return_type] || 'void'))
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Parse a single RBS function type string (one overload) into its components.
|
|
122
|
+
#
|
|
123
|
+
# @param sig [String] e.g. "(String name, Integer age) -> String"
|
|
124
|
+
# @return [Hash] { :params => [...], :block_param => Hash|nil, :return_types => [...] }
|
|
125
|
+
def parse_function_type(sig)
|
|
126
|
+
sig = sig.strip
|
|
127
|
+
return { :params => [], :block_param => nil, :return_types => ['void'] } if sig.empty?
|
|
128
|
+
|
|
129
|
+
remaining = sig
|
|
130
|
+
params = []
|
|
131
|
+
block_param = nil
|
|
132
|
+
|
|
133
|
+
# 1. Extract positional/keyword params: leading `(...)`.
|
|
134
|
+
if remaining.start_with?('(')
|
|
135
|
+
close = find_matching(remaining, 0, '(', ')')
|
|
136
|
+
raise YARD::Parser::UndocumentableError, "malformed signature (unclosed '('): #{sig}" if close.nil?
|
|
137
|
+
params_str = remaining[1...close]
|
|
138
|
+
remaining = remaining[close + 1..-1].lstrip
|
|
139
|
+
params = parse_params_list(params_str)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# 2. Extract block type: `{ ... }`.
|
|
143
|
+
if remaining.start_with?('{')
|
|
144
|
+
close = find_matching(remaining, 0, '{', '}')
|
|
145
|
+
raise YARD::Parser::UndocumentableError, "malformed signature (unclosed '{'): #{sig}" if close.nil?
|
|
146
|
+
block_inner = remaining[1...close]
|
|
147
|
+
remaining = remaining[close + 1..-1].lstrip
|
|
148
|
+
block_param = parse_block_type(block_inner)
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# 3. Return type after `->`.
|
|
152
|
+
return_types = if remaining =~ /\A->\s*(.*)\z/
|
|
153
|
+
self.class.rbs_type_to_yard_types($1.strip)
|
|
154
|
+
else
|
|
155
|
+
['void']
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
{ :params => params, :block_param => block_param, :return_types => return_types }
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Parse a comma-separated parameter list (content inside outer parens).
|
|
162
|
+
def parse_params_list(str)
|
|
163
|
+
str = str.strip
|
|
164
|
+
return [] if str.empty?
|
|
165
|
+
|
|
166
|
+
split_by_comma(str).map { |p| parse_single_param(p.strip) }.compact
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Parse one parameter from an RBS param list.
|
|
170
|
+
def parse_single_param(param)
|
|
171
|
+
return nil if param.empty?
|
|
172
|
+
|
|
173
|
+
optional = false
|
|
174
|
+
rest = false
|
|
175
|
+
|
|
176
|
+
# Optional marker `?`.
|
|
177
|
+
if param.start_with?('?') && !param.start_with?('?(')
|
|
178
|
+
optional = true
|
|
179
|
+
param = param[1..-1].lstrip
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Double-splat `**` (rest keyword).
|
|
183
|
+
if param.start_with?('**')
|
|
184
|
+
rest = true
|
|
185
|
+
param = param[2..-1].lstrip
|
|
186
|
+
# Single-splat `*` (rest positional).
|
|
187
|
+
elsif param.start_with?('*') && !param.start_with?('*)')
|
|
188
|
+
rest = true
|
|
189
|
+
param = param[1..-1].lstrip
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# Block-type proc: `^(...)`.
|
|
193
|
+
if param.start_with?('^')
|
|
194
|
+
return { :name => nil, :types => [param], :optional => false, :rest => false, :block => true }
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Keyword parameter: `name: Type` or `?name: Type`.
|
|
198
|
+
if param =~ /\A([a-z_]\w*)\s*:\s*(.*)\z/ && !rest
|
|
199
|
+
kw_name = $1
|
|
200
|
+
kw_type = $2.strip
|
|
201
|
+
return { :name => "#{kw_name}:", :types => self.class.rbs_type_to_yard_types(kw_type),
|
|
202
|
+
:optional => optional, :rest => false }
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Positional: `Type [param_name]`.
|
|
206
|
+
type_str, param_name = extract_type_and_name(param)
|
|
207
|
+
{ :name => param_name, :types => self.class.rbs_type_to_yard_types(type_str),
|
|
208
|
+
:optional => optional, :rest => rest }
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# Split a type+name string like "Array[String] names" into ["Array[String]", "names"].
|
|
212
|
+
# The name is the trailing lowercase identifier (if any).
|
|
213
|
+
def extract_type_and_name(str)
|
|
214
|
+
str = str.strip
|
|
215
|
+
if str =~ /\A(.*\S)\s+([a-z_]\w*)\z/m
|
|
216
|
+
type_part = $1.strip
|
|
217
|
+
name_part = $2
|
|
218
|
+
# Exclude RBS type keywords from being mistaken for names.
|
|
219
|
+
unless %w[void untyped nil bool top bottom self instance class].include?(name_part)
|
|
220
|
+
return [type_part, name_part] unless type_part.empty?
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
[str, nil]
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# Parse the inside of a `{ ... }` block type, e.g. "(Integer) -> String".
|
|
227
|
+
def parse_block_type(inner)
|
|
228
|
+
inner = inner.strip
|
|
229
|
+
params = []
|
|
230
|
+
ret = nil
|
|
231
|
+
|
|
232
|
+
if inner.start_with?('(')
|
|
233
|
+
close = find_matching(inner, 0, '(', ')')
|
|
234
|
+
raise YARD::Parser::UndocumentableError, "malformed block type (unclosed '('): #{inner}" if close.nil?
|
|
235
|
+
params = parse_params_list(inner[1...close])
|
|
236
|
+
rest = inner[close + 1..-1].lstrip
|
|
237
|
+
else
|
|
238
|
+
rest = inner
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
ret = $1.strip if rest =~ /\A->\s*(.*)\z/
|
|
242
|
+
{ :params => params, :return_type => ret }
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# Find the index of the matching close bracket starting from +start+.
|
|
246
|
+
# @return [nil] if no matching bracket is found (malformed input).
|
|
247
|
+
def find_matching(str, start, open, close)
|
|
248
|
+
depth = 0
|
|
249
|
+
(start...str.length).each do |i|
|
|
250
|
+
case str[i]
|
|
251
|
+
when open then depth += 1
|
|
252
|
+
when close
|
|
253
|
+
depth -= 1
|
|
254
|
+
return i if depth == 0
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
nil
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# Split +str+ on commas that are not inside brackets.
|
|
261
|
+
def split_by_comma(str)
|
|
262
|
+
depth = 0
|
|
263
|
+
parts = []
|
|
264
|
+
cur = String.new('')
|
|
265
|
+
str.each_char do |c|
|
|
266
|
+
case c
|
|
267
|
+
when '(', '[', '{'
|
|
268
|
+
depth += 1
|
|
269
|
+
cur << c
|
|
270
|
+
when ')', ']', '}'
|
|
271
|
+
depth -= 1
|
|
272
|
+
cur << c
|
|
273
|
+
when ','
|
|
274
|
+
if depth == 0
|
|
275
|
+
parts << cur.strip
|
|
276
|
+
cur = String.new('')
|
|
277
|
+
else
|
|
278
|
+
cur << c
|
|
279
|
+
end
|
|
280
|
+
else
|
|
281
|
+
cur << c
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
parts << cur.strip unless cur.strip.empty?
|
|
285
|
+
parts
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
# Split +str+ on `|` that are not inside brackets.
|
|
289
|
+
def self.split_on_pipe(str)
|
|
290
|
+
depth = 0
|
|
291
|
+
parts = []
|
|
292
|
+
cur = String.new('')
|
|
293
|
+
str.each_char do |c|
|
|
294
|
+
case c
|
|
295
|
+
when '(', '[', '{'
|
|
296
|
+
depth += 1
|
|
297
|
+
cur << c
|
|
298
|
+
when ')', ']', '}'
|
|
299
|
+
depth -= 1
|
|
300
|
+
cur << c
|
|
301
|
+
when '|'
|
|
302
|
+
if depth == 0
|
|
303
|
+
parts << cur.strip
|
|
304
|
+
cur = String.new('')
|
|
305
|
+
else
|
|
306
|
+
cur << c
|
|
307
|
+
end
|
|
308
|
+
else
|
|
309
|
+
cur << c
|
|
310
|
+
end
|
|
311
|
+
end
|
|
312
|
+
parts << cur.strip unless cur.strip.empty?
|
|
313
|
+
parts
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
# Return the bracket depth of the full string (should be 0 for well-formed types).
|
|
317
|
+
def self.bracket_depth(str)
|
|
318
|
+
depth = 0
|
|
319
|
+
str.each_char do |c|
|
|
320
|
+
case c
|
|
321
|
+
when '(', '[', '{' then depth += 1
|
|
322
|
+
when ')', ']', '}' then depth -= 1
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
depth
|
|
326
|
+
end
|
|
327
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Handles RBS include, extend, and prepend declarations.
|
|
3
|
+
class YARD::Handlers::RBS::MixinHandler < YARD::Handlers::RBS::Base
|
|
4
|
+
handles :include, :extend, :prepend
|
|
5
|
+
|
|
6
|
+
process do
|
|
7
|
+
mixin = P(namespace, statement.mixin_name)
|
|
8
|
+
case statement.type
|
|
9
|
+
when :include
|
|
10
|
+
mixins = namespace.mixins(:instance)
|
|
11
|
+
mixins << mixin unless mixins.include?(mixin)
|
|
12
|
+
when :extend
|
|
13
|
+
mixins = namespace.mixins(:class)
|
|
14
|
+
mixins << mixin unless mixins.include?(mixin)
|
|
15
|
+
when :prepend
|
|
16
|
+
mixins = namespace.mixins(:instance)
|
|
17
|
+
mixins.unshift(mixin) unless mixins.include?(mixin)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|