From 106bd64e307a6fca3b4e10f9fe808a874b89917d Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Sat, 23 Oct 2021 01:27:13 +0100 Subject: [PATCH 1/2] Don't vendor YARD --- .gitignore | 2 + .../gems/yard-0.9.26/lib/rubygems_plugin.rb | 9 - .../ruby/2.6.0/gems/yard-0.9.26/lib/yard.rb | 69 - .../gems/yard-0.9.26/lib/yard/autoload.rb | 308 ---- .../gems/yard-0.9.26/lib/yard/cli/command.rb | 85 -- .../lib/yard/cli/command_parser.rb | 93 -- .../gems/yard-0.9.26/lib/yard/cli/config.rb | 198 --- .../gems/yard-0.9.26/lib/yard/cli/diff.rb | 273 ---- .../gems/yard-0.9.26/lib/yard/cli/display.rb | 69 - .../gems/yard-0.9.26/lib/yard/cli/gems.rb | 84 - .../gems/yard-0.9.26/lib/yard/cli/graph.rb | 125 -- .../gems/yard-0.9.26/lib/yard/cli/help.rb | 20 - .../gems/yard-0.9.26/lib/yard/cli/i18n.rb | 70 - .../gems/yard-0.9.26/lib/yard/cli/list.rb | 23 - .../yard-0.9.26/lib/yard/cli/markup_types.rb | 32 - .../gems/yard-0.9.26/lib/yard/cli/server.rb | 266 ---- .../gems/yard-0.9.26/lib/yard/cli/stats.rb | 231 --- .../gems/yard-0.9.26/lib/yard/cli/yardoc.rb | 789 ---------- .../lib/yard/cli/yardopts_command.rb | 110 -- .../gems/yard-0.9.26/lib/yard/cli/yri.rb | 215 --- .../yard-0.9.26/lib/yard/code_objects/base.rb | 622 -------- .../lib/yard/code_objects/class_object.rb | 146 -- .../code_objects/class_variable_object.rb | 11 - .../lib/yard/code_objects/constant_object.rb | 16 - .../code_objects/extended_method_object.rb | 24 - .../yard/code_objects/extra_file_object.rb | 134 -- .../lib/yard/code_objects/macro_object.rb | 172 --- .../lib/yard/code_objects/method_object.rb | 196 --- .../lib/yard/code_objects/module_object.rb | 21 - .../lib/yard/code_objects/namespace_mapper.rb | 141 -- .../lib/yard/code_objects/namespace_object.rb | 200 --- .../lib/yard/code_objects/proxy.rb | 245 --- .../lib/yard/code_objects/root_object.rb | 19 - .../2.6.0/gems/yard-0.9.26/lib/yard/config.rb | 270 ---- .../yard-0.9.26/lib/yard/core_ext/array.rb | 16 - .../yard-0.9.26/lib/yard/core_ext/file.rb | 69 - .../yard-0.9.26/lib/yard/core_ext/hash.rb | 16 - .../lib/yard/core_ext/insertion.rb | 63 - .../yard-0.9.26/lib/yard/core_ext/module.rb | 11 - .../yard-0.9.26/lib/yard/core_ext/string.rb | 68 - .../lib/yard/core_ext/symbol_hash.rb | 75 - .../gems/yard-0.9.26/lib/yard/docstring.rb | 386 ----- .../yard-0.9.26/lib/yard/docstring_parser.rb | 345 ----- .../gems/yard-0.9.26/lib/yard/gem_index.rb | 29 - .../gems/yard-0.9.26/lib/yard/globals.rb | 22 - .../yard-0.9.26/lib/yard/handlers/base.rb | 595 -------- .../lib/yard/handlers/c/alias_handler.rb | 16 - .../lib/yard/handlers/c/attribute_handler.rb | 13 - .../yard-0.9.26/lib/yard/handlers/c/base.rb | 164 -- .../lib/yard/handlers/c/class_handler.rb | 27 - .../lib/yard/handlers/c/constant_handler.rb | 13 - .../lib/yard/handlers/c/handler_methods.rb | 212 --- .../lib/yard/handlers/c/init_handler.rb | 20 - .../lib/yard/handlers/c/method_handler.rb | 45 - .../lib/yard/handlers/c/mixin_handler.rb | 21 - .../lib/yard/handlers/c/module_handler.rb | 17 - .../handlers/c/override_comment_handler.rb | 31 - .../lib/yard/handlers/c/path_handler.rb | 11 - .../lib/yard/handlers/c/struct_handler.rb | 13 - .../lib/yard/handlers/c/symbol_handler.rb | 8 - .../yard/handlers/common/method_handler.rb | 19 - .../lib/yard/handlers/processor.rb | 200 --- .../lib/yard/handlers/ruby/alias_handler.rb | 45 - .../yard/handlers/ruby/attribute_handler.rb | 87 -- .../lib/yard/handlers/ruby/base.rb | 165 -- .../handlers/ruby/class_condition_handler.rb | 92 -- .../lib/yard/handlers/ruby/class_handler.rb | 119 -- .../handlers/ruby/class_variable_handler.rb | 17 - .../lib/yard/handlers/ruby/comment_handler.rb | 10 - .../yard/handlers/ruby/constant_handler.rb | 55 - .../ruby/decorator_handler_methods.rb | 123 -- .../lib/yard/handlers/ruby/dsl_handler.rb | 15 - .../yard/handlers/ruby/dsl_handler_methods.rb | 96 -- .../yard/handlers/ruby/exception_handler.rb | 27 - .../lib/yard/handlers/ruby/extend_handler.rb | 22 - .../handlers/ruby/legacy/alias_handler.rb | 37 - .../handlers/ruby/legacy/attribute_handler.rb | 65 - .../lib/yard/handlers/ruby/legacy/base.rb | 245 --- .../ruby/legacy/class_condition_handler.rb | 83 - .../handlers/ruby/legacy/class_handler.rb | 113 -- .../ruby/legacy/class_variable_handler.rb | 15 - .../handlers/ruby/legacy/comment_handler.rb | 10 - .../handlers/ruby/legacy/constant_handler.rb | 29 - .../yard/handlers/ruby/legacy/dsl_handler.rb | 17 - .../handlers/ruby/legacy/exception_handler.rb | 13 - .../handlers/ruby/legacy/extend_handler.rb | 21 - .../handlers/ruby/legacy/method_handler.rb | 90 -- .../handlers/ruby/legacy/mixin_handler.rb | 39 - .../ruby/legacy/module_function_handler.rb | 19 - .../handlers/ruby/legacy/module_handler.rb | 12 - .../legacy/private_class_method_handler.rb | 22 - .../ruby/legacy/private_constant_handler.rb | 22 - .../ruby/legacy/visibility_handler.rb | 17 - .../handlers/ruby/legacy/yield_handler.rb | 29 - .../handlers/ruby/method_condition_handler.rb | 9 - .../lib/yard/handlers/ruby/method_handler.rb | 104 -- .../lib/yard/handlers/ruby/mixin_handler.rb | 52 - .../handlers/ruby/module_function_handler.rb | 27 - .../lib/yard/handlers/ruby/module_handler.rb | 12 - .../ruby/private_class_method_handler.rb | 14 - .../handlers/ruby/private_constant_handler.rb | 43 - .../ruby/public_class_method_handler.rb | 14 - .../handlers/ruby/struct_handler_methods.rb | 143 -- .../yard/handlers/ruby/visibility_handler.rb | 22 - .../lib/yard/handlers/ruby/yield_handler.rb | 31 - .../gems/yard-0.9.26/lib/yard/i18n/locale.rb | 67 - .../gems/yard-0.9.26/lib/yard/i18n/message.rb | 57 - .../yard-0.9.26/lib/yard/i18n/messages.rb | 56 - .../yard-0.9.26/lib/yard/i18n/po_parser.rb | 61 - .../lib/yard/i18n/pot_generator.rb | 290 ---- .../gems/yard-0.9.26/lib/yard/i18n/text.rb | 173 --- .../gems/yard-0.9.26/lib/yard/logging.rb | 205 --- .../gems/yard-0.9.26/lib/yard/options.rb | 217 --- .../gems/yard-0.9.26/lib/yard/parser/base.rb | 57 - .../yard-0.9.26/lib/yard/parser/c/c_parser.rb | 235 --- .../lib/yard/parser/c/comment_parser.rb | 134 -- .../lib/yard/parser/c/statement.rb | 66 - .../lib/yard/parser/ruby/ast_node.rb | 551 ------- .../lib/yard/parser/ruby/legacy/irb/slex.rb | 276 ---- .../lib/yard/parser/ruby/legacy/ruby_lex.rb | 1345 ----------------- .../yard/parser/ruby/legacy/ruby_parser.rb | 32 - .../lib/yard/parser/ruby/legacy/statement.rb | 68 - .../yard/parser/ruby/legacy/statement_list.rb | 394 ----- .../lib/yard/parser/ruby/legacy/token_list.rb | 74 - .../lib/yard/parser/ruby/ruby_parser.rb | 701 --------- .../lib/yard/parser/ruby/token_resolver.rb | 158 -- .../lib/yard/parser/source_parser.rb | 526 ------- .../yard-0.9.26/lib/yard/rake/yardoc_task.rb | 81 - .../gems/yard-0.9.26/lib/yard/registry.rb | 439 ------ .../yard-0.9.26/lib/yard/registry_resolver.rb | 217 --- .../yard-0.9.26/lib/yard/registry_store.rb | 342 ----- .../lib/yard/rubygems/backports.rb | 10 - .../lib/yard/rubygems/backports/LICENSE.txt | 57 - .../lib/yard/rubygems/backports/MIT.txt | 20 - .../lib/yard/rubygems/backports/gem.rb | 10 - .../yard/rubygems/backports/source_index.rb | 365 ----- .../lib/yard/rubygems/doc_manager.rb | 90 -- .../yard-0.9.26/lib/yard/rubygems/hook.rb | 197 --- .../lib/yard/rubygems/specification.rb | 50 - .../yard-0.9.26/lib/yard/serializers/base.rb | 83 - .../serializers/file_system_serializer.rb | 123 -- .../yard/serializers/process_serializer.rb | 24 - .../lib/yard/serializers/stdout_serializer.rb | 34 - .../lib/yard/serializers/yardoc_serializer.rb | 152 -- .../2.6.0/gems/yard-0.9.26/lib/yard/server.rb | 13 - .../yard-0.9.26/lib/yard/server/adapter.rb | 100 -- .../lib/yard/server/commands/base.rb | 209 --- .../server/commands/display_file_command.rb | 29 - .../server/commands/display_object_command.rb | 65 - .../yard/server/commands/frames_command.rb | 16 - .../yard/server/commands/library_command.rb | 187 --- .../server/commands/library_index_command.rb | 28 - .../lib/yard/server/commands/list_command.rb | 25 - .../server/commands/root_request_command.rb | 15 - .../yard/server/commands/search_command.rb | 79 - .../server/commands/static_file_command.rb | 23 - .../server/commands/static_file_helpers.rb | 61 - .../lib/yard/server/doc_server_helper.rb | 91 -- .../lib/yard/server/doc_server_serializer.rb | 39 - .../lib/yard/server/library_version.rb | 277 ---- .../lib/yard/server/rack_adapter.rb | 89 -- .../yard-0.9.26/lib/yard/server/router.rb | 187 --- .../lib/yard/server/static_caching.rb | 46 - .../default/fulldoc/html/css/custom.css | 127 -- .../fulldoc/html/images/processing.gif | Bin 1251 -> 0 bytes .../default/fulldoc/html/js/autocomplete.js | 12 - .../default/layout/html/breadcrumb.erb | 37 - .../default/layout/html/script_setup.erb | 7 - .../templates/default/layout/html/setup.rb | 8 - .../default/method_details/html/permalink.erb | 4 - .../default/method_details/html/setup.rb | 5 - .../doc_server/library_list/html/headers.erb | 8 - .../library_list/html/library_list.erb | 14 - .../doc_server/library_list/html/listing.erb | 13 - .../doc_server/library_list/html/setup.rb | 6 - .../doc_server/library_list/html/title.erb | 2 - .../doc_server/processing/html/processing.erb | 52 - .../doc_server/processing/html/setup.rb | 4 - .../doc_server/search/html/search.erb | 18 - .../templates/doc_server/search/html/setup.rb | 9 - .../lib/yard/server/webrick_adapter.rb | 45 - .../lib/yard/tags/default_factory.rb | 191 --- .../yard-0.9.26/lib/yard/tags/default_tag.rb | 13 - .../yard-0.9.26/lib/yard/tags/directives.rb | 616 -------- .../gems/yard-0.9.26/lib/yard/tags/library.rb | 633 -------- .../yard-0.9.26/lib/yard/tags/option_tag.rb | 13 - .../yard-0.9.26/lib/yard/tags/overload_tag.rb | 71 - .../gems/yard-0.9.26/lib/yard/tags/ref_tag.rb | 8 - .../yard-0.9.26/lib/yard/tags/ref_tag_list.rb | 28 - .../gems/yard-0.9.26/lib/yard/tags/tag.rb | 71 - .../lib/yard/tags/tag_format_error.rb | 7 - .../lib/yard/tags/types_explainer.rb | 162 -- .../yard-0.9.26/lib/yard/templates/engine.rb | 186 --- .../lib/yard/templates/erb_cache.rb | 23 - .../lib/yard/templates/helpers/base_helper.rb | 215 --- .../yard/templates/helpers/filter_helper.rb | 27 - .../lib/yard/templates/helpers/html_helper.rb | 670 -------- .../helpers/html_syntax_highlight_helper.rb | 78 - .../templates/helpers/markup/rdoc_markdown.rb | 23 - .../templates/helpers/markup/rdoc_markup.rb | 110 -- .../yard/templates/helpers/markup_helper.rb | 172 --- .../yard/templates/helpers/method_helper.rb | 75 - .../yard/templates/helpers/module_helper.rb | 21 - .../lib/yard/templates/helpers/text_helper.rb | 112 -- .../lib/yard/templates/helpers/uml_helper.rb | 47 - .../yard-0.9.26/lib/yard/templates/section.rb | 103 -- .../lib/yard/templates/template.rb | 418 ----- .../lib/yard/templates/template_options.rb | 92 -- .../gems/yard-0.9.26/lib/yard/verifier.rb | 151 -- .../gems/yard-0.9.26/lib/yard/version.rb | 6 - .../gems/yard-sorbet-0.6.0/lib/yard-sorbet.rb | 14 - .../lib/yard-sorbet/directives.rb | 30 - .../lib/yard-sorbet/handlers.rb | 16 - .../handlers/abstract_dsl_handler.rb | 30 - .../lib/yard-sorbet/handlers/enums_handler.rb | 34 - .../yard-sorbet/handlers/include_handler.rb | 37 - .../mixes_in_class_methods_handler.rb | 22 - .../lib/yard-sorbet/handlers/sig_handler.rb | 70 - .../handlers/struct_class_handler.rb | 72 - .../handlers/struct_class_handler.rbi | 5 - .../handlers/struct_prop_handler.rb | 72 - .../lib/yard-sorbet/node_utils.rb | 62 - .../lib/yard-sorbet/sig_to_yard.rb | 130 -- .../lib/yard-sorbet/t_struct_prop.rb | 13 - .../lib/yard-sorbet/tag_utils.rb | 44 - .../lib/yard-sorbet/version.rb | 8 - 226 files changed, 2 insertions(+), 25041 deletions(-) delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/rubygems_plugin.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/autoload.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/command.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/command_parser.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/config.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/diff.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/display.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/gems.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/graph.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/help.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/i18n.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/list.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/markup_types.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/server.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/stats.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/yardoc.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/yardopts_command.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/yri.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/base.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/class_object.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/class_variable_object.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/constant_object.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/extended_method_object.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/extra_file_object.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/macro_object.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/method_object.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/module_object.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/namespace_mapper.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/namespace_object.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/proxy.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/root_object.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/config.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/array.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/file.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/hash.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/insertion.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/module.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/string.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/symbol_hash.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/docstring.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/docstring_parser.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/gem_index.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/globals.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/base.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/alias_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/attribute_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/base.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/class_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/constant_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/handler_methods.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/init_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/method_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/mixin_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/module_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/override_comment_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/path_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/struct_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/symbol_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/common/method_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/processor.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/alias_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/attribute_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/base.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/class_condition_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/class_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/class_variable_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/comment_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/constant_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/decorator_handler_methods.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/dsl_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/dsl_handler_methods.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/exception_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/extend_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/alias_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/attribute_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/base.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/class_condition_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/class_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/class_variable_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/comment_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/constant_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/dsl_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/exception_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/extend_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/method_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/mixin_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/module_function_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/module_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/private_class_method_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/private_constant_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/visibility_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/yield_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/method_condition_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/method_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/mixin_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/module_function_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/module_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/private_class_method_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/private_constant_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/public_class_method_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/struct_handler_methods.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/visibility_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/yield_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/locale.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/message.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/messages.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/po_parser.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/pot_generator.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/text.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/logging.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/options.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/base.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/c/c_parser.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/c/comment_parser.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/c/statement.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/ast_node.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/irb/slex.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/ruby_lex.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/ruby_parser.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/statement.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/statement_list.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/token_list.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/ruby_parser.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/token_resolver.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/source_parser.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rake/yardoc_task.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/registry.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/registry_resolver.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/registry_store.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports/LICENSE.txt delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports/MIT.txt delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports/gem.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports/source_index.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/doc_manager.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/hook.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/specification.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/base.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/file_system_serializer.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/process_serializer.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/stdout_serializer.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/yardoc_serializer.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/adapter.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/base.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/display_file_command.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/display_object_command.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/frames_command.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/library_command.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/library_index_command.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/list_command.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/root_request_command.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/search_command.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/static_file_command.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/static_file_helpers.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/doc_server_helper.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/doc_server_serializer.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/library_version.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/rack_adapter.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/router.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/static_caching.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/fulldoc/html/css/custom.css delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/fulldoc/html/images/processing.gif delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/fulldoc/html/js/autocomplete.js delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/layout/html/breadcrumb.erb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/layout/html/script_setup.erb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/layout/html/setup.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/method_details/html/permalink.erb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/method_details/html/setup.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/headers.erb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/library_list.erb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/listing.erb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/setup.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/title.erb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/processing/html/processing.erb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/processing/html/setup.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/search/html/search.erb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/search/html/setup.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/webrick_adapter.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/default_factory.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/default_tag.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/directives.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/library.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/option_tag.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/overload_tag.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/ref_tag.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/ref_tag_list.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/tag.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/tag_format_error.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/types_explainer.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/engine.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/erb_cache.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/base_helper.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/filter_helper.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/html_helper.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/html_syntax_highlight_helper.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/markup/rdoc_markdown.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/markup/rdoc_markup.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/markup_helper.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/method_helper.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/module_helper.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/text_helper.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/uml_helper.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/section.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/template.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/template_options.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/verifier.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/version.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/directives.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/abstract_dsl_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/enums_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/include_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/mixes_in_class_methods_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/sig_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/struct_class_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/struct_class_handler.rbi delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/struct_prop_handler.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/node_utils.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/sig_to_yard.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/t_struct_prop.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/tag_utils.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/version.rb diff --git a/.gitignore b/.gitignore index 15eda49254..334a06e404 100644 --- a/.gitignore +++ b/.gitignore @@ -161,6 +161,8 @@ **/vendor/bundle/ruby/*/gems/unparser-*/ **/vendor/bundle/ruby/*/gems/uri_template-*/ **/vendor/bundle/ruby/*/gems/webrobots-*/ +**/vendor/bundle/ruby/*/gems/yard-*/ +**/vendor/bundle/ruby/*/gems/yard-sorbet-*/ # Ignore `bin` contents (again). /bin diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/rubygems_plugin.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/rubygems_plugin.rb deleted file mode 100644 index d0b59bf370..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/rubygems_plugin.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true -if defined?(Gem::VERSION) && Gem::VERSION >= "2.0." - require File.expand_path(File.dirname(__FILE__) + '/yard/rubygems/hook') -else - unless defined?(Gem::DocManager.load_yardoc) - require File.expand_path(File.dirname(__FILE__) + '/yard/rubygems/specification') - require File.expand_path(File.dirname(__FILE__) + '/yard/rubygems/doc_manager') - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard.rb deleted file mode 100644 index dd02af11ad..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard.rb +++ /dev/null @@ -1,69 +0,0 @@ -# frozen_string_literal: true -module YARD - # The root path for YARD source libraries - ROOT = File.expand_path(File.dirname(__FILE__)) - - require File.join(YARD::ROOT, 'yard', 'version') - require File.join(YARD::ROOT, 'yard', 'autoload') - - # The root path for YARD builtin templates - TEMPLATE_ROOT = File.join(ROOT, '..', 'templates') - - # @deprecated Use {Config::CONFIG_DIR} - CONFIG_DIR = Config::CONFIG_DIR - - # An alias to {Parser::SourceParser}'s parsing method - # - # @example Parse a glob of files - # YARD.parse('lib/**/*.rb') - # @see Parser::SourceParser.parse - def self.parse(*args) Parser::SourceParser.parse(*args) end - - # An alias to {Parser::SourceParser}'s parsing method - # - # @example Parse a string of input - # YARD.parse_string('class Foo; end') - # @see Parser::SourceParser.parse_string - def self.parse_string(*args) Parser::SourceParser.parse_string(*args) end - - # (see YARD::Config.load_plugins) - # @deprecated Use {Config.load_plugins} - def self.load_plugins; YARD::Config.load_plugins end - - # @return [Boolean] whether YARD is being run inside of Windows - def self.windows? - return @windows if defined? @windows - require 'rbconfig' - @windows = - ::RbConfig::CONFIG['host_os'] =~ /mingw|win32|cygwin/ ? true : false - ensure - @windows ||= false - end - - # @return [Boolean] whether YARD is being run in Ruby 1.8 mode - def self.ruby18?; !ruby19? end - - # @return [Boolean] whether YARD is being run in Ruby 1.9 mode - def self.ruby19?; @ruby19 ||= (RUBY_VERSION >= "1.9.1") end - - # @return [Boolean] whether YARD is being run in Ruby 2.0 - def self.ruby2?; @ruby2 ||= (RUBY_VERSION >= '2.0.0') end -end - -# Keep track of Ruby version for compatibility code -# @deprecated Use {YARD.ruby18?} or {YARD.ruby19?} instead. -RUBY18 = YARD.ruby18? -RUBY19 = YARD.ruby19? - -# Load Ruby core extension classes -Dir.glob(File.join(YARD::ROOT, 'yard', 'core_ext', '*.rb')).each do |file| - require file -end - -# Backport RubyGems SourceIndex and other classes -require File.join(YARD::ROOT, 'yard', 'rubygems', 'backports') - -require File.join(YARD::ROOT, 'yard', 'globals') - -# Load YARD configuration options (and plugins) -YARD::Config.load diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/autoload.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/autoload.rb deleted file mode 100644 index d00371c64c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/autoload.rb +++ /dev/null @@ -1,308 +0,0 @@ -# frozen_string_literal: true -# @private -def __p(path) File.join(YARD::ROOT, 'yard', *path.split('/')); end - -module YARD - module CLI # Namespace for command-line interface components - autoload :Command, __p('cli/command') - autoload :CommandParser, __p('cli/command_parser') - autoload :Config, __p('cli/config') - autoload :Diff, __p('cli/diff') - autoload :Display, __p('cli/display') - autoload :Gems, __p('cli/gems') - autoload :Graph, __p('cli/graph') - autoload :Help, __p('cli/help') - autoload :List, __p('cli/list') - autoload :MarkupTypes, __p('cli/markup_types') - autoload :Server, __p('cli/server') - autoload :Stats, __p('cli/stats') - autoload :Yardoc, __p('cli/yardoc') - autoload :YardoptsCommand, __p('cli/yardopts_command') - autoload :YRI, __p('cli/yri') - autoload :I18n, __p('cli/i18n') - end - - # A "code object" is defined as any entity in the Ruby language. - # Classes, modules, methods, class variables and constants are the - # major objects, but DSL languages can create their own by inheriting - # from {CodeObjects::Base}. - module CodeObjects - autoload :Base, __p('code_objects/base') - autoload :CodeObjectList, __p('code_objects/base') - autoload :ClassObject, __p('code_objects/class_object') - autoload :ClassVariableObject, __p('code_objects/class_variable_object') - autoload :ConstantObject, __p('code_objects/constant_object') - autoload :ExtendedMethodObject, __p('code_objects/extended_method_object') - autoload :ExtraFileObject, __p('code_objects/extra_file_object') - autoload :MacroObject, __p('code_objects/macro_object') - autoload :MethodObject, __p('code_objects/method_object') - autoload :ModuleObject, __p('code_objects/module_object') - autoload :NamespaceMapper, __p('code_objects/namespace_mapper') - autoload :NamespaceObject, __p('code_objects/namespace_object') - autoload :Proxy, __p('code_objects/proxy') - autoload :ProxyMethodError, __p('code_objects/proxy') - autoload :RootObject, __p('code_objects/root_object') - - autoload :BUILTIN_ALL, __p('code_objects/base') - autoload :BUILTIN_CLASSES, __p('code_objects/base') - autoload :BUILTIN_MODULES, __p('code_objects/base') - autoload :BUILTIN_EXCEPTIONS, __p('code_objects/base') - autoload :CONSTANTMATCH, __p('code_objects/base') - autoload :CONSTANTSTART, __p('code_objects/base') - autoload :METHODMATCH, __p('code_objects/base') - autoload :METHODNAMEMATCH, __p('code_objects/base') - autoload :NAMESPACEMATCH, __p('code_objects/base') - autoload :NSEP, __p('code_objects/base') - autoload :NSEPQ, __p('code_objects/base') - autoload :ISEP, __p('code_objects/base') - autoload :ISEPQ, __p('code_objects/base') - autoload :CSEP, __p('code_objects/base') - autoload :CSEPQ, __p('code_objects/base') - end - - # Handlers are called during the data processing part of YARD's - # parsing phase. This allows YARD as well as any custom extension to - # analyze source and generate {CodeObjects} to be stored for later use. - module Handlers - # Shared logic between C and Ruby handlers. - module Common - autoload :MethodHandler, __p('handlers/common/method_handler') - end - - # CRuby Handlers - # @since 0.8.0 - module C - autoload :Base, __p('handlers/c/base') - - autoload :AliasHandler, __p('handlers/c/alias_handler') - autoload :AttributeHandler, __p('handlers/c/attribute_handler') - autoload :ClassHandler, __p('handlers/c/class_handler') - autoload :ConstantHandler, __p('handlers/c/constant_handler') - autoload :HandlerMethods, __p('handlers/c/handler_methods') - autoload :InitHandler, __p('handlers/c/init_handler') - autoload :MethodHandler, __p('handlers/c/method_handler') - autoload :MixinHandler, __p('handlers/c/mixin_handler') - autoload :ModuleHandler, __p('handlers/c/module_handler') - autoload :OverrideCommentHandler, __p('handlers/c/override_comment_handler') - autoload :PathHandler, __p('handlers/c/path_handler') - autoload :StructHandler, __p('handlers/c/struct_handler') - autoload :SymbolHandler, __p('handlers/c/symbol_handler') - end - - module Ruby # All Ruby handlers - module Legacy # Handlers for old Ruby 1.8 parser - autoload :Base, __p('handlers/ruby/legacy/base') - - autoload :AliasHandler, __p('handlers/ruby/legacy/alias_handler') - autoload :AttributeHandler, __p('handlers/ruby/legacy/attribute_handler') - autoload :ClassHandler, __p('handlers/ruby/legacy/class_handler') - autoload :ClassConditionHandler, __p('handlers/ruby/legacy/class_condition_handler') - autoload :ClassVariableHandler, __p('handlers/ruby/legacy/class_variable_handler') - autoload :CommentHandler, __p('handlers/ruby/legacy/comment_handler') - autoload :ConstantHandler, __p('handlers/ruby/legacy/constant_handler') - autoload :DSLHandler, __p('handlers/ruby/legacy/dsl_handler') - autoload :ExceptionHandler, __p('handlers/ruby/legacy/exception_handler') - autoload :ExtendHandler, __p('handlers/ruby/legacy/extend_handler') - autoload :MethodHandler, __p('handlers/ruby/legacy/method_handler') - autoload :MixinHandler, __p('handlers/ruby/legacy/mixin_handler') - autoload :ModuleHandler, __p('handlers/ruby/legacy/module_handler') - autoload :ModuleFunctionHandler, __p('handlers/ruby/legacy/module_function_handler') - autoload :PrivateClassMethodHandler, __p('handlers/ruby/legacy/private_class_method_handler') - autoload :PrivateConstantHandler, __p('handlers/ruby/legacy/private_constant_handler') - autoload :VisibilityHandler, __p('handlers/ruby/legacy/visibility_handler') - autoload :YieldHandler, __p('handlers/ruby/legacy/yield_handler') - end - - autoload :Base, __p('handlers/ruby/base') - - autoload :AliasHandler, __p('handlers/ruby/alias_handler') - autoload :AttributeHandler, __p('handlers/ruby/attribute_handler') - autoload :ClassHandler, __p('handlers/ruby/class_handler') - autoload :ClassConditionHandler, __p('handlers/ruby/class_condition_handler') - autoload :ClassVariableHandler, __p('handlers/ruby/class_variable_handler') - autoload :CommentHandler, __p('handlers/ruby/comment_handler') - autoload :ConstantHandler, __p('handlers/ruby/constant_handler') - autoload :DecoratorHandlerMethods, __p('handlers/ruby/decorator_handler_methods') - autoload :DSLHandler, __p('handlers/ruby/dsl_handler') - autoload :DSLHandlerMethods, __p('handlers/ruby/dsl_handler_methods') - autoload :ExceptionHandler, __p('handlers/ruby/exception_handler') - autoload :ExtendHandler, __p('handlers/ruby/extend_handler') - autoload :MethodHandler, __p('handlers/ruby/method_handler') - autoload :MethodConditionHandler, __p('handlers/ruby/method_condition_handler') - autoload :MixinHandler, __p('handlers/ruby/mixin_handler') - autoload :ModuleHandler, __p('handlers/ruby/module_handler') - autoload :ModuleFunctionHandler, __p('handlers/ruby/module_function_handler') - autoload :PrivateClassMethodHandler, __p('handlers/ruby/private_class_method_handler') - autoload :PrivateConstantHandler, __p('handlers/ruby/private_constant_handler') - autoload :PublicClassMethodHandler, __p('handlers/ruby/public_class_method_handler') - autoload :StructHandlerMethods, __p('handlers/ruby/struct_handler_methods') - autoload :VisibilityHandler, __p('handlers/ruby/visibility_handler') - autoload :YieldHandler, __p('handlers/ruby/yield_handler') - end - - autoload :Base, __p('handlers/base') - autoload :HandlerAborted, __p('handlers/base') - autoload :NamespaceMissingError, __p('handlers/base') - autoload :Processor, __p('handlers/processor') - end - - # Namespace for internationalization (i18n) - # @since 0.8.0 - module I18n - autoload :Locale, __p('i18n/locale') - autoload :Message, __p('i18n/message') - autoload :Messages, __p('i18n/messages') - autoload :PotGenerator, __p('i18n/pot_generator') - autoload :Text, __p('i18n/text') - end - - # The parser namespace holds all parsing engines used by YARD. - # Currently only Ruby and C (Ruby) parsers are implemented. - module Parser - module C # CRuby Parsing components - autoload :BodyStatement, __p('parser/c/statement') - autoload :Comment, __p('parser/c/statement') - autoload :CommentParser, __p('parser/c/comment_parser') - autoload :CParser, __p('parser/c/c_parser') - autoload :Statement, __p('parser/c/statement') - autoload :ToplevelStatement, __p('parser/c/statement') - end - - module Ruby # Ruby parsing components. - module Legacy # Handles Ruby parsing in Ruby 1.8. - autoload :RipperParser, __p('parser/ruby/legacy/ruby_parser') - autoload :RubyParser, __p('parser/ruby/legacy/ruby_parser') - autoload :RubyToken, __p('parser/ruby/legacy/ruby_lex') - autoload :Statement, __p('parser/ruby/legacy/statement') - autoload :StatementList, __p('parser/ruby/legacy/statement_list') - autoload :TokenList, __p('parser/ruby/legacy/token_list') - end - - autoload :AstNode, __p('parser/ruby/ast_node') - autoload :RubyParser, __p('parser/ruby/ruby_parser') - autoload :TokenResolver, __p('parser/ruby/token_resolver') - end - - autoload :Base, __p('parser/base') - autoload :ParserSyntaxError, __p('parser/source_parser') - autoload :SourceParser, __p('parser/source_parser') - autoload :UndocumentableError, __p('parser/source_parser') - end - - module Rake # Holds Rake tasks used by YARD - autoload :YardocTask, __p('rake/yardoc_task') - end - - module Serializers # Namespace for components that serialize to various endpoints - autoload :Base, __p('serializers/base') - autoload :FileSystemSerializer, __p('serializers/file_system_serializer') - autoload :ProcessSerializer, __p('serializers/process_serializer') - autoload :StdoutSerializer, __p('serializers/stdout_serializer') - autoload :YardocSerializer, __p('serializers/yardoc_serializer') - end - - # Namespace for classes and modules that handle serving documentation over HTTP - # - # == Implementing a Custom Server - # To customize the YARD server, see the {Adapter} and {Router} classes. - # - # == Rack Middleware - # If you want to use the YARD server as a Rack middleware, see the documentation - # in {RackMiddleware}. - # - # @since 0.6.0 - module Server - require __p('server') - - # Commands implement specific kinds of server responses which are routed - # to by the {Router} class. To implement a custom command, subclass {Commands::Base}. - module Commands - autoload :Base, __p('server/commands/base') - autoload :DisplayFileCommand, __p('server/commands/display_file_command') - autoload :DisplayObjectCommand, __p('server/commands/display_object_command') - autoload :FramesCommand, __p('server/commands/frames_command') - autoload :ListCommand, __p('server/commands/list_command') - autoload :LibraryCommand, __p('server/commands/library_command') - autoload :LibraryIndexCommand, __p('server/commands/library_index_command') - autoload :RootRequestCommand, __p('server/commands/root_request_command') - autoload :SearchCommand, __p('server/commands/search_command') - autoload :StaticFileCommand, __p('server/commands/static_file_command') - autoload :StaticFileHelpers, __p('server/commands/static_file_helpers') - end - - autoload :Adapter, __p('server/adapter') - autoload :DocServerSerializer, __p('server/doc_server_serializer') - autoload :DocServerHelper, __p('server/doc_server_helper') - autoload :FinishRequest, __p('server/adapter') - autoload :LibraryVersion, __p('server/library_version') - autoload :NotFoundError, __p('server/adapter') - autoload :RackAdapter, __p('server/rack_adapter') - autoload :RackMiddleware, __p('server/rack_adapter') - autoload :Router, __p('server/router') - autoload :StaticCaching, __p('server/static_caching') - autoload :WebrickAdapter, __p('server/webrick_adapter') - autoload :WebrickServlet, __p('server/webrick_adapter') - end - - module Tags # Namespace for Tag components - autoload :AttributeDirective, __p('tags/directives') - autoload :DefaultFactory, __p('tags/default_factory') - autoload :DefaultTag, __p('tags/default_tag') - autoload :Directive, __p('tags/directives') - autoload :EndGroupDirective, __p('tags/directives') - autoload :GroupDirective, __p('tags/directives') - autoload :Library, __p('tags/library') - autoload :MacroDirective, __p('tags/directives') - autoload :MethodDirective, __p('tags/directives') - autoload :OptionTag, __p('tags/option_tag') - autoload :OverloadTag, __p('tags/overload_tag') - autoload :ParseDirective, __p('tags/directives') - autoload :RefTag, __p('tags/ref_tag') - autoload :RefTagList, __p('tags/ref_tag_list') - autoload :ScopeDirective, __p('tags/directives') - autoload :Tag, __p('tags/tag') - autoload :TagFormatError, __p('tags/tag_format_error') - autoload :TypesExplainer, __p('tags/types_explainer') - autoload :VisibilityDirective, __p('tags/directives') - end - - # Namespace for templating system - module Templates - module Helpers # Namespace for template helpers - module Markup # Namespace for markup providers - autoload :RDocMarkup, __p('templates/helpers/markup/rdoc_markup') - autoload :RDocMarkdown, __p('templates/helpers/markup/rdoc_markdown') - end - - autoload :BaseHelper, __p('templates/helpers/base_helper') - autoload :FilterHelper, __p('templates/helpers/filter_helper') - autoload :HtmlHelper, __p('templates/helpers/html_helper') - autoload :HtmlSyntaxHighlightHelper, __p('templates/helpers/html_syntax_highlight_helper') - autoload :MarkupHelper, __p('templates/helpers/markup_helper') - autoload :MethodHelper, __p('templates/helpers/method_helper') - autoload :ModuleHelper, __p('templates/helpers/module_helper') - autoload :TextHelper, __p('templates/helpers/text_helper') - autoload :UMLHelper, __p('templates/helpers/uml_helper') - end - - autoload :Engine, __p('templates/engine') - autoload :ErbCache, __p('templates/erb_cache') - autoload :Section, __p('templates/section') - autoload :Template, __p('templates/template') - autoload :TemplateOptions, __p('templates/template_options') - end - - autoload :Config, __p('config') - autoload :Docstring, __p('docstring') - autoload :DocstringParser, __p('docstring_parser') - autoload :GemIndex, __p('gem_index') - autoload :Logger, __p('logging') - autoload :Options, __p('options') - autoload :Registry, __p('registry') - autoload :RegistryResolver, __p('registry_resolver') - autoload :RegistryStore, __p('registry_store') - autoload :StubProxy, __p('serializers/yardoc_serializer') - autoload :Verifier, __p('verifier') -end - -undef __p diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/command.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/command.rb deleted file mode 100644 index abd521abd9..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/command.rb +++ /dev/null @@ -1,85 +0,0 @@ -# frozen_string_literal: true -require 'optparse' - -module YARD - module CLI - # Abstract base class for CLI utilities. Provides some helper methods for - # the option parser - # - # @abstract - # @since 0.6.0 - class Command - # Helper method to run the utility on an instance. - # @see #run - def self.run(*args) new.run(*args) end - - def description; '' end - - protected - - # Adds a set of common options to the tail of the OptionParser - # - # @param [OptionParser] opts the option parser object - # @return [void] - def common_options(opts) - opts.separator "" - opts.separator "Other options:" - opts.on('-e', '--load FILE', 'A Ruby script to load before running command.') do |file| - load_script(file) - end - opts.on('--plugin PLUGIN', 'Load a YARD plugin (gem with `yard-\' prefix)') do |name| - # Not actually necessary to load here, this is done at boot in YARD::Config.load_plugins - # YARD::Config.load_plugin(name) - end - opts.on('--legacy', 'Use old style Ruby parser and handlers. ', - ' Always on in 1.8.x.') do - YARD::Parser::SourceParser.parser_type = :ruby18 - end - opts.on('--safe', 'Enable safe mode for this instance') do - # Parsed in YARD::Config.load - end - opts.on_tail('-q', '--quiet', 'Show no warnings.') { log.level = Logger::ERROR } - opts.on_tail('--verbose', 'Show more information.') { log.level = Logger::INFO } - opts.on_tail('--debug', 'Show debugging information.') { log.level = Logger::DEBUG } - opts.on_tail('--backtrace', 'Show stack traces') { log.show_backtraces = true } - opts.on_tail('-v', '--version', 'Show version.') { log.puts "yard #{YARD::VERSION}"; exit } - opts.on_tail('-h', '--help', 'Show this help.') { log.puts opts; exit } - end - - # Parses the option and gracefully handles invalid switches - # - # @param [OptionParser] opts the option parser object - # @param [Array] args the arguments passed from input. This - # array will be modified. - # @return [void] - def parse_options(opts, args) - opts.parse!(args) - rescue OptionParser::ParseError => err - unrecognized_option(err) - args.shift if args.first && args.first[0, 1] != '-' - retry - end - - # Loads a Ruby script. If Config.options[:safe_mode] is enabled, - # this method will do nothing. - # - # @param [String] file the path to the script to load - # @since 0.6.2 - def load_script(file) - return if YARD::Config.options[:safe_mode] - load(file) - rescue LoadError => load_exception - log.error "The file `#{file}' could not be loaded:\n#{load_exception}" - exit - end - - # Callback when an unrecognize option is parsed - # - # @param [OptionParser::ParseError] err the exception raised by the - # option parser - def unrecognized_option(err) - log.warn "Unrecognized/#{err.message}" - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/command_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/command_parser.rb deleted file mode 100644 index 1ffc4ec47f..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/command_parser.rb +++ /dev/null @@ -1,93 +0,0 @@ -# frozen_string_literal: true -module YARD - module CLI - # This class parses a command name out of the +yard+ CLI command and calls - # that command in the form: - # - # $ yard command_name [options] - # - # If no command or arguments are specified, or if the arguments immediately - # begin with a +--opt+ (not +--help+), the {default_command} will be used - # (which itself defaults to +:doc+). - # - # == Adding a Command - # - # To add a custom command via plugin, create a mapping in {commands} from - # the Symbolic command name to the {Command} class that implements the - # command. To implement a command, see the documentation for the {Command} - # class. - # - # @see Command - # @see commands - # @see default_command - class CommandParser - class << self - # @return [Hash{Symbol => Command}] the mapping of command names to - # command classes to parse the user command. - attr_accessor :commands - - # @return [Symbol] the default command name to use when no options - # are specified or - attr_accessor :default_command - end - - self.commands = SymbolHash[ - :config => Config, - :diff => Diff, - :display => Display, - :doc => Yardoc, - :gems => Gems, - :graph => Graph, - :help => Help, - :list => List, - :markups => MarkupTypes, - :ri => YRI, - :server => Server, - :stats => Stats, - :i18n => I18n - ] - - self.default_command = :doc - - # Convenience method to create a new CommandParser and call {#run} - # @return (see #run) - def self.run(*args) new.run(*args) end - - def initialize - log.show_backtraces = false - end - - # Runs the {Command} object matching the command name of the first - # argument. - # @return [void] - def run(*args) - unless args == ['--help'] - if args.empty? || args.first =~ /^-/ - command_name = self.class.default_command - else - command_name = args.first.to_sym - args.shift - end - if commands.key?(command_name) - return commands[command_name].run(*args) - end - end - list_commands - end - - private - - def commands; self.class.commands end - - def list_commands - log.puts "Usage: yard [options]" - log.puts - log.puts "Commands:" - commands.keys.sort_by(&:to_s).each do |command_name| - command = commands[command_name].new - log.puts "%-8s %s" % [command_name, command.description] - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/config.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/config.rb deleted file mode 100644 index 0de2b28606..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/config.rb +++ /dev/null @@ -1,198 +0,0 @@ -# frozen_string_literal: true -module YARD - module CLI - # CLI command to view or edit configuration options - # @since 0.6.2 - class Config < Command - # @return [Symbol, nil] the key to view/edit, if any - attr_accessor :key - - # @return [Array, nil] the list of values to set (or single value), if modifying - attr_accessor :values - - # @return [Boolean] whether to reset the {#key} - attr_accessor :reset - - # @return [Boolean] whether the value being set should be inside a list - attr_accessor :as_list - - # @return [Boolean] whether to append values to existing key - attr_accessor :append - - # @return [String, nil] command to use when configuring ~/.gemrc file. - # If the string is nil, configuration should not occur. - attr_accessor :gem_install_cmd - - def initialize - super - self.key = nil - self.values = [] - self.reset = false - self.append = false - self.as_list = false - self.gem_install_cmd = nil - end - - def description - 'Views or edits current global configuration' - end - - def run(*args) - optparse(*args) - if gem_install_cmd - configure_gemrc - elsif key - if reset || !values.empty? - modify_item - else - view_item - end - else - list_configuration - end - end - - private - - def configure_gemrc - return unless gem_install_cmd - - require 'rubygems' - - ['install', :install, 'gem', :gem].find do |cmd| - conf = Gem.configuration[cmd] || "" - next if conf.empty? && cmd != :gem - - conf = conf.split(/\s+/) - conf.delete_if {|c| c =~ /^--(no-)?document\b/ } # scrub doc args - conf |= ["--document=#{gem_install_cmd}"] - conf = conf.join(' ') - - Gem.configuration[cmd] = conf - Gem.configuration.write - log.puts "Updated #{Gem.configuration.path || '~/.gemrc'}: '#{cmd}: #{conf}'" - true - end - end - - def modify_item - if reset - log.debug "Resetting #{key}" - YARD::Config.options[key] = YARD::Config::DEFAULT_CONFIG_OPTIONS[key] - else - log.debug "Setting #{key} to #{values.inspect}" - items = encode_values - current_items = YARD::Config.options[key] - items = [current_items].flatten + [items].flatten if append - YARD::Config.options[key] = items - end - YARD::Config.save - end - - def view_item - log.debug "Viewing #{key}" - log.puts YARD::Config.options[key].inspect - end - - def list_configuration - log.debug "Listing configuration" - require 'yaml' - log.puts YAML.dump(YARD::Config.options).sub(/\A--.*\n/, '').gsub(/\n\n/, "\n") - end - - def encode_values - if values.size == 1 && !as_list - encode_value(values.first) - else - values.map {|v| encode_value(v) } - end - end - - def encode_value(value) - case value - when /^-?\d+/; value.to_i - when "true"; true - when "false"; false - else value - end - end - - def optparse(*args) - list = false - self.as_list = false - self.append = false - opts = OptionParser.new - opts.banner = "Usage: yard config [options] [item [value ...]]" - opts.separator "" - opts.separator "Example: yard config load_plugins true" - opts.separator "" - opts.separator "Views and sets configuration items. If an item is provided" - opts.separator "With no value, the item is viewed. If a value is provided," - opts.separator "the item is modified. Specifying no item is equivalent to --list." - opts.separator "If you specify multiple space delimited values, these are" - opts.separator "parsed as an array of values." - opts.separator "" - opts.separator "Note that `true` and `false` are reserved words." - opts.separator "" - opts.separator "---------------------------------------------------------" - opts.separator "" - opts.separator "Configuring RubyGems support:" - opts.separator "" - opts.separator "YARD can automatically generate the YRI index or HTML" - opts.separator "documentation in a `gem install` by adding the following" - opts.separator "to your ~/.gemrc file:" - opts.separator "" - opts.separator " gem: \"--document=yri\"" - opts.separator "" - opts.separator "Note: you can add 'yard' to also generate HTML docs." - opts.separator " You can also add 'ri' to continue generating RDoc." - opts.separator "" - opts.separator "You can also run the following command to configure this" - opts.separator "behavior automatically:" - opts.separator "" - opts.separator " $ yard config --gem-install-yri" - opts.separator "" - opts.separator "Add --gem-install-yard to also generate HTML." - opts.separator "" - opts.separator "---------------------------------------------------------" - opts.separator "" - opts.separator "General options:" - - opts.on('-l', '--list', 'List current configuration') do - list = true - end - opts.on('-r', '--reset', 'Resets the specific item to default') do - self.reset = true - end - - opts.separator "" - opts.separator "Modifying keys:" - - opts.on('-a', '--append', 'Appends items to existing key values') do - self.append = true - end - opts.on('--as-list', 'Forces the value(s) to be wrapped in an array') do - self.as_list = true - end - - opts.separator "" - opts.separator "Add RubyGems install hook:" - - opts.on('--gem-install-yri', 'Configures ~/.gemrc to run yri on a gem install') do - self.gem_install_cmd = 'yri' if gem_install_cmd != 'yard' - end - - opts.on('--gem-install-yard', 'Configures ~/.gemrc to run yard on a gem install') do - self.gem_install_cmd = 'yard' - end - - common_options(opts) - parse_options(opts, args) - args = [] if list - self.key = args.shift.to_sym if args.size >= 1 - self.values = args if args.size >= 1 - args - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/diff.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/diff.rb deleted file mode 100644 index e426978952..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/diff.rb +++ /dev/null @@ -1,273 +0,0 @@ -# frozen_string_literal: true -require 'tmpdir' -require 'fileutils' -require 'open-uri' - -module YARD - module CLI - # CLI command to return the objects that were added/removed from 2 versions - # of a project (library, gem, working copy). - # @since 0.6.0 - class Diff < Command - def initialize - super - @list_all = false - @use_git = false - @compact = false - @modified = true - @verifier = Verifier.new - @old_git_commit = nil - @old_path = Dir.pwd - log.show_backtraces = true - end - - def description - 'Returns the object diff of two gems or .yardoc files' - end - - def run(*args) - registry = optparse(*args).map do |gemfile| - if @use_git - load_git_commit(gemfile) - all_objects - elsif load_gem_data(gemfile) - log.info "Found #{gemfile}" - all_objects - else - log.error "Cannot find gem #{gemfile}" - nil - end - end.compact - - return if registry.size != 2 - - first_object = nil - [["Added objects", "A", added_objects(*registry)], - ["Modified objects", "M", modified_objects(*registry)], - ["Removed objects", "D", removed_objects(*registry)]].each do |name, short, objects| - next if short == "M" && @modified == false - next if objects.empty? - last_object = nil - all_objects_notice = false - log.puts name + ":" unless @compact - objects.sort_by(&:path).each do |object| - if !@list_all && last_object && object.parent == last_object - log.print " (...)" unless all_objects_notice - all_objects_notice = true - next - elsif @compact - log.puts if first_object - else - log.puts - end - all_objects_notice = false - log.print "" + (@compact ? "#{short} " : " ") + - object.path + " (#{object.file}:#{object.line})" - last_object = object - first_object = true - end - unless @compact - log.puts; log.puts - end - end - log.puts if @compact - end - - private - - def all_objects - return Registry.all if @verifier.expressions.empty? - @verifier.run(Registry.all) - end - - def added_objects(registry1, registry2) - registry2.reject {|o| registry1.find {|o2| o2.path == o.path } } - end - - def modified_objects(registry1, registry2) - registry1.select do |obj| - case obj - when CodeObjects::MethodObject - registry2.find {|o| obj == o && o.source != obj.source } - when CodeObjects::ConstantObject - registry2.find {|o| obj == o && o.value != obj.value } - end - end.compact - end - - def removed_objects(registry1, registry2) - registry1.reject {|o| registry2.find {|o2| o2.path == o.path } } - end - - def load_git_commit(commit) - Registry.clear - commit_path = 'git_commit' + commit.gsub(/\W/, '_') - tmpdir = File.join(Dir.tmpdir, commit_path) - log.info "Expanding #{commit} to #{tmpdir}..." - Dir.chdir(@old_path) - FileUtils.mkdir_p(tmpdir) - FileUtils.cp_r('.', tmpdir) - Dir.chdir(tmpdir) - log.info("git says: " + `git reset --hard #{commit}`.chomp) - generate_yardoc(tmpdir) - ensure - Dir.chdir(@old_path) - cleanup(commit_path) - end - - def load_gem_data(gemfile) - require_rubygems - Registry.clear - - # First check for argument as .yardoc file - [File.join(gemfile, '.yardoc'), gemfile].each do |yardoc| - log.info "Searching for .yardoc db at #{yardoc}" - next unless File.directory?(yardoc) - Registry.load_yardoc(yardoc) - Registry.load_all - return true - end - - # Next check installed RubyGems - gemfile_without_ext = gemfile.sub(/\.gem$/, '') - log.info "Searching for installed gem #{gemfile_without_ext}" - YARD::GemIndex.each.find do |spec| - next unless spec.full_name == gemfile_without_ext - yardoc = Registry.yardoc_file_for_gem(spec.name, "= #{spec.version}") - if yardoc - Registry.load_yardoc(yardoc) - Registry.load_all - else - log.enter_level(Logger::ERROR) do - olddir = Dir.pwd - Gems.run(spec.name, spec.version.to_s) - Dir.chdir(olddir) - end - end - return true - end - - # Look for local .gem file - gemfile += '.gem' unless gemfile =~ /\.gem$/ - log.info "Searching for local gem file #{gemfile}" - if File.exist?(gemfile) - File.open(gemfile, 'rb') do |io| - expand_and_parse(gemfile, io) - end - return true - end - - # Remote gemfile from rubygems.org - url = "http://rubygems.org/downloads/#{gemfile}" - log.info "Searching for remote gem file #{url}" - begin - # Note: In Ruby 2.4.x, URI.open is a private method. After - # 2.5, URI.open behaves much like Kernel#open once you've - # required 'open-uri' - OpenURI.open_uri(url) {|io| expand_and_parse(gemfile, io) } - return true - rescue OpenURI::HTTPError - nil # noop - end - false - end - - def expand_and_parse(gemfile, io) - dir = expand_gem(gemfile, io) - generate_yardoc(dir) - cleanup(gemfile) - end - - def generate_yardoc(dir) - Dir.chdir(dir) do - log.enter_level(Logger::ERROR) { Yardoc.run('-n', '--no-save') } - end - end - - def expand_gem(gemfile, io) - tmpdir = File.join(Dir.tmpdir, gemfile) - FileUtils.mkdir_p(tmpdir) - log.info "Expanding #{gemfile} to #{tmpdir}..." - - if Gem::VERSION >= '2.0.0' - require 'rubygems/package/tar_reader' - reader = Gem::Package::TarReader.new(io) - reader.each do |pkg| - next unless pkg.full_name == 'data.tar.gz' - Zlib::GzipReader.wrap(pkg) do |gzio| - tar = Gem::Package::TarReader.new(gzio) - tar.each do |entry| - file = File.join(tmpdir, entry.full_name) - FileUtils.mkdir_p(File.dirname(file)) - File.open(file, 'wb') do |out| - out.write(entry.read) - begin - out.fsync - rescue NotImplementedError - nil # noop - end - end - end - end - break - end - else - Gem::Package.open(io) do |pkg| - pkg.each do |entry| - pkg.extract_entry(tmpdir, entry) - end - end - end - - tmpdir - end - - def require_rubygems - require 'rubygems' - require 'rubygems/package' - rescue LoadError => e - log.error "Missing RubyGems, cannot run this command." - raise(e) - end - - def cleanup(gemfile) - dir = File.join(Dir.tmpdir, gemfile) - log.info "Cleaning up #{dir}..." - FileUtils.rm_rf(dir) - end - - def optparse(*args) - opts = OptionParser.new - opts.banner = "Usage: yard diff [options] oldgem newgem" - opts.separator "" - opts.separator "Example: yard diff yard-0.5.6 yard-0.5.8" - opts.separator "" - opts.separator "If the files don't exist locally, they will be grabbed using the `gem fetch`" - opts.separator "command. If the gem is a .yardoc directory, it will be used. Finally, if the" - opts.separator "gem name matches an installed gem (full name-version syntax), that gem will be used." - - opts.on('-a', '--all', 'List all objects, even if they are inside added/removed module/class') do - @list_all = true - end - opts.on('--compact', 'Show compact results') { @compact = true } - opts.on('--git', 'Compare versions from two git commit/branches') do - @use_git = true - end - opts.on('--query QUERY', 'Only diff filtered objects') do |query| - @verifier.add_expressions(query) - end - opts.on('--no-modified', 'Ignore modified objects') do - @modified = false - end - common_options(opts) - parse_options(opts, args) - unless args.size == 2 - log.puts opts.banner - exit(0) - end - - args - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/display.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/display.rb deleted file mode 100644 index 0295a660cc..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/display.rb +++ /dev/null @@ -1,69 +0,0 @@ -# frozen_string_literal: true -module YARD - module CLI - # Display one object - # @since 0.8.6 - class Display < Yardoc - def description; 'Displays a formatted object' end - - def initialize(*args) - super - options.format = :text # default for this command - @layout = nil - @objects = [] - end - - # Runs the commandline utility, parsing arguments and displaying an object - # from the {Registry}. - # - # @param [Array] args the list of arguments. - # @return [void] - def run(*args) - return unless parse_arguments(*args) - log.puts wrap_layout(format_objects) - end - - # @return [String] the output data for all formatted objects - def format_objects - @objects.inject([]) do |arr, obj| - arr.push obj.format(options) - end.join("\n") - end - - def wrap_layout(contents) - return contents unless @layout - opts = options.merge( - :contents => contents, - :object => @objects.first, - :objects => @objects - ) - args = [options.template, @layout, options.format] - Templates::Engine.template(*args).run(opts) - end - - # Parses commandline options. - # @param [Array] args each tokenized argument - def parse_arguments(*args) - opts = OptionParser.new - opts.banner = "Usage: yard display [options] OBJECT [OTHER OBJECTS]" - general_options(opts) - output_options(opts) - parse_options(opts, args) - - Registry.load - @objects = args.map {|o| Registry.at(o) } - - # validation - return false if @objects.any?(&:nil?) - verify_markup_options - end - - def output_options(opts) - super(opts) - opts.on('-l', '--layout [LAYOUT]', 'Wraps output in layout template (good for HTML)') do |layout| - @layout = layout || 'layout' - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/gems.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/gems.rb deleted file mode 100644 index a68e942977..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/gems.rb +++ /dev/null @@ -1,84 +0,0 @@ -# frozen_string_literal: true -module YARD - module CLI - # @since 0.6.0 - class Gems < Command - def initialize - @rebuild = false - @gems = [] - end - - def description; "Builds YARD index for gems" end - - # Runs the commandline utility, parsing arguments and generating - # YARD indexes for gems. - # - # @param [Array] args the list of arguments - # @return [void] - def run(*args) - require 'rubygems' - optparse(*args) - build_gems - end - - private - - # Builds .yardoc files for all non-existing gems - def build_gems - require 'rubygems' - @gems.each do |spec| - ver = "= #{spec.version}" - dir = Registry.yardoc_file_for_gem(spec.name, ver) - if dir && File.directory?(dir) && !@rebuild - log.debug "#{spec.name} index already exists at '#{dir}'" - else - yfile = Registry.yardoc_file_for_gem(spec.name, ver, true) - next unless yfile - next unless File.directory?(spec.full_gem_path) - Registry.clear - Dir.chdir(spec.full_gem_path) do - log.info "Building yardoc index for gem: #{spec.full_name}" - Yardoc.run('--no-stats', '-n', '-b', yfile) - end - end - end - end - - def add_gems(gems) - 0.step(gems.size - 1, 2) do |index| - gem = gems[index] - ver_require = gems[index + 1] || ">= 0" - specs = YARD::GemIndex.find_all_by_name(gem, ver_require) - if specs.empty? - log.warn "#{gem} #{ver_require} could not be found in RubyGems index" - else - @gems += specs - end - end - end - - # Parses options - def optparse(*args) - opts = OptionParser.new - opts.banner = 'Usage: yard gems [options] [gem_name [version]]' - opts.separator "" - opts.separator "#{description}. If no gem_name is given," - opts.separator "all gems are built." - opts.separator "" - opts.on('--rebuild', 'Rebuilds index') do - @rebuild = true - end - - common_options(opts) - parse_options(opts, args) - add_gems(args) - - if !args.empty? && @gems.empty? - log.error "No specified gems could be found for command" - elsif @gems.empty? - @gems += YARD::GemIndex.all if @gems.empty? - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/graph.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/graph.rb deleted file mode 100644 index 863d61acca..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/graph.rb +++ /dev/null @@ -1,125 +0,0 @@ -# frozen_string_literal: true -module YARD - module CLI - # Options to pass to the {Graph} CLI. - class GraphOptions < Templates::TemplateOptions - # @return [:dot] the default output format - default_attr :format, :dot - - # @return [Boolean] whether to list the full class diagram - attr_accessor :full - - # @return [Boolean] whether to show the object dependencies - attr_accessor :dependencies - - # @return [String] any contents to pass to the digraph - attr_accessor :contents - end - - # A command-line utility to generate Graphviz graphs from - # a set of objects - # - # @see Graph#run - # @since 0.6.0 - class Graph < YardoptsCommand - # The options parsed out of the commandline. - # Default options are: - # :format => :dot - attr_reader :options - - # The set of objects to include in the graph. - attr_reader :objects - - # Creates a new instance of the command-line utility - def initialize - super - @use_document_file = false - @options = GraphOptions.new - options.reset_defaults - options.serializer = YARD::Serializers::StdoutSerializer.new - end - - def description - "Graphs class diagram using Graphviz" - end - - # Runs the command-line utility. - # - # @example - # grapher = Graph.new - # grapher.run('--private') - # @param [Array] args each tokenized argument - def run(*args) - parse_arguments(*args) - - contents = objects.map do |o| - o.format(options.merge(:serialize => false)) - end.join("\n") - opts = {:type => :layout, :contents => contents} - options.update(opts) - Templates::Engine.render(options) - end - - private - - def unrecognized_option(err) end - - # Parses commandline options. - # @param [Array] args each tokenized argument - def optparse(*args) - visibilities = [:public] - opts = OptionParser.new - - opts.separator "" - opts.separator "General Options:" - - opts.on('-b', '--db FILE', 'Use a specified .yardoc db to load from or save to. (defaults to .yardoc)') do |yfile| - YARD::Registry.yardoc_file = yfile - end - - opts.on('--full', 'Full class diagrams (show methods and attributes).') do - options[:full] = true - end - - opts.on('-d', '--dependencies', 'Show mixins in dependency graph.') do - options[:dependencies] = true - end - - opts.on('--no-public', "Don't show public methods. (default shows public)") do - visibilities.delete(:public) - end - - opts.on('--protected', "Show or don't show protected methods. (default hides protected)") do - visibilities.push(:protected) - end - - opts.on('--private', "Show or don't show private methods. (default hides private)") do - visibilities.push(:private) - end - - opts.separator "" - opts.separator "Output options:" - - opts.on('--dot [OPTIONS]', 'Send the results directly to `dot` with optional arguments.') do |dotopts| - options.serializer = Serializers::ProcessSerializer.new('dot ' + dotopts.to_s) - end - - opts.on('-f', '--file [FILE]', 'Writes output to a file instead of stdout.') do |file| - options.serializer = Serializers::FileSystemSerializer.new(:basepath => '.', :extension => nil) - options.serializer.instance_eval "def serialized_path(object) #{file.inspect} end" - end - - common_options(opts) - parse_options(opts, args) - - Registry.load - - expression = "#{visibilities.uniq.inspect}.include?(object.visibility)" - options.verifier = Verifier.new(expression) - @objects = args.first ? - args.map {|o| Registry.at(o) }.compact : - [Registry.root] - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/help.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/help.rb deleted file mode 100644 index 3367c2521b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/help.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true -module YARD - module CLI - # Handles help for commands - # @since 0.6.0 - class Help < Command - def description; "Retrieves help for a command" end - - def run(*args) - cmd = args.first && CommandParser.commands[args.first.to_sym] - if cmd - cmd.run('--help') - else - log.puts "Command #{args.first} not found." if args.first - CommandParser.run('--help') - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/i18n.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/i18n.rb deleted file mode 100644 index 21e61aa7cb..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/i18n.rb +++ /dev/null @@ -1,70 +0,0 @@ -# frozen_string_literal: true -require "pathname" - -module YARD - module CLI - # CLI command to support internationalization (a.k.a. i18n). - # I18n feature is based on gettext technology. - # This command generates .pot file from docstring and extra - # documentation. - # - # @since 0.8.0 - # @todo Support msgminit and msgmerge features? - class I18n < Yardoc - def initialize - super - @options.serializer.basepath = "po/yard.pot" - end - - def description - 'Generates .pot file from source code and extra documentation' - end - - def run(*args) - if args.empty? || !args.first.nil? - # fail early if arguments are not valid - return unless parse_arguments(*args) - end - - YARD.parse(files, excluded) - - serializer = options.serializer - pot_file_path = Pathname.new(serializer.basepath).expand_path - pot_file_dir_path, pot_file_basename = pot_file_path.split - relative_base_path = Pathname.pwd.relative_path_from(pot_file_dir_path) - serializer.basepath = pot_file_dir_path.to_s - serializer.serialize(pot_file_basename.to_s, - generate_pot(relative_base_path.to_s)) - - true - end - - private - - def general_options(opts) - opts.banner = "Usage: yard i18n [options] [source_files [- extra_files]]" - opts.top.list.clear - opts.separator "(if a list of source files is omitted, " - opts.separator " {lib,app}/**/*.rb ext/**/*.{c,rb} is used.)" - opts.separator "" - opts.separator "Example: yard i18n -o yard.pot - FAQ LICENSE" - opts.separator " The above example outputs .pot file for files in" - opts.separator " lib/**/*.rb to yard.pot including the extra files" - opts.separator " FAQ and LICENSE." - opts.separator "" - opts.separator "A base set of options can be specified by adding a .yardopts" - opts.separator "file to your base path containing all extra options separated" - opts.separator "by whitespace." - super(opts) - end - - def generate_pot(relative_base_path) - generator = YARD::I18n::PotGenerator.new(relative_base_path) - objects = run_verifier(all_objects) - generator.parse_objects(objects) - generator.parse_files(options.files || []) - generator.generate - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/list.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/list.rb deleted file mode 100644 index d8b66b8f7d..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/list.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true -module YARD - module CLI - # Lists all constant and method names in the codebase. Uses {Yardoc} --list. - class List < Command - def description; 'Lists all constant and methods. Uses `yard doc --list`' end - - # Runs the commandline utility, parsing arguments and displaying a - # list of objects - # - # @param [Array] args the list of arguments. - # @return [void] - def run(*args) - if args.include?('--help') - log.puts "Usage: yard list [yardoc_options]" - log.puts "Takes the same arguments as yardoc. See yardoc --help" - else - Yardoc.run('-c', '--list', *args) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/markup_types.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/markup_types.rb deleted file mode 100644 index 46fd1a3bf2..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/markup_types.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true -module YARD - module CLI - # Lists all markup types - # @since 0.8.6 - class MarkupTypes < Command - def description; 'Lists all available markup types and libraries' end - - # Runs the commandline utility, parsing arguments and displaying a - # list of markup types - # - # @param [Array] args the list of arguments. - # @return [void] - def run(*args) # rubocop:disable Lint/UnusedMethodArgument - log.puts "Available markup types for `doc' command:" - log.puts - types = Templates::Helpers::MarkupHelper::MARKUP_PROVIDERS - exts = Templates::Helpers::MarkupHelper::MARKUP_EXTENSIONS - types.sort_by {|name, _| name.to_s }.each do |name, providers| - log.puts "[#{name}]" - libs = providers.map {|p| p[:lib] }.compact - log.puts " Providers: #{libs.join(" ")}" unless libs.empty? - if exts[name] - log.puts " Extensions: #{exts[name].map {|e| ".#{e}" }.join(" ")}" - end - - log.puts - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/server.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/server.rb deleted file mode 100644 index 75ff2f8d2e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/server.rb +++ /dev/null @@ -1,266 +0,0 @@ -# frozen_string_literal: true - -module YARD - module CLI - # A local documentation server - # @since 0.6.0 - class Server < Command - # @return [Hash] a list of options to pass to the doc server - attr_accessor :options - - # @return [Hash] a list of options to pass to the web server - attr_accessor :server_options - - # @return [Hash] a list of library names and yardoc files to serve - attr_accessor :libraries - - # @return [YARD::Server::Adapter] the adapter to use for loading the web server - attr_accessor :adapter - - # @return [Array] a list of scripts to load - # @since 0.6.2 - attr_accessor :scripts - - # @return [Array] a list of template paths to register - # @since 0.6.2 - attr_accessor :template_paths - - # Creates a new instance of the Server command line utility - def initialize - super - self.scripts = [] - self.template_paths = [] - self.libraries = {} - self.options = SymbolHash.new(false).update( - :single_library => true, - :caching => false - ) - self.server_options = {:Port => 8808} - end - - def description - "Runs a local documentation server" - end - - def run(*args) - optparse(*args) - - select_adapter.setup - load_scripts - load_template_paths - adapter.new(libraries, options, server_options).start - end - - private - - def load_scripts - scripts.each {|file| load_script(file) } - end - - def load_template_paths - return if YARD::Config.options[:safe_mode] - - Templates::Engine.template_paths |= template_paths - end - - def select_adapter - return adapter if adapter - - require 'rubygems' - require 'rack' - self.adapter = YARD::Server::RackAdapter - rescue LoadError - self.adapter = YARD::Server::WebrickAdapter - end - - def add_libraries(args) - (0...args.size).step(2) do |index| - library = args[index] - dir = args[index + 1] - - libver = nil - if dir - if File.exist?(dir) - # Provided dir contains a .yardopts file - libver = create_library_version_if_yardopts_exist(library, dir) - libver ||= YARD::Server::LibraryVersion.new(library, nil, dir) - end - else - # Check if this dir contains a .yardopts file - pwd = Dir.pwd - libver = create_library_version_if_yardopts_exist(library, pwd) - - # Check default location - yfile = File.join(pwd, Registry::DEFAULT_YARDOC_FILE) - libver ||= YARD::Server::LibraryVersion.new(library, nil, yfile) - end - - # Register library - if libver - libver.yardoc_file = File.expand_path(libver.yardoc_file) if libver.yardoc_file - libver.source_path = File.expand_path(libver.source_path) if libver.source_path - libraries[library] ||= [] - libraries[library] |= [libver] - else - log.warn "Cannot find yardoc db for #{library}: #{dir.inspect}" - end - end - end - - # @param [String] library The library name. - # @param [String, nil] dir The argument provided on the CLI after the - # library name. Is supposed to point to either a project directory - # with a Yard options file, or a yardoc db. - # @return [LibraryVersion, nil] - def create_library_version_if_yardopts_exist(library, dir) - if dir - options_file = File.join(dir, Yardoc::DEFAULT_YARDOPTS_FILE) - if File.exist?(options_file) - # Found yardopts, extract db path - yfile = extract_db_from_options_file(options_file) - db = File.expand_path(yfile, dir) - - # Create libver - libver = YARD::Server::LibraryVersion.new(library, nil, db) - libver.source_path = dir - libver - end - end - end - - def add_gems - require 'rubygems' - YARD::GemIndex.each do |spec| - libraries[spec.name] ||= [] - libraries[spec.name] |= [YARD::Server::LibraryVersion.new(spec.name, spec.version.to_s, - nil, :gem)] - end - end - - def add_gems_from_gemfile(gemfile = nil) - require 'bundler' - gemfile ||= "Gemfile" - if File.exist?("#{gemfile}.lock") - Bundler::LockfileParser.new(File.read("#{gemfile}.lock")).specs.each do |spec| - libraries[spec.name] ||= [] - libraries[spec.name] |= [YARD::Server::LibraryVersion.new(spec.name, - spec.version.to_s, nil, :gem)] - end - else - log.warn "Cannot find #{gemfile}.lock, ignoring --gemfile option" - end - rescue LoadError - log.error "Bundler not available, ignoring --gemfile option" - end - - def optparse(*args) - opts = OptionParser.new - opts.banner = 'Usage: yard server [options] [[library yardoc_file] ...]' - opts.separator '' - opts.separator 'Example: yard server -m yard .yardoc ruby-core ../ruby/.yardoc' - opts.separator 'The above example serves documentation for YARD and Ruby-core' - opts.separator '' - opts.separator 'If no library/yardoc_file is specified, the server uses' - opts.separator 'the name of the current directory and `.yardoc` respectively' - opts.separator '' - opts.separator "General Options:" - opts.on('-m', '--multi-library', 'Serves documentation for multiple libraries') do - options[:single_library] = false - end - opts.on('-c', '--cache', 'Caches all documentation to document root (see --docroot)') do - options[:caching] = true - end - opts.on('-r', '--reload', 'Reparses the library code on each request') do - options[:incremental] = true - end - opts.on('-g', '--gems', 'Serves documentation for installed gems') do - add_gems - end - opts.on('-G', '--gemfile [GEMFILE]', - 'Serves documentation for gems from Gemfile') do |gemfile| - add_gems_from_gemfile(gemfile) - end - opts.on('-t', '--template-path PATH', - 'The template path to look for templates in. (used with -t).') do |path| - template_paths << path - end - opts.separator '' - opts.separator "Web Server Options:" - opts.on('-d', '--daemon', 'Daemonizes the server process') do - server_options[:daemonize] = true - end - opts.on('-B HOST', '--bind', 'The host address to bind to') do |host| - server_options[:Host] = host.to_s - end - opts.on('-p PORT', '--port', 'Serves documentation on PORT') do |port| - server_options[:Port] = port.to_i - end - opts.on('--docroot DOCROOT', 'Uses DOCROOT as document root') do |docroot| - server_options[:DocumentRoot] = File.expand_path(docroot) - end - opts.on('-a', '--adapter ADAPTER', - 'Use the ADAPTER (full Ruby class) for web server') do |adapter| - self.adapter = if adapter.casecmp('webrick') == 0 - YARD::Server::WebrickAdapter - elsif adapter.casecmp('rack') == 0 - YARD::Server::RackAdapter - else - eval(adapter) # rubocop:disable Security/Eval - end - end - opts.on('-s', '--server TYPE', - 'Use a specific server type eg. thin,mongrel,cgi (Rack specific)') do |type| - server_options[:server] = type - end - opts.on('--fork', 'Use process forking when serving requests') do - options[:use_fork] = true - end - common_options(opts) - opts.on('-e', '--load FILE', - 'A Ruby script to load before the source tree is parsed.') do |file| - scripts << file - end - parse_options(opts, args) - - if args.empty? && libraries.empty? - # No args - try to use current dir - add_libraries([File.basename(Dir.pwd), nil]) - - # Generate doc for first time - # This is not necessary but makes for a better first-run experience - libver = libraries.empty? ? nil : libraries.values.first.first - generate_doc_for_first_time(libver) if libver && !libver.ready? - else - add_libraries(args) - options[:single_library] = false if libraries.size > 1 - end - end - - def generate_doc_for_first_time(libver) - log.enter_level(Logger::INFO) do - yardoc_file = libver.yardoc_file.sub(%r{^#{Regexp.quote Dir.pwd}[\\/]+}, '') - log.info "No yardoc db found in #{yardoc_file}, parsing source before starting server..." - end - Dir.chdir(libver.source_path) do - Yardoc.run('-n') - end - end - - def extract_db_from_options_file(options_file) - args = File.read_binary(options_file).shell_split - db = YARD::Registry.yardoc_file - opts = OptionParser.new - opts.on('-b', '--db FILE') {|file| db = file } - - begin - opts.parse!(args) - rescue OptionParser::ParseError - args.shift if args.first && args.first[0, 1] != '-' - retry - end - - db - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/stats.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/stats.rb deleted file mode 100644 index 38b8475970..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/stats.rb +++ /dev/null @@ -1,231 +0,0 @@ -# frozen_string_literal: true -module YARD - module CLI - # @since 0.6.0 - class Stats < Yardoc - include Templates::Helpers::BaseHelper - - # Maintains the order in which +stats_for_+ statistics methods should be - # printed. - # - # @see #print_statistics - STATS_ORDER = [:files, :modules, :classes, :constants, :attributes, :methods] - - # @return [Boolean] whether to parse and load registry - attr_accessor :parse - - # @param [Boolean] parse whether to parse and load registry (see {#parse}) - def initialize(parse = true) - super() - @parse = parse - @undoc_list = nil - @compact = false - end - - def description - "Prints documentation statistics on a set of files" - end - - # Runs the commandline utility, parsing arguments and generating - # output if set. - # - # @param [Array] args the list of arguments - # @return [void] - def run(*args) - parse_arguments(*args) - - if use_cache - Registry.load! - elsif parse - YARD.parse(files, excluded) - Registry.save(use_cache) if save_yardoc - end - - print_statistics - print_undocumented_objects - end - - # Prints statistics for different object types - # - # To add statistics for a specific type, add a method +#stats_for_TYPE+ - # to this class that calls {#output}. - def print_statistics - @total = 0 - @undocumented = 0 - meths = methods.map(&:to_s).grep(/^stats_for_/) - STATS_ORDER.each do |meth| - mname = "stats_for_#{meth}" - if meths.include?(mname) - send(mname) - meths.delete(mname) - end - end - meths.each {|m| send(m) } - - total = - if @undocumented == 0 - 100 - elsif @total == 0 - 0 - else - (@total - @undocumented).to_f / @total.to_f * 100 - end - log.puts("% 3.2f%% documented" % total) - end - - # Prints list of undocumented objects - def print_undocumented_objects - return if !@undoc_list || @undoc_list.empty? - log.puts - log.puts "Undocumented Objects:" - - # array needed for sort due to unstable sort - objects = @undoc_list.sort_by {|o| [o.file.to_s, o.path] } - max = objects.max {|a, b| a.path.length <=> b.path.length }.path.length - if @compact - objects.each do |object| - log.puts("%-#{max}s (%s)" % [object.path, - [object.file || "-unknown-", object.line].compact.join(":")]) - end - else - last_file = nil - objects.each do |object| - if object.file != last_file - log.puts - log.puts "(in file: #{object.file || "-unknown-"})" - end - log.puts object.path - last_file = object.file - end - end - end - - # @return [Array] all the parsed objects in the registry, - # removing any objects that are not visible (private, protected) depending - # on the arguments passed to the command. - def all_objects - @all_objects ||= run_verifier Registry.all - end - - # Statistics for files - def stats_for_files - files = [] - all_objects.each {|o| files |= [o.file] } - output "Files", files.size - end - - # Statistics for modules - def stats_for_modules - output "Modules", *type_statistics(:module) - end - - # Statistics for classes - def stats_for_classes - output "Classes", *type_statistics(:class) - end - - # Statistics for constants - def stats_for_constants - output "Constants", *type_statistics(:constant) - end - - # Statistics for attributes - def stats_for_attributes - objs = all_objects.select {|m| m.type == :method && m.is_attribute? } - objs.uniq! {|m| m.name.to_s.gsub(/=$/, '') } - undoc = objs.select {|m| m.docstring.blank? } - @undoc_list |= undoc if @undoc_list - output "Attributes", objs.size, undoc.size - end - - # Statistics for methods - def stats_for_methods - objs = all_objects.select {|m| m.type == :method } - objs.reject!(&:is_alias?) - objs.reject!(&:is_attribute?) - undoc = objs.select {|m| m.docstring.blank? } - @undoc_list |= undoc if @undoc_list - output "Methods", objs.size, undoc.size - end - - # Prints a statistic to standard out. This method is optimized for - # getting Integer values, though it allows any data to be printed. - # - # @param [String] name the statistic name - # @param [Integer, String] data the numeric (or any) data representing - # the statistic. If +data+ is an Integer, it should represent the - # total objects of a type. - # @param [Integer, nil] undoc number of undocumented objects for the type - # @return [void] - def output(name, data, undoc = nil) - @total += data if data.is_a?(Integer) && undoc - @undocumented += undoc if undoc.is_a?(Integer) - data = - if undoc - ("%5s (% 5d undocumented)" % [data, undoc]) - else - "%5s" % data - end - log.puts("%-12s %s" % [name + ":", data]) - end - - private - - def type_statistics(type) - objs = all_objects.select {|m| m.type == type } - undoc = objs.find_all {|m| m.docstring.blank? } - @undoc_list |= undoc if @undoc_list - [objs.size, undoc.size] - end - - # Parses commandline options. - # @param [Array] args each tokenized argument - def optparse(*args) - opts = OptionParser.new - opts.banner = "Usage: yard stats [options] [source_files]" - - opts.separator "(if a list of source files is omitted, lib/**/*.rb ext/**/*.{c,rb} is used.)" - - general_options(opts) - output_options(opts) - tag_options(opts) - common_options(opts) - parse_options(opts, args) - parse_files(*args) unless args.empty? - end - - def general_options(opts) - super(opts) - - opts.on('--list-undoc', 'List all undocumented objects') do - @undoc_list = [] - end - - opts.on('--compact', 'Compact undocumented objects listing') do - @compact = true - end - - opts.on('--no-public', "Don't include public methods in statistics.") do - visibilities.delete(:public) - end - - opts.on('--protected', "Include protected methods in statistics.") do - visibilities.push(:protected) - end - - opts.on('--private', "Include private methods in statistics.") do - visibilities.push(:private) - end - - opts.on('--no-private', "Don't include objects with @private tag in statistics.") do - options[:verifier].add_expressions '!object.tag(:private) && - (object.namespace.type == :proxy || !object.namespace.tag(:private))' - end - - opts.on('--query QUERY', "Only includes objects that match a specific query") do |query| - options[:verifier].add_expressions(query.taint) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/yardoc.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/yardoc.rb deleted file mode 100644 index 5332196f6c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/yardoc.rb +++ /dev/null @@ -1,789 +0,0 @@ -# frozen_string_literal: true -require 'digest/sha1' -require 'fileutils' - -module YARD - module CLI - # Default options used in +yard doc+ command. - class YardocOptions < Templates::TemplateOptions - # @return [Array] - # the list of extra files rendered along with objects - default_attr :files, lambda { [] } - - # @return [String] the default title appended to each generated page - default_attr :title, "Documentation by YARD #{YARD::VERSION}" - - # @return [Verifier] the default verifier object to filter queries - default_attr :verifier, lambda { Verifier.new } - - # @return [Serializers::Base] the default serializer for generating output - # to disk. - default_attr :serializer, lambda { Serializers::FileSystemSerializer.new } - - # @return [Symbol] the default output format (:html). - default_attr :format, :html - - # @return [Boolean] whether the data should be rendered in a single page, - # if the template supports it. - default_attr :onefile, false - - # @return [CodeObjects::ExtraFileObject] the README file object rendered - # along with objects - attr_accessor :readme - - # @return [Array] the list of code objects to render - # the templates with. - attr_accessor :objects - - # @return [Numeric] An index value for rendering sequentially related templates - attr_accessor :index - - # @return [CodeObjects::Base] an extra item to send to a template that is not - # the main rendered object - attr_accessor :item - - # @return [CodeObjects::ExtraFileObject] the file object being rendered. - # The +object+ key is not used so that a file may be rendered in the context - # of an object's namespace (for generating links). - attr_accessor :file - - # @return [String] the current locale - attr_accessor :locale - end - - # Yardoc is the default YARD CLI command (+yard doc+ and historic +yardoc+ - # executable) used to generate and output (mainly) HTML documentation given - # a set of source files. - # - # == Usage - # - # Main usage for this command is: - # - # $ yardoc [options] [source_files [- extra_files]] - # - # See +yardoc --help+ for details on valid options. - # - # == Options File (+.yardopts+) - # - # If a +.yardopts+ file is found in the source directory being processed, - # YARD will use the contents of the file as arguments to the command, - # treating newlines as spaces. You can use shell-style quotations to - # group space delimited arguments, just like on the command line. - # - # A valid +.yardopts+ file might look like: - # - # --no-private - # --title "My Title" - # --exclude foo --exclude bar - # lib/**/*.erb - # lib/**/*.rb - - # HACKING.rdoc LEGAL COPYRIGHT - # - # Note that Yardoc also supports the legacy RDoc style +.document+ file, - # though this file can only specify source globs to parse, not options. - # - # == Queries (+--query+) - # - # Yardoc supports queries to select specific code objects for which to - # generate documentation. For example, you might want to generate - # documentation only for your public API. If you've documented your public - # methods with +@api public+, you can use the following query to select - # all of these objects: - # - # --query '@api.text == "public"' - # - # Note that the syntax for queries is mostly Ruby with a few syntactic - # simplifications for meta-data tags. See the {Verifier} class for an - # overview of this syntax. - # - # == Adding Custom Ad-Hoc Meta-data Tags (+--tag+) - # - # YARD allows specification of {file:docs/Tags.md meta-data tags} - # programmatically via the {YARD::Tags::Library} class, but often this is not - # practical for users writing documentation. To make adding custom tags - # easier, Yardoc has a few command-line switches for creating basic tags - # and displaying them in generated HTML output. - # - # To specify a custom tag to be displayed in output, use any of the - # following: - # - # * +--tag+ TAG:TITLE - # * +--name-tag+ TAG:TITLE - # * +--type-tag+ TAG:TITLE - # * +--type-name-tag+ TAG:TITLE - # * +--title-tag+ TAG:TITLE - # - # "TAG:TITLE" is of the form: name:"Display Title", for example: - # - # --tag overload:"Overloaded Method" - # - # See +yard help doc+ for a description of the various options. - # - # Tags added in this way are automatically displayed in output. To add - # a meta-data tag that does not show up in output, use +--hide-tag TAG+. - # Note that you can also use this option on existing tags to hide - # builtin tags, for instance. - # - # == Processed Data Storage (+.yardoc+ directory) - # - # When Yardoc parses a source directory, it creates a +.yardoc+ directory - # (by default, override with +-b+) at the root of the project. This directory - # contains marshal dumps for all raw object data in the source, so that - # you can access it later for various commands (+stats+, +graph+, etc.). - # This directory is also used as a cache for any future calls to +yardoc+ - # so as to process only the files which have changed since the last call. - # - # When Yardoc uses the cache in subsequent calls to +yardoc+, methods - # or classes that have been deleted from source since the last parsing - # will not be erased from the cache (YARD never deletes objects). In such - # a case, you should wipe the cache and do a clean parsing of the source tree. - # You can do this by deleting the +.yardoc+ directory manually, or running - # Yardoc without +--use-cache+ (+-c+). - # - # @since 0.2.1 - # @see Verifier - class Yardoc < YardoptsCommand - # @return [Hash] the hash of options passed to the template. - # @see Templates::Engine#render - attr_reader :options - - # @return [Array] list of Ruby source files to process - attr_accessor :files - - # @return [Array] list of excluded paths (regexp matches) - # @since 0.5.3 - attr_accessor :excluded - - # @return [Boolean] whether to use the existing yardoc db if the - # .yardoc already exists. Also makes use of file checksums to - # parse only changed files. - attr_accessor :use_cache - - # @return [Boolean] whether objects should be serialized to .yardoc db - attr_accessor :save_yardoc - - # @return [Boolean] whether to generate output - attr_accessor :generate - - # @return [Boolean] whether to print a list of objects - # @since 0.5.5 - attr_accessor :list - - # Keep track of which visibilities are to be shown - # @return [Array] a list of visibilities - # @since 0.5.6 - attr_accessor :visibilities - - # Keep track of which APIs are to be shown - # @return [Array] a list of APIs - # @since 0.8.1 - attr_accessor :apis - - # Keep track of which APIs are to be hidden - # @return [Array] a list of APIs to be hidden - # @since 0.8.7 - attr_accessor :hidden_apis - - # @return [Array] a list of tags to hide from templates - # @since 0.6.0 - attr_accessor :hidden_tags - - # @return [Boolean] whether to print statistics after parsing - # @since 0.6.0 - attr_accessor :statistics - - # @return [Array] a list of assets to copy after generation - # @since 0.6.0 - attr_accessor :assets - - # @return [Boolean] whether markup option was specified - # @since 0.7.0 - attr_accessor :has_markup - - # @return [Boolean] whether yard exits with error status code if a warning occurs - attr_accessor :fail_on_warning - - # Creates a new instance of the commandline utility - def initialize - super - @options = YardocOptions.new - @options.reset_defaults - @visibilities = [:public] - @apis = [] - @hidden_apis = [] - @assets = {} - @excluded = [] - @files = [] - @hidden_tags = [] - @use_cache = false - @generate = true - @statistics = true - @list = false - @save_yardoc = true - @has_markup = false - @fail_on_warning = false - - if defined?(::Encoding) && ::Encoding.respond_to?(:default_external=) - utf8 = ::Encoding.find('utf-8') - - ::Encoding.default_external = utf8 unless ::Encoding.default_external == utf8 - ::Encoding.default_internal = utf8 unless ::Encoding.default_internal == utf8 - end - end - - def description - "Generates documentation" - end - - # Runs the commandline utility, parsing arguments and generating - # output if set. - # - # @param [Array] args the list of arguments. If the list only - # contains a single nil value, skip calling of {#parse_arguments} - # @return [void] - def run(*args) - log.show_progress = true - if args.empty? || !args.first.nil? - # fail early if arguments are not valid - return unless parse_arguments(*args) - end - - checksums = nil - if use_cache - Registry.load - checksums = Registry.checksums.dup - end - - if save_yardoc - Registry.lock_for_writing do - YARD.parse(files, excluded) - Registry.save(use_cache) - end - else - YARD.parse(files, excluded) - end - - if generate - run_generate(checksums) - copy_assets - elsif list - print_list - end - - if !list && statistics && log.level < Logger::ERROR - Registry.load_all - log.enter_level(Logger::ERROR) do - Stats.new(false).run(*args) - end - end - - abort if fail_on_warning && log.warned - - true - ensure - log.show_progress = false - end - - # Parses commandline arguments - # @param [Array] args the list of arguments - # @return [Boolean] whether or not arguments are valid - # @since 0.5.6 - def parse_arguments(*args) - super(*args) - - # Last minute modifications - self.files = Parser::SourceParser::DEFAULT_PATH_GLOB if files.empty? - files.delete_if {|x| x =~ /\A\s*\Z/ } # remove empty ones - readme = Dir.glob('README{,*[^~]}'). - sort_by {|r| [r.count('.'), r.index('.'), r] }.first - readme ||= Dir.glob(files.first).first if options.onefile && !files.empty? - options.readme ||= CodeObjects::ExtraFileObject.new(readme) if readme - options.files.unshift(options.readme).uniq! if options.readme - - Tags::Library.visible_tags -= hidden_tags - add_visibility_verifier - add_api_verifier - - apply_locale - - # US-ASCII is invalid encoding for onefile - if defined?(::Encoding) && options.onefile - if ::Encoding.default_internal == ::Encoding::US_ASCII - log.warn "--one-file is not compatible with US-ASCII encoding, using ASCII-8BIT" - ::Encoding.default_external, ::Encoding.default_internal = ['ascii-8bit'] * 2 - end - end - - if generate && !verify_markup_options - false - else - true - end - end - - # The list of all objects to process. Override this method to change - # which objects YARD should generate documentation for. - # - # @deprecated To hide methods use the +@private+ tag instead. - # @return [Array] a list of code objects to process - def all_objects - Registry.all(:root, :module, :class) - end - - private - - # Generates output for objects - # @param [Hash, nil] checksums if supplied, a list of checkums for files. - # @return [void] - # @since 0.5.1 - def run_generate(checksums) - if checksums - changed_files = [] - Registry.checksums.each do |file, hash| - changed_files << file if checksums[file] != hash - end - end - Registry.load_all if use_cache - objects = run_verifier(all_objects).reject do |object| - serialized = !options.serializer || options.serializer.exists?(object) - if checksums && serialized && !object.files.any? {|f, _line| changed_files.include?(f) } - true - else - log.debug "Re-generating object #{object.path}..." - false - end - end - Templates::Engine.generate(objects, options) - end - - # Verifies that the markup options are valid before parsing any code. - # Failing early is better than failing late. - # - # @return (see YARD::Templates::Helpers::MarkupHelper#load_markup_provider) - def verify_markup_options - result = false - lvl = has_markup ? log.level : Logger::FATAL - obj = Struct.new(:options).new(options) - obj.extend(Templates::Helpers::MarkupHelper) - options.files.each do |file| - markup = file.attributes[:markup] || obj.markup_for_file('', file.filename) - result = obj.load_markup_provider(markup) - return false if !result && markup != :rdoc - end - options.markup = :rdoc unless has_markup - log.enter_level(lvl) { result = obj.load_markup_provider } - if !result && !has_markup - log.warn "Could not load default RDoc formatter, " \ - "ignoring any markup (install RDoc to get default formatting)." - options.markup = :none - true - else - result - end - end - - # Copies any assets to the output directory - # @return [void] - # @since 0.6.0 - def copy_assets - return unless options.serializer - outpath = options.serializer.basepath - assets.each do |from, to| - to = File.join(outpath, to) - log.debug "Copying asset '#{from}' to '#{to}'" - from += '/.' if File.directory?(from) - FileUtils.cp_r(from, to) - end - end - - # Prints a list of all objects - # @return [void] - # @since 0.5.5 - def print_list - Registry.load_all - run_verifier(Registry.all). - sort_by {|item| [item.file || '', item.line || 0] }.each do |item| - log.puts "#{item.file}:#{item.line}: #{item.path}" - end - end - - # Adds a set of extra documentation files to be processed - # @param [Array] files the set of documentation files - def add_extra_files(*files) - files.map! {|f| f.include?("*") ? Dir.glob(f) : f }.flatten! - files.each do |file| - if extra_file_valid?(file) - options.files << CodeObjects::ExtraFileObject.new(file) - end - end - end - - # @param file [String] the filename to validate - # @param check_exists [Boolean] whether the file should exist on disk - # @return [Boolean] whether the file is allowed to be used - def extra_file_valid?(file, check_exists = true) - if file =~ %r{^(?:\.\./|/)} - log.warn "Invalid file: #{file}" - false - elsif check_exists && !File.file?(file) - log.warn "Could not find file: #{file}" - false - else - true - end - end - - # Parses the file arguments into Ruby files and extra files, which are - # separated by a '-' element. - # - # @example Parses a set of Ruby source files - # parse_files %w(file1 file2 file3) - # @example Parses a set of Ruby files with a separator and extra files - # parse_files %w(file1 file2 - extrafile1 extrafile2) - # @param [Array] files the list of files to parse - # @return [void] - def parse_files(*files) - seen_extra_files_marker = false - - files.each do |file| - if file == "-" - seen_extra_files_marker = true - next - end - - if seen_extra_files_marker - add_extra_files(file) - else - self.files << file - end - end - end - - # Adds verifier rule for visibilities - # @return [void] - # @since 0.5.6 - def add_visibility_verifier - vis_expr = "#{visibilities.uniq.inspect}.include?(object.visibility)" - options.verifier.add_expressions(vis_expr) - end - - # Adds verifier rule for APIs - # @return [void] - # @since 0.8.1 - def add_api_verifier - no_api = true if apis.delete('') - exprs = [] - - exprs << "#{apis.uniq.inspect}.include?(@api.text)" unless apis.empty? - - unless hidden_apis.empty? - exprs << "!#{hidden_apis.uniq.inspect}.include?(@api.text)" - end - - exprs = !exprs.empty? ? [exprs.join(' && ')] : [] - exprs << "!@api" if no_api - - expr = exprs.join(' || ') - options.verifier.add_expressions(expr) unless expr.empty? - end - - # Applies the specified locale to collected objects - # @return [void] - # @since 0.8.3 - def apply_locale - YARD::I18n::Locale.default = options.locale - options.files.each do |file| - file.locale = options.locale - end - end - - # (see Templates::Helpers::BaseHelper#run_verifier) - def run_verifier(list) - options.verifier ? options.verifier.run(list) : list - end - - # @since 0.6.0 - def add_tag(tag_data, factory_method = nil) - tag, title = *tag_data.split(':') - title ||= tag.capitalize - Tags::Library.define_tag(title, tag.to_sym, factory_method) - Tags::Library.visible_tags |= [tag.to_sym] - end - - # Parses commandline options. - # @param [Array] args each tokenized argument - def optparse(*args) - opts = OptionParser.new - opts.banner = "Usage: yard doc [options] [source_files [- extra_files]]" - - opts.separator "(if a list of source files is omitted, " - opts.separator " {lib,app}/**/*.rb ext/**/*.{c,rb} is used.)" - opts.separator "" - opts.separator "Example: yardoc -o documentation/ - FAQ LICENSE" - opts.separator " The above example outputs documentation for files in" - opts.separator " lib/**/*.rb to documentation/ including the extra files" - opts.separator " FAQ and LICENSE." - opts.separator "" - opts.separator "A base set of options can be specified by adding a .yardopts" - opts.separator "file to your base path containing all extra options separated" - opts.separator "by whitespace." - - general_options(opts) - output_options(opts) - tag_options(opts) - common_options(opts) - parse_options(opts, args) - parse_files(*args) unless args.empty? - end - - # Adds general options - def general_options(opts) - opts.separator "" - opts.separator "General Options:" - - opts.on('-b', '--db FILE', 'Use a specified .yardoc db to load from or save to', - ' (defaults to .yardoc)') do |yfile| - YARD::Registry.yardoc_file = yfile - end - - opts.on('--[no-]single-db', 'Whether code objects should be stored to single', - ' database file (advanced)') do |use_single_db| - Registry.single_object_db = use_single_db - end - - opts.on('-n', '--no-output', 'Only generate .yardoc database, no documentation.') do - self.generate = false - end - - opts.on('-c', '--use-cache [FILE]', - "Use the cached .yardoc db to generate documentation.", - " (defaults to no cache)") do |file| - YARD::Registry.yardoc_file = file if file - self.use_cache = true - end - - opts.on('--no-cache', "Clear .yardoc db before parsing source.") do - self.use_cache = false - end - - yardopts_options(opts) - - opts.on('--no-save', 'Do not save the parsed data to the yardoc db') do - self.save_yardoc = false - end - - opts.on('--exclude REGEXP', 'Ignores a file if it matches path match (regexp)') do |path| - excluded << path - end - - opts.on('--fail-on-warning', 'Exit with error status code if a warning occurs') do - self.fail_on_warning = true - end - end - - # Adds output options - def output_options(opts) - opts.separator "" - opts.separator "Output options:" - - opts.on('--one-file', 'Generates output as a single file') do - options.onefile = true - end - - opts.on('--list', 'List objects to standard out (implies -n)') do |_format| - self.generate = false - self.list = true - end - - opts.on('--no-public', "Don't show public methods. (default shows public)") do - visibilities.delete(:public) - end - - opts.on('--protected', "Show protected methods. (default hides protected)") do - visibilities.push(:protected) - end - - opts.on('--private', "Show private methods. (default hides private)") do - visibilities.push(:private) - end - - opts.on('--no-private', "Hide objects with @private tag") do - options.verifier.add_expressions '!object.tag(:private) && - (object.namespace.is_a?(CodeObjects::Proxy) || !object.namespace.tag(:private))' - end - - opts.on('--[no-]api API', 'Generates documentation for a given API', - '(objects which define the correct @api tag).', - 'If --no-api is given, displays objects with', - 'no @api tag.') do |api| - api = '' if api == false - apis.push(api) - end - - opts.on('--hide-api API', 'Hides given @api tag from documentation') do |api| - hidden_apis.push(api) - end - - opts.on('--embed-mixins', "Embeds mixin methods into class documentation") do - options.embed_mixins << '*' - end - - opts.on('--embed-mixin [MODULE]', "Embeds mixin methods from a particular", - " module into class documentation") do |mod| - options.embed_mixins << mod - end - - opts.on('--no-highlight', "Don't highlight code blocks in output.") do - options.highlight = false - end - - opts.on('--default-return TYPE', "Shown if method has no return type. ", - " (defaults to 'Object')") do |type| - options.default_return = type - end - - opts.on('--hide-void-return', "Hides return types specified as 'void'. ", - " (default is shown)") do - options.hide_void_return = true - end - - opts.on('--query QUERY', "Only show objects that match a specific query") do |query| - next if YARD::Config.options[:safe_mode] - options.verifier.add_expressions(query.taint) - end - - opts.on('--title TITLE', 'Add a specific title to HTML documents') do |title| - options.title = title - end - - opts.on('-r', '--readme FILE', '--main FILE', 'The readme file used as the title page', - ' of documentation.') do |readme| - if extra_file_valid?(readme) - options.readme = CodeObjects::ExtraFileObject.new(readme) - end - end - - opts.on('--files FILE1,FILE2,...', 'Any extra comma separated static files to be ', - ' included (eg. FAQ)') do |files| - add_extra_files(*files.split(",")) - end - - opts.on('--asset FROM[:TO]', 'A file or directory to copy over to output ', - ' directory after generating') do |asset| - from, to = *asset.split(':').map {|f| File.cleanpath(f, true) } - to ||= from - if extra_file_valid?(from, false) && extra_file_valid?(to, false) - assets[from] = to - end - end - - opts.on('-o', '--output-dir PATH', - 'The output directory. (defaults to ./doc)') do |dir| - options.serializer.basepath = dir - end - - opts.on('-m', '--markup MARKUP', - 'Markup style used in documentation, like textile, ', - ' markdown or rdoc. (defaults to rdoc)') do |markup| - self.has_markup = true - options.markup = markup.to_sym - end - - opts.on('-M', '--markup-provider MARKUP_PROVIDER', - 'Overrides the library used to process markup ', - ' formatting (specify the gem name)') do |markup_provider| - options.markup_provider = markup_provider.to_sym - end - - opts.on('--charset ENC', 'Character set to use when parsing files ', - ' (default is system locale)') do |encoding| - begin - if defined?(Encoding) && Encoding.respond_to?(:default_external=) - Encoding.default_external = encoding - Encoding.default_internal = encoding - end - rescue ArgumentError => e - raise OptionParser::InvalidOption, e - end - end - - opts.on('-t', '--template TEMPLATE', - 'The template to use. (defaults to "default")') do |template| - options.template = template.to_sym - end - - opts.on('-p', '--template-path PATH', - 'The template path to look for templates in.', - ' (used with -t).') do |path| - next if YARD::Config.options[:safe_mode] - YARD::Templates::Engine.register_template_path(File.expand_path(path)) - end - - opts.on('-f', '--format FORMAT', - 'The output format for the template.', - ' (defaults to html)') do |format| - options.format = format.to_sym - end - - opts.on('--no-stats', 'Don\'t print statistics') do - self.statistics = false - end - - opts.on('--no-progress', 'Don\'t show progress bar') do - log.show_progress = false - end - - opts.on('--locale LOCALE', - 'The locale for generated documentation.', - ' (defaults to en)') do |locale| - options.locale = locale - end - - opts.on('--po-dir DIR', - 'The directory that has .po files.', - " (defaults to #{YARD::Registry.po_dir})") do |dir| - YARD::Registry.po_dir = dir - end - end - - # Adds tag options - # @since 0.6.0 - def tag_options(opts) - opts.separator "" - opts.separator "Tag options: (TAG:TITLE looks like: 'overload:Overloaded Method')" - - opts.on('--tag TAG:TITLE', 'Registers a new free-form metadata @tag') do |tag| - add_tag(tag) - end - - opts.on('--type-tag TAG:TITLE', 'Tag with an optional types field') do |tag| - add_tag(tag, :with_types) - end - - opts.on('--type-name-tag TAG:TITLE', 'Tag with optional types and a name field') do |tag| - add_tag(tag, :with_types_and_name) - end - - opts.on('--name-tag TAG:TITLE', 'Tag with a name field') do |tag| - add_tag(tag, :with_name) - end - - opts.on('--title-tag TAG:TITLE', 'Tag with first line as title field') do |tag| - add_tag(tag, :with_title_and_text) - end - - opts.on('--hide-tag TAG', 'Hides a previously defined tag from templates') do |tag| - self.hidden_tags |= [tag.to_sym] - end - - opts.on('--transitive-tag TAG', 'Marks a tag as transitive') do |tag| - Tags::Library.transitive_tags |= [tag.to_sym] - end - - opts.on('--non-transitive-tag TAG', 'Marks a tag as not transitive') do |tag| - Tags::Library.transitive_tags -= [tag.to_sym] - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/yardopts_command.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/yardopts_command.rb deleted file mode 100644 index b86497e85e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/yardopts_command.rb +++ /dev/null @@ -1,110 +0,0 @@ -# frozen_string_literal: true -require 'optparse' - -module YARD - module CLI - # Abstract base class for command that reads .yardopts file - # - # @abstract - # @since 0.8.3 - class YardoptsCommand < Command - # The configuration filename to load extra options from - DEFAULT_YARDOPTS_FILE = ".yardopts" - - # @return [Boolean] whether to parse options from .yardopts - attr_accessor :use_yardopts_file - - # @return [Boolean] whether to parse options from .document - attr_accessor :use_document_file - - # The options file name (defaults to {DEFAULT_YARDOPTS_FILE}) - # @return [String] the filename to load extra options from - attr_accessor :options_file - - # Creates a new command that reads .yardopts - def initialize - super - @options_file = DEFAULT_YARDOPTS_FILE - @use_yardopts_file = true - @use_document_file = true - end - - # Parses commandline arguments - # @param [Array] args the list of arguments - # @return [Boolean] whether or not arguments are valid - # @since 0.5.6 - def parse_arguments(*args) - parse_yardopts_options(*args) - - # Parse files and then command line arguments - parse_rdoc_document_file - parse_yardopts - optparse(*args) - end - - protected - - # Adds --[no-]yardopts / --[no-]document - def yardopts_options(opts) - opts.on('--[no-]yardopts [FILE]', - "If arguments should be read from FILE", - " (defaults to yes, FILE defaults to .yardopts)") do |use_yardopts| - if use_yardopts.is_a?(String) - self.options_file = use_yardopts - self.use_yardopts_file = true - else - self.use_yardopts_file = (use_yardopts != false) - end - end - - opts.on('--[no-]document', "If arguments should be read from .document file. ", - " (defaults to yes)") do |use_document| - self.use_document_file = use_document - end - end - - private - - # Parses the .yardopts file for default yard options - # @return [Array] an array of options parsed from .yardopts - def yardopts(file = options_file) - return [] unless use_yardopts_file - File.read_binary(file).shell_split - rescue Errno::ENOENT - [] - end - - # Parses out the yardopts/document options - def parse_yardopts_options(*args) - opts = OptionParser.new - opts.base.long.clear # HACK: why are --help and --version defined? - yardopts_options(opts) - begin - opts.parse(args) - rescue OptionParser::ParseError => err - idx = args.index(err.args.first) - args = args[(idx + 1)..-1] - args.shift while args.first && args.first[0, 1] != '-' - retry - end - end - - def parse_rdoc_document_file(file = '.document') - optparse(*support_rdoc_document_file!(file)) if use_document_file - end - - def parse_yardopts(file = options_file) - optparse(*yardopts(file)) if use_yardopts_file - end - - # Reads a .document file in the directory to get source file globs - # @return [Array] an array of files parsed from .document - def support_rdoc_document_file!(file = '.document') - return [] unless use_document_file - File.read(file).gsub(/^[ \t]*#.+/m, '').split(/\s+/) - rescue Errno::ENOENT - [] - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/yri.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/yri.rb deleted file mode 100644 index c6629cd97a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/cli/yri.rb +++ /dev/null @@ -1,215 +0,0 @@ -# frozen_string_literal: true -require 'rbconfig' - -module YARD - module CLI - # A tool to view documentation in the console like `ri` - class YRI < Command - # The location in {YARD::CONFIG_DIR} where the YRI cache file is loaded - # from. - CACHE_FILE = File.expand_path(File.join(YARD::Config::CONFIG_DIR, 'yri_cache')) - - # A file containing all paths, delimited by newlines, to search for - # yardoc databases. - # @since 0.5.1 - SEARCH_PATHS_FILE = File.expand_path(File.join(YARD::Config::CONFIG_DIR, 'yri_search_paths')) - - # Default search paths that should be loaded dynamically into YRI. These paths - # take precedence over all other paths ({SEARCH_PATHS_FILE} and RubyGems - # paths). To add a path, call: - # - # DEFAULT_SEARCH_PATHS.push("/path/to/.yardoc") - # - # @return [Array] a list of extra search paths - # @since 0.6.0 - DEFAULT_SEARCH_PATHS = [] - - # Helper method to run the utility on an instance. - # @see #run - def self.run(*args) new.run(*args) end - - def initialize - super - @cache = {} - @search_paths = [] - add_default_paths - add_gem_paths - load_cache - @search_paths.uniq! - end - - def description - "A tool to view documentation in the console like `ri`" - end - - # Runs the command-line utility. - # - # @example - # YRI.new.run('String#reverse') - # @param [Array] args each tokenized argument - def run(*args) - optparse(*args) - - if ::RbConfig::CONFIG['host_os'] =~ /mingw|win32/ - @serializer ||= YARD::Serializers::StdoutSerializer.new - else - @serializer ||= YARD::Serializers::ProcessSerializer.new('less') - end - - if @name.nil? || @name.strip.empty? - print_usage - return exit(1) - end - - object = find_object(@name) - if object - print_object(object) - else - STDERR.puts "No documentation for `#{@name}'" - return exit(1) - end - end - - protected - - # Prints the command usage - # @return [void] - # @since 0.5.6 - def print_usage - log.puts "Usage: yri [options] " - log.puts "See yri --help for more options." - end - - # Caches the .yardoc file where an object can be found in the {CACHE_FILE} - # @return [void] - def cache_object(name, path) - return if path == Registry.yardoc_file - @cache[name] = path - - File.open!(CACHE_FILE, 'w') do |file| - @cache.each do |key, value| - file.puts("#{key} #{value}") - end - end - end - - # @param [CodeObjects::Base] object the object to print. - # @return [String] the formatted output for an object. - def print_object(object) - if object.type == :method && object.is_alias? - tmp = P(object.namespace, (object.scope == :instance ? "#" : "") + - object.namespace.aliases[object].to_s) - object = tmp unless YARD::CodeObjects::Proxy === tmp - end - object.format(:serializer => @serializer) - end - - # Locates an object by name starting in the cached paths and then - # searching through any search paths. - # - # @param [String] name the full name of the object - # @return [CodeObjects::Base] an object if found - # @return [nil] if no object is found - def find_object(name) - @search_paths.unshift(@cache[name]) if @cache[name] - @search_paths.unshift(Registry.yardoc_file) - - # Try to load it from in memory cache - log.debug "Searching for #{name} in memory" - obj = try_load_object(name, nil) - return obj if obj - - log.debug "Searching for #{name} in search paths" - @search_paths.each do |path| - next unless File.exist?(path) - log.debug "Searching for #{name} in #{path}..." - Registry.load(path) - obj = try_load_object(name, path) - return obj if obj - end - nil - end - - private - - # Tries to load the object with name. If successful, caches the object - # with the cache_path - # - # @param [String] name the object path - # @param [String] cache_path the location of the yardoc - # db containing the object to cache for future lookups. - # No caching is done if this is nil. - # @return [void] - def try_load_object(name, cache_path) - obj = Registry.at(name) - cache_object(name, cache_path) if obj && cache_path - obj - end - - # Loads {CACHE_FILE} - # @return [void] - def load_cache - return unless File.file?(CACHE_FILE) - File.readlines(CACHE_FILE).each do |line| - line = line.strip.split(/\s+/) - @cache[line[0]] = line[1] - end - end - - # Adds all RubyGems yardoc files to search paths - # @return [void] - def add_gem_paths - require 'rubygems' - gem_paths = [] - YARD::GemIndex.each do |spec| - yfile = Registry.yardoc_file_for_gem(spec.name) - next if yfile.nil? - - if spec.name =~ /^yard-doc-/ - gem_paths.unshift(yfile) - else - gem_paths.push(yfile) - end - end - @search_paths += gem_paths - rescue LoadError - nil # noop - end - - # Adds paths in {SEARCH_PATHS_FILE} - # @since 0.5.1 - def add_default_paths - @search_paths.concat(DEFAULT_SEARCH_PATHS) - return unless File.file?(SEARCH_PATHS_FILE) - paths = File.readlines(SEARCH_PATHS_FILE).map(&:strip) - @search_paths.concat(paths) - end - - # Parses commandline options. - # @param [Array] args each tokenized argument - def optparse(*args) - opts = OptionParser.new - opts.banner = "Usage: yri [options] " - opts.separator "Example: yri String#gsub" - opts.separator "" - opts.separator "General Options:" - - opts.on('-b', '--db FILE', 'Use a specified .yardoc db to search in') do |yfile| - @search_paths.unshift(yfile) - end - - opts.on('-T', '--no-pager', 'No pager') do - @serializer = YARD::Serializers::StdoutSerializer.new - end - - opts.on('-p PAGER', '--pager') do |pager| - @serializer = YARD::Serializers::ProcessSerializer.new(pager) - end - - common_options(opts) - parse_options(opts, args) - @name = args.first - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/base.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/base.rb deleted file mode 100644 index 5a724cf240..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/base.rb +++ /dev/null @@ -1,622 +0,0 @@ -# frozen_string_literal: true -module YARD - module CodeObjects - # A list of code objects. This array acts like a set (no unique items) - # but also disallows any {Proxy} objects from being added. - class CodeObjectList < Array - # Creates a new object list associated with a namespace - # - # @param [NamespaceObject] owner the namespace the list should be associated with - # @return [CodeObjectList] - def initialize(owner = Registry.root) - @owner = owner - end - - # Adds a new value to the list - # - # @param [Base] value a code object to add - # @return [CodeObjectList] self - def push(value) - value = Proxy.new(@owner, value) if value.is_a?(String) || value.is_a?(Symbol) - if value.is_a?(CodeObjects::Base) || value.is_a?(Proxy) - super(value) unless include?(value) - else - raise ArgumentError, "#{value.class} is not a valid CodeObject" - end - self - end - alias << push - end - - extend NamespaceMapper - - # Namespace separator - NSEP = '::' - - # Regex-quoted namespace separator - NSEPQ = NSEP - - # Instance method separator - ISEP = '#' - - # Regex-quoted instance method separator - ISEPQ = ISEP - - # Class method separator - CSEP = '.' - - # Regex-quoted class method separator - CSEPQ = Regexp.quote CSEP - - # Regular expression to match constant name - CONSTANTMATCH = /[A-Z]\w*/ - - # Regular expression to match the beginning of a constant - CONSTANTSTART = /^[A-Z]/ - - # Regular expression to match namespaces (const A or complex path A::B) - NAMESPACEMATCH = /(?:(?:#{NSEPQ}\s*)?#{CONSTANTMATCH})+/ - - # Regular expression to match a method name - METHODNAMEMATCH = %r{[a-zA-Z_]\w*[!?=]?|[-+~]\@|<<|>>|=~|===?|![=~]?|<=>|[<>]=?|\*\*|[-/+%^&*~`|]|\[\]=?} - - # Regular expression to match a fully qualified method def (self.foo, Class.foo). - METHODMATCH = /(?:(?:#{NAMESPACEMATCH}|[a-z]\w*)\s*(?:#{CSEPQ}|#{NSEPQ})\s*)?#{METHODNAMEMATCH}/ - - # All builtin Ruby exception classes for inheritance tree. - BUILTIN_EXCEPTIONS = ["ArgumentError", "ClosedQueueError", "EncodingError", - "EOFError", "Exception", "FiberError", "FloatDomainError", "IndexError", - "Interrupt", "IOError", "KeyError", "LoadError", "LocalJumpError", - "NameError", "NoMemoryError", "NoMethodError", "NotImplementedError", - "RangeError", "RegexpError", "RuntimeError", "ScriptError", "SecurityError", - "SignalException", "StandardError", "StopIteration", "SyntaxError", - "SystemCallError", "SystemExit", "SystemStackError", "ThreadError", - "TypeError", "UncaughtThrowError", "ZeroDivisionError"] - - # All builtin Ruby classes for inheritance tree. - # @note MatchingData is a 1.8.x legacy class - BUILTIN_CLASSES = ["Array", "Bignum", "Binding", "Class", "Complex", - "ConditionVariable", "Data", "Dir", "Encoding", "Enumerator", "FalseClass", - "Fiber", "File", "Fixnum", "Float", "Hash", "IO", "Integer", "MatchData", - "Method", "Module", "NilClass", "Numeric", "Object", "Proc", "Queue", - "Random", "Range", "Rational", "Regexp", "RubyVM", "SizedQueue", "String", - "Struct", "Symbol", "Thread", "ThreadGroup", "Time", "TracePoint", - "TrueClass", "UnboundMethod"] + BUILTIN_EXCEPTIONS - - # All builtin Ruby modules for mixin handling. - BUILTIN_MODULES = ["Comparable", "Enumerable", "Errno", "FileTest", "GC", - "Kernel", "Marshal", "Math", "ObjectSpace", "Precision", "Process", "Signal"] - - # All builtin Ruby classes and modules. - BUILTIN_ALL = BUILTIN_CLASSES + BUILTIN_MODULES - - # Hash of {BUILTIN_EXCEPTIONS} as keys and true as value (for O(1) lookups) - BUILTIN_EXCEPTIONS_HASH = BUILTIN_EXCEPTIONS.inject({}) {|h, n| h.update(n => true) } - - # +Base+ is the superclass of all code objects recognized by YARD. A code - # object is any entity in the Ruby language (class, method, module). A - # DSL might subclass +Base+ to create a new custom object representing - # a new entity type. - # - # == Registry Integration - # Any created object associated with a namespace is immediately registered - # with the registry. This allows the Registry to act as an identity map - # to ensure that no object is represented by more than one Ruby object - # in memory. A unique {#path} is essential for this identity map to work - # correctly. - # - # == Custom Attributes - # Code objects allow arbitrary custom attributes to be set using the - # {#[]=} assignment method. - # - # == Namespaces - # There is a special type of object called a "namespace". These are subclasses - # of the {NamespaceObject} and represent Ruby entities that can have - # objects defined within them. Classically these are modules and classes, - # though a DSL might create a custom {NamespaceObject} to describe a - # specific set of objects. - # - # == Separators - # Custom classes with different separator tokens should define their own - # separators using the {NamespaceMapper.register_separator} method. The - # standard Ruby separators have already been defined ('::', '#', '.', etc). - # - # @abstract This class should not be used directly. Instead, create a - # subclass that implements {#path}, {#sep} or {#type}. You might also - # need to register custom separators if {#sep} uses alternate separator - # tokens. - # @see Registry - # @see #path - # @see #[]= - # @see NamespaceObject - # @see NamespaceMapper.register_separator - class Base - # The files the object was defined in. To add a file, use {#add_file}. - # @return [Array] a list of files - # @see #add_file - attr_reader :files - - # The namespace the object is defined in. If the object is in the - # top level namespace, this is {Registry.root} - # @return [NamespaceObject] the namespace object - attr_reader :namespace - - # The source code associated with the object - # @return [String, nil] source, if present, or nil - attr_reader :source - - # Language of the source code associated with the object. Defaults to - # +:ruby+. - # - # @return [Symbol] the language type - attr_accessor :source_type - - # The one line signature representing an object. For a method, this will - # be of the form "def meth(arguments...)". This is usually the first - # source line. - # - # @return [String] a line of source - attr_accessor :signature - - # The non-localized documentation string associated with the object - # @return [Docstring] the documentation string - # @since 0.8.4 - attr_reader :base_docstring - undef base_docstring - def base_docstring; @docstring end - - # Marks whether or not the method is conditionally defined at runtime - # @return [Boolean] true if the method is conditionally defined at runtime - attr_accessor :dynamic - - # @return [String] the group this object is associated with - # @since 0.6.0 - attr_accessor :group - - # Is the object defined conditionally at runtime? - # @see #dynamic - def dynamic?; @dynamic end - - # @return [Symbol] the visibility of an object (:public, :private, :protected) - attr_accessor :visibility - undef visibility= - def visibility=(v) @visibility = v.to_sym end - - class << self - # Allocates a new code object - # @return [Base] - # @see #initialize - def new(namespace, name, *args, &block) - raise ArgumentError, "invalid empty object name" if name.to_s.empty? - if namespace.is_a?(ConstantObject) - unless namespace.value =~ /\A#{NAMESPACEMATCH}\Z/ - raise Parser::UndocumentableError, "constant mapping" - end - - namespace = Proxy.new(namespace.namespace, namespace.value) - end - - if name.to_s[0, 2] == NSEP - name = name.to_s[2..-1] - namespace = Registry.root - end - - if name =~ /(?:#{NSEPQ})([^:]+)$/ - return new(Proxy.new(namespace, $`), $1, *args, &block) - end - - obj = super(namespace, name, *args) - existing_obj = Registry.at(obj.path) - obj = existing_obj if existing_obj && existing_obj.class == self - yield(obj) if block_given? - obj - end - - # Compares the class with subclasses - # - # @param [Object] other the other object to compare classes with - # @return [Boolean] true if other is a subclass of self - def ===(other) - other.is_a?(self) - end - end - - # Creates a new code object - # - # @example Create a method in the root namespace - # CodeObjects::Base.new(:root, '#method') # => # - # @example Create class Z inside namespace X::Y - # CodeObjects::Base.new(P("X::Y"), :Z) # or - # CodeObjects::Base.new(Registry.root, "X::Y") - # @param [NamespaceObject] namespace the namespace the object belongs in, - # {Registry.root} or :root should be provided if it is associated with - # the top level namespace. - # @param [Symbol, String] name the name (or complex path) of the object. - # @yield [self] a block to perform any extra initialization on the object - # @yieldparam [Base] self the newly initialized code object - # @return [Base] the newly created object - def initialize(namespace, name, *) - if namespace && namespace != :root && - !namespace.is_a?(NamespaceObject) && !namespace.is_a?(Proxy) - raise ArgumentError, "Invalid namespace object: #{namespace}" - end - - @files = [] - @current_file_has_comments = false - @name = name.to_sym - @source_type = :ruby - @visibility = :public - @tags = [] - @docstrings = {} - @docstring = Docstring.new!('', [], self) - @namespace = nil - self.namespace = namespace - yield(self) if block_given? - end - - # Copies all data in this object to another code object, except for - # uniquely identifying information (path, namespace, name, scope). - # - # @param [Base] other the object to copy data to - # @return [Base] the other object - # @since 0.8.0 - def copy_to(other) - copyable_attributes.each do |ivar| - ivar = "@#{ivar}" - other.instance_variable_set(ivar, instance_variable_get(ivar)) - end - other.docstring = @docstring.to_raw - other - end - - # The name of the object - # @param [Boolean] prefix whether to show a prefix. Implement - # this in a subclass to define how the prefix is showed. - # @return [Symbol] if prefix is false, the symbolized name - # @return [String] if prefix is true, prefix + the name as a String. - # This must be implemented by the subclass. - def name(prefix = false) - prefix ? @name.to_s : (defined?(@name) && @name) - end - - # Associates a file with a code object, optionally adding the line where it was defined. - # By convention, '' should be used to associate code that comes form standard input. - # - # @param [String] file the filename ('' for standard input) - # @param [Fixnum, nil] line the line number where the object lies in the file - # @param [Boolean] has_comments whether or not the definition has comments associated. This - # will allow {#file} to return the definition where the comments were made instead - # of any empty definitions that might have been parsed before (module namespaces for instance). - def add_file(file, line = nil, has_comments = false) - raise(ArgumentError, "file cannot be nil or empty") if file.nil? || file == '' - obj = [file.to_s, line] - return if files.include?(obj) - if has_comments && !@current_file_has_comments - @current_file_has_comments = true - @files.unshift(obj) - else - @files << obj # back of the line - end - end - - # Returns the filename the object was first parsed at, taking - # definitions with docstrings first. - # - # @return [String] a filename - def file - @files.first ? @files.first[0] : nil - end - - # Returns the line the object was first parsed at (or nil) - # - # @return [Fixnum] the line where the object was first defined. - # @return [nil] if there is no line associated with the object - def line - @files.first ? @files.first[1] : nil - end - - # Tests if another object is equal to this, including a proxy - # @param [Base, Proxy] other if other is a {Proxy}, tests if - # the paths are equal - # @return [Boolean] whether or not the objects are considered the same - def equal?(other) - if other.is_a?(Base) || other.is_a?(Proxy) - path == other.path - else - super - end - end - alias == equal? - alias eql? equal? - - # @return [Integer] the object's hash value (for equality checking) - def hash; path.hash end - - # @return [nil] this object does not turn into an array - def to_ary; nil end - - # Accesses a custom attribute on the object - # @param [#to_s] key the name of the custom attribute - # @return [Object, nil] the custom attribute or nil if not found. - # @see #[]= - def [](key) - if respond_to?(key) - send(key) - elsif instance_variable_defined?("@#{key}") - instance_variable_get("@#{key}") - end - end - - # Sets a custom attribute on the object - # @param [#to_s] key the name of the custom attribute - # @param [Object] value the value to associate - # @return [void] - # @see #[] - def []=(key, value) - if respond_to?("#{key}=") - send("#{key}=", value) - else - instance_variable_set("@#{key}", value) - end - end - - # @overload dynamic_attr_name - # @return the value of attribute named by the method attribute name - # @raise [NoMethodError] if no method or custom attribute exists by - # the attribute name - # @see #[] - # @overload dynamic_attr_name=(value) - # @param value a value to set - # @return +value+ - # @see #[]= - def method_missing(meth, *args, &block) - if meth.to_s =~ /=$/ - self[meth.to_s[0..-2]] = args.first - elsif instance_variable_get("@#{meth}") - self[meth] - else - super - end - end - - # Attaches source code to a code object with an optional file location - # - # @param [#source, String] statement - # the +Parser::Statement+ holding the source code or the raw source - # as a +String+ for the definition of the code object only (not the block) - def source=(statement) - if statement.respond_to?(:source) - @source = format_source(statement.source.strip) - else - @source = format_source(statement.to_s) - end - - if statement.respond_to?(:signature) - self.signature = statement.signature - end - end - - # The documentation string associated with the object - # - # @param [String, I18n::Locale] locale (I18n::Locale.default) - # the locale of the documentation string. - # @return [Docstring] the documentation string - def docstring(locale = I18n::Locale.default) - if locale.nil? - @docstring.resolve_reference - return @docstring - end - - if locale.is_a?(String) - locale_name = locale - locale = nil - else - locale_name = locale.name - end - @docstrings[locale_name] ||= - translate_docstring(locale || Registry.locale(locale_name)) - end - - # Attaches a docstring to a code object by parsing the comments attached to the statement - # and filling the {#tags} and {#docstring} methods with the parsed information. - # - # @param [String, Array, Docstring] comments - # the comments attached to the code object to be parsed - # into a docstring and meta tags. - def docstring=(comments) - @docstrings.clear - @docstring = Docstring === comments ? - comments : Docstring.new(comments, self) - end - - # Default type is the lowercase class name without the "Object" suffix. - # Override this method to provide a custom object type - # - # @return [Symbol] the type of code object this represents - def type - self.class.name.split('::').last.gsub(/Object$/, '').downcase.to_sym - end - - # Represents the unique path of the object. The default implementation - # joins the path of {#namespace} with {#name} via the value of {#sep}. - # Custom code objects should ensure that the path is unique to the code - # object by either overriding {#sep} or this method. - # - # @example The path of an instance method - # MethodObject.new(P("A::B"), :c).path # => "A::B#c" - # @return [String] the unique path of the object - # @see #sep - def path - @path ||= if parent && !parent.root? - [parent.path, name.to_s].join(sep) - else - name.to_s - end - end - alias to_s path - - # @note - # Override this method if your object has a special title that does - # not match the {#path} attribute value. This title will be used - # when linking or displaying the object. - # @return [String] the display title for an object - # @see 0.8.4 - def title - path - end - - # @param [Base, String] other another code object (or object path) - # @return [String] the shortest relative path from this object to +other+ - # @since 0.5.3 - def relative_path(other) - other = Registry.at(other) if String === other && Registry.at(other) - same_parent = false - if other.respond_to?(:path) - same_parent = other.parent == parent - other = other.path - end - return other unless namespace - common = [path, other].join(" ").match(/^(\S*)\S*(?: \1\S*)*$/)[1] - common = path unless common =~ /(\.|::|#)$/ - common = common.sub(/(\.|::|#)[^:#\.]*?$/, '') if same_parent - suffix = %w(. :).include?(common[-1, 1]) || other[common.size, 1] == '#' ? - '' : '(::|\.)' - result = other.sub(/^#{Regexp.quote common}#{suffix}/, '') - result.empty? ? other : result - end - - # Renders the object using the {Templates::Engine templating system}. - # - # @example Formats a class in plaintext - # puts P('MyClass').format - # @example Formats a method in html with rdoc markup - # puts P('MyClass#meth').format(:format => :html, :markup => :rdoc) - # @param [Hash] options a set of options to pass to the template - # @option options [Symbol] :format (:text) :html, :text or another output format - # @option options [Symbol] :template (:default) a specific template to use - # @option options [Symbol] :markup (nil) the markup type (:rdoc, :markdown, :textile) - # @option options [Serializers::Base] :serializer (nil) see Serializers - # @return [String] the rendered template - # @see Templates::Engine#render - def format(options = {}) - options = options.merge(:object => self) - options = options.merge(:type => type) unless options[:type] - Templates::Engine.render(options) - end - - # Inspects the object, returning the type and path - # @return [String] a string describing the object - def inspect - "#" - end - - # Sets the namespace the object is defined in. - # - # @param [NamespaceObject, :root, nil] obj the new namespace (:root - # for {Registry.root}). If obj is nil, the object is unregistered - # from the Registry. - def namespace=(obj) - if @namespace - @namespace.children.delete(self) - Registry.delete(self) - end - - @namespace = (obj == :root ? Registry.root : obj) - - if @namespace - reg_obj = Registry.at(path) - return if reg_obj && reg_obj.class == self.class - - unless @namespace.is_a?(Proxy) - # remove prior objects from obj's children that match this one - @namespace.children.delete_if {|o| o.path == path } - @namespace.children << self - end - Registry.register(self) - end - end - - alias parent namespace - alias parent= namespace= - - # Gets a tag from the {#docstring} - # @see Docstring#tag - def tag(name); docstring.tag(name) end - - # Gets a list of tags from the {#docstring} - # @see Docstring#tags - def tags(name = nil); docstring.tags(name) end - - # Tests if the {#docstring} has a tag - # @see Docstring#has_tag? - def has_tag?(name); docstring.has_tag?(name) end - - # Add tags to the {#docstring} - # @see Docstring#add_tag - # @since 0.8.4 - def add_tag(*tags) - @docstrings.clear - @docstring.add_tag(*tags) - end - - # @return whether or not this object is a RootObject - def root?; false end - - # Override this method with a custom component separator. For instance, - # {MethodObject} implements sep as '#' or '.' (depending on if the - # method is instance or class respectively). {#path} depends on this - # value to generate the full path in the form: namespace.path + sep + name - # - # @return [String] the component that separates the namespace path - # and the name (default is {NSEP}) - def sep; NSEP end - - protected - - # Override this method if your code object subclass does not allow - # copying of certain attributes. - # - # @return [Array] the list of instance variable names (without - # "@" prefix) that should be copied when {#copy_to} is called - # @see #copy_to - # @since 0.8.0 - def copyable_attributes - vars = instance_variables.map {|ivar| ivar.to_s[1..-1] } - vars -= %w(docstring docstrings namespace name path) - vars - end - - private - - # Formats source code by removing leading indentation - # - # @param [String] source the source code to format - # @return [String] formatted source - def format_source(source) - source = source.chomp - last = source.split(/\r?\n/).last - indent = last ? last[/^([ \t]*)/, 1].length : 0 - source.gsub(/^[ \t]{#{indent}}/, '') - end - - def translate_docstring(locale) - @docstring.resolve_reference - return @docstring if locale.nil? - - text = I18n::Text.new(@docstring) - localized_text = text.translate(locale) - docstring = Docstring.new(localized_text, self) - @docstring.tags.each do |tag| - if tag.is_a?(Tags::Tag) - localized_tag = tag.clone - localized_tag.text = I18n::Text.new(tag.text).translate(locale) - docstring.add_tag(localized_tag) - else - docstring.add_tag(tag) - end - end - docstring - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/class_object.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/class_object.rb deleted file mode 100644 index 125cc9760f..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/class_object.rb +++ /dev/null @@ -1,146 +0,0 @@ -# frozen_string_literal: true -module YARD::CodeObjects - register_separator NSEP, :class - - # A ClassObject represents a Ruby class in source code. It is a {ModuleObject} - # with extra inheritance semantics through the superclass. - class ClassObject < NamespaceObject - # The {ClassObject} that this class object inherits from in Ruby source. - # @return [ClassObject] a class object that is the superclass of this one - attr_reader :superclass - - # Creates a new class object in +namespace+ with +name+ - # - # @see Base.new - def initialize(namespace, name, *args, &block) - super - - if is_exception? - self.superclass ||= "::Exception" unless P(namespace, name) == P(:Exception) - else - case P(namespace, name).path - when "BasicObject" - nil - when "Object" - self.superclass ||= "::BasicObject" - else - self.superclass ||= "::Object" - end - end - end - - # Whether or not the class is a Ruby Exception - # - # @return [Boolean] whether the object represents a Ruby exception - def is_exception? - inheritance_tree.reverse.any? {|o| BUILTIN_EXCEPTIONS_HASH.key? o.path } - end - - # Returns the inheritance tree of the object including self. - # - # @param [Boolean] include_mods whether or not to include mixins in the - # inheritance tree. - # @return [Array] the list of code objects that make up - # the inheritance tree. - def inheritance_tree(include_mods = false) - list = (include_mods ? mixins(:instance, :class) : []) - if superclass.is_a?(Proxy) || superclass.respond_to?(:inheritance_tree) - list += [superclass] unless superclass == P(:Object) || superclass == P(:BasicObject) - end - [self] + list.map do |m| - next m if m == self - next m unless m.respond_to?(:inheritance_tree) - m.inheritance_tree(include_mods) - end.flatten.uniq - end - - # Returns the list of methods matching the options hash. Returns - # all methods if hash is empty. - # - # @param [Hash] opts the options hash to match - # @option opts [Boolean] :inherited (true) whether inherited methods should be - # included in the list - # @option opts [Boolean] :included (true) whether mixed in methods should be - # included in the list - # @return [Array] the list of methods that matched - def meths(opts = {}) - opts = SymbolHash[:inherited => true].update(opts) - list = super(opts) - list += inherited_meths(opts).reject do |o| - next(false) if opts[:all] - list.find {|o2| o2.name == o.name && o2.scope == o.scope } - end if opts[:inherited] - list - end - - # Returns only the methods that were inherited. - # - # @return [Array] the list of inherited method objects - def inherited_meths(opts = {}) - inheritance_tree[1..-1].inject([]) do |list, superclass| - if superclass.is_a?(Proxy) - list - else - list += superclass.meths(opts).reject do |o| - next(false) if opts[:all] - child(:name => o.name, :scope => o.scope) || - list.find {|o2| o2.name == o.name && o2.scope == o.scope } - end - end - end - end - - # Returns the list of constants matching the options hash. - # - # @param [Hash] opts the options hash to match - # @option opts [Boolean] :inherited (true) whether inherited constant should be - # included in the list - # @option opts [Boolean] :included (true) whether mixed in constant should be - # included in the list - # @return [Array] the list of constant that matched - def constants(opts = {}) - opts = SymbolHash[:inherited => true].update(opts) - super(opts) + (opts[:inherited] ? inherited_constants : []) - end - - # Returns only the constants that were inherited. - # - # @return [Array] the list of inherited constant objects - def inherited_constants - inheritance_tree[1..-1].inject([]) do |list, superclass| - if superclass.is_a?(Proxy) - list - else - list += superclass.constants.reject do |o| - child(:name => o.name) || list.find {|o2| o2.name == o.name } - end - end - end - end - - # Sets the superclass of the object - # - # @param [Base, Proxy, String, Symbol, nil] object the superclass value - # @return [void] - def superclass=(object) - case object - when Base, Proxy, NilClass - @superclass = object - when String, Symbol - @superclass = Proxy.new(namespace, object) - else - raise ArgumentError, "superclass must be CodeObject, Proxy, String or Symbol" - end - - if name == @superclass.name && namespace != YARD::Registry.root && !object.is_a?(Base) - @superclass = Proxy.new(namespace.namespace, object) - end - - if @superclass == self - msg = "superclass #{@superclass.inspect} cannot be the same as the declared class #{inspect}" - @superclass = P("::Object") - raise ArgumentError, msg - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/class_variable_object.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/class_variable_object.rb deleted file mode 100644 index ddd2ffa4b3..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/class_variable_object.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true -module YARD::CodeObjects - register_separator NSEP, :class_variable - - # Represents a class variable inside a namespace. The path is expressed - # in the form "A::B::@@classvariable" - class ClassVariableObject < Base - # @return [String] the class variable's value - attr_accessor :value - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/constant_object.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/constant_object.rb deleted file mode 100644 index b7904648bd..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/constant_object.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true -module YARD::CodeObjects - register_separator NSEP, :constant - - # A +ConstantObject+ represents a Ruby constant (not a module or class). - # To access the constant's (source code) value, use {#value}. - class ConstantObject < Base - # The source code representing the constant's value - # @return [String] the value the constant is set to - attr_reader :value - - def value=(value) - @value = format_source(value) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/extended_method_object.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/extended_method_object.rb deleted file mode 100644 index b96794076a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/extended_method_object.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true -module YARD::CodeObjects - # Represents an instance method of a module that was mixed into the class - # scope of another namespace. - # - # @see MethodObject - class ExtendedMethodObject - instance_methods.each {|m| undef_method(m) unless m =~ /^__/ || m.to_sym == :object_id } - - # @return [Symbol] always +:class+ - def scope; :class end - - # Sets up a delegate for {MethodObject} obj. - # - # @param [MethodObject] obj the instance method to treat as a mixed in - # class method on another namespace. - def initialize(obj) @del = obj end - - # Sends all methods to the {MethodObject} assigned in {#initialize} - # @see #initialize - # @see MethodObject - def method_missing(sym, *args, &block) @del.__send__(sym, *args, &block) end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/extra_file_object.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/extra_file_object.rb deleted file mode 100644 index c0f53a3e50..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/extra_file_object.rb +++ /dev/null @@ -1,134 +0,0 @@ -# frozen_string_literal: true -module YARD::CodeObjects - # An ExtraFileObject represents an extra documentation file (README or other - # file). It is not strictly a CodeObject (does not inherit from `Base`) although - # it implements `path`, `name` and `type`, and therefore should be structurally - # compatible with most CodeObject interfaces. - class ExtraFileObject - attr_accessor :filename - attr_writer :attributes - attr_accessor :name - # @since 0.8.3 - attr_reader :locale - - # Creates a new extra file object. - # @param [String] filename the location on disk of the file - # @param [String] contents the file contents. If not set, the contents - # will be read from disk using the +filename+. - def initialize(filename, contents = nil) - self.filename = filename - self.name = File.basename(filename).gsub(/\.[^.]+$/, '') - self.attributes = SymbolHash.new(false) - @original_contents = contents - @parsed = false - @locale = nil - ensure_parsed - end - - alias path name - - def attributes - ensure_parsed - @attributes - end - - def title - attributes[:title] || name - end - - def contents - ensure_parsed - @contents - end - - def contents=(contents) - @original_contents = contents - @parsed = false - end - - # @param [String] locale the locale name to be translated. - # @return [void] - # @since 0.8.3 - def locale=(locale) - @locale = locale - @parsed = false - end - - def inspect - "#" - end - alias to_s inspect - - def type; :extra_file end - - def ==(other) - return false unless self.class === other - other.filename == filename - end - alias eql? == - alias equal? == - def hash; filename.hash end - - private - - def ensure_parsed - return if @parsed - @parsed = true - @contents = parse_contents(@original_contents || File.read(@filename)) - end - - # @param [String] data the file contents - def parse_contents(data) - retried = false - cut_index = 0 - data = translate(data) - data = data.split("\n") - data.each_with_index do |line, index| - case line - when /^#!(\S+)\s*$/ - if index == 0 - attributes[:markup] = $1 - else - cut_index = index - break - end - when /^\s*#\s*@(\S+)\s*(.+?)\s*$/ - attributes[$1] = $2 - when /^\s*\s*$/ - # Ignore HTML comments - else - cut_index = index - break - end - end - data = data[cut_index..-1] if cut_index > 0 - contents = data.join("\n") - - if contents.respond_to?(:force_encoding) && attributes[:encoding] - begin - contents.force_encoding(attributes[:encoding]) - rescue ArgumentError - log.warn "Invalid encoding `#{attributes[:encoding]}' in #{filename}" - end - end - contents - rescue ArgumentError => e - raise unless e.message =~ /invalid byte sequence/ - - if retried - # This should never happen. - log.warn "Could not read #{filename}, #{e.message}. You probably want to set `--charset`." - return '' - else - data.force_encoding('binary') if data.respond_to?(:force_encoding) - retried = true - retry - end - end - - def translate(data) - text = YARD::I18n::Text.new(data, :have_header => true) - text.translate(YARD::Registry.locale(locale)) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/macro_object.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/macro_object.rb deleted file mode 100644 index 235de4207c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/macro_object.rb +++ /dev/null @@ -1,172 +0,0 @@ -# frozen_string_literal: true -require 'ostruct' - -module YARD - module CodeObjects - # A MacroObject represents a docstring defined through +@!macro NAME+ and can be - # reused by specifying the tag +@!macro NAME+. You can also provide the - # +attached+ type flag to the macro definition to have it attached to the - # specific DSL method so it will be implicitly reused. - # - # Macros are fully described in the {file:docs/Tags.md#macro Tags Overview} - # document. - # - # @example Creating a basic named macro - # # @!macro prop - # # @!method $1(${3-}) - # # @return [$2] the value of the $0 - # property :foo, String, :a, :b - # - # # @!macro prop - # property :bar, Numeric, :value - # - # @example Creating a macro that is attached to the method call - # # @!macro [attach] prop2 - # # @!method $1(value) - # property :foo - # - # # Extra data added to docstring - # property :bar - class MacroObject < Base - MACRO_MATCH = /(\\)?\$(?:\{(-?\d+|\*)(-)?(-?\d+)?\}|(-?\d+|\*))/ - - class << self - # Creates a new macro and fills in the relevant properties. - # @param [String] macro_name the name of the macro, must be unique. - # @param [String] data the data the macro should expand when re-used - # @param [CodeObjects::Base] method_object an object to attach this - # macro to. If supplied, {#attached?} will be true - # @return [MacroObject] the newly created object - def create(macro_name, data, method_object = nil) - obj = new(:root, macro_name) - obj.macro_data = data - obj.method_object = method_object - obj - end - - # Finds a macro using +macro_name+ - # @param [#to_s] macro_name the name of the macro - # @return [MacroObject] if a macro is found - # @return [nil] if there is no registered macro by that name - def find(macro_name) - Registry.at('.macro.' + macro_name.to_s) - end - - # Parses a given docstring and determines if the macro is "new" or - # not. If the macro has $variable names or if it has a @!macro tag - # with the [new] or [attached] flag, it is considered new. - # - # If a new macro is found, the macro is created and registered. Otherwise - # the macro name is searched and returned. If a macro is not found, - # nil is returned. - # - # @param [#to_s] macro_name the name of the macro - # @param [CodeObjects::Base] method_object an optional method to attach - # the macro to. Only used if the macro is being created, otherwise - # this argument is ignored. - # @return [MacroObject] the newly created or existing macro, depending - # on whether the @!macro tag was a new tag or not. - # @return [nil] if the +data+ has no macro tag or if the macro is - # not new and no macro by the macro name is found. - def find_or_create(macro_name, data, method_object = nil) - find(name) || create(macro_name, data, method_object) - end - alias create_docstring find_or_create - - # Expands +macro_data+ using the interpolation parameters. - # - # Interpolation rules: - # * $0, $1, $2, ... = the Nth parameter in +call_params+ - # * $* = the full statement source (excluding block) - # * Also supports $!{N-M} ranges, as well as negative indexes on N or M - # * Use \$ to escape the variable name in a macro. - # - # @!macro [new] macro.expand - # @param [Array] call_params the method name and parameters - # to the method call. These arguments will fill \$0-N - # @param [String] full_source the full source line (excluding block) - # interpolated as \$* - # @param [String] block_source Currently unused. Will support - # interpolating the block data as a variable. - # @return [String] the expanded macro data - # @param [String] macro_data the macro data to expand (taken from {#macro_data}) - def expand(macro_data, call_params = [], full_source = '', block_source = '') # rubocop:disable Lint/UnusedMethodArgument - macro_data = macro_data.all if macro_data.is_a?(Docstring) - macro_data.gsub(MACRO_MATCH) do - escape = $1 - first = $2 || $5 - last = $4 - rng = $3 ? true : false - next $&[1..-1] if escape - if first == '*' - last ? $& : full_source - else - first_i = first.to_i - last_i = (last ? last.to_i : call_params.size) - last_i = first_i unless rng - params = call_params[first_i..last_i] - params ? params.join(", ") : '' - end - end - end - - # Applies a macro on a docstring by creating any macro data inside of - # the docstring first. Equivalent to calling {find_or_create} and {apply_macro} - # on the new macro object. - # - # @param [Docstring] docstring the docstring to create a macro out of - # @!macro macro.expand - # @see find_or_create - def apply(docstring, call_params = [], full_source = '', block_source = '', _method_object = nil) # rubocop:disable Lint/UnusedMethodArgument - docstring = docstring.all if Docstring === docstring - parser = Docstring.parser - handler = OpenStruct.new - handler.call_params = call_params[1..-1] - handler.caller_method = call_params.first - handler.statement = OpenStruct.new(:source => full_source) - parser.parse(docstring, nil, handler).to_docstring.to_raw - end - - # Applies a macro to a docstring, interpolating the macro's data on the - # docstring and appending any extra local docstring data that was in - # the original +docstring+ object. - # - # @param [MacroObject] macro the macro object - # @!macro macro.expand - def apply_macro(macro, docstring, call_params = [], full_source = '', block_source = '') # rubocop:disable Lint/UnusedMethodArgument - apply(docstring, call_params, full_source, block_source) - end - end - - # @return [String] the macro data stored on the object - attr_accessor :macro_data - - # @return [CodeObjects::Base] the method object that this macro is - # attached to. - attr_accessor :method_object - - # @return [Boolean] whether this macro is attached to a method - def attached?; method_object ? true : false end - - # Overrides {Base#path} so the macro path is ".macro.MACRONAME" - def path; '.macro.' + name.to_s end - - # Overrides the separator to be '.' - def sep; '.' end - - # Expands the macro using - # @param [Array] call_params a list of tokens that are passed - # to the method call - # @param [String] full_source the full method call (not including the block) - # @param [String] block_source the source passed in the block of the method - # call, if there is a block. - # @example Expanding a Macro - # macro.expand(%w(property foo bar), 'property :foo, :bar', '') #=> - # "...macro data interpolating this line of code..." - # @see expand - def expand(call_params = [], full_source = '', block_source = '') - self.class.expand(macro_data, call_params, full_source, block_source) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/method_object.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/method_object.rb deleted file mode 100644 index c34ef3a298..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/method_object.rb +++ /dev/null @@ -1,196 +0,0 @@ -# frozen_string_literal: true -module YARD::CodeObjects - register_separator CSEP, :method - register_separator ISEP, :method - - # Represents a Ruby method in source - class MethodObject < Base - # The scope of the method (+:class+ or +:instance+) - # - # @return [Symbol] the scope - attr_reader :scope - - # Whether the object is explicitly defined in source or whether it was - # inferred by a handler. For instance, attribute methods are generally - # inferred and therefore not explicitly defined in source. - # - # @return [Boolean] whether the object is explicitly defined in source. - attr_accessor :explicit - - # Returns the list of parameters parsed out of the method signature - # with their default values. - # - # @return [Array] a list of parameter names followed - # by their default values (or nil) - attr_accessor :parameters - - # Creates a new method object in +namespace+ with +name+ and an instance - # or class +scope+ - # - # If scope is +:module+, this object is instantiated as a public - # method in +:class+ scope, but also creates a new (empty) method - # as a private +:instance+ method on the same class or module. - # - # @param [NamespaceObject] namespace the namespace - # @param [String, Symbol] name the method name - # @param [Symbol] scope +:instance+, +:class+, or +:module+ - def initialize(namespace, name, scope = :instance, &block) - @module_function = false - @scope = nil - - # handle module function - if scope == :module - other = self.class.new(namespace, name, &block) - other.visibility = :private - scope = :class - @module_function = true - end - - @visibility = :public - self.scope = scope - self.parameters = [] - - super - end - - # Changes the scope of an object from :instance or :class - # @param [Symbol] v the new scope - def scope=(v) - reregister = @scope ? true : false - - # handle module function - if v == :module - other = self.class.new(namespace, name) - other.visibility = :private - @visibility = :public - @module_function = true - @path = nil - end - - YARD::Registry.delete(self) - @path = nil - @scope = v.to_sym - @scope = :class if @scope == :module - YARD::Registry.register(self) if reregister - end - - # @return whether or not the method is the #initialize constructor method - def constructor? - name == :initialize && scope == :instance && namespace.is_a?(ClassObject) - end - - # @return [Boolean] whether or not this method was created as a module - # function - # @since 0.8.0 - def module_function? - @module_function - end - - # Returns the read/writer info for the attribute if it is one - # @return [SymbolHash] if there is information about the attribute - # @return [nil] if the method is not an attribute - # @since 0.5.3 - def attr_info - return nil unless namespace.is_a?(NamespaceObject) - namespace.attributes[scope][name.to_s.gsub(/=$/, '')] - end - - # @return [Boolean] whether the method is a writer attribute - # @since 0.5.3 - def writer? - info = attr_info - info && info[:write] == self ? true : false - end - - # @return [Boolean] whether the method is a reader attribute - # @since 0.5.3 - def reader? - info = attr_info - info && info[:read] == self ? true : false - end - - # Tests if the object is defined as an attribute in the namespace - # @return [Boolean] whether the object is an attribute - def is_attribute? - info = attr_info - if info - read_or_write = name.to_s =~ /=$/ ? :write : :read - info[read_or_write] ? true : false - else - false - end - end - - # Tests if the object is defined as an alias of another method - # @return [Boolean] whether the object is an alias - def is_alias? - return false unless namespace.is_a?(NamespaceObject) - namespace.aliases.key? self - end - - # Tests boolean {#explicit} value. - # - # @return [Boolean] whether the method is explicitly defined in source - def is_explicit? - explicit ? true : false - end - - # @return [MethodObject] the object that this method overrides - # @return [nil] if it does not override a method - # @since 0.6.0 - def overridden_method - return nil if namespace.is_a?(Proxy) - meths = namespace.meths(:all => true) - meths.find {|m| m.path != path && m.name == name && m.scope == scope } - end - - # Returns all alias names of the object - # @return [Array] the alias names - def aliases - list = [] - return list unless namespace.is_a?(NamespaceObject) - namespace.aliases.each do |o, aname| - list << o if aname == name && o.scope == scope - end - list - end - - # Override path handling for instance methods in the root namespace - # (they should still have a separator as a prefix). - # @return [String] the path of a method - def path - @path ||= !namespace || namespace.path == "" ? sep + super : super - end - - # Returns the name of the object. - # - # @example The name of an instance method (with prefix) - # an_instance_method.name(true) # => "#mymethod" - # @example The name of a class method (with prefix) - # a_class_method.name(true) # => "mymethod" - # @param [Boolean] prefix whether or not to show the prefix - # @return [String] returns {#sep} + +name+ for an instance method if - # prefix is true - # @return [Symbol] the name without {#sep} if prefix is set to false - def name(prefix = false) - prefix ? (sep == ISEP ? "#{sep}#{super}" : super.to_s) : super - end - - # Override separator to differentiate between class and instance - # methods. - # @return [String] "#" for an instance method, "." for class - def sep - if scope == :class - namespace && namespace != YARD::Registry.root ? CSEP : NSEP - else - ISEP - end - end - - protected - - def copyable_attributes - super - %w(scope module_function) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/module_object.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/module_object.rb deleted file mode 100644 index 838933e6a2..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/module_object.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true -module YARD::CodeObjects - register_separator NSEP, :module - - # Represents a Ruby module. - class ModuleObject < NamespaceObject - # Returns the inheritance tree of mixins. - # - # @param [Boolean] include_mods if true, will include mixed in - # modules (which is likely what is wanted). - # @return [Array] a list of namespace objects - def inheritance_tree(include_mods = false) - return [self] unless include_mods - [self] + mixins(:instance, :class).map do |m| - next if m == self - next m unless m.respond_to?(:inheritance_tree) - m.inheritance_tree(true) - end.compact.flatten.uniq - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/namespace_mapper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/namespace_mapper.rb deleted file mode 100644 index ecb500513f..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/namespace_mapper.rb +++ /dev/null @@ -1,141 +0,0 @@ -# frozen_string_literal: true -module YARD - module CodeObjects - # This module controls registration and accessing of namespace separators - # for {Registry} lookup. - # - # @since 0.9.1 - module NamespaceMapper - # @!group Registering a Separator for a Namespace - - # Registers a separator with an optional set of valid types that - # must follow the separator lexically. - # - # Calls all callbacks defined by {NamespaceMapper.on_invalidate} after - # the separator is registered. - # - # @param sep [String] the separator string for the namespace - # @param valid_types [Array] a list of object types that - # must follow the separator. If the list is empty, any type can - # follow the separator. - # @example Registering separators for a method object - # # Anything after a "#" denotes a method object - # register_separator "#", :method - # # Anything after a "." denotes a method object - # register_separator ".", :method - # @see .on_invalidate - def register_separator(sep, *valid_types) - NamespaceMapper.invalidate - - valid_types.each do |t| - NamespaceMapper.rev_map[t] ||= [] - NamespaceMapper.rev_map[t] << sep - end - - NamespaceMapper.map[sep] ||= [] - NamespaceMapper.map[sep] += valid_types - end - - # Unregisters a separator by a type. - # - # @param type [Symbol] the type to unregister - # @see #register_separator - def unregister_separator_by_type(type) - seps = NamespaceMapper.rev_map[type] - return unless seps - - seps.each {|s| NamespaceMapper.map.delete(s) } - NamespaceMapper.rev_map.delete(type) - NamespaceMapper.invalidate - end - - # Clears the map of separators. - # - # @return [void] - def clear_separators - NamespaceMapper.invalidate - NamespaceMapper.map = {} - NamespaceMapper.rev_map = {} - end - - # Gets or sets the default separator value to use when no - # separator for the namespace can be determined. - # - # @param value [String, nil] the default separator, or nil to return the - # value - # @example - # default_separator "::" - def default_separator(value = nil) - if value - NamespaceMapper.invalidate - NamespaceMapper.default_separator = Regexp.quote value - else - NamespaceMapper.default_separator - end - end - - # @!group Separator and Type Lookup Helpers - - # @return [Array] all of the registered separators - def separators - NamespaceMapper.map.keys - end - - # @return [Regexp] the regexp match of all separators - def separators_match - NamespaceMapper.map_match - end - - # @param sep [String] the separator to return types for - # @return [Array] a list of types registered to a separator - def types_for_separator(sep) - NamespaceMapper.map[sep] || [] - end - - # @param type [String] the type to return separators for - # @return [Array] a list of separators registered to a type - def separators_for_type(type) - NamespaceMapper.rev_map[type] || [] - end - - # Internal methods to act as a singleton registry - class << self - # @!group Invalidation callbacks - - # Adds a callback that triggers when a new separator is registered or - # the cache is cleared by invalidation. - def on_invalidate(&block) - (@invalidation_callbacks ||= []).push(block) - end - - # @!visibility private - - # @return [Hash] a mapping of types to separators - def map - @map ||= {} - end - - # @return [Hash] a reverse mapping of separators to types - def rev_map - @rev_map ||= {} - end - - # Invalidates all separators - # @return [void] - def invalidate - @map_match = nil - (@invalidation_callbacks || []).each(&:call) - end - - # @return [Regexp] the full list of separators as a regexp match - def map_match - @map_match ||= map.keys.map {|k| Regexp.quote k }.join('|') - end - - # @return [String] the default separator when no separator can begin - # determined. - attr_accessor :default_separator - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/namespace_object.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/namespace_object.rb deleted file mode 100644 index 25cdee110d..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/namespace_object.rb +++ /dev/null @@ -1,200 +0,0 @@ -# frozen_string_literal: true -module YARD::CodeObjects - register_separator NSEP, :namespace - default_separator NSEP - - # A "namespace" is any object that can store other objects within itself. - # The two main Ruby objects that can act as namespaces are modules - # ({ModuleObject}) and classes ({ClassObject}). - class NamespaceObject < Base - # @return [Array] a list of ordered group names inside the namespace - # @since 0.6.0 - attr_accessor :groups - - # The list of objects defined in this namespace - # @return [Array] a list of objects - attr_reader :children - - # A hash containing two keys, class and instance, each containing - # the attribute name with a { :read, :write } hash for the read and - # write objects respectively. - # - # @example The attributes of an object - # >> Registry.at('YARD::Docstring').attributes - # => { - # :class => { }, - # :instance => { - # :ref_tags => { - # :read => #, - # :write => nil - # }, - # :object => { - # :read => #, - # :write => # - # }, - # ... - # } - # } - # @return [Hash] a list of methods - attr_reader :attributes - - # A hash containing two keys, :class and :instance, each containing - # a hash of objects and their alias names. - # @return [Hash] a list of methods - attr_reader :aliases - - # Class mixins - # @return [Array] a list of mixins - attr_reader :class_mixins - - # Instance mixins - # @return [Array] a list of mixins - attr_reader :instance_mixins - - # Creates a new namespace object inside +namespace+ with +name+. - # @see Base#initialize - def initialize(namespace, name, *args, &block) - @children = CodeObjectList.new(self) - @class_mixins = CodeObjectList.new(self) - @instance_mixins = CodeObjectList.new(self) - @attributes = SymbolHash[:class => SymbolHash.new, :instance => SymbolHash.new] - @aliases = {} - @groups = [] - super - end - - # Only the class attributes - # @return [Hash] a list of method names and their read/write objects - # @see #attributes - def class_attributes - attributes[:class] - end - - # Only the instance attributes - # @return [Hash] a list of method names and their read/write objects - # @see #attributes - def instance_attributes - attributes[:instance] - end - - # Looks for a child that matches the attributes specified by +opts+. - # - # @example Finds a child by name and scope - # namespace.child(:name => :to_s, :scope => :instance) - # # => # - # @return [Base, nil] the first matched child object, or nil - def child(opts = {}) - if !opts.is_a?(Hash) - children.find {|o| o.name == opts.to_sym } - else - opts = SymbolHash[opts] - children.find do |obj| - opts.each do |meth, value| - break false unless value.is_a?(Array) ? value.include?(obj[meth]) : obj[meth] == value - end - end - end - end - - # Returns all methods that match the attributes specified by +opts+. If - # no options are provided, returns all methods. - # - # @example Finds all private and protected class methods - # namespace.meths(:visibility => [:private, :protected], :scope => :class) - # # => [#, #] - # @option opts [Array, Symbol] :visibility ([:public, :private, - # :protected]) the visibility of the methods to list. Can be an array or - # single value. - # @option opts [Array, Symbol] :scope ([:class, :instance]) the - # scope of the methods to list. Can be an array or single value. - # @option opts [Boolean] :included (true) whether to include mixed in - # methods in the list. - # @return [Array] a list of method objects - def meths(opts = {}) - opts = SymbolHash[ - :visibility => [:public, :private, :protected], - :scope => [:class, :instance], - :included => true - ].update(opts) - - opts[:visibility] = [opts[:visibility]].flatten - opts[:scope] = [opts[:scope]].flatten - - ourmeths = children.select do |o| - o.is_a?(MethodObject) && - opts[:visibility].include?(o.visibility) && - opts[:scope].include?(o.scope) - end - - ourmeths + (opts[:included] ? included_meths(opts) : []) - end - - # Returns methods included from any mixins that match the attributes - # specified by +opts+. If no options are specified, returns all included - # methods. - # - # @option opts [Array, Symbol] :visibility ([:public, :private, - # :protected]) the visibility of the methods to list. Can be an array or - # single value. - # @option opts [Array, Symbol] :scope ([:class, :instance]) the - # scope of the methods to list. Can be an array or single value. - # @option opts [Boolean] :included (true) whether to include mixed in - # methods in the list. - # @see #meths - def included_meths(opts = {}) - opts = SymbolHash[:scope => [:instance, :class]].update(opts) - [opts[:scope]].flatten.map do |scope| - mixins(scope).inject([]) do |list, mixin| - next list if mixin.is_a?(Proxy) - arr = mixin.meths(opts.merge(:scope => :instance)).reject do |o| - next false if opts[:all] - child(:name => o.name, :scope => scope) || list.find {|o2| o2.name == o.name } - end - arr.map! {|o| ExtendedMethodObject.new(o) } if scope == :class - list + arr - end - end.flatten - end - - # Returns all constants in the namespace - # - # @option opts [Boolean] :included (true) whether or not to include - # mixed in constants in list - # @return [Array] a list of constant objects - def constants(opts = {}) - opts = SymbolHash[:included => true].update(opts) - consts = children.select {|o| o.is_a? ConstantObject } - consts + (opts[:included] ? included_constants : []) - end - - # Returns constants included from any mixins - # @return [Array] a list of constant objects - def included_constants - instance_mixins.inject([]) do |list, mixin| - if mixin.respond_to? :constants - list += mixin.constants.reject do |o| - child(:name => o.name) || list.find {|o2| o2.name == o.name } - end - else - list - end - end - end - - # Returns class variables defined in this namespace. - # @return [Array] a list of class variable objects - def cvars - children.select {|o| o.is_a? ClassVariableObject } - end - - # Returns for specific scopes. If no scopes are provided, returns all mixins. - # @param [Array] scopes a list of scopes (:class, :instance) to - # return mixins for. If this is empty, all scopes will be returned. - # @return [Array] a list of mixins - def mixins(*scopes) - return class_mixins if scopes == [:class] - return instance_mixins if scopes == [:instance] - class_mixins | instance_mixins - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/proxy.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/proxy.rb deleted file mode 100644 index 0b0a091eab..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/proxy.rb +++ /dev/null @@ -1,245 +0,0 @@ -# frozen_string_literal: true -module YARD - module CodeObjects - # A special type of +NoMethodError+ when raised from a {Proxy} - class ProxyMethodError < NoMethodError; end - - # @private - PROXY_MATCH = /(?:#{NSEPQ}|#{ISEPQ}|#{CSEPQ})([^#{Regexp.quote( - (NSEP + ISEP + CSEP).split('').uniq.join - )}]+)$/ - - # The Proxy class is a way to lazily resolve code objects in - # cases where the object may not yet exist. A proxy simply stores - # an unresolved path until a method is called on the object, at which - # point it does a lookup using {Registry.resolve}. If the object is - # not found, a warning is raised and {ProxyMethodError} might be raised. - # - # @example Creates a Proxy to the String class from a module - # # When the String class is parsed this method will - # # begin to act like the String ClassObject. - # Proxy.new(mymoduleobj, "String") - # @see Registry.resolve - # @see ProxyMethodError - class Proxy - def self.===(other) other.is_a?(self) end - - attr_reader :namespace - alias parent namespace - - # Creates a new Proxy - # - # @raise [ArgumentError] if namespace is not a NamespaceObject - # @return [Proxy] self - def initialize(namespace, name, type = nil) - namespace = Registry.root if !namespace || namespace == :root - - if name =~ /^#{NSEPQ}/ - namespace = Registry.root - name = name[2..-1] - end - - if name =~ PROXY_MATCH - @orignamespace = namespace - @origname = name - @imethod = true if name.include? ISEP - namespace = Proxy.new(namespace, $`) unless $`.empty? - name = $1 - else - @orignamespace = nil - @origname = nil - @imethod = nil - end - - @name = name.to_sym - @namespace = namespace - @obj = nil - @imethod ||= nil - self.type = type - - if @namespace.is_a?(ConstantObject) - unless @namespace.value =~ /\A#{NAMESPACEMATCH}\Z/ - raise Parser::UndocumentableError, "constant mapping for " + - "#{@origname} (type=#{type.inspect})" - end - - @origname = nil # forget these for a constant - @orignamespace = nil - @namespace = Proxy.new(@namespace.namespace, @namespace.value) - end - - unless @namespace.is_a?(NamespaceObject) || @namespace.is_a?(Proxy) - raise ArgumentError, "Invalid namespace object: #{namespace}" - end - - # If the name begins with "::" (like "::String") - # this is definitely a root level object, so - # remove the namespace and attach it to the root - if @name =~ /^#{NSEPQ}/ - @name.gsub!(/^#{NSEPQ}/, '') - @namespace = Registry.root - end - end - - # (see Base#name) - def name(prefix = false) - prefix ? "#{@imethod && ISEP}#{@name}" : @name - end - - # Returns a text representation of the Proxy - # @return [String] the object's #inspect method or P(OBJECTPATH) - def inspect - to_obj ? to_obj.inspect : "P(#{path})" - end - - # If the proxy resolves to an object, returns its path, otherwise - # guesses at the correct path using the original namespace and name. - # - # @return [String] the assumed path of the proxy (or the real path - # of the resolved object) - def path - to_obj ? to_obj.path : proxy_path - end - alias to_s path - alias to_str path - alias title path - - # @return [Boolean] - def is_a?(klass) - to_obj ? to_obj.is_a?(klass) : self.class <= klass - end - - # @return [Boolean] - def ===(other) - to_obj ? to_obj === other : self.class <= other.class - end - - # @return [Boolean] - def <=>(other) - if other.respond_to? :path - path <=> other.path - else - false - end - end - - # @return [Boolean] - def equal?(other) - if other.respond_to? :path - path == other.path - else - false - end - end - alias == equal? - - # @return [Integer] the object's hash value (for equality checking) - def hash; path.hash end - - # Returns the class name of the object the proxy is mimicking, if - # resolved. Otherwise returns +Proxy+. - # @return [Class] the resolved object's class or +Proxy+ - def class - to_obj ? to_obj.class : Proxy - end - - # Returns the type of the proxy. If it cannot be resolved at the - # time of the call, it will either return the inferred proxy type - # (see {#type=}) or +:proxy+ - # @return [Symbol] the Proxy's type - # @see #type= - def type - to_obj ? to_obj.type : @type || :proxy - end - - # Allows a parser to infer the type of the proxy by its path. - # @param [#to_sym] type the proxy's inferred type - # @return [void] - def type=(type) @type = type ? type.to_sym : nil end - - # @return [Boolean] - def instance_of?(klass) - self.class == klass - end - - # @return [Boolean] - def kind_of?(klass) - self.class <= klass - end - - # @return [Boolean] - def respond_to?(meth, include_private = false) - to_obj ? to_obj.respond_to?(meth, include_private) : super - end - - # Dispatches the method to the resolved object. - # - # @raise [ProxyMethodError] if the proxy cannot find the real object - def method_missing(meth, *args, &block) - if to_obj - to_obj.__send__(meth, *args, &block) - else - log.warn "Load Order / Name Resolution Problem on #{path}:\n" \ - "-\n" \ - "Something is trying to call #{meth} on object #{path} before it has been recognized.\n" \ - "This error usually means that you need to modify the order in which you parse files\n" \ - "so that #{path} is parsed before methods or other objects attempt to access it.\n" \ - "-\n" \ - "YARD will recover from this error and continue to parse but you *may* have problems\n" \ - "with your generated documentation. You should probably fix this.\n" \ - "-\n" - begin - super - rescue NoMethodError - raise ProxyMethodError, "Proxy cannot call method ##{meth} on object '#{path}'" - end - end - end - - # This class is never a root object - def root?; false end - - private - - # @note this method fixes a bug in 1.9.2: http://gist.github.com/437136 - def to_ary; nil end - - # Attempts to find the object that this unresolved object - # references by checking if any objects by this name are - # registered all the way up the namespace tree. - # - # @return [Base, nil] the registered code object or nil - def to_obj - return @obj if @obj - @obj = Registry.resolve(@namespace, (@imethod ? ISEP : '') + @name.to_s, false, false, @type) - if @obj - if @origname && @origname.include?("::") && !@obj.path.include?(@origname) - # the object's path should include the original proxy namespace, - # otherwise it's (probably) not the right object. - @obj = nil - else - @namespace = @obj.namespace - @name = @obj.name - end - end - @obj - end - - def proxy_path - if @namespace.root? - (@imethod ? ISEP : "") + name.to_s - elsif @origname - if @origname =~ CONSTANTSTART - @origname - else - [namespace.path, @origname].join - end - elsif name.to_s =~ CONSTANTSTART - name.to_s - else # class meth? - [namespace.path, name.to_s].join(CSEP) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/root_object.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/root_object.rb deleted file mode 100644 index 8711787989..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/code_objects/root_object.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true -module YARD - module CodeObjects - # Represents the root namespace object (the invisible Ruby module that - # holds all top level modules, class and other objects). - class RootObject < ModuleObject - def path; @path ||= "" end - def inspect; @inspect ||= "#" end - def root?; true end - def title; 'Top Level Namespace' end - - def equal?(other) - other == :root ? true : super(other) - end - - def hash; :root.hash end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/config.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/config.rb deleted file mode 100644 index 8285662e2a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/config.rb +++ /dev/null @@ -1,270 +0,0 @@ -# frozen_string_literal: true -module YARD - # This class maintains all system-wide configuration for YARD and handles - # the loading of plugins. To access options call {options}, and to load - # a plugin use {load_plugin}. All other public methods are used by YARD - # during load time. - # - # == User Configuration Files - # - # Persistent user configuration files can be stored in the file - # +~/.yard/config+, which is read when YARD first loads. The file should - # be formatted as YAML, and should contain a map of keys and values. - # - # Although you can specify any key-value mapping in the configuration file, - # YARD defines special keys specified in {DEFAULT_CONFIG_OPTIONS}. - # - # An example of a configuration file is listed below: - # - # !!!yaml - # load_plugins: true # Auto-load plugins when YARD starts - # ignored_plugins: - # - yard-broken - # - broken2 # yard- prefix not necessary - # autoload_plugins: - # - yard-rspec - # - # == Automatic Loading of Plugins - # - # YARD 0.6.2 will no longer automatically load all plugins by default. This - # option can be reset by setting 'load_plugins' to true in the configuration - # file. In addition, you can specify a set of specific plugins to load on - # load through the 'autoload_plugins' list setting. This setting is - # independent of the 'load_plugins' value and will always be processed. - # - # == Ignored Plugins File - # - # YARD 0.5 and below used a +~/.yard/ignored_plugins+ file to specify - # plugins to be ignored at load time. Ignored plugins in 0.6.2 and above - # should now be specified in the main configuration file, though YARD - # will support the +ignored_plugins+ file until 0.7.x. - # - # == Safe Mode - # - # YARD supports running in safe-mode. By doing this, it will avoid executing - # any user code such as require files or queries. Plugins will still be - # loaded with safe mode on, because plugins are properly namespaced with - # a 'yard-' prefix, must be installed as a gem, and therefore cannot be - # touched by the user. To specify safe mode, use the +safe_mode+ key. - # - # == Plugin Specific Configuration - # - # Additional settings can be defined within the configuration file - # specifically to provide configuration for a plugin. A plugin that utilizes - # the YARD configuration is strongly encouraged to utilize namespacing of - # their configuration content. - # - # !!!yaml - # load_plugins: true # Auto-load plugins when YARD starts - # ignored_plugins: - # - yard-broken - # - broken2 # yard- prefix not necessary - # autoload_plugins: - # - yard-rspec - # # Plugin Specific Configuration - # yard-sample-plugin: - # show-results-inline: true - # - # As the configuration is available system wide, it can be - # accessed within the plugin code. - # - # - # if YARD::Config.options['yard-sample-plugin'] and - # YARD::Config.options['yard-sample-plugin']['show-results-inline'] - # # ... perform the action that places the results inline ... - # else - # # ... do the default behavior of not showing the results inline ... - # end - # - # When accessing the configuration, be aware that this file is user managed - # so configuration keys and values may not be present. Make no assumptions and - # instead ensure that you check for the existence of keys before proceeding to - # retrieve values. - # - # @since 0.6.2 - # @see options - class Config - class << self - # The system-wide configuration options for YARD - # @return [SymbolHash] a map a key-value pair settings. - # @see DEFAULT_CONFIG_OPTIONS - attr_accessor :options - end - - # The location where YARD stores user-specific settings - CONFIG_DIR = File.expand_path('~/.yard') - - # The main configuration YAML file. - CONFIG_FILE = File.join(CONFIG_DIR, 'config') - - # File listing all ignored plugins - # @deprecated Set `ignored_plugins` in the {CONFIG_FILE} instead. - IGNORED_PLUGINS = File.join(CONFIG_DIR, 'ignored_plugins') - - # Default configuration options - DEFAULT_CONFIG_OPTIONS = { - :load_plugins => false, # Whether to load plugins automatically with YARD - :ignored_plugins => [], # A list of ignored plugins by name - :autoload_plugins => [], # A list of plugins to be automatically loaded - :safe_mode => false # Does not execute or eval any user-level code - } - - # The prefix used for YARD plugins. Name your gem with this prefix - # to allow it to be used as a plugin. - YARD_PLUGIN_PREFIX = /^yard[-_]/ - - # Loads settings from {CONFIG_FILE}. This method is called by YARD at - # load time and should not be called by the user. - # @return [void] - def self.load - self.options = SymbolHash.new(false) - options.update(DEFAULT_CONFIG_OPTIONS) - options.update(read_config_file) - load_commandline_safemode - add_ignored_plugins_file - translate_plugin_names - load_plugins - rescue => e - log.error "Invalid configuration file, using default options." - log.backtrace(e) - options.update(DEFAULT_CONFIG_OPTIONS) - end - - # Saves settings to {CONFIG_FILE}. - # @return [void] - def self.save - require 'yaml' - Dir.mkdir(CONFIG_DIR) unless File.directory?(CONFIG_DIR) - File.open(CONFIG_FILE, 'w') {|f| f.write(YAML.dump(options)) } - end - - # Loads gems that match the name 'yard-*' (recommended) or 'yard_*' except - # those listed in +~/.yard/ignored_plugins+. This is called immediately - # after YARD is loaded to allow plugin support. - # - # @return [Boolean] true if all plugins loaded successfully, false otherwise. - def self.load_plugins - load_gem_plugins && - load_autoload_plugins && - load_commandline_plugins ? true : false - end - - # Loads an individual plugin by name. It is not necessary to include the - # +yard-+ plugin prefix here. - # - # @param [String] name the name of the plugin (with or without +yard-+ prefix) - # @return [Boolean] whether the plugin was successfully loaded - def self.load_plugin(name) - name = translate_plugin_name(name) - return false if options[:ignored_plugins].include?(name) - return false if name =~ /^yard-doc-/ - log.debug "Loading plugin '#{name}'..." - require name - true - rescue LoadError => e - load_plugin_failed(name, e) - end - - # Load gem plugins if :load_plugins is true - def self.load_gem_plugins - return true unless options[:load_plugins] - require 'rubygems' - result = true - YARD::GemIndex.each do |gem| - begin - next true unless gem.name =~ YARD_PLUGIN_PREFIX - load_plugin(gem.name) - rescue Gem::LoadError => e - tmp = load_plugin_failed(gem.name, e) - result = tmp unless tmp - end - end - result - rescue LoadError - log.debug "RubyGems is not present, skipping plugin loading" - false - end - - # Load plugins set in :autoload_plugins - def self.load_autoload_plugins - options[:autoload_plugins].each {|name| load_plugin(name) } - end - - # Load plugins from {arguments} - def self.load_commandline_plugins - with_yardopts do - arguments.each_with_index do |arg, i| - next unless arg == '--plugin' - load_plugin(arguments[i + 1]) - end - end - end - - # Check for command-line safe_mode switch in {arguments} - def self.load_commandline_safemode - with_yardopts do - arguments.each_with_index do |arg, _i| - options[:safe_mode] = true if arg == '--safe' - end - end - end - - # Print a warning if the plugin failed to load - # @return [false] - def self.load_plugin_failed(name, exception) - log.error "Error loading plugin '#{name}'" - log.backtrace(exception) if $DEBUG - false - end - - # Legacy support for {IGNORED_PLUGINS} - def self.add_ignored_plugins_file - if File.file?(IGNORED_PLUGINS) - options[:ignored_plugins] += File.read(IGNORED_PLUGINS).split(/\s+/) - end - end - - # Translates plugin names to add yard- prefix. - def self.translate_plugin_names - options[:ignored_plugins].map! {|name| translate_plugin_name(name) } - options[:autoload_plugins].map! {|name| translate_plugin_name(name) } - end - - # Loads the YAML configuration file into memory - # @return [Hash] the contents of the YAML file from disk - # @see CONFIG_FILE - def self.read_config_file - if File.file?(CONFIG_FILE) - require 'yaml' - YAML.load_file(CONFIG_FILE) - else - {} - end - end - - # Sanitizes and normalizes a plugin name to include the 'yard-' prefix. - # @param [String] name the plugin name - # @return [String] the sanitized and normalized plugin name. - def self.translate_plugin_name(name) - name = name.delete('/') # Security sanitization - name = "yard-" + name unless name =~ YARD_PLUGIN_PREFIX - name - end - - # Temporarily loads .yardopts file into @yardopts - def self.with_yardopts - yfile = CLI::Yardoc::DEFAULT_YARDOPTS_FILE - @yardopts = File.file?(yfile) ? File.read_binary(yfile).shell_split : [] - result = yield - @yardopts = nil - result - end - - # @return [Array] arguments from commandline and yardopts file - def self.arguments - ARGV + @yardopts - end - end - - Config.options = Config::DEFAULT_CONFIG_OPTIONS -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/array.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/array.rb deleted file mode 100644 index acbfea36bd..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/array.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true -class Array - # Places values before or after another object (by value) in - # an array. This is used in tandem with the before and after - # methods of the {Insertion} class. - # - # @example Places an item before another - # [1, 2, 3].place(4).before(3) # => [1, 2, 4, 3] - # @example Places an item after another - # [:a, :b, :c].place(:x).after(:a) # => [:a, :x, :b, :c] - # @param [Array] values value to insert - # @return [Insertion] an insertion object to - # @see Insertion#before - # @see Insertion#after - def place(*values) Insertion.new(self, values) end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/file.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/file.rb deleted file mode 100644 index c918b5af30..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/file.rb +++ /dev/null @@ -1,69 +0,0 @@ -# frozen_string_literal: true -require 'fileutils' - -class File - RELATIVE_PARENTDIR = '..' - RELATIVE_SAMEDIR = '.' - - # @group Manipulating Paths - - # Turns a path +to+ into a relative path from starting - # point +from+. The argument +from+ is assumed to be - # a filename. To treat it as a directory, make sure it - # ends in +File::SEPARATOR+ ('/' on UNIX filesystems). - # - # @param [String] from the starting filename - # (or directory with +from_isdir+ set to +true+). - # @param [String] to the final path that should be made relative. - # @return [String] the relative path from +from+ to +to+. - def self.relative_path(from, to) - from = expand_path(from).split(SEPARATOR) - to = expand_path(to).split(SEPARATOR) - from.length.times do - break if from[0] != to[0] - from.shift; to.shift - end - from.pop - join(*(from.map { RELATIVE_PARENTDIR } + to)) - end - - # Cleans a path by removing extraneous '..', '.' and '/' characters - # - # @example Clean a path - # File.cleanpath('a/b//./c/../e') # => "a/b/e" - # @param [String] path the path to clean - # @param [Boolean] rel_root allows relative path above root value - # @return [String] the sanitized path - def self.cleanpath(path, rel_root = false) - path = path.split(SEPARATOR) - path = path.inject([]) do |acc, comp| - next acc if comp == RELATIVE_SAMEDIR - if comp == RELATIVE_PARENTDIR && !acc.empty? && acc.last != RELATIVE_PARENTDIR - acc.pop - next acc - elsif !rel_root && comp == RELATIVE_PARENTDIR && acc.empty? - next acc - end - acc << comp - end - File.join(*path) - end - - # @group Reading Files - - # Forces opening a file (for writing) by first creating the file's directory - # @param [String] file the filename to open - # @since 0.5.2 - def self.open!(file, *args, &block) - dir = dirname(file) - FileUtils.mkdir_p(dir) unless directory?(dir) - open(file, *args, &block) - end - - # Reads a file with binary encoding - # @return [String] the ascii-8bit encoded data - # @since 0.5.3 - def self.read_binary(file) - File.open(file, 'rb', &:read) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/hash.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/hash.rb deleted file mode 100644 index 6de7e080cc..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/hash.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true -class Hash - class << self - def create(*args) - if args.first.is_a?(Array) && args.size == 1 - obj = new - args.first.each {|k, v| obj[k] = v } - obj - else - create_186(*args) - end - end - alias create_186 [] - alias [] create - end -end if RUBY_VERSION < "1.8.7" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/insertion.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/insertion.rb deleted file mode 100644 index 13efd0142e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/insertion.rb +++ /dev/null @@ -1,63 +0,0 @@ -# frozen_string_literal: true -# The Insertion class inserts a value before or after another -# value in a list. -# -# @example -# Insertion.new([1, 2, 3], 4).before(3) # => [1, 2, 4, 3] -class Insertion - # Creates an insertion object on a list with a value to be - # inserted. To finalize the insertion, call {#before} or - # {#after} on the object. - # - # @param [Array] list the list to perform the insertion on - # @param [Object] value the value to insert - def initialize(list, value) - @list = list - @values = (Array === value ? value : [value]) - end - - # Inserts the value before +val+ - # @param [Object] val the object the value will be inserted before - # @param [Boolean] recursive look inside sublists - def before(val, recursive = false) insertion(val, 0, recursive) end - - # Inserts the value after +val+. - # - # @example If subsections are ignored - # Insertion.new([1, [2], 3], :X).after(1) # => [1, [2], :X, 3] - # @param [Object] val the object the value will be inserted after - # @param [Boolean] recursive look inside sublists - def after(val, recursive = false) insertion(val, 1, recursive) end - - # Alias for {#before} with +recursive+ set to true - # @since 0.6.0 - def before_any(val) insertion(val, 0, true) end - - # Alias for {#after} with +recursive+ set to true - # @since 0.6.0 - def after_any(val) insertion(val, 1, true) end - - private - - # This method performs the actual insertion - # - # @param [Object] val the value to insert - # @param [Fixnum] rel the relative index (0 or 1) of where the object - # should be placed - # @param [Boolean] recursive look inside sublists - # @param [Array] list the list to place objects into - def insertion(val, rel, recursive = false, list = @list) - if recursive - list.each do |item| - next unless item.is_a?(Array) - tmp = item.dup - insertion(val, rel, recursive, item) - return(list) unless item == tmp - end - end - - index = list.index(val) - list[index + rel, 0] = @values if index - list - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/module.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/module.rb deleted file mode 100644 index 93fef9d9a2..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/module.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true -class Module - # Returns the class name of a full module namespace path - # - # @example - # module A::B::C; class_name end # => "C" - # @return [String] the last part of a module path - def class_name - name.split("::").last - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/string.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/string.rb deleted file mode 100644 index 17d3709e51..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/string.rb +++ /dev/null @@ -1,68 +0,0 @@ -# frozen_string_literal: true -class String - # Splits text into tokens the way a shell would, handling quoted - # text as a single token. Use '\"' and "\'" to escape quotes and - # '\\' to escape a backslash. - # - # @return [Array] an array representing the tokens - def shell_split - out = [String.new("")] - state = :none - escape_next = false - quote = String.new("") - strip.split(//).each do |char| - case state - when :none, :space - case char - when /\s/ - out << String.new("") unless state == :space - state = :space - escape_next = false - when "\\" - if escape_next - out.last << char - escape_next = false - else - escape_next = true - end - when '"', "'" - if escape_next - out.last << char - escape_next = false - else - state = char - quote = String.new("") - end - else - state = :none - out.last << char - escape_next = false - end - when '"', "'" - case char - when '"', "'" - if escape_next - quote << char - escape_next = false - elsif char == state - out.last << quote - state = :none - else - quote << char - end - when '\\' - if escape_next - quote << char - escape_next = false - else - escape_next = true - end - else - quote << char - escape_next = false - end - end - end - out - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/symbol_hash.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/symbol_hash.rb deleted file mode 100644 index b93742a322..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/core_ext/symbol_hash.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: true -# A subclass of Hash where all keys are converted into Symbols, and -# optionally, all String values are converted into Symbols. -class SymbolHash < Hash - # Creates a new SymbolHash object - # - # @param [Boolean] symbolize_value converts any String values into Symbols - # if this is set to +true+. - def initialize(symbolize_value = true) - @symbolize_value = symbolize_value - end - - # @overload [](hash) - # Creates a SymbolHash object from an existing Hash - # - # @example - # SymbolHash['x' => 1, :y => 2] # => # - # @param [Hash] hash the hash object - # @return [SymbolHash] a new SymbolHash from a hash object - # - # @overload [](*list) - # Creates a SymbolHash from an even list of keys and values - # - # @example - # SymbolHash[key1, value1, key2, value2, ...] - # @param [Array] list an even list of key followed by value - # @return [SymbolHash] a new SymbolHash object - def self.[](*hsh) - obj = new - if hsh.size == 1 && hsh.first.is_a?(Hash) - hsh.first.each {|k, v| obj[k] = v } - else - 0.step(hsh.size, 2) {|n| obj[hsh[n]] = hsh[n + 1] } - end - obj - end - - # Assigns a value to a symbolized key - # @param [#to_sym] key the key - # @param [Object] value the value to be assigned. If this is a String and - # values are set to be symbolized, it will be converted into a Symbol. - def []=(key, value) - super(key.to_sym, value.instance_of?(String) && @symbolize_value ? value.to_sym : value) - end - - # Accessed a symbolized key - # @param [#to_sym] key the key to access - # @return [Object] the value associated with the key - def [](key) super(key.to_sym) end - - # Deleted a key and value associated with it - # @param [#to_sym] key the key to delete - # @return [void] - def delete(key) super(key.to_sym) end - - # Tests if a symbolized key exists - # @param [#to_sym] key the key to test - # @return [Boolean] whether the key exists - def key?(key) super(key.to_sym) end - alias has_key? key? - - # Updates the object with the contents of another Hash object. - # This method modifies the original SymbolHash object - # - # @param [Hash] hash the hash object to copy the values from - # @return [SymbolHash] self - def update(hash) hash.each {|k, v| self[k] = v }; self end - alias merge! update - - # Merges the contents of another hash into a new SymbolHash object - # - # @param [Hash] hash the hash of objects to copy - # @return [SymbolHash] a new SymbolHash containing the merged data - def merge(hash) dup.merge!(hash) end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/docstring.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/docstring.rb deleted file mode 100644 index e02524a6d9..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/docstring.rb +++ /dev/null @@ -1,386 +0,0 @@ -# frozen_string_literal: true -module YARD - # A documentation string, or "docstring" for short, encapsulates the - # comments and metadata, or "tags", of an object. Meta-data is expressed - # in the form +@tag VALUE+, where VALUE can span over multiple lines as - # long as they are indented. The following +@example+ tag shows how tags - # can be indented: - # - # # @example My example - # # a = "hello world" - # # a.reverse - # # @version 1.0 - # - # Tags can be nested in a documentation string, though the {Tags::Tag} - # itself is responsible for parsing the inner tags. - class Docstring < String - class << self - # @note Plugin developers should make sure to reset this value - # after parsing finishes. This can be done via the - # {Parser::SourceParser.after_parse_list} callback. This will - # ensure that YARD can properly parse multiple projects in - # the same process. - # @return [Class] the parser class used to parse - # text and optional meta-data from docstrings. Defaults to - # {DocstringParser}. - # @see DocstringParser - # @see Parser::SourceParser.after_parse_list - attr_accessor :default_parser - - # Creates a parser object using the current {default_parser}. - # Equivalent to: - # Docstring.default_parser.new(*args) - # @param args arguments are passed to the {DocstringParser} - # class. See {DocstringParser#initialize} for details on - # arguments. - # @return [DocstringParser] the parser object used to parse a - # docstring. - def parser(*args) default_parser.new(*args) end - end - - self.default_parser = DocstringParser - - # @return [Array] the list of reference tags - attr_reader :ref_tags - - # @return [CodeObjects::Base] the object that owns the docstring. - attr_accessor :object - - # @return [Range] line range in the {#object}'s file where the docstring was parsed from - attr_accessor :line_range - - # @return [String] the raw documentation (including raw tag text) - attr_reader :all - - # @return [Boolean] whether the docstring was started with "##" - attr_reader :hash_flag - def hash_flag=(v) @hash_flag = v.nil? ? false : v end - - # Matches a tag at the start of a comment line - # @deprecated Use {DocstringParser::META_MATCH} - META_MATCH = DocstringParser::META_MATCH - - # @group Creating a Docstring Object - - # Creates a new docstring without performing any parsing through - # a {DocstringParser}. This method is called by +DocstringParser+ - # when creating the new docstring object. - # - # @param [String] text the textual portion of the docstring - # @param [Array] tags the list of tag objects in the docstring - # @param [CodeObjects::Base, nil] object the object associated with the - # docstring. May be nil. - # @param [String] raw_data the complete docstring, including all - # original formatting and any unparsed tags/directives. - # @param [CodeObjects::Base, nil] ref_object a reference object used for - # the base set of documentation / tag information. - def self.new!(text, tags = [], object = nil, raw_data = nil, ref_object = nil) - docstring = allocate - docstring.replace(text, false) - docstring.object = object - docstring.add_tag(*tags) - docstring.instance_variable_set("@unresolved_reference", ref_object) - docstring.instance_variable_set("@all", raw_data) if raw_data - docstring - end - - # Creates a new docstring with the raw contents attached to an optional - # object. Parsing will be done by the {DocstringParser} class. - # - # @note To properly parse directives with proper parser context within - # handlers, you should not use this method to create a Docstring. - # Instead, use the {parser}, which takes a handler object that - # can pass parser state onto directives. If a Docstring is created - # with this method, directives do not have access to any parser - # state, and may not function as expected. - # @example - # Docstring.new("hello world\n@return Object return", someobj) - # - # @param [String] content the raw comments to be parsed into a docstring - # and associated meta-data. - # @param [CodeObjects::Base] object an object to associate the docstring - # with. - def initialize(content = '', object = nil) - @object = object - @summary = nil - @hash_flag = false - - self.all = content - end - - # Adds another {Docstring}, copying over tags. - # - # @param [Docstring, String] other the other docstring (or string) to - # add. - # @return [Docstring] a new docstring with both docstrings combines - def +(other) - case other - when Docstring - Docstring.new([all, other.all].join("\n"), object) - else - super - end - end - - def to_s - resolve_reference - super - end - - # Replaces the docstring with new raw content. Called by {#all=}. - # @param [String] content the raw comments to be parsed - def replace(content, parse = true) - content = content.join("\n") if content.is_a?(Array) - @tags = [] - @ref_tags = [] - if parse - super(parse_comments(content)) - else - @all = content - @unresolved_reference = nil - super(content) - end - end - alias all= replace - - # Deep-copies a docstring - # - # @note This method creates a new docstring with new tag lists, but does - # not create new individual tags. Modifying the tag objects will still - # affect the original tags. - # @return [Docstring] a new copied docstring - # @since 0.7.0 - def dup - resolve_reference - obj = super - %w(all summary tags ref_tags).each do |name| - val = instance_variable_defined?("@#{name}") && instance_variable_get("@#{name}") - obj.instance_variable_set("@#{name}", val ? val.dup : nil) - end - obj - end - - # @endgroup - - # @return [Fixnum] the first line of the {#line_range} - # @return [nil] if there is no associated {#line_range} - def line - line_range ? line_range.first : nil - end - - # Gets the first line of a docstring to the period or the first paragraph. - # @return [String] The first line or paragraph of the docstring; always ends with a period. - def summary - resolve_reference - return @summary if defined?(@summary) && @summary - stripped = gsub(/[\r\n](?![\r\n])/, ' ').strip - num_parens = 0 - idx = length.times do |index| - case stripped[index, 1] - when "." - next_char = stripped[index + 1, 1].to_s - break index - 1 if num_parens <= 0 && next_char =~ /^\s*$/ - when "\r", "\n" - next_char = stripped[index + 1, 1].to_s - if next_char =~ /^\s*$/ - break stripped[index - 1, 1] == '.' ? index - 2 : index - 1 - end - when "{", "(", "[" - num_parens += 1 - when "}", ")", "]" - num_parens -= 1 - end - end - @summary = stripped[0..idx] - if !@summary.empty? && @summary !~ /\A\s*\{include:.+\}\s*\Z/ - @summary += '.' - end - @summary - end - - # Reformats and returns a raw representation of the tag data using the - # current tag and docstring data, not the original text. - # - # @return [String] the updated raw formatted docstring data - # @since 0.7.0 - # @todo Add Tags::Tag#to_raw and refactor - def to_raw - tag_data = tags.map do |tag| - case tag - when Tags::OverloadTag - tag_text = "@#{tag.tag_name} #{tag.signature}\n" - unless tag.docstring.blank? - tag_text += "\n " + tag.docstring.all.gsub(/\r?\n/, "\n ") - end - when Tags::OptionTag - tag_text = "@#{tag.tag_name} #{tag.name}" - tag_text += ' [' + tag.pair.types.join(', ') + ']' if tag.pair.types - tag_text += ' ' + tag.pair.name.to_s if tag.pair.name - tag_text += "\n " if tag.name && tag.text - tag_text += ' (' + tag.pair.defaults.join(', ') + ')' if tag.pair.defaults - tag_text += " " + tag.pair.text.strip.gsub(/\n/, "\n ") if tag.pair.text - else - tag_text = '@' + tag.tag_name - tag_text += ' [' + tag.types.join(', ') + ']' if tag.types - tag_text += ' ' + tag.name.to_s if tag.name - tag_text += "\n " if tag.name && tag.text - tag_text += ' ' + tag.text.strip.gsub(/\n/, "\n ") if tag.text - end - tag_text - end - [strip, tag_data.join("\n")].reject(&:empty?).compact.join("\n") - end - - # @group Creating and Accessing Meta-data - - # Adds a tag or reftag object to the tag list. If you want to parse - # tag data based on the {Tags::DefaultFactory} tag factory, use - # {DocstringParser} instead. - # - # @param [Tags::Tag, Tags::RefTag] tags list of tag objects to add - # @return [void] - def add_tag(*tags) - tags.each_with_index do |tag, i| - case tag - when Tags::Tag - tag.object = object - @tags << tag - when Tags::RefTag, Tags::RefTagList - @ref_tags << tag - else - raise ArgumentError, "expected Tag or RefTag, got #{tag.class} (at index #{i})" - end - end - end - - # Convenience method to return the first tag - # object in the list of tag objects of that name - # - # @example - # doc = Docstring.new("@return zero when nil") - # doc.tag(:return).text # => "zero when nil" - # - # @param [#to_s] name the tag name to return data for - # @return [Tags::Tag] the first tag in the list of {#tags} - def tag(name) - tags.find {|tag| tag.tag_name.to_s == name.to_s } - end - - # Returns a list of tags specified by +name+ or all tags if +name+ is not specified. - # - # @param [#to_s] name the tag name to return data for, or nil for all tags - # @return [Array] the list of tags by the specified tag name - def tags(name = nil) - list = stable_sort_by(@tags + convert_ref_tags, &:tag_name) - return list unless name - list.select {|tag| tag.tag_name.to_s == name.to_s } - end - - # Returns true if at least one tag by the name +name+ was declared - # - # @param [String] name the tag name to search for - # @return [Boolean] whether or not the tag +name+ was declared - def has_tag?(name) - tags.any? {|tag| tag.tag_name.to_s == name.to_s } - end - - # Delete all tags with +name+ - # @param [String] name the tag name - # @return [void] - # @since 0.7.0 - def delete_tags(name) - delete_tag_if {|tag| tag.tag_name.to_s == name.to_s } - end - - # Deletes all tags where the block returns true - # @yieldparam [Tags::Tag] tag the tag that is being tested - # @yieldreturn [Boolean] true if the tag should be deleted - # @return [void] - # @since 0.7.0 - def delete_tag_if(&block) - @tags.delete_if(&block) - @ref_tags.delete_if(&block) - end - - # Returns true if the docstring has no content that is visible to a template. - # - # @param [Boolean] only_visible_tags whether only {Tags::Library.visible_tags} - # should be checked, or if all tags should be considered. - # @return [Boolean] whether or not the docstring has content - def blank?(only_visible_tags = true) - if only_visible_tags - empty? && !tags.any? {|tag| Tags::Library.visible_tags.include?(tag.tag_name.to_sym) } - else - empty? && @tags.empty? && @ref_tags.empty? - end - end - - # @endgroup - - # Resolves unresolved other docstring reference if there is - # unresolved reference. Does nothing if there is no unresolved - # reference. - # - # Normally, you don't need to call this method - # explicitly. Resolving unresolved reference is done implicitly. - # - # @return [void] - def resolve_reference - loop do - return if defined?(@unresolved_reference).nil? || @unresolved_reference.nil? - return if CodeObjects::Proxy === @unresolved_reference - - reference = @unresolved_reference - @unresolved_reference = nil - self.all = [reference.docstring.all, @all].join("\n") - end - end - - private - - # Maps valid reference tags - # - # @return [Array] the list of valid reference tags - def convert_ref_tags - list = @ref_tags.reject {|t| CodeObjects::Proxy === t.owner } - - @ref_tag_recurse_count ||= 0 - @ref_tag_recurse_count += 1 - if @ref_tag_recurse_count > 2 - log.error "#{@object.file}:#{@object.line}: Detected circular reference tag in " \ - "`#{@object}', ignoring all reference tags for this object " \ - "(#{@ref_tags.map {|t| "@#{t.tag_name}" }.join(", ")})." - @ref_tags = [] - return @ref_tags - end - list = list.map(&:tags).flatten - @ref_tag_recurse_count -= 1 - list - end - - # Parses out comments split by newlines into a new code object - # - # @param [String] comments - # the newline delimited array of comments. If the comments - # are passed as a String, they will be split by newlines. - # - # @return [String] the non-metadata portion of the comments to - # be used as a docstring - def parse_comments(comments) - parser = self.class.parser - parser.parse(comments, object) - @all = parser.raw_text - @unresolved_reference = parser.reference - add_tag(*parser.tags) - parser.text - end - - # A stable sort_by method. - # - # @param list [Enumerable] the list to sort. - # @return [Array] a stable sorted list. - def stable_sort_by(list) - list.each_with_index.sort_by {|tag, i| [yield(tag), i] }.map(&:first) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/docstring_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/docstring_parser.rb deleted file mode 100644 index 7ce8b6eb38..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/docstring_parser.rb +++ /dev/null @@ -1,345 +0,0 @@ -# frozen_string_literal: true -require 'ostruct' - -module YARD - # Parses text and creates a {Docstring} object to represent documentation - # for a {CodeObjects::Base}. To create a new docstring, you should initialize - # the parser and call {#parse} followed by {#to_docstring}. - # - # == Subclassing Notes - # - # The DocstringParser can be subclassed and subtituted during parsing by - # setting the {Docstring.default_parser} attribute with the name of the - # subclass. This allows developers to change the way docstrings are - # parsed, allowing for completely different docstring syntaxes. - # - # @example Creating a Docstring with a DocstringParser - # DocstringParser.new.parse("text here").to_docstring - # @example Creating a Custom DocstringParser - # # Parses docstrings backwards! - # class ReverseDocstringParser - # def parse_content(content) - # super(content.reverse) - # end - # end - # - # # Set the parser as default when parsing - # YARD::Docstring.default_parser = ReverseDocstringParser - # @see #parse_content - # @since 0.8.0 - class DocstringParser - # @return [String] the parsed text portion of the docstring, - # with tags removed. - attr_accessor :text - - # @return [String] the complete input string to the parser. - attr_accessor :raw_text - - # @return [Array] the list of meta-data tags identified - # by the parser - attr_accessor :tags - - # @return [Array] a list of directives identified - # by the parser. This list will not be passed on to the - # Docstring object. - attr_accessor :directives - - # @return [OpenStruct] any arbitrary state to be passed between - # tags during parsing. Mainly used by directives to coordinate - # behaviour (so that directives can be aware of other directives - # used in a docstring). - attr_accessor :state - - # @return [CodeObjects::Base, nil] the object associated with - # the docstring being parsed. May be nil if the docstring is - # not attached to any object. - attr_accessor :object - - # @return [CodeObjects::Base, nil] the object referenced by - # the docstring being parsed. May be nil if the docstring doesn't - # refer to any object. - attr_accessor :reference - - # @return [Handlers::Base, nil] the handler parsing this - # docstring. May be nil if this docstring parser is not - # initialized through - attr_accessor :handler - - # @return [Tags::Library] the tag library being used to - # identify registered tags in the docstring. - attr_accessor :library - - # The regular expression to match the tag syntax - META_MATCH = /^@(!)?((?:\w\.?)+)(?:\s+(.*))?$/i - - # @!group Creation and Conversion Methods - - # Creates a new parser to parse docstring data - # - # @param [Tags::Library] library a tag library for recognizing - # tags. - def initialize(library = Tags::Library.instance) - @text = "" - @raw_text = "" - @tags = [] - @directives = [] - @library = library - @object = nil - @reference = nil - @handler = nil - @state = OpenStruct.new - end - - # @return [Docstring] translates parsed text into - # a Docstring object. - def to_docstring - Docstring.new!(text, tags, object, raw_text, reference) - end - - # @!group Parsing Methods - - # Parses all content and returns itself. - # - # @param [String] content the docstring text to parse - # @param [CodeObjects::Base] object the object that the docstring - # is attached to. Will be passed to directives to act on - # this object. - # @param [Handlers::Base, nil] handler the handler object that is - # parsing this object. May be nil if this parser is not being - # called from a {Parser::SourceParser} context. - # @return [self] the parser object. To get the docstring, - # call {#to_docstring}. - # @see #to_docstring - def parse(content, object = nil, handler = nil) - @object = object - @handler = handler - @reference, @raw_text = detect_reference(content) - text = parse_content(@raw_text) - @text = text.strip - call_directives_after_parse - post_process - self - end - - # Parses a given block of text. - # - # @param [String] content the content to parse - # @note Subclasses can override this method to perform custom - # parsing of content data. - def parse_content(content) - content = content.split(/\r?\n/) if content.is_a?(String) - return '' if !content || content.empty? - docstring = String.new("") - - indent = content.first[/^\s*/].length - last_indent = 0 - orig_indent = 0 - directive = false - last_line = "" - tag_name = nil - tag_buf = [] - - (content + ['']).each_with_index do |line, index| - indent = line[/^\s*/].length - empty = (line =~ /^\s*$/ ? true : false) - done = content.size == index - - if tag_name && (((indent < orig_indent && !empty) || done || - (indent == 0 && !empty)) || (indent <= last_indent && line =~ META_MATCH)) - buf = tag_buf.join("\n") - if directive || tag_is_directive?(tag_name) - directive = create_directive(tag_name, buf) - if directive - docstring << parse_content(directive.expanded_text).chomp - end - else - create_tag(tag_name, buf) - end - tag_name = nil - tag_buf = [] - directive = false - orig_indent = 0 - end - - # Found a meta tag - if line =~ META_MATCH - directive = $1 - tag_name = $2 - tag_buf = [($3 || '')] - elsif tag_name && indent >= orig_indent && !empty - orig_indent = indent if orig_indent == 0 - # Extra data added to the tag on the next line - last_empty = last_line =~ /^[ \t]*$/ ? true : false - - tag_buf << '' if last_empty - tag_buf << line.gsub(/^[ \t]{#{orig_indent}}/, '') - elsif !tag_name - # Regular docstring text - docstring << line - docstring << "\n" - end - - last_indent = indent - last_line = line - end - - docstring - end - - # @!group Parser Callback Methods - - # Call post processing callbacks on parser. - # This is called implicitly by parser. Use this when - # manually configuring a {Docstring} object. - # - # @return [void] - def post_process - call_after_parse_callbacks - end - - # @!group Tag Manipulation Methods - - # Creates a tag from the {Tags::DefaultFactory tag factory}. - # - # To add an already created tag object, append it to {#tags}. - # - # @param [String] tag_name the tag name - # @param [String] tag_buf the text attached to the tag with newlines removed. - # @return [Tags::Tag, Tags::RefTag] a tag - def create_tag(tag_name, tag_buf = '') - if tag_buf =~ /\A\s*(?:(\S+)\s+)?\(\s*see\s+(\S+)\s*\)\s*\Z/ - return create_ref_tag(tag_name, $1, $2) - end - - if library.has_tag?(tag_name) - @tags += [library.tag_create(tag_name, tag_buf)].flatten - else - log.warn "Unknown tag @#{tag_name}" + - (object ? " in file `#{object.file}` near line #{object.line}" : "") - end - rescue Tags::TagFormatError - log.warn "Invalid tag format for @#{tag_name}" + - (object ? " in file `#{object.file}` near line #{object.line}" : "") - end - - # Creates a {Tags::RefTag} - def create_ref_tag(tag_name, name, object_name) - @tags << Tags::RefTagList.new(tag_name, P(object, object_name), name) - end - - # Creates a new directive using the registered {#library} - # @return [Tags::Directive] the directive object that is created - def create_directive(tag_name, tag_buf) - if library.has_directive?(tag_name) - dir = library.directive_create(tag_name, tag_buf, self) - if dir.is_a?(Tags::Directive) - @directives << dir - dir - end - else - log.warn "Unknown directive @!#{tag_name}" + - (object ? " in file `#{object.file}` near line #{object.line}" : "") - nil - end - rescue Tags::TagFormatError - log.warn "Invalid directive format for @!#{tag_name}" + - (object ? " in file `#{object.file}` near line #{object.line}" : "") - nil - end - - # Backward compatibility to detect old tags that should be specified - # as directives in 0.8 and onward. - def tag_is_directive?(tag_name) - list = %w(attribute endgroup group macro method scope visibility) - list.include?(tag_name) - end - - # Creates a callback that is called after a docstring is successfully - # parsed. Use this method to perform sanity checks on a docstring's - # tag data, or add any extra tags automatically to a docstring. - # - # @yield [parser] a block to be called after a docstring is parsed - # @yieldparam [DocstringParser] parser the docstring parser object - # with all directives and tags created. - # @yieldreturn [void] - # @return [void] - def self.after_parse(&block) - after_parse_callbacks << block - end - - # @return [Array] the {after_parse} callback proc objects - def self.after_parse_callbacks - @after_parse_callbacks ||= [] - end - - # Define a callback to check that @param tags are properly named - after_parse do |parser| - next unless parser.object - next unless parser.object.is_a?(CodeObjects::MethodObject) - next if parser.object.is_alias? - names = parser.object.parameters.map {|l| l.first.gsub(/\W/, '') } - seen_names = [] - infile_info = "\n in file `#{parser.object.file}' " \ - "near line #{parser.object.line}" - parser.tags.each do |tag| - next if tag.is_a?(Tags::RefTagList) # we don't handle this yet - next unless tag.tag_name == "param" - if seen_names.include?(tag.name) - log.warn "@param tag has duplicate parameter name: " \ - "#{tag.name} #{infile_info}" - elsif names.include?(tag.name) - seen_names << tag.name - else - log.warn "@param tag has unknown parameter name: " \ - "#{tag.name} #{infile_info}" - end - end - end - - private - - def namespace - object && object.namespace - end - - def detect_reference(content) - if content =~ /\A\s*\(see (\S+)\s*\)(?:\s|$)/ - path = $1 - extra = $' - [CodeObjects::Proxy.new(namespace, path), extra] - else - [nil, content] - end - end - - # @!group Parser Callback Methods - - # Calls the {Tags::Directive#after_parse} callback on all the - # created directives. - def call_directives_after_parse - directives.each(&:after_parse) - end - - # Calls all {after_parse} callbacks - def call_after_parse_callbacks - self.class.after_parse_callbacks.each do |cb| - cb.call(self) - end - end - - # Define a callback to check that @see tags do not use {}. - after_parse do |parser| - next unless parser.object - - parser.tags.each_with_index do |tag, i| - next if tag.is_a?(Tags::RefTagList) # we don't handle this yet - next unless tag.tag_name == "see" - next unless "#{tag.name}#{tag.text}" =~ /\A\{.*\}\Z/ - infile_info = "\n in file `#{parser.object.file}' " \ - "near line #{parser.object.line}" - log.warn "@see tag (##{i + 1}) should not be wrapped in {} " \ - "(causes rendering issues): #{infile_info}" - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/gem_index.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/gem_index.rb deleted file mode 100644 index c4c882e085..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/gem_index.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -# Backward compatibility for gem specification lookup -# @see Gem::SourceIndex -module YARD - module GemIndex - module_function - - def find_all_by_name(*args) - if defined?(Gem::Specification) && Gem::Specification.respond_to?(:find_all_by_name) - Gem::Specification.find_all_by_name(*args) - else - Gem.source_index.find_name(*args) - end - end - - def each(&block) - if defined?(Gem::Specification) && Gem::Specification.respond_to?(:each) - Gem::Specification.each(&block) - else - Gem.source_index.find_name('').each(&block) - end - end - - def all - each.to_a - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/globals.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/globals.rb deleted file mode 100644 index 6b2701170b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/globals.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true -# @group Global Convenience Methods - -# Shortcut for creating a YARD::CodeObjects::Proxy via a path -# -# @see YARD::CodeObjects::Proxy -# @see YARD::Registry.resolve -def P(namespace, name = nil, type = nil) # rubocop:disable Naming/MethodName - if name.nil? - name = namespace - namespace = nil - end - YARD::Registry.resolve(namespace, name, false, true, type) -end - -# The global {YARD::Logger} instance -# -# @return [YARD::Logger] the global {YARD::Logger} instance -# @see YARD::Logger -def log - YARD::Logger.instance -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/base.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/base.rb deleted file mode 100644 index 989eb10083..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/base.rb +++ /dev/null @@ -1,595 +0,0 @@ -# frozen_string_literal: true -module YARD - module Handlers - # Raise this error when a handler should exit before completing. - # The exception will be silenced, allowing the next handler(s) in the - # queue to be executed. - # @since 0.8.4 - class HandlerAborted < ::RuntimeError; end - - # Raised during processing phase when a handler needs to perform - # an operation on an object's namespace but the namespace could - # not be resolved. - class NamespaceMissingError < Parser::UndocumentableError - # The object the error occurred on - # @return [CodeObjects::Base] a code object - attr_accessor :object - - def initialize(object) @object = object end - end - - # Handlers are pluggable semantic parsers for YARD's code generation - # phase. They allow developers to control what information gets - # generated by YARD, giving them the ability to, for instance, document - # any Ruby DSLs that a customized framework may use. A good example - # of this would be the ability to document and generate meta data for - # the 'describe' declaration of the RSpec testing framework by simply - # adding a handler for such a keyword. Similarly, any Ruby API that - # takes advantage of class level declarations could add these to the - # documentation in a very explicit format by treating them as first- - # class objects in any outputted documentation. - # - # == Overview of a Typical Handler Scenario - # - # Generally, a handler class will declare a set of statements which - # it will handle using the {handles} class declaration. It will then - # implement the {#process} method to do the work. The processing would - # usually involve the manipulation of the {#namespace}, {#owner} - # {CodeObjects::Base code objects} or the creation of new ones, in - # which case they should be registered by {#register}, a method that - # sets some basic attributes for the new objects. - # - # Handlers are usually simple and take up to a page of code to process - # and register a new object or add new attributes to the current +namespace+. - # - # == Setting up a Handler for Use - # - # A Handler is automatically registered when it is subclassed from the - # base class. The only other thing that needs to be done is to specify - # which statement the handler will process. This is done with the +handles+ - # declaration, taking either a {Parser::Ruby::Legacy::RubyToken}, {String} or `Regexp`. - # Here is a simple example which processes module statements. - # - # class MyModuleHandler < YARD::Handlers::Base - # handles TkMODULE - # - # def process - # # do something - # end - # end - # - # == Processing Handler Data - # - # The goal of a specific handler is really up to the developer, and as - # such there is no real guideline on how to process the data. However, - # it is important to know where the data is coming from to be able to use - # it. - # - # === +statement+ Attribute - # - # The +statement+ attribute pertains to the {Parser::Ruby::Legacy::Statement} object - # containing a set of tokens parsed in by the parser. This is the main set - # of data to be analyzed and processed. The comments attached to the statement - # can be accessed by the {Parser::Ruby::Legacy::Statement#comments} method, but generally - # the data to be processed will live in the +tokens+ attribute. This list - # can be converted to a +String+ using +#to_s+ to parse the data with - # regular expressions (or other text processing mechanisms), if needed. - # - # === +namespace+ Attribute - # - # The +namespace+ attribute is a {CodeObjects::NamespaceObject namespace object} - # which represents the current namespace that the parser is in. For instance: - # - # module SomeModule - # class MyClass - # def mymethod; end - # end - # end - # - # If a handler was to parse the 'class MyClass' statement, it would - # be necessary to know that it belonged inside the SomeModule module. - # This is the value that +namespace+ would return when processing such - # a statement. If the class was then entered and another handler was - # called on the method, the +namespace+ would be set to the 'MyClass' - # code object. - # - # === +owner+ Attribute - # - # The +owner+ attribute is similar to the +namespace+ attribute in that - # it also follows the scope of the code during parsing. However, a namespace - # object is loosely defined as a module or class and YARD has the ability - # to parse beyond module and class blocks (inside methods, for instance), - # so the +owner+ attribute would not be limited to modules and classes. - # - # To put this into context, the example from above will be used. If a method - # handler was added to the mix and decided to parse inside the method body, - # the +owner+ would be set to the method object but the namespace would remain - # set to the class. This would allow the developer to process any method - # definitions set inside a method (def x; def y; 2 end end) by adding them - # to the correct namespace (the class, not the method). - # - # In summary, the distinction between +namespace+ and +owner+ can be thought - # of as the difference between first-class Ruby objects (namespaces) and - # second-class Ruby objects (methods). - # - # === +visibility+ and +scope+ Attributes - # - # Mainly needed for parsing methods, the +visibility+ and +scope+ attributes - # refer to the public/protected/private and class/instance values (respectively) - # of the current parsing position. - # - # == Parsing Blocks in Statements - # - # In addition to parsing a statement and creating new objects, some - # handlers may wish to continue parsing the code inside the statement's - # block (if there is one). In this context, a block means the inside - # of any statement, be it class definition, module definition, if - # statement or classic 'Ruby block'. - # - # For example, a class statement would be "class MyClass" and the block - # would be a list of statements including the method definitions inside - # the class. For a class handler, the programmer would execute the - # {#parse_block} method to continue parsing code inside the block, with - # the +namespace+ now pointing to the class object the handler created. - # - # YARD has the ability to continue into any block: class, module, method, - # even if statements. For this reason, the block parsing method must be - # invoked explicitly out of efficiency sake. - # - # @abstract Subclass this class to provide a handler for YARD to use - # during the processing phase. - # - # @see CodeObjects::Base - # @see CodeObjects::NamespaceObject - # @see handles - # @see #namespace - # @see #owner - # @see #register - # @see #parse_block - class Base - # For accessing convenience, eg. "MethodObject" - # instead of the full qualified namespace - include YARD::CodeObjects - - include Parser - - class << self - # Clear all registered subclasses. Testing purposes only - # @return [void] - def clear_subclasses - @@subclasses = [] - end - - # Returns all registered handler subclasses. - # @return [Array] a list of handlers - def subclasses - @@subclasses ||= [] - end - - def inherited(subclass) - @@subclasses ||= [] - @@subclasses << subclass - end - - # Declares the statement type which will be processed - # by this handler. - # - # A match need not be unique to a handler. Multiple - # handlers can process the same statement. However, - # in this case, care should be taken to make sure that - # {#parse_block} would only be executed by one of - # the handlers, otherwise the same code will be parsed - # multiple times and slow YARD down. - # - # @param [Parser::Ruby::Legacy::RubyToken, Symbol, String, Regexp] matches - # statements that match the declaration will be - # processed by this handler. A {String} match is - # equivalent to a +/\Astring/+ regular expression - # (match from the beginning of the line), and all - # token matches match only the first token of the - # statement. - # - def handles(*matches) - (@handlers ||= []).concat(matches) - end - - # This class is implemented by {Ruby::Base} and {Ruby::Legacy::Base}. - # To implement a base handler class for another language, implement - # this method to return true if the handler should process the given - # statement object. Use {handlers} to enumerate the matchers declared - # for the handler class. - # - # @param statement a statement object or node (depends on language type) - # @return [Boolean] whether or not this handler object should process - # the given statement - def handles?(statement) # rubocop:disable Lint/UnusedMethodArgument - raise NotImplementedError, "override #handles? in a subclass" - end - - # @return [Array] a list of matchers for the handler object. - # @see handles? - def handlers - @handlers ||= [] - end - - # Declares that the handler should only be called when inside a - # {CodeObjects::NamespaceObject}, not a method body. - # - # @return [void] - def namespace_only - @namespace_only = true - end - - # @return [Boolean] whether the handler should only be processed inside - # a namespace. - def namespace_only? - @namespace_only ||= false - end - - # Declares that a handler should only be called when inside a filename - # by its basename or a regex match for the full path. - # - # @param [String, Regexp] filename a matching filename or regex - # @return [void] - # @since 0.6.2 - def in_file(filename) - (@in_files ||= []) << filename - end - - # @return [Boolean] whether the filename matches the declared file - # match for a handler. If no file match is specified, returns true. - # @since 0.6.2 - def matches_file?(filename) - @in_files ||= nil # avoid ruby warnings - return true unless @in_files - @in_files.any? do |in_file| - case in_file - when String - File.basename(filename) == in_file - when Regexp - filename =~ in_file - else - true - end - end - end - - # Generates a +process+ method, equivalent to +def process; ... end+. - # Blocks defined with this syntax will be wrapped inside an anonymous - # module so that the handler class can be extended with mixins that - # override the +process+ method without alias chaining. - # - # @!macro yard.handlers.process - # @!method process - # Main processing callback - # @return [void] - # @see #process - # @return [void] - # @since 0.5.4 - def process(&block) - mod = Module.new - mod.send(:define_method, :process, &block) - include mod - end - end - - def initialize(source_parser, stmt) - @parser = source_parser - @statement = stmt - end - - # The main handler method called by the parser on a statement - # that matches the {handles} declaration. - # - # Subclasses should override this method to provide the handling - # functionality for the class. - # - # @return [Array, CodeObjects::Base, Object] - # If this method returns a code object (or a list of them), - # they are passed to the +#register+ method which adds basic - # attributes. It is not necessary to return any objects and in - # some cases you may want to explicitly avoid the returning of - # any objects for post-processing by the register method. - # - # @see handles - # @see #register - # - def process - raise NotImplementedError, "#{self} did not implement a #process method for handling." - end - - # Parses the semantic "block" contained in the statement node. - # - # @abstract Subclasses should call {Processor#process parser.process} - def parse_block(*) - raise NotImplementedError, "#{self} did not implement a #parse_block method for handling" - end - - # @return [Processor] the processor object that manages all global state - # during handling. - attr_reader :parser - - # @return [Object] the statement object currently being processed. Usually - # refers to one semantic language statement, though the strict definition - # depends on the parser used. - attr_reader :statement - - # (see Processor#owner) - attr_accessor :owner - - # (see Processor#namespace) - attr_accessor :namespace - - # (see Processor#visibility) - attr_accessor :visibility - - # (see Processor#scope) - attr_accessor :scope - - # (see Processor#globals) - attr_reader :globals - - # (see Processor#extra_state) - attr_reader :extra_state - - undef owner, owner=, namespace, namespace= - undef visibility, visibility=, scope, scope= - undef globals, extra_state - - def owner; parser.owner end - def owner=(v) parser.owner = v end - def namespace; parser.namespace end - def namespace=(v); parser.namespace = v end - def visibility; parser.visibility end - def visibility=(v); parser.visibility = v end - def scope; parser.scope end - def scope=(v); parser.scope = v end - def globals; parser.globals end - def extra_state; parser.extra_state end - - # Aborts a handler by raising {Handlers::HandlerAborted}. - # An exception will only be logged in debugging mode for - # this kind of handler exit. - # - # @since 0.8.4 - def abort! - raise Handlers::HandlerAborted - end - - # Executes a given block with specific state values for {#owner}, - # {#namespace} and {#scope}. - # - # @option opts [CodeObjects::NamespaceObject] :namespace (value of #namespace) - # the namespace object that {#namespace} will be equal to for the - # duration of the block. - # @option opts [Symbol] :scope (:instance) - # the scope for the duration of the block. - # @option opts [CodeObjects::Base] :owner (value of #owner) - # the owner object (method) for the duration of the block - # @yield a block to execute with the given state values. - def push_state(opts = {}) - opts = { - :namespace => namespace, - :scope => :instance, - :owner => owner || namespace, - :visibility => nil - }.update(opts) - - ns = namespace - vis = visibility - sc = scope - oo = owner - self.namespace = opts[:namespace] - self.visibility = opts[:visibility] || :public - self.scope = opts[:scope] - self.owner = opts[:owner] - - yield - - self.namespace = ns - self.visibility = vis - self.scope = sc - self.owner = oo - end - - # Do some post processing on a list of code objects. - # Adds basic attributes to the list of objects like - # the filename, line number, {CodeObjects::Base#dynamic}, - # source code and {CodeObjects::Base#docstring}, - # but only if they don't exist. - # - # @param [Array] objects - # the list of objects to post-process. - # - # @return [CodeObjects::Base, Array] - # returns whatever is passed in, for chainability. - # - def register(*objects) - objects.flatten.each do |object| - next unless object.is_a?(CodeObjects::Base) - register_ensure_loaded(object) - yield(object) if block_given? - register_file_info(object) - register_source(object) - register_visibility(object) - register_docstring(object) - register_group(object) - register_dynamic(object) - register_module_function(object) - end - objects.size == 1 ? objects.first : objects - end - - # Ensures that the object's namespace is loaded before attaching it - # to the namespace. - # - # @param [CodeObjects::Base] object the object to register - # @return [void] - # @since 0.8.0 - def register_ensure_loaded(object) - ensure_loaded!(object.namespace) - object.namespace.children << object - rescue NamespaceMissingError - nil # noop - end - - # Registers the file/line of the declaration with the object - # - # @param [CodeObjects::Base] object the object to register - # @return [void] - # @since 0.8.0 - def register_file_info(object, file = parser.file, line = statement.line, comments = statement.comments) - object.add_file(file, line, comments) - end - - # Registers any docstring found for the object and expands macros - # - # @param [CodeObjects::Base] object the object to register - # @return [void] - # @since 0.8.0 - def register_docstring(object, docstring = statement.comments, stmt = statement) - docstring = docstring.join("\n") if Array === docstring - parser = Docstring.parser - parser.parse(docstring || "", object, self) - - if object && docstring - object.docstring = parser.to_docstring - - # Add hash_flag/line_range - if stmt - object.docstring.hash_flag = stmt.comments_hash_flag - object.docstring.line_range = stmt.comments_range - end - end - - register_transitive_tags(object) - end - - # Registers the object as being inside a specific group - # - # @param [CodeObjects::Base] object the object to register - # @return [void] - # @since 0.8.0 - def register_group(object, group = extra_state.group) - if group - unless object.namespace.is_a?(Proxy) - object.namespace.groups |= [group] - end - object.group = group - end - end - - # Registers any transitive tags from the namespace on the object - # - # @param [CodeObjects::Base, nil] object the object to register - # @return [void] - # @since 0.8.0 - def register_transitive_tags(object) - return unless object && !object.namespace.is_a?(Proxy) - Tags::Library.transitive_tags.each do |tag| - next unless object.namespace.has_tag?(tag) - next if object.has_tag?(tag) - object.add_tag(*object.namespace.tags(tag)) - end - end - - # @param [CodeObjects::Base] object the object to register - # @return [void] - # @since 0.8.0 - def register_source(object, source = statement, type = parser.parser_type) - return unless object.is_a?(MethodObject) - object.source ||= source - object.source_type = type - end - - # Registers visibility on a method object. If the object does not - # respond to setting visibility, nothing is done. - # - # @param [#visibility=] object the object to register - # @param [Symbol] visibility the visibility to set on the object - # @since 0.8.0 - def register_visibility(object, visibility = self.visibility) - return unless object.respond_to?(:visibility=) - return if object.is_a?(NamespaceObject) - object.visibility = visibility - end - - # Registers the same method information on the module function, if - # the object was defined as a module function. - # - # @param [CodeObjects::Base] object the possible module function object - # to copy data for - # @since 0.8.0 - def register_module_function(object) - return unless object.is_a?(MethodObject) - return unless object.module_function? - modobj = MethodObject.new(object.namespace, object.name) - object.copy_to(modobj) - modobj.visibility = :private # rubocop:disable Lint/UselessSetterCall - end - - # Registers the object as dynamic if the object is defined inside - # a method or block (owner != namespace) - # - # @param [CodeObjects::Base] object the object to register - # @return [void] - # @since 0.8.0 - def register_dynamic(object) - object.dynamic = true if owner != namespace - end - - # Ensures that a specific +object+ has been parsed and loaded into the - # registry. This is necessary when adding data to a namespace, for instance, - # since the namespace may not have been processed yet (it can be located - # in a file that has not been handled). - # - # Calling this method defers the handler until all other files have been - # processed. If the object gets resolved, the rest of the handler continues, - # otherwise an exception is raised. - # - # @example Adding a mixin to the String class programmatically - # ensure_loaded! P('String') - # # "String" is now guaranteed to be loaded - # P('String').mixins << P('MyMixin') - # - # @param [Proxy, CodeObjects::Base] object the object to resolve. - # @param [Integer] max_retries the number of times to defer the handler - # before raising a +NamespaceMissingError+. - # @raise [NamespaceMissingError] if the object is not resolved within - # +max_retries+ attempts, this exception is raised and the handler - # finishes processing. - def ensure_loaded!(object, max_retries = 1) - return if object.root? - return object unless object.is_a?(Proxy) - - retries = 0 - while object.is_a?(Proxy) - raise NamespaceMissingError, object if retries > max_retries - log.debug "Missing object #{object} in file `#{parser.file}', moving it to the back of the line." - parser.parse_remaining_files - retries += 1 - end - object - end - - # @group Macro Support - - # @abstract Implement this method to return the parameters in a method call - # statement. It should return an empty list if the statement is not a - # method call. - # @return [Array] a list of argument names - def call_params - raise NotImplementedError - end - - # @abstract Implement this method to return the method being called in - # a method call. It should return nil if the statement is not a method - # call. - # @return [String] the method name being called - # @return [nil] if the statement is not a method call - def caller_method - raise NotImplementedError - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/alias_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/alias_handler.rb deleted file mode 100644 index 85a99bd758..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/alias_handler.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true -class YARD::Handlers::C::AliasHandler < YARD::Handlers::C::Base - MATCH = /rb_define_alias - \s*\(\s*([\w\.]+), - \s*"([^"]+)", - \s*"([^"]+)"\s*\)/xm - handles MATCH - statement_class BodyStatement - - process do - statement.source.scan(MATCH) do |var_name, new_name, old_name| - var_name = "rb_cObject" if var_name == "rb_mKernel" - handle_alias(var_name, new_name, old_name) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/attribute_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/attribute_handler.rb deleted file mode 100644 index 537ea12e7e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/attribute_handler.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true -class YARD::Handlers::C::AttributeHandler < YARD::Handlers::C::Base - MATCH = /rb_define_attr\s*\(\s*([\w\.]+),\s*"([^"]+)",\s*(0|1)\s*,\s*(0|1)\s*\)/ - handles MATCH - - process do - return if ToplevelStatement == statement - return if Comment === statement && statement.type != :multi - statement.source.scan(MATCH) do |var_name, name, read, write| - handle_attribute(var_name, name, read, write) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/base.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/base.rb deleted file mode 100644 index 78420d1328..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/base.rb +++ /dev/null @@ -1,164 +0,0 @@ -# frozen_string_literal: true -module YARD - module Handlers - module C - class Base < Handlers::Base - include YARD::Parser::C - include HandlerMethods - - # @return [Boolean] whether the handler handles this statement - def self.handles?(statement, processor) - processor.globals.cruby_processed_files ||= {} - processor.globals.cruby_processed_files[processor.file] = true - - src = statement.respond_to?(:declaration) ? - statement.declaration : statement.source - - handlers.any? do |a_handler| - statement_class >= statement.class && - case a_handler - when String - src == a_handler - when Regexp - src =~ a_handler - end - end - end - - def self.statement_class(type = nil) - if type - @statement_class = type - else - (defined?(@statement_class) && @statement_class) || Statement - end - end - - # @group Registering objects - - def register_docstring(object, docstring = nil, stmt = nil) - super(object, docstring, stmt) if docstring - end - - def register_file_info(object, file = nil, line = nil, comments = nil) - super(object, file, line, comments) if file - end - - def register_source(object, source = nil, type = nil) - super(object, source, type) if source - end - - def register_visibility(object, visibility = nil) - super(object, visibility) if visibility - end - - # @group Looking up Symbol and Var Values - - def symbols - globals.cruby_symbols ||= {} - end - - def override_comments - globals.cruby_override_comments ||= [] - end - - def namespace_for_variable(var) - return namespaces[var] if namespaces[var] - - # The global variables for Ruby's core error classes does not - # represent their Ruby name. So we need to look up these names. - name = ERROR_CLASS_NAMES[var] - return P(name) if name - - # Otherwise the name is inferred from the C variable name. - var = remove_var_prefix(var) - var.empty? ? nil : P(var) - end - - def ensure_variable_defined!(var, max_retries = 1) - retries = 0 - object = nil - - loop do - object = namespace_for_variable(var) - break unless object.is_a?(Proxy) - - raise NamespaceMissingError, object if retries > max_retries - log.debug "Missing namespace variable #{var} in file `#{parser.file}', moving it to the back of the line." - parser.parse_remaining_files - retries += 1 - end - - object - end - - def namespaces - globals.cruby_namespaces ||= {} - end - - def processed_files - globals.cruby_processed_files ||= {} - end - - # @group Parsing an Inner Block - - def parse_block(opts = {}) - return if !statement.block || statement.block.empty? - push_state(opts) do - parser.process(statement.block) - end - end - - # @group Processing other files - - def process_file(file, object) - file = File.cleanpath(file) - return if processed_files[file] - processed_files[file] = file - begin - log.debug "Processing embedded call to C source #{file}..." - globals.ordered_parser.files.delete(file) if globals.ordered_parser - parser.process(Parser::C::CParser.new(File.read(file), file).parse) - rescue Errno::ENOENT - log.warn "Missing source file `#{file}' when parsing #{object}" - end - end - - # @endgroup - - private - - # Generated by update_error_map.rb (Copy+past results) - ERROR_CLASS_NAMES = { - 'rb_eArgError' => 'ArgumentError', - 'rb_eEncodingError' => 'EncodingError', - 'rb_eException' => 'Exception', - 'rb_eFatal' => 'fatal', - 'rb_eFrozenError' => 'FrozenError', - 'rb_eIndexError' => 'IndexError', - 'rb_eInterrupt' => 'Interrupt', - 'rb_eKeyError' => 'KeyError', - 'rb_eLoadError' => 'LoadError', - 'rb_eNameError' => 'NameError', - 'rb_eNoMatchingPatternError' => 'NoMatchingPatternError', - 'rb_eNoMemError' => 'NoMemoryError', - 'rb_eNoMethodError' => 'NoMethodError', - 'rb_eNotImpError' => 'NotImplementedError', - 'rb_eRangeError' => 'RangeError', - 'rb_eRuntimeError' => 'RuntimeError', - 'rb_eScriptError' => 'ScriptError', - 'rb_eSecurityError' => 'SecurityError', - 'rb_eSignal' => 'SignalException', - 'rb_eStandardError' => 'StandardError', - 'rb_eSyntaxError' => 'SyntaxError', - 'rb_eSystemCallError' => 'SystemCallError', - 'rb_eSystemExit' => 'SystemExit', - 'rb_eTypeError' => 'TypeError', - } - - def remove_var_prefix(var) - var.gsub(/^rb_[mc]|^[a-z_]+/, '') - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/class_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/class_handler.rb deleted file mode 100644 index aac65fce5e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/class_handler.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true -class YARD::Handlers::C::ClassHandler < YARD::Handlers::C::Base - MATCH1 = /([\w\.]+)\s* = \s*(?:rb_define_class|boot_defclass)\s* - \( - \s*"([\w:]+)", - \s*(\w+|0)\s* - \)/mx - - MATCH2 = /([\w\.]+)\s* = \s*rb_define_class_under\s* - \( - \s*(\w+), - \s*"(\w+)"(?:, - \s*([\w\*\s\(\)\.\->]+)\s*)? # for SWIG - \s*\)/mx - handles MATCH1 - handles MATCH2 - statement_class BodyStatement - - process do - statement.source.scan(MATCH1) do |var_name, class_name, parent| - handle_class(var_name, class_name, parent) - end - statement.source.scan(MATCH2) do |var_name, in_module, class_name, parent| - handle_class(var_name, class_name, parent.strip, in_module) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/constant_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/constant_handler.rb deleted file mode 100644 index e98d279f49..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/constant_handler.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true -class YARD::Handlers::C::ConstantHandler < YARD::Handlers::C::Base - MATCH = /\brb_define_((?:readonly_)?variable|(?:global_)?const) - \s*\((?:\s*(\w+),)?\s*"(\w+)",\s*(.*?)\s*\)\s*;/xm - handles MATCH - statement_class BodyStatement - - process do - statement.source.scan(MATCH) do |type, var_name, const_name, value| - handle_constants(type, var_name, const_name, value) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/handler_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/handler_methods.rb deleted file mode 100644 index 9f1769b782..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/handler_methods.rb +++ /dev/null @@ -1,212 +0,0 @@ -# frozen_string_literal: true -module YARD - module Handlers - module C - module HandlerMethods - include Parser::C - include CodeObjects - include Common::MethodHandler - - def handle_class(var_name, class_name, parent, in_module = nil) - parent = nil if parent == "0" - namespace = in_module ? ensure_variable_defined!(in_module) : Registry.root - if namespace.nil? - raise Parser::UndocumentableError, - "class #{class_name}. Cannot find definition for parent namespace." - end - - register ClassObject.new(namespace, class_name) do |obj| - if parent - parent_class = namespace_for_variable(parent) - if parent_class.is_a?(Proxy) - obj.superclass = "::#{parent_class.path}" - obj.superclass.type = :class - else - obj.superclass = parent_class - end - end - namespaces[var_name] = obj - register_file_info(obj, statement.file, statement.line) - end - end - - def handle_module(var_name, module_name, in_module = nil) - namespace = in_module ? ensure_variable_defined!(in_module) : Registry.root - if namespace.nil? - raise Parser::UndocumentableError, - "module #{module_name}. Cannot find definition for parent namespace." - end - - register ModuleObject.new(namespace, module_name) do |obj| - namespaces[var_name] = obj - register_file_info(obj, statement.file, statement.line) - end - end - - def handle_method(scope, var_name, name, func_name, _source_file = nil) - visibility = :public - case scope - when "singleton_method"; scope = :class - when "module_function"; scope = :module - when "private_method"; scope = :instance; visibility = :private - else; scope = :instance - end - - namespace = namespace_for_variable(var_name) - - # Is this method being defined on a core Ruby class or module? - if namespace.is_a?(Proxy) - if var_name =~ /^rb_c(\w+)/ && YARD::CodeObjects::BUILTIN_CLASSES.include?($1) - namespace = namespaces[var_name] = YARD::CodeObjects::ClassObject.new(:root, $1) - elsif var_name =~ /^rb_m(\w+)/ && YARD::CodeObjects::BUILTIN_MODULES.include?($1) - namespace = namespaces[var_name] = YARD::CodeObjects::ModuleObject.new(:root, $1) - end - end - - return if namespace.nil? # XXX: raise UndocumentableError might be too noisy. - register MethodObject.new(namespace, name, scope) do |obj| - register_visibility(obj, visibility) - find_method_body(obj, func_name) - obj.explicit = true - add_predicate_return_tag(obj) if name =~ /\?$/ - end - end - - def handle_attribute(var_name, name, read, write) - values = {:read => read.to_i, :write => write.to_i} - {:read => name, :write => "#{name}="}.each do |type, meth_name| - next unless values[type] > 0 - obj = handle_method(:instance, var_name, meth_name, nil) - register_file_info(obj, statement.file, statement.line) - obj.namespace.attributes[:instance][name] ||= SymbolHash[:read => nil, :write => nil] - obj.namespace.attributes[:instance][name][type] = obj - end - end - - def handle_alias(var_name, new_name, old_name) - namespace = namespace_for_variable(var_name) - return if namespace.nil? - new_meth = new_name.to_sym - old_meth = old_name.to_sym - old_obj = namespace.child(:name => old_meth, :scope => :instance) - new_obj = register MethodObject.new(namespace, new_meth, :instance) do |o| - register_visibility(o, visibility) - register_file_info(o, statement.file, statement.line) - end - - if old_obj - new_obj.signature = old_obj.signature - new_obj.source = old_obj.source - new_obj.docstring = old_obj.docstring - new_obj.docstring.object = new_obj - else - new_obj.signature = "def #{new_meth}" # this is all we know. - end - - namespace.aliases[new_obj] = old_meth - end - - def handle_constants(type, var_name, const_name, value) - return unless type =~ /^const$|^global_const$/ - namespace = type == 'global_const' ? - :root : namespace_for_variable(var_name) - register ConstantObject.new(namespace, const_name) do |obj| - obj.source_type = :c - obj.value = value - register_file_info(obj, statement.file, statement.line) - find_constant_docstring(obj) - end - end - - private - - def find_constant_docstring(object) - comment = nil - - # look inside overrides for declaration value - override_comments.each do |name, override_comment| - next unless override_comment.file == statement.file - just_const_name = name.gsub(/\A.+::/, '') - if object.path == name || object.name.to_s == just_const_name - comment = override_comment.source - break - end - end - - # use any comments on this statement as a last resort - if comment.nil? && statement.comments && statement.comments.source =~ /\S/ - comment = statement.comments.source - stmt = statement.comments - end - - # In the case of rb_define_const, the definition and comment are in - # "/* definition: comment */" form. The literal ':' and '\' characters - # can be escaped with a backslash. - if comment - comment.scan(/\A\s*(.*?[^\s\\]):\s*(.+)/m) do |new_value, new_comment| - object.value = new_value.gsub(/\\:/, ':') - comment = new_comment - end - register_docstring(object, comment, stmt) - end - end - - def find_method_body(object, symbol) - file = statement.file - in_file = false - if statement.comments && statement.comments.source =~ /\A\s*in (\S+)\Z/ - file = $1 - in_file = true - process_file(file, object) - end - - src_stmt = symbols[symbol] - if src_stmt - register_file_info(object, src_stmt.file, src_stmt.line, true) - register_source(object, src_stmt) - record_parameters(object, symbol, src_stmt) - unless src_stmt.comments.nil? || src_stmt.comments.source.empty? - register_docstring(object, src_stmt.comments.source, src_stmt) - return # found docstring - end - end - - # found source (possibly) but no docstring - # so look in overrides - return if override_comments.any? do |name, override_comment| - next unless override_comment.file == file - name = name.gsub(/::([^:\.#]+?)\Z/, '.\1') - - # explicit namespace in override comment - path = (name =~ /\.|#/ ? object.path : object.name.to_s) - if path == name || path == name.sub(/new$/, 'initialize') || path == name.sub('.', '#') - register_docstring(object, override_comment.source, override_comment) - true - else - false - end - end - - # use any comments on this statement as a last resort - if !in_file && statement.comments && statement.comments.source =~ /\S/ - register_docstring(object, statement.comments.source, statement) - end - end - - def record_parameters(object, symbol, src) - # use regex to extract comma-delimited list of parameters from cfunc definition - if src.source =~ /VALUE\s+#{symbol}\(([^)]*)\)\s*\{/m - params = $~[1].split(/\s*,\s*/) # rubocop:disable Style/SpecialGlobalVars - # cfunc for a "varargs" method has params "int argc, VALUE *argv" - if params[0] =~ /int\s+argc/ && params[1] =~ /VALUE\s*\*\s*argv/ - object.parameters = [['*args', nil]] - else - # the first cfunc argument is the 'self' argument, we don't need that - object.parameters = params.drop(1).map {|s| [s[/VALUE\s+(\S+)/, 1], nil] } - end - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/init_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/init_handler.rb deleted file mode 100644 index 792bbbbd83..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/init_handler.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true -# Handles the Init_Libname() method -class YARD::Handlers::C::InitHandler < YARD::Handlers::C::Base - MATCH = /\A\s*(?:\S+\s+)*void\s+(?:[Ii]nit_)?(\w+)\s*/ - handles MATCH - statement_class ToplevelStatement - - process do - parse_block - decl = statement.declaration[MATCH, 1] - if decl - ns = namespace_for_variable(decl) - if ns.is_a?(YARD::CodeObjects::NamespaceObject) && ns.docstring.blank? - if statement.comments - register_docstring(ns, statement.comments.source, statement) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/method_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/method_handler.rb deleted file mode 100644 index 7799ffcd5b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/method_handler.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true -class YARD::Handlers::C::MethodHandler < YARD::Handlers::C::Base - MATCH1 = /rb_define_ - ( - singleton_method | - method | - module_function | - private_method - ) - \s*\(\s*([\w\.]+)\s*, - \s*"([^"]+)"\s*, - \s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\(|\(\w+\))?(\w+)\)?\s*, - \s*(-?\w+)\s*\)/xm - MATCH2 = /rb_define_global_function\s*\( - \s*"([^"]+)", - \s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\(|\(\w+\))?(\w+)\)?, - \s*(-?\w+)\s*\)/xm - MATCH3 = /define_filetest_function\s*\( - \s*"([^"]+)", - \s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\(|\(\w+\))?(\w+)\)?, - \s*(-?\w+)\s*\)/xm - handles MATCH1 - handles MATCH2 - handles MATCH3 - statement_class BodyStatement - - process do - statement.source.scan(MATCH1) do |type, var_name, name, func_name, _param_count| - break if var_name == "ruby_top_self" - break if var_name == "nstr" - break if var_name == "envtbl" - - var_name = "rb_cObject" if var_name == "rb_mKernel" - handle_method(type, var_name, name, func_name) - end - - statement.source.scan(MATCH2) do |name, func_name, _param_count| - handle_method("method", "rb_mKernel", name, func_name) - end - - statement.source.scan(MATCH3) do |name, func_name, _param_count| - handle_method("singleton_method", "rb_cFile", name, func_name) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/mixin_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/mixin_handler.rb deleted file mode 100644 index 7688326dba..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/mixin_handler.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true -class YARD::Handlers::C::MixinHandler < YARD::Handlers::C::Base - MATCH = /rb_include_module\s*\(\s*(\w+?),\s*(\w+?)\s*\)/ - handles MATCH - statement_class BodyStatement - - process do - statement.source.scan(MATCH) do |klass_var, mixin_var| - namespace = namespace_for_variable(klass_var) - ensure_loaded!(namespace) - - var = namespace_for_variable(mixin_var) - if var - namespace.mixins(:instance) << var - else - raise YARD::Parser::UndocumentableError, - "CRuby mixin for unrecognized variable '#{mixin_var}'" - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/module_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/module_handler.rb deleted file mode 100644 index aaf5998df3..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/module_handler.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true -class YARD::Handlers::C::ModuleHandler < YARD::Handlers::C::Base - MATCH1 = /([\w\.]+)\s* = \s*rb_define_module\s*\(\s*"([\w:]+)"\s*\)/mx - MATCH2 = /([\w\.]+)\s* = \s*rb_define_module_under\s*\(\s*(\w+),\s*"(\w+)"\s*\)/mx - handles MATCH1 - handles MATCH2 - statement_class BodyStatement - - process do - statement.source.scan(MATCH1) do |var_name, module_name| - handle_module(var_name, module_name) - end - statement.source.scan(MATCH2) do |var_name, in_module, module_name| - handle_module(var_name, module_name, in_module) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/override_comment_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/override_comment_handler.rb deleted file mode 100644 index 0af2afdf67..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/override_comment_handler.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true -# Parses comments -class YARD::Handlers::C::OverrideCommentHandler < YARD::Handlers::C::Base - handles(/./) - statement_class Comment - - process do - return if statement.overrides.empty? - statement.overrides.each do |type, name| - override_comments << [name, statement] - obj = nil - case type - when :class - name, superclass = *name.split(/\s*<\s*/) - obj = YARD::CodeObjects::ClassObject.new(:root, name) - obj.superclass = "::#{superclass}" if superclass - when :module - obj = YARD::CodeObjects::ModuleObject.new(:root, name) - end - register(obj) - end - end - - def register_docstring(object, docstring = statement.source, stmt = statement) - super - end - - def register_file_info(object, file = parser.file, line = statement.line, comments = statement.comments) - super - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/path_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/path_handler.rb deleted file mode 100644 index 63cf8e34a5..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/path_handler.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true -class YARD::Handlers::C::PathHandler < YARD::Handlers::C::Base - MATCH = /([\w\.]+)\s* = \s*rb_path2class\s*\(\s*"([\w:]+)"\)/mx - handles MATCH - - process do - statement.source.scan(MATCH) do |var_name, path| - namespaces[var_name] = P(path) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/struct_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/struct_handler.rb deleted file mode 100644 index 37092d3e0c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/struct_handler.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true -class YARD::Handlers::C::StructHandler < YARD::Handlers::C::Base - MATCH = /([\w\.]+)\s*=\s*(?:rb_struct_define_without_accessor)\s* - \(\s*"([\w:]+)"\s*,\s*(\w+)\s*/mx - handles MATCH - statement_class BodyStatement - - process do - statement.source.scan(MATCH) do |var_name, class_name, parent| - handle_class(var_name, class_name, parent) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/symbol_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/symbol_handler.rb deleted file mode 100644 index 4d12b1a0eb..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/c/symbol_handler.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true -# Keeps track of function bodies for symbol lookup during Ruby method declarations -class YARD::Handlers::C::SymbolHandler < YARD::Handlers::C::Base - MATCH = /\A\s*(?:(?:\w+)\s+)?(?:intern\s+)?VALUE\s+(\w+)\s*\(/ - handles MATCH - statement_class ToplevelStatement - process { symbols[statement.source[MATCH, 1]] = statement } -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/common/method_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/common/method_handler.rb deleted file mode 100644 index 3df668ea3d..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/common/method_handler.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -module YARD::Handlers - module Common - # Shared functionality between Ruby and C method handlers. - module MethodHandler - # @param [MethodObject] obj - def add_predicate_return_tag(obj) - if obj.tag(:return) && (obj.tag(:return).types || []).empty? - obj.tag(:return).types = ['Boolean'] - elsif obj.tag(:return).nil? - unless obj.tags(:overload).any? {|overload| overload.tag(:return) } - obj.add_tag(YARD::Tags::Tag.new(:return, "", "Boolean")) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/processor.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/processor.rb deleted file mode 100644 index d6ea675adc..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/processor.rb +++ /dev/null @@ -1,200 +0,0 @@ -# frozen_string_literal: true -require 'ostruct' - -module YARD - module Handlers - # Iterates over all statements in a file and delegates them to the - # {Handlers::Base} objects that are registered to handle the statement. - # - # This class is passed to each handler and keeps overall processing state. - # For example, if the {#visibility} is set in a handler, all following - # statements will have access to this state. This allows "public", - # "protected" and "private" statements to be handled in classes and modules. - # In addition, the {#namespace} can be set during parsing to control - # where objects are being created from. You can also access extra stateful - # properties that any handler can set during the duration of the post - # processing of a file from {#extra_state}. If you need to access state - # across different files, look at {#globals}. - # - # @see Handlers::Base - class Processor - class << self - # Registers a new namespace for handlers of the given type. - # @since 0.6.0 - def register_handler_namespace(type, ns) - namespace_for_handler[type] = ns - end - - # @return [Hash] a list of registered parser type extensions - # @private - # @since 0.6.0 - attr_reader :namespace_for_handler - undef namespace_for_handler - def namespace_for_handler; @@parser_type_extensions ||= {} end - end - - register_handler_namespace :ruby, Ruby - register_handler_namespace :ruby18, Ruby::Legacy - register_handler_namespace :c, C - - # @return [String] the filename - attr_accessor :file - - # @return [CodeObjects::NamespaceObject] the current namespace - attr_accessor :namespace - - # @return [Symbol] the current visibility (public, private, protected) - attr_accessor :visibility - - # @return [Symbol] the current scope (class, instance) - attr_accessor :scope - - # @return [CodeObjects::Base, nil] unlike the namespace, the owner - # is a non-namespace object that should be stored between statements. - # For instance, when parsing a method body, the {CodeObjects::MethodObject} - # is set as the owner, in case any extra method information is processed. - attr_accessor :owner - - # @return [Symbol] the parser type (:ruby, :ruby18, :c) - attr_accessor :parser_type - - # Handlers can share state for the entire post processing stage through - # this attribute. Note that post processing stage spans multiple files. - # To share state only within a single file, use {#extra_state} - # - # @example Sharing state among two handlers - # class Handler1 < YARD::Handlers::Ruby::Base - # handles :class - # process { globals.foo = :bar } - # end - # - # class Handler2 < YARD::Handlers::Ruby::Base - # handles :method - # process { puts globals.foo } - # end - # @return [OpenStruct] global shared state for post-processing stage - # @see #extra_state - attr_accessor :globals - - # Share state across different handlers inside of a file. - # This attribute is similar to {#visibility}, {#scope}, {#namespace} - # and {#owner}, in that they all maintain state across all handlers - # for the entire source file. Use this attribute to store any data - # your handler might need to save during the parsing of a file. If - # you need to save state across files, see {#globals}. - # - # @return [OpenStruct] an open structure that can store arbitrary data - # @see #globals - attr_accessor :extra_state - - # Creates a new Processor for a +file+. - # @param [Parser::SourceParser] parser the parser used to initialize the processor - def initialize(parser) - @file = parser.file || "(stdin)" - @namespace = YARD::Registry.root - @visibility = :public - @scope = :instance - @owner = @namespace - @parser_type = parser.parser_type - @handlers_loaded = {} - @globals = parser.globals || OpenStruct.new - @extra_state = OpenStruct.new - load_handlers - end - - # Processes a list of statements by finding handlers to process each - # one. - # - # @param [Array] statements a list of statements - # @return [void] - def process(statements) - statements.each_with_index do |stmt, _index| - find_handlers(stmt).each do |handler| - begin - handler.new(self, stmt).process - rescue HandlerAborted - log.debug "#{handler} cancelled from #{caller.last}" - log.debug "\tin file '#{file}':#{stmt.line}:\n\n" + stmt.show + "\n" - rescue NamespaceMissingError => missingerr - log.warn "The #{missingerr.object.type} #{missingerr.object.path} has not yet been recognized.\n" \ - "If this class/method is part of your source tree, this will affect your documentation results.\n" \ - "You can correct this issue by loading the source file for this object before `#{file}'\n" - rescue Parser::UndocumentableError => undocerr - log.warn "in #{handler}: Undocumentable #{undocerr.message}\n" \ - "\tin file '#{file}':#{stmt.line}:\n\n" + stmt.show + "\n" - rescue => e - log.error "Unhandled exception in #{handler}:\n" \ - " in `#{file}`:#{stmt.line}:\n\n#{stmt.show}\n" - log.backtrace(e) - end - end - end - end - - # Continue parsing the remainder of the files in the +globals.ordered_parser+ - # object. After the remainder of files are parsed, processing will continue - # on the current file. - # - # @return [void] - # @see Parser::OrderedParser - def parse_remaining_files - if globals.ordered_parser - globals.ordered_parser.parse - log.debug("Re-processing #{@file}...") - end - end - - # Searches for all handlers in {Base.subclasses} that match the +statement+ - # - # @param statement the statement object to match. - # @return [Array] a list of handlers to process the statement with. - def find_handlers(statement) - Base.subclasses.find_all do |handler| - handler_base_class > handler && - (handler.namespace_only? ? owner.is_a?(CodeObjects::NamespaceObject) : true) && - handles?(handler, statement) - end - end - - private - - def handles?(handler, statement) - return false unless handler.matches_file?(file) - if handler.method(:handles?).arity == 1 - handler.handles?(statement) - elsif [-1, 2].include?(handler.method(:handles?).arity) - handler.handles?(statement, self) - end - end - - # Returns the handler base class - # @return [Base] the base class - def handler_base_class - handler_base_namespace.const_get(:Base) - end - - # The module holding the handlers to be loaded - # - # @return [Module] the module containing the handlers depending on - # {#parser_type}. - def handler_base_namespace - self.class.namespace_for_handler[parser_type] - end - - # Loads handlers from {#handler_base_namespace}. This ensures that - # Ruby1.9 handlers are never loaded into 1.8; also lowers the amount - # of modules that are loaded - # @return [void] - def load_handlers - return if @handlers_loaded[parser_type] - handler_base_namespace.constants.each do |c| - const = handler_base_namespace.const_get(c) - unless Handlers::Base.subclasses.include?(const) - Handlers::Base.subclasses << const - end - end - @handlers_loaded[parser_type] = true - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/alias_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/alias_handler.rb deleted file mode 100644 index 965cd86a8c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/alias_handler.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true -# Handles alias and alias_method calls -class YARD::Handlers::Ruby::AliasHandler < YARD::Handlers::Ruby::Base - handles :alias, method_call(:alias_method) - namespace_only - - process do - names = [] - if statement.type == :alias - nodes = [:ident, :op, :kw, :const, :tstring_content, :string_content] - names = statement.map {|o| o.jump(*nodes).source } - elsif statement.call? - statement.parameters(false).each do |obj| - case obj.type - when :symbol_literal - names << obj.jump(:ident, :op, :kw, :const).source - when :string_literal, :dyna_symbol - names << obj.jump(:string_content, :tstring_content).source - end - end - end - raise YARD::Parser::UndocumentableError, "alias/alias_method" if names.size != 2 - - new_meth = names[0].to_sym - old_meth = names[1].to_sym - old_obj = namespace.child(:name => old_meth, :scope => scope) - new_obj = register MethodObject.new(namespace, new_meth, scope) do |o| - o.add_file(parser.file, statement.line) - end - namespace.aliases[new_obj] = old_meth - - if old_obj - new_obj.signature = old_obj.signature - new_obj.source = old_obj.source - comments = [old_obj.docstring.to_raw, statement.comments].join("\n") - doc = YARD::Docstring.parser.parse(comments, new_obj, self) - new_obj.docstring = doc.to_docstring - new_obj.docstring.line_range = statement.comments_range - new_obj.docstring.hash_flag = statement.comments_hash_flag - new_obj.docstring.object = new_obj - else - new_obj.signature = "def #{new_meth}" # this is all we know. - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/attribute_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/attribute_handler.rb deleted file mode 100644 index fa39e1505c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/attribute_handler.rb +++ /dev/null @@ -1,87 +0,0 @@ -# frozen_string_literal: true -# Handles +attr_*+ statements in modules/classes -class YARD::Handlers::Ruby::AttributeHandler < YARD::Handlers::Ruby::Base - handles method_call(:attr) - handles method_call(:attr_reader) - handles method_call(:attr_writer) - handles method_call(:attr_accessor) - namespace_only - - process do - return if statement.type == :var_ref || statement.type == :vcall - read = true - write = false - params = statement.parameters(false).dup - - # Change read/write based on attr_reader/writer/accessor - case statement.method_name(true) - when :attr - # In the case of 'attr', the second parameter (if given) isn't a symbol. - if params.size == 2 - write = true if params.pop == s(:var_ref, s(:kw, "true")) - end - when :attr_accessor - write = true - when :attr_reader - # change nothing - when :attr_writer - read = false - write = true - end - - # Add all attributes - validated_attribute_names(params).each do |name| - namespace.attributes[scope][name] ||= SymbolHash[:read => nil, :write => nil] - - # Show their methods as well - {:read => name, :write => "#{name}="}.each do |type, meth| - if type == :read ? read : write - o = MethodObject.new(namespace, meth, scope) - if type == :write - o.parameters = [['value', nil]] - src = "def #{meth}(value)" - full_src = "#{src}\n @#{name} = value\nend" - doc = "Sets the attribute #{name}\n@param value the value to set the attribute #{name} to." - else - src = "def #{meth}" - full_src = "#{src}\n @#{name}\nend" - doc = "Returns the value of attribute #{name}." - end - o.source ||= full_src - o.signature ||= src - register(o) - o.docstring = doc if o.docstring.blank?(false) - - # Regsiter the object explicitly - namespace.attributes[scope][name][type] = o - else - obj = namespace.children.find {|other| other.name == meth.to_sym && other.scope == scope } - - # register an existing method as attribute - namespace.attributes[scope][name][type] = obj if obj - end - end - end - end - - protected - - # Strips out any non-essential arguments from the attr statement. - # - # @param [Array] params a list of the parameters - # in the attr call. - # @return [Array] the validated attribute names - # @raise [Parser::UndocumentableError] if the arguments are not valid. - def validated_attribute_names(params) - params.map do |obj| - case obj.type - when :symbol_literal - obj.jump(:ident, :op, :kw, :const).source - when :string_literal - obj.jump(:string_content).source - else - raise YARD::Parser::UndocumentableError, obj.source - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/base.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/base.rb deleted file mode 100644 index f33420767b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/base.rb +++ /dev/null @@ -1,165 +0,0 @@ -# frozen_string_literal: true -module YARD - module Handlers - module Ruby - # To implement a custom handler matcher, subclass this class and implement - # {#matches?} to return whether a node matches the handler. - # - # @example A Custom Handler Matcher Extension - # # Implements a handler that checks for a specific string - # # in the node's source. - # class MyExtension < HandlesExtension - # def matches?(node) node.source.include?(name) end - # end - # - # # This handler will handle any node where the source includes 'foo' - # class MyHandler < Handlers::Ruby::Base - # handles MyExtension.new('foo') - # end - class HandlesExtension - # Creates a new extension with a specific matcher value +name+ - # @param [Object] name the matcher value to check against {#matches?} - def initialize(name) @name = name end - - # Tests if the node matches the handler - # @param [Parser::Ruby::AstNode] node a Ruby node - # @return [Boolean] whether the +node+ matches the handler - def matches?(node) # rubocop:disable Lint/UnusedMethodArgument - raise NotImplementedError - end - - protected - - # @return [String] the extension matcher value - attr_reader :name - end - - class MethodCallWrapper < HandlesExtension - def matches?(node) - case node.type - when :var_ref - if !node.parent || node.parent.type == :list - return true if node[0].type == :ident && (name.nil? || node[0][0] == name) - end - when :fcall, :command, :vcall - return true if name.nil? || node[0][0] == name - when :call, :command_call - return true if name.nil? || node[2][0] == name - end - false - end - end - - class TestNodeWrapper < HandlesExtension - def matches?(node) !node.send(name).is_a?(FalseClass) end - end - - # This is the base handler class for the new-style (1.9) Ruby parser. - # All handlers that subclass this base class will be used when the - # new-style parser is used. For implementing legacy handlers, see - # {Legacy::Base}. - # - # @abstract See {Handlers::Base} for subclassing information. - # @see Handlers::Base - # @see Legacy::Base - class Base < Handlers::Base - class << self - include Parser::Ruby - - # @group Statement Matcher Extensions - - # Matcher for handling any type of method call. Method calls can - # be expressed by many {AstNode} types depending on the syntax - # with which it is called, so YARD allows you to use this matcher - # to simplify matching a method call. - # - # @example Match the "describe" method call - # handles method_call(:describe) - # - # # The following will be matched: - # # describe(...) - # # object.describe(...) - # # describe "argument" do ... end - # - # @param [#to_s] name matches the method call of this name - # @return [void] - def method_call(name = nil) - MethodCallWrapper.new(name ? name.to_s : nil) - end - - # Matcher for handling a node with a specific meta-type. An {AstNode} - # has a {AstNode#type} to define its type but can also be associated - # with a set of types. For instance, +:if+ and +:unless+ are both - # of the meta-type +:condition+. - # - # A meta-type is any method on the {AstNode} class ending in "?", - # though you should not include the "?" suffix in your declaration. - # Some examples are: "condition", "call", "literal", "kw", "token", - # "ref". - # - # @example Handling any conditional statement (if, unless) - # handles meta_type(:condition) - # @param [Symbol] type the meta-type to match. A meta-type can be - # any method name + "?" that {AstNode} responds to. - # @return [void] - def meta_type(type) - TestNodeWrapper.new(type.to_s + "?") - end - - # @group Testing for a Handler - - # @return [Boolean] whether or not an {AstNode} object should be - # handled by this handler - def handles?(node) - handlers.any? do |a_handler| - case a_handler - when Symbol - a_handler == node.type - when String - node.source == a_handler - when Regexp - node.source =~ a_handler - when Parser::Ruby::AstNode - a_handler == node - when HandlesExtension - a_handler.matches?(node) - end - end - end - end - - include Parser::Ruby - - # @group Parsing an Inner Block - - def parse_block(inner_node, opts = {}) - push_state(opts) do - nodes = inner_node.type == :list ? inner_node.children : [inner_node] - parser.process(nodes) - end - end - - # @group Macro Handling - - def call_params - return [] unless statement.respond_to?(:parameters) - statement.parameters(false).compact.map do |param| - if param.type == :list - param.map {|n| n.jump(:ident, :kw, :tstring_content).source } - else - param.jump(:ident, :kw, :tstring_content).source - end - end.flatten - end - - def caller_method - if statement.call? || statement.def? - statement.method_name(true).to_s - elsif statement.type == :var_ref || statement.type == :vcall - statement[0].jump(:ident, :kw).source - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/class_condition_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/class_condition_handler.rb deleted file mode 100644 index 1c11700456..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/class_condition_handler.rb +++ /dev/null @@ -1,92 +0,0 @@ -# frozen_string_literal: true -# Matches if/unless conditions inside classes and attempts to process only -# one branch (by evaluating the condition if possible). -# -# @example A simple class conditional -# class Foo -# if 0 -# # This method is ignored -# def xyz; end -# end -# end -class YARD::Handlers::Ruby::ClassConditionHandler < YARD::Handlers::Ruby::Base - handles meta_type(:condition) - namespace_only - - process do - condition = parse_condition - if condition.nil? - # Parse both blocks if we're unsure of the condition - parse_then_block - parse_else_block - elsif condition - parse_then_block - else - parse_else_block - end - end - - protected - - # Parses the condition part of the if/unless statement - # - # @return [true, false, nil] true if the condition can be definitely - # parsed to true, false if not, and nil if the condition cannot be - # parsed with certainty (it's dynamic) - def parse_condition - condition = nil - - # Right now we can handle very simple unary conditions like: - # if true - # if false - # if 0 - # if 100 (not 0) - # if defined? SOME_CONSTANT - # - # The last case will do a lookup in the registry and then one - # in the Ruby world (using eval). - case statement.condition.type - when :int - condition = statement.condition[0] != "0" - when :defined - # defined? keyword used, let's see if we can look up the name - # in the registry, then we'll try using Ruby's powers. eval() is not - # *too* dangerous here since code is not actually executed. - arg = statement.condition.first - - if arg.type == :var_ref - name = arg.source - obj = YARD::Registry.resolve(namespace, name, true) - - begin - condition = true if obj || (name && Object.instance_eval("defined? #{name}")) - rescue SyntaxError, NameError - condition = false - end - end - when :var_ref - var = statement.condition[0] - if var == s(:kw, "true") - condition = true - elsif var == s(:kw, "false") - condition = false - end - end - - # Invert an unless condition - if statement.type == :unless || statement.type == :unless_mod - condition = !condition unless condition.nil? - end - condition - end - - def parse_then_block - parse_block(statement.then_block, :visibility => visibility) - end - - def parse_else_block - if statement.else_block - parse_block(statement.else_block, :visibility => visibility) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/class_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/class_handler.rb deleted file mode 100644 index 6b0159fe0f..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/class_handler.rb +++ /dev/null @@ -1,119 +0,0 @@ -# frozen_string_literal: true -# Handles class declarations -class YARD::Handlers::Ruby::ClassHandler < YARD::Handlers::Ruby::Base - include YARD::Handlers::Ruby::StructHandlerMethods - handles :class, :sclass - namespace_only - - process do - classname = statement[0].source.gsub(/\s/, '') - if statement.type == :class - superclass = parse_superclass(statement[1]) - if superclass == "Struct" - is_a_struct = true - superclass = struct_superclass_name(statement[1]) # refine the superclass if possible - create_struct_superclass(superclass, statement[1]) - end - undocsuper = statement[1] && superclass.nil? - klass = register ClassObject.new(namespace, classname) do |o| - o.superclass = superclass if superclass - o.superclass.type = :class if o.superclass.is_a?(Proxy) - end - if is_a_struct - parse_struct_superclass(klass, statement[1]) - elsif klass - create_attributes(klass, members_from_tags(klass)) - end - parse_block(statement[2], :namespace => klass) - - if undocsuper - raise YARD::Parser::UndocumentableError, 'superclass (class was added without superclass)' - end - elsif statement.type == :sclass - if statement[0] == s(:var_ref, s(:kw, "self")) - parse_block(statement[1], :namespace => namespace, :scope => :class) - else - proxy = Proxy.new(namespace, classname) - - # Allow constants to reference class names - if ConstantObject === proxy - if proxy.value =~ /\A#{NAMESPACEMATCH}\Z/ - proxy = Proxy.new(namespace, proxy.value) - else - raise YARD::Parser::UndocumentableError, "constant class reference '#{classname}'" - end - end - - if classname[0, 1] =~ /[A-Z]/ - register ClassObject.new(namespace, classname) if Proxy === proxy - parse_block(statement[1], :namespace => proxy, :scope => :class) - else - raise YARD::Parser::UndocumentableError, "class '#{classname}'" - end - end - else - sig_end = (statement[1] ? statement[1].source_end : statement[0].source_end) - statement.source_start - raise YARD::Parser::UndocumentableError, "class: #{statement.source[0..sig_end]}" - end - end - - private - - # Extract the parameters from the Struct.new AST node, returning them as a list - # of strings - # - # @param [MethodCallNode] superclass the AST node for the Struct.new call - # @return [Array] the member names to generate methods for - def extract_parameters(superclass) - members = superclass.parameters.select {|x| x && x.type == :symbol_literal } - members.map! {|x| x.source.strip[1..-1] } - members - end - - def create_struct_superclass(superclass, superclass_def) - return if superclass == "Struct" - the_super = register ClassObject.new(P("Struct"), superclass[8..-1]) do |o| - o.superclass = "Struct" - end - parse_struct_superclass(the_super, superclass_def) - the_super - end - - def struct_superclass_name(superclass) - if superclass.call? - first = superclass.parameters.first - if first.type == :string_literal && first[0].type == :string_content && first[0].size == 1 - return "Struct::#{first[0][0][0]}" - end - end - "Struct" - end - - def parse_struct_superclass(klass, superclass) - return unless superclass.call? && superclass.parameters - members = extract_parameters(superclass) - create_attributes(klass, members) - end - - def parse_superclass(superclass) - return nil unless superclass - - case superclass.type - when :var_ref - return namespace.path if superclass.first == s(:kw, "self") - return superclass.source if superclass.first.type == :const - when :const, :const_ref, :const_path_ref, :top_const_ref - return superclass.source - when :fcall, :command - methname = superclass.method_name.source - return superclass.parameters.first.source if methname == "DelegateClass" - return methname if superclass.method_name.type == :const - when :call, :command_call - cname = superclass.namespace.source - if cname =~ /^O?Struct$/ && superclass.method_name(true) == :new - return cname - end - end - nil - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/class_variable_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/class_variable_handler.rb deleted file mode 100644 index 290beb48d0..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/class_variable_handler.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true -# Handles a class variable (@@variable) -class YARD::Handlers::Ruby::ClassVariableHandler < YARD::Handlers::Ruby::Base - handles :assign - namespace_only - - process do - if statement[0].type == :var_field && statement[0][0].type == :cvar - name = statement[0][0][0] - value = statement[1].source - register ClassVariableObject.new(namespace, name) do |o| - o.source = statement - o.value = value - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/comment_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/comment_handler.rb deleted file mode 100644 index 19733b4408..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/comment_handler.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true -# Handles any lone comment statement in a Ruby file -class YARD::Handlers::Ruby::CommentHandler < YARD::Handlers::Ruby::Base - handles :comment, :void_stmt - namespace_only - - process do - register_docstring(nil) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/constant_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/constant_handler.rb deleted file mode 100644 index d90504c6b2..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/constant_handler.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true -# Handles any constant assignment -class YARD::Handlers::Ruby::ConstantHandler < YARD::Handlers::Ruby::Base - include YARD::Handlers::Ruby::StructHandlerMethods - handles :assign - namespace_only - - process do - if statement[1].call? && statement[1][0][0] == s(:const, "Struct") && - statement[1][2] == s(:ident, "new") - process_structclass(statement) - elsif statement[0].type == :var_field && statement[0][0].type == :const - process_constant(statement) - elsif statement[0].type == :const_path_field - process_constant(statement) - end - end - - private - - def process_constant(statement) - name = statement[0].source - value = statement[1].source - obj = P(namespace, name) - if obj.is_a?(NamespaceObject) && obj.namespace == namespace - raise YARD::Parser::UndocumentableError, "constant for existing #{obj.type} #{obj}" - else - ensure_loaded! obj.parent - register ConstantObject.new(namespace, name) {|o| o.source = statement; o.value = value.strip } - end - end - - def process_structclass(statement) - lhs = statement[0][0] - if lhs.type == :const - klass = create_class(lhs[0], P(:Struct)) - create_attributes(klass, extract_parameters(statement[1])) - parse_block(statement[1].block[1], :namespace => klass) unless statement[1].block.nil? - else - raise YARD::Parser::UndocumentableError, "Struct assignment to #{statement[0].source}" - end - end - - # Extract the parameters from the Struct.new AST node, returning them as a list - # of strings - # - # @param [MethodCallNode] superclass the AST node for the Struct.new call - # @return [Array] the member names to generate methods for - def extract_parameters(superclass) - return [] unless superclass.parameters - members = superclass.parameters.select {|x| x && x.type == :symbol_literal } - members.map! {|x| x.source.strip[1..-1] } - members - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/decorator_handler_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/decorator_handler_methods.rb deleted file mode 100644 index 2a401c2c43..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/decorator_handler_methods.rb +++ /dev/null @@ -1,123 +0,0 @@ -# frozen_string_literal: true -# Helper methods to assist with processing decorators. -module YARD::Handlers::Ruby::DecoratorHandlerMethods - # @overload process_decorator(*nodes, opts = {}, &block) - # Takes care of parsing method definitions passed to decorators - # as parameters, as well as parsing chained decorators. - # - # Use this in a handler's process block. - # - # @yieldparam method [YARD::CodeObjects::MethodObject] Method being decorated. - # @yieldparam node [YARD::Parser::Ruby::AstNode] AST node of the decorated method. - # @yieldparam name [Symbol] Name of the decorated method. - # @return [Array] Array of hashes containing :method, :node, :name. - # See yield params. - # - # @param nodes [YARD::Parser::Ruby::AstNode] AST nodes that refer to decorated - # methods, like indexes of statement.parameter. Defaults to all parameters. - # Pass nil to specify zero parameters. - # - # @option opts [:instance, :class] :scope (:instance) Scope to use for each - # MethodObject. - # - # @option opts [true, false] :transfer_docstring Set false to disable - # transferring the decorator docstring to method definitions passed to the - # decorator as parameters. - # - # @option opts [true, false] :transfer_source Set false to disable - # transferring the decorator source code string to method definitions - # passed to the decorator as parameters. - # - # @example Basic Usage - # # Simply pass the method docs through to the method definition. - # process do - # process_decorator - # end - # - # @example Setting a method's visibility to private. - # process do - # process_decorator :scope => :class do |method| - # method.visibility = :private if method.respond_to? :visibility - # end - # end - def process_decorator(*nodes, &block) - opts = nodes.last.is_a?(Hash) ? nodes.pop : {} - - all_nodes = statement.parameters.select do |p| - p.is_a? YARD::Parser::Ruby::AstNode - end - - # Parse decorator parameters (decorator chain). - all_nodes.each do |param| - parse_block param if param.call? || param.def? - end - - selected_nodes = - if nodes.empty? - all_nodes - elsif nodes.count == 1 && nodes.first.nil? - [] - else - nodes - end - - decorated_methods = selected_nodes.map do |param| - process_decorator_parameter param, opts, &block - end.flatten - - # Store method nodes in decorator node. - statement.define_singleton_method :decorators do - decorated_methods.map {|h| h[:node] } - end - - decorated_methods - end - - private - - def process_decorator_parameter(node, opts = {}, &block) - scope = opts.fetch :scope, :instance - transfer_docstring = opts.fetch :transfer_docstring, true - transfer_source = opts.fetch :transfer_source, true - - name = nil - - if node.call? - if node.respond_to? :decorators - return node.decorators.map do |n| - process_decorator_parameter n, opts, &block - end - end - elsif node.def? - name = node.jump(:def).method_name.source - else - name = node.jump(:ident, :string_content, :const).source - end - - if name.nil? - raise YARD::Parser::UndocumentableError, 'statement, cannot determine method name' - end - - method = YARD::CodeObjects::Proxy.new( - namespace, - (scope == :instance ? '#' : '.') + name.to_s, - :method - ) - - # Transfer source to methods passed to the helper as parameters. - method.source = statement.source if transfer_source && node.def? - - # Transfer decorator docstring to methods passed to the helper as parameters. - if transfer_docstring && node.def? && - statement.docstring && method.docstring.empty? - tags = method.tags if method.respond_to? :tags - tags ||= [] - method.docstring = statement.docstring - tags.each {|t| method.add_tag t } - end - - yield method, node, name.to_sym if block_given? - - [{:method => method, :node => node, :name => name.to_sym}] - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/dsl_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/dsl_handler.rb deleted file mode 100644 index dec24a2f98..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/dsl_handler.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true -module YARD - module Handlers - module Ruby - # Handles automatic detection of dsl-style methods - class DSLHandler < Base - include CodeObjects - include DSLHandlerMethods - handles method_call - namespace_only - process { handle_comments } - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/dsl_handler_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/dsl_handler_methods.rb deleted file mode 100644 index f077eec57a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/dsl_handler_methods.rb +++ /dev/null @@ -1,96 +0,0 @@ -# frozen_string_literal: true -module YARD - module Handlers - module Ruby - module DSLHandlerMethods - include CodeObjects - include Parser - - IGNORE_METHODS = Hash[*%w(alias alias_method autoload attr attr_accessor - attr_reader attr_writer extend include module_function public private - protected private_constant private_class_method public_class_method). - map {|n| [n, true] }.flatten] - - def handle_comments - return if IGNORE_METHODS[caller_method] - - @docstring = statement.comments || "" - @docstring = @docstring.join("\n") if @docstring.is_a?(Array) - - attaching = false - if @docstring =~ /^@!?macro\s+\[[^\]]*attach/ - register_docstring(nil) - @docstring = "" - attaching = true - end - - macro = find_attached_macro - if macro - txt = macro.expand([caller_method, *call_params], statement.source) - @docstring += "\n" + txt - - # macro may have a directive - return register_docstring(nil) if !attaching && txt.match(/^\s*@!/) - elsif !statement.comments_hash_flag && !implicit_docstring? - return register_docstring(nil) - end - - # ignore DSL definitions if @method/@attribute directive is used - if @docstring =~ /^@!?(method|attribute)\b/ - return register_docstring(nil) - end - - register MethodObject.new(namespace, method_name, scope) do |o| - o.signature = method_signature - end - end - - def register_docstring(object, docstring = @docstring, stmt = statement) - super - end - - private - - def implicit_docstring? - tags = %w(method attribute overload visibility scope return) - tags.any? {|tag| @docstring =~ /^@!?#{tag}\b/ } - end - - def method_name - name = call_params.first || "" - if name =~ /^#{CodeObjects::METHODNAMEMATCH}$/ - name - else - raise UndocumentableError, "method, missing name" - end - end - - def method_signature - "def #{method_name}" - end - - def find_attached_macro - Registry.all(:macro).each do |macro| - next unless macro.method_object - next unless macro_name_matches(macro) - (namespace.inheritance_tree(true) + [P('Object')]).each do |obj| - return macro if obj == macro.method_object.namespace - end - end - nil - end - - # @return [Boolean] whether caller method matches a macro or - # its alias names. - def macro_name_matches(macro) - objs = [macro.method_object] - if objs.first.type != :proxy && objs.first.respond_to?(:aliases) - objs.concat(objs.first.aliases) - end - - objs.any? {|obj| obj.name.to_s == caller_method.to_s } - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/exception_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/exception_handler.rb deleted file mode 100644 index 8e4d1cf932..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/exception_handler.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true -# Handles 'raise' calls inside methods -class YARD::Handlers::Ruby::ExceptionHandler < YARD::Handlers::Ruby::Base - handles method_call(:raise) - - process do - return unless owner.is_a?(MethodObject) # Only methods yield - return if [:command_call, :call].include? statement.type - return if owner.has_tag?(:raise) - - klass = nil - if statement.call? - params = statement.parameters(false) - if params.size == 1 - if params.first.ref? && params.first.first.type != :ident - klass = params.first.source - elsif params.first.call? && params.first.method_name(true) == :new - klass = params.first.namespace.source - end - elsif params.size > 1 - klass = params.first.source - end - end - - owner.add_tag YARD::Tags::Tag.new(:raise, '', klass) if klass - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/extend_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/extend_handler.rb deleted file mode 100644 index e07f498788..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/extend_handler.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true -# Handles 'extend' call to include modules into the class scope of another -# @see MixinHandler -class YARD::Handlers::Ruby::ExtendHandler < YARD::Handlers::Ruby::MixinHandler - handles method_call(:extend) - namespace_only - - def scope; :class end - - private - - def process_mixin(mixin) - if mixin == s(:var_ref, s(:kw, "self")) - if namespace.is_a?(ClassObject) - raise UndocumentableError, "extend(self) statement on class" - end - namespace.mixins(scope) << namespace - else - super - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/alias_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/alias_handler.rb deleted file mode 100644 index a1947fc89e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/alias_handler.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true -# (see Ruby::AliasHandler) -class YARD::Handlers::Ruby::Legacy::AliasHandler < YARD::Handlers::Ruby::Legacy::Base - handles(/\Aalias(_method)?(\s|\()/) - namespace_only - - process do - if TkALIAS === statement.tokens.first - tokens = statement.tokens[2..-1].to_s.split(/\s+/) - names = [tokens[0], tokens[1]].map {|t| t.gsub(/^:(['"])?(.+?)\1?$|^(:)(.+)/, '\2') } - else - names = tokval_list(statement.tokens[2..-1], :attr) - end - raise YARD::Parser::UndocumentableError, statement.tokens.first.text if names.size != 2 - - names = names.map {|n| Symbol === n ? n.to_s.delete('"') : n } - new_meth = names[0].to_sym - old_meth = names[1].to_sym - old_obj = namespace.child(:name => old_meth, :scope => scope) - new_obj = register MethodObject.new(namespace, new_meth, scope) do |o| - o.add_file(parser.file, statement.tokens.first.line_no, statement.comments) - end - - if old_obj - new_obj.signature = old_obj.signature - new_obj.source = old_obj.source - new_obj.docstring = old_obj.docstring + YARD::Docstring.new(statement.comments) - new_obj.docstring.line_range = statement.comments_range - new_obj.docstring.hash_flag = statement.comments_hash_flag - new_obj.docstring.object = new_obj - else - new_obj.signature = "def #{new_meth}" # this is all we know. - end - - namespace.aliases[new_obj] = old_meth - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/attribute_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/attribute_handler.rb deleted file mode 100644 index 74a7b9db5e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/attribute_handler.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true -# (see Ruby::AttributeHandler) -class YARD::Handlers::Ruby::Legacy::AttributeHandler < YARD::Handlers::Ruby::Legacy::Base - handles(/\Aattr(?:_(?:reader|writer|accessor))?(?:\s|\()/) - namespace_only - - process do - begin - attr_type = statement.tokens.first.text.to_sym - symbols = tokval_list statement.tokens[2..-1], :attr, TkTRUE, TkFALSE - read = true - write = false - rescue SyntaxError - raise YARD::Parser::UndocumentableError, attr_type - end - - # Change read/write based on attr_reader/writer/accessor - case attr_type - when :attr - # In the case of 'attr', the second parameter (if given) isn't a symbol. - write = symbols.pop if symbols.size == 2 - when :attr_accessor - write = true - when :attr_reader - # change nothing - when :attr_writer - read = false - write = true - end - - # Add all attributes - symbols.each do |name| - namespace.attributes[scope][name] = SymbolHash[:read => nil, :write => nil] - - # Show their methods as well - {:read => name, :write => "#{name}="}.each do |type, meth| - if type == :read ? read : write - o = MethodObject.new(namespace, meth, scope) - if type == :write - o.parameters = [['value', nil]] - src = "def #{meth}(value)" - full_src = "#{src}\n @#{name} = value\nend" - doc = "Sets the attribute #{name}\n@param value the value to set the attribute #{name} to." - else - src = "def #{meth}" - full_src = "#{src}\n @#{name}\nend" - doc = "Returns the value of attribute #{name}" - end - o.source ||= full_src - o.signature ||= src - register(o) - o.docstring = doc if o.docstring.blank?(false) - - # Regsiter the object explicitly - namespace.attributes[scope][name][type] = o - else - obj = namespace.children.find {|other| other.name == meth.to_sym && other.scope == scope } - - # register an existing method as attribute - namespace.attributes[scope][name][type] = obj if obj - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/base.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/base.rb deleted file mode 100644 index 8a00f73a63..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/base.rb +++ /dev/null @@ -1,245 +0,0 @@ -# frozen_string_literal: true -module YARD - module Handlers - module Ruby::Legacy - # This is the base handler for the legacy parser. To implement a legacy - # handler, subclass this class. - # - # @abstract (see Ruby::Base) - class Base < Handlers::Base - # For tokens like TkDEF, TkCLASS, etc. - include YARD::Parser::Ruby::Legacy::RubyToken - - # @return [Boolean] whether or not a {Parser::Ruby::Legacy::Statement} object should be handled - # by this handler. - def self.handles?(stmt) - handlers.any? do |a_handler| - case a_handler - when String - stmt.tokens.first.text == a_handler - when Regexp - stmt.tokens.to_s =~ a_handler - else - a_handler == stmt.tokens.first.class - end - end - end - - # Parses a statement's block with a set of state values. If the - # statement has no block, nothing happens. A description of state - # values can be found at {Handlers::Base#push_state} - # - # @param [Hash] opts State options - # @option opts (see Handlers::Base#push_state) - # @see Handlers::Base#push_state #push_state - def parse_block(opts = {}) - push_state(opts) do - if statement.block - blk = Parser::Ruby::Legacy::StatementList.new(statement.block) - parser.process(blk) - end - end - end - - def call_params - if statement.tokens.first.is_a?(TkDEF) - extract_method_details.last.map(&:first) - else - tokens = statement.tokens[1..-1] - tokval_list(tokens, :attr, :identifier, TkId).map(&:to_s) - end - end - - def caller_method - if statement.tokens.first.is_a?(TkIDENTIFIER) - statement.tokens.first.text - elsif statement.tokens.first.is_a?(TkDEF) - extract_method_details.first - end - end - - private - - # Extracts method information for macro expansion only - # - # @todo This is a duplicate implementation of {MethodHandler}. Refactor. - # @return [Array>>] the method name followed by method - # arguments (name and optional value) - def extract_method_details - if statement.tokens.to_s =~ /^def\s+(#{METHODMATCH})(?:(?:\s+|\s*\()(.*)(?:\)\s*$)?)?/m - meth = $1 - args = $2 - meth.gsub!(/\s+/, '') - args = tokval_list(Parser::Ruby::Legacy::TokenList.new(args), :all) - args.map! {|a| k, v = *a.split('=', 2); [k.strip, (v ? v.strip : nil)] } if args - meth = $` if meth =~ /(?:#{NSEPQ}|#{CSEPQ})([^#{NSEP}#{CSEPQ}]+)$/ - [meth, args] - end - end - - # The string value of a token. For example, the return value for the symbol :sym - # would be :sym. The return value for a string +"foo #{ bar}"+ would be the literal - # +"foo #{ bar}"+ without any interpolation. The return value of the identifier - # 'test' would be the same value: 'test'. Here is a list of common types and - # their return values: - # - # @example - # tokval(TokenList.new('"foo"').first) => "foo" - # tokval(TokenList.new(':foo').first) => :foo - # tokval(TokenList.new('CONSTANT').first, RubyToken::TkId) => "CONSTANT" - # tokval(TokenList.new('identifier').first, RubyToken::TkId) => "identifier" - # tokval(TokenList.new('3.25').first) => 3.25 - # tokval(TokenList.new('/xyz/i').first) => /xyz/i - # - # @param [Token] token The token of the class - # - # @param [Array>, Symbol] accepted_types - # The allowed token types that this token can be. Defaults to [{TkVal}]. - # A list of types would be, for example, [+TkSTRING+, +TkSYMBOL+], to return - # the token's value if it is either of those types. If +TkVal+ is accepted, - # +TkNode+ is also accepted. - # - # Certain symbol keys are allowed to specify multiple types in one fell swoop. - # These symbols are: - # :string => +TkSTRING+, +TkDSTRING+, +TkDXSTRING+ and +TkXSTRING+ - # :attr => +TkSYMBOL+ and +TkSTRING+ - # :identifier => +TkIDENTIFIER, +TkFID+ and +TkGVAR+. - # :number => +TkFLOAT+, +TkINTEGER+ - # - # @return [Object] if the token is one of the accepted types, in its real value form. - # It should be noted that identifiers and constants are kept in String form. - # @return [nil] if the token is not any of the specified accepted types - def tokval(token, *accepted_types) - accepted_types = [TkVal] if accepted_types.empty? - accepted_types.push(TkNode) if accepted_types.include? TkVal - - if accepted_types.include?(:attr) - accepted_types.push(TkSTRING, TkSYMBOL) - end - - if accepted_types.include?(:string) - accepted_types.push(TkSTRING, TkDSTRING, TkXSTRING, TkDXSTRING) - end - - if accepted_types.include?(:identifier) - accepted_types.push(TkIDENTIFIER, TkFID, TkGVAR) - end - - if accepted_types.include?(:number) - accepted_types.push(TkFLOAT, TkINTEGER) - end - - return unless accepted_types.any? {|t| t === token } - - case token - when TkSTRING, TkDSTRING, TkXSTRING, TkDXSTRING - token.text[1..-2] - when TkSYMBOL - token.text[1..-1].to_sym - when TkFLOAT - token.text.to_f - when TkINTEGER - token.text.to_i - when TkREGEXP - token.text =~ %r{\A/(.+)/([^/])\Z} - Regexp.new($1, $2) - when TkTRUE - true - when TkFALSE - false - when TkNIL - nil - else - token.text - end - end - - # Returns a list of symbols or string values from a statement. - # The list must be a valid comma delimited list, and values - # will only be returned to the end of the list only. - # - # Example: - # attr_accessor :a, 'b', :c, :d => ['a', 'b', 'c', 'd'] - # attr_accessor 'a', UNACCEPTED_TYPE, 'c' => ['a', 'c'] - # - # The tokval list of a {Parser::Ruby::Legacy::TokenList} of the above - # code would be the {#tokval} value of :a, 'b', - # :c and :d. - # - # It should also be noted that this function stops immediately at - # any ruby keyword encountered: - # "attr_accessor :a, :b, :c if x == 5" => ['a', 'b', 'c'] - # - # @param [TokenList] tokenlist The list of tokens to process. - # @param [Array>] accepted_types passed to {#tokval} - # @return [Array] the list of tokvalues in the list. - # @return [Array] if there are no symbols or Strings in the list - # @see #tokval - def tokval_list(tokenlist, *accepted_types) - return [] unless tokenlist - out = [[]] - parencount = 0 - beforeparen = 0 - needcomma = false - seen_comma = true - tokenlist.each do |token| - tokval = accepted_types == [:all] ? token.text : tokval(token, *accepted_types) - parencond = !out.last.empty? && !tokval.nil? - # puts "#{seen_comma.inspect} #{parencount} #{token.class.class_name} #{out.inspect}" - case token - when TkCOMMA - if parencount == 0 - out << [] unless out.last.empty? - needcomma = false - seen_comma = true - elsif parencond - out.last << token.text - end - when TkLPAREN - if seen_comma - beforeparen += 1 - else - parencount += 1 - out.last << token.text if parencond - end - when TkRPAREN - if beforeparen > 0 - beforeparen -= 1 - else - out.last << token.text if parencount > 0 && !tokval.nil? - parencount -= 1 - end - when TkLBRACE, TkLBRACK, TkDO - parencount += 1 - out.last << token.text unless tokval.nil? - when TkRBRACE, TkRBRACK, TkEND - out.last << token.text unless tokval.nil? - parencount -= 1 - else - break if TkKW === token && ![TkTRUE, TkFALSE, TkSUPER, TkSELF, TkNIL].include?(token.class) - - seen_comma = false unless TkWhitespace === token - if parencount == 0 - next if needcomma - next if TkWhitespace === token - if !tokval.nil? - out.last << tokval - else - out.last.clear - needcomma = true - end - elsif parencond - needcomma = true - out.last << token.text - end - end - - break if beforeparen == 0 && parencount < 0 - end - # Flatten any single element lists - out.map {|e| e.empty? ? nil : (e.size == 1 ? e.pop : e.flatten.join) }.compact - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/class_condition_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/class_condition_handler.rb deleted file mode 100644 index ef79b7479b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/class_condition_handler.rb +++ /dev/null @@ -1,83 +0,0 @@ -# frozen_string_literal: true -# (see Ruby::ClassConditionHandler) -# @since 0.5.4 -class YARD::Handlers::Ruby::Legacy::ClassConditionHandler < YARD::Handlers::Ruby::Legacy::Base - namespace_only - handles TkIF, TkELSIF, TkUNLESS - - process do - condition = parse_condition - if condition.nil? - # Parse both blocks if we're unsure of the condition - parse_then_block - parse_else_block - elsif condition - parse_then_block - else - parse_else_block - end - end - - protected - - # Parses the condition part of the if/unless statement - # - # @return [true, false, nil] true if the condition can be definitely - # parsed to true, false if not, and nil if the condition cannot be - # parsed with certainty (it's dynamic) - # @since 0.5.5 - def parse_condition - condition = nil - - # Right now we can handle very simple unary conditions like: - # if true - # if false - # if 0 - # if 100 (not 0) - # if defined? SOME_CONSTANT - # - # The last case will do a lookup in the registry and then one - # in the Ruby world (using eval). - case statement.tokens[1..-1].to_s.strip - when /^(\d+)$/ - condition = $1 != "0" - when /^defined\?\s*\(?\s*([A-Za-z0-9:_]+?)\s*\)?$/ - # defined? keyword used, let's see if we can look up the name - # in the registry, then we'll try using Ruby's powers. eval() is not - # *too* dangerous here since code is not actually executed. - name = $1 - obj = YARD::Registry.resolve(namespace, name, true) - begin - condition = true if obj || Object.instance_eval("defined? #{name}") - rescue SyntaxError, NameError - condition = false - end - when "true" - condition = true - when "false" - condition = false - end - - if TkUNLESS === statement.tokens.first - condition = !condition unless condition.nil? - end - condition - end - - # @since 0.5.5 - def parse_then_block - parse_block(:visibility => visibility) - end - - # @since 0.5.5 - def parse_else_block - return unless statement.block - stmtlist = YARD::Parser::Ruby::Legacy::StatementList - stmtlist.new(statement.block).each do |stmt| - next unless TkELSE === stmt.tokens.first - push_state(:visibility => visibility) do - parser.process(stmtlist.new(stmt.block)) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/class_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/class_handler.rb deleted file mode 100644 index b0729b8e44..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/class_handler.rb +++ /dev/null @@ -1,113 +0,0 @@ -# frozen_string_literal: true -# (see Ruby::ClassHandler) -class YARD::Handlers::Ruby::Legacy::ClassHandler < YARD::Handlers::Ruby::Legacy::Base - include YARD::Handlers::Ruby::StructHandlerMethods - handles TkCLASS - namespace_only - - process do - if statement.tokens.to_s =~ /^class\s+(#{NAMESPACEMATCH})\s*(?:<\s*(.+)|\Z)/m - classname = $1 - superclass_def = $2 - superclass = parse_superclass($2) - classname = classname.gsub(/\s/, '') - if superclass == "Struct" - is_a_struct = true - superclass = struct_superclass_name(superclass_def) - create_struct_superclass(superclass, superclass_def) - end - undocsuper = superclass_def && superclass.nil? - - klass = register ClassObject.new(namespace, classname) do |o| - o.superclass = superclass if superclass - o.superclass.type = :class if o.superclass.is_a?(Proxy) - end - if is_a_struct - parse_struct_subclass(klass, superclass_def) - elsif klass - create_attributes(klass, members_from_tags(klass)) - end - parse_block(:namespace => klass) - - if undocsuper - raise YARD::Parser::UndocumentableError, 'superclass (class was added without superclass)' - end - elsif statement.tokens.to_s =~ /^class\s*<<\s*([\w\:\s]+)/ - classname = $1.gsub(/\s/, '') - proxy = Proxy.new(namespace, classname) - - # Allow constants to reference class names - if ConstantObject === proxy - if proxy.value =~ /\A#{NAMESPACEMATCH}\Z/ - proxy = Proxy.new(namespace, proxy.value) - else - raise YARD::Parser::UndocumentableError, "constant class reference '#{classname}'" - end - end - - if classname == "self" - parse_block(:namespace => namespace, :scope => :class) - elsif classname[0, 1] =~ /[A-Z]/ - register ClassObject.new(namespace, classname) if Proxy === proxy - parse_block(:namespace => proxy, :scope => :class) - else - raise YARD::Parser::UndocumentableError, "class '#{classname}'" - end - else - raise YARD::Parser::UndocumentableError, "class: #{statement.tokens}" - end - end - - private - - # Extracts the parameter list from the Struct.new declaration and returns it - # formatted as a list of member names. Expects the user will have used symbols - # to define the struct member names - # - # @param [String] superstring the string declaring the superclass - # @return [Array] a list of member names - def extract_parameters(superstring) - paramstring = superstring.match(/\A(O?Struct)\.new\((.*?)\)/)[2] - paramstring.split(",").select {|x| x.strip[0, 1] == ":" }.map {|x| x.strip[1..-1] } # the 1..-1 chops the leading : - end - - def create_struct_superclass(superclass, superclass_def) - return if superclass == "Struct" - the_super = register ClassObject.new(P("Struct"), superclass[8..-1]) do |o| - o.superclass = "Struct" - end - parse_struct_subclass(the_super, superclass_def) - the_super - end - - def struct_superclass_name(superclass) - match = superclass.match(/\A(Struct)\.new\((.*?)\)/) - if match - paramstring = match[2].split(",") - first = paramstring.first.strip - if first[0, 1] =~ /['"]/ && first[-1, 1] =~ /['"]/ && first !~ /\#\{/ - return "Struct::#{first[1..-2]}" - end - end - "Struct" - end - - def parse_struct_subclass(klass, superclass_def) - # Bounce if there's no parens - return unless superclass_def =~ /O?Struct\.new\((.*?)\)/ - members = extract_parameters(superclass_def) - create_attributes(klass, members) - end - - def parse_superclass(superclass) - case superclass - when /\A(#{NAMESPACEMATCH})(?:\s|\Z)/, - /\A(Struct|OStruct)\.new/, - /\ADelegateClass\((.+?)\)\s*\Z/, - /\A(#{NAMESPACEMATCH})\(/ - $1 - when "self" - namespace.path - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/class_variable_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/class_variable_handler.rb deleted file mode 100644 index 79b586dfa0..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/class_variable_handler.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true -# (see Ruby::ClassVariableHandler) -class YARD::Handlers::Ruby::Legacy::ClassVariableHandler < YARD::Handlers::Ruby::Legacy::Base - HANDLER_MATCH = /\A@@\w+\s*=\s*/m - handles HANDLER_MATCH - namespace_only - - process do - name, value = *statement.tokens.to_s.split(/\s*=\s*/, 2) - register ClassVariableObject.new(namespace, name) do |o| - o.source = statement - o.value = value.strip - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/comment_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/comment_handler.rb deleted file mode 100644 index 1a0be2c9b9..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/comment_handler.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true -# (see Ruby::CommentHandler) -class YARD::Handlers::Ruby::Legacy::CommentHandler < YARD::Handlers::Ruby::Legacy::Base - handles TkCOMMENT - namespace_only - - process do - register_docstring(nil) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/constant_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/constant_handler.rb deleted file mode 100644 index aedfc24627..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/constant_handler.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true -# (see Ruby::ConstantHandler) -class YARD::Handlers::Ruby::Legacy::ConstantHandler < YARD::Handlers::Ruby::Legacy::Base - include YARD::Handlers::Ruby::StructHandlerMethods - HANDLER_MATCH = /\A[A-Z]\w*\s*=[^=]\s*/m - handles HANDLER_MATCH - namespace_only - - process do - name, value = *statement.tokens.to_s.split(/\s*=\s*/, 2) - if value =~ /\A\s*Struct.new(?:\s*\(?|\b)/ - process_structclass(name, $') - else - register ConstantObject.new(namespace, name) {|o| o.source = statement; o.value = value.strip } - end - end - - private - - def process_structclass(classname, parameters) - klass = create_class(classname, P(:Struct)) - create_attributes(klass, extract_parameters(parameters)) - end - - def extract_parameters(parameters) - members = tokval_list(YARD::Parser::Ruby::Legacy::TokenList.new(parameters), TkSYMBOL) - members.map(&:to_s) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/dsl_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/dsl_handler.rb deleted file mode 100644 index 502fca34de..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/dsl_handler.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true -module YARD - module Handlers - module Ruby - module Legacy - # (see Ruby::DSLHandler) - class DSLHandler < Base - include CodeObjects - include DSLHandlerMethods - handles TkIDENTIFIER - namespace_only - process { handle_comments } - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/exception_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/exception_handler.rb deleted file mode 100644 index 4c2f9c6e7a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/exception_handler.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true -# (see Ruby::ExceptionHandler) -class YARD::Handlers::Ruby::Legacy::ExceptionHandler < YARD::Handlers::Ruby::Legacy::Base - handles(/\Araise(\s|\(|\Z)/) - - process do - return unless owner.is_a?(MethodObject) # Only methods yield - return if owner.has_tag?(:raise) - - klass = statement.tokens.to_s[/^raise[\(\s]*(#{NAMESPACEMATCH})\s*(?:\)|,|\s(?:if|unless|until)|;|(?:(?:\.|\:\:)\s*)?new|$)/, 1] - owner.add_tag YARD::Tags::Tag.new(:raise, '', klass) if klass - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/extend_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/extend_handler.rb deleted file mode 100644 index dfb0f8cf83..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/extend_handler.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true -# (see Ruby::ExtendHandler) -class YARD::Handlers::Ruby::Legacy::ExtendHandler < YARD::Handlers::Ruby::Legacy::MixinHandler - handles(/\Aextend(\s|\()/) - namespace_only - - def scope; :class end - - private - - def process_mixin(mixin) - if mixin == "self" - if namespace.is_a?(ClassObject) - raise UndocumentableError, "extend(self) statement on class" - end - namespace.mixins(scope) << namespace - else - super - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/method_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/method_handler.rb deleted file mode 100644 index aac740422b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/method_handler.rb +++ /dev/null @@ -1,90 +0,0 @@ -# frozen_string_literal: true -# (see Ruby::MethodHandler) -class YARD::Handlers::Ruby::Legacy::MethodHandler < YARD::Handlers::Ruby::Legacy::Base - handles TkDEF - - process do - nobj = namespace - mscope = scope - - if statement.tokens.to_s =~ /^def\s+(#{METHODMATCH})(?:(?:\s+|\s*\()(.*)(?:\)\s*$)?)?/m - meth = $1 - args = $2 - meth.gsub!(/\s+/, '') - args = tokval_list(YARD::Parser::Ruby::Legacy::TokenList.new(args), :all) - args.map! do |a| - k, v, r = *a.split(/(:)|=/, 2) - if r - k += v - v = r - end - [k.strip, (v ? v.strip : nil)] - end if args - else - raise YARD::Parser::UndocumentableError, "method: invalid name" - end - - # Class method if prefixed by self(::|.) or Module(::|.) - if meth =~ /(?:#{NSEPQ}|#{CSEPQ})([^#{NSEP}#{CSEPQ}]+)$/ - mscope = :class - meth = $1 - prefix = $` - if prefix =~ /^[a-z]/ && prefix != "self" - raise YARD::Parser::UndocumentableError, 'method defined on object instance' - end - nobj = P(namespace, prefix) unless prefix == "self" - end - - nobj = P(namespace, nobj.value) while nobj.type == :constant - obj = register MethodObject.new(nobj, meth, mscope) do |o| - o.explicit = true - o.parameters = args - end - - # delete any aliases referencing old method - nobj.aliases.each do |aobj, name| - next unless name == obj.name - nobj.aliases.delete(aobj) - end if nobj.is_a?(NamespaceObject) - - if mscope == :instance && meth == "initialize" - unless obj.has_tag?(:return) - obj.add_tag(YARD::Tags::Tag.new(:return, - "a new instance of #{namespace.name}", namespace.name.to_s)) - end - elsif mscope == :class && obj.docstring.blank? && %w(inherited included - extended method_added method_removed method_undefined).include?(meth) - obj.add_tag(YARD::Tags::Tag.new(:private, nil)) - elsif meth.to_s =~ /\?$/ - if obj.tag(:return) && (obj.tag(:return).types || []).empty? - obj.tag(:return).types = ['Boolean'] - elsif obj.tag(:return).nil? - unless obj.tags(:overload).any? {|overload| overload.tag(:return) } - obj.add_tag(YARD::Tags::Tag.new(:return, "", "Boolean")) - end - end - end - - if obj.has_tag?(:option) - # create the options parameter if its missing - obj.tags(:option).each do |option| - expected_param = option.name - unless obj.tags(:param).find {|x| x.name == expected_param } - new_tag = YARD::Tags::Tag.new(:param, "a customizable set of options", "Hash", expected_param) - obj.add_tag(new_tag) - end - end - end - - info = obj.attr_info - if info - if meth.to_s =~ /=$/ # writer - info[:write] = obj if info[:read] - elsif info[:write] - info[:read] = obj - end - end - - parse_block(:owner => obj) # mainly for yield/exceptions - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/mixin_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/mixin_handler.rb deleted file mode 100644 index 718d3807c0..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/mixin_handler.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true -# (see Ruby::MixinHandler) -class YARD::Handlers::Ruby::Legacy::MixinHandler < YARD::Handlers::Ruby::Legacy::Base - handles(/\Ainclude(\s|\()/) - namespace_only - - process do - errors = [] - statement.tokens[1..-1].to_s.split(/\s*,\s*/).reverse.each do |mixin| - mixin = mixin.strip - begin - process_mixin(mixin) - rescue YARD::Parser::UndocumentableError => err - errors << err.message - end - end - - unless errors.empty? - msg = errors.size == 1 ? ": #{errors[0]}" : "s: #{errors.join(", ")}" - raise YARD::Parser::UndocumentableError, "mixin#{msg} for class #{namespace.path}" - end - end - - private - - def process_mixin(mixin) - mixmatch = mixin[/\A(#{NAMESPACEMATCH})/, 1] - raise YARD::Parser::UndocumentableError unless mixmatch - - case obj = Proxy.new(namespace, mixmatch) - when ConstantObject # If a constant is included, use its value as the real object - obj = Proxy.new(namespace, obj.value, :module) - else - obj = Proxy.new(namespace, mixmatch, :module) - end - - namespace.mixins(scope).unshift(obj) unless namespace.mixins(scope).include?(obj) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/module_function_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/module_function_handler.rb deleted file mode 100644 index e245a3d425..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/module_function_handler.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true -# (see Ruby::ModuleFunctionHandler) -class YARD::Handlers::Ruby::Legacy::ModuleFunctionHandler < YARD::Handlers::Ruby::Legacy::Base - handles(/\A(module_function)(\s|\(|$)/) - namespace_only - - process do - if statement.tokens.size == 1 - self.scope = :module - else - tokval_list(statement.tokens[2..-1], :attr).each do |name| - instance_method = MethodObject.new(namespace, name) - class_method = MethodObject.new(namespace, name, :module) - instance_method.copy_to(class_method) - class_method.visibility = :public - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/module_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/module_handler.rb deleted file mode 100644 index ed1b48f932..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/module_handler.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true -# (see Ruby::ModuleHandler) -class YARD::Handlers::Ruby::Legacy::ModuleHandler < YARD::Handlers::Ruby::Legacy::Base - handles TkMODULE - namespace_only - - process do - modname = statement.tokens.to_s[/^module\s+(#{NAMESPACEMATCH})/, 1] - mod = register ModuleObject.new(namespace, modname) - parse_block(:namespace => mod) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/private_class_method_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/private_class_method_handler.rb deleted file mode 100644 index da41c3f4c2..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/private_class_method_handler.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true -# (see Ruby::PrivateClassMethodHandler) -class YARD::Handlers::Ruby::Legacy::PrivateClassMethodHandler < YARD::Handlers::Ruby::Legacy::Base - handles(/\Aprivate_class_method(\s|\(|$)/) - namespace_only - - process do - tokval_list(statement.tokens[2..-1], :attr).each do |name| - privatize_class_method name - end - end - - private - - def privatize_class_method(name) - method = Proxy.new(namespace, name) - ensure_loaded!(method) - method.visibility = :private - rescue YARD::Handlers::NamespaceMissingError - raise UndocumentableError, "private visibility set on unrecognized method: #{name}" - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/private_constant_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/private_constant_handler.rb deleted file mode 100644 index 52b1aa2b79..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/private_constant_handler.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true -# (see Ruby::PrivateConstantHandler) -class YARD::Handlers::Ruby::Legacy::PrivateConstantHandler < YARD::Handlers::Ruby::Legacy::Base - handles(/\Aprivate_constant(\s|\(|$)/) - namespace_only - - process do - tokval_list(statement.tokens[2..-1], :attr, TkCONSTANT).each do |name| - privatize_constant name - end - end - - private - - def privatize_constant(name) - const = Proxy.new(namespace, name) - ensure_loaded!(const) - const.visibility = :private - rescue NamespaceMissingError - raise UndocumentableError, "private visibility set on unrecognized constant: #{name}" - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/visibility_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/visibility_handler.rb deleted file mode 100644 index 62ec9e3817..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/visibility_handler.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true -# (see Ruby::VisibilityHandler) -class YARD::Handlers::Ruby::Legacy::VisibilityHandler < YARD::Handlers::Ruby::Legacy::Base - handles(/\A(protected|private|public)(\s|\(|$)/) - namespace_only - - process do - vis = statement.tokens.first.text - if statement.tokens.size == 1 - self.visibility = vis - else - tokval_list(statement.tokens[2..-1], :attr).each do |name| - MethodObject.new(namespace, name, scope) {|o| o.visibility = vis } - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/yield_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/yield_handler.rb deleted file mode 100644 index 61933ab8b0..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/legacy/yield_handler.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true -# (see Ruby::YieldHandler) -class YARD::Handlers::Ruby::Legacy::YieldHandler < YARD::Handlers::Ruby::Legacy::Base - handles TkYIELD - - process do - return unless owner.is_a?(MethodObject) # Only methods yield - return if owner.has_tag? :yield # Don't override yield tags - return if owner.has_tag? :yieldparam # Same thing. - - yieldtag = YARD::Tags::Tag.new(:yield, "", []) - tokval_list(statement.tokens[2..-1], Token).each do |item| - item = item.inspect unless item.is_a?(String) - if item == "self" - yieldtag.types << '_self' - owner.add_tag YARD::Tags::Tag.new(:yieldparam, - "the object that the method was called on", owner.namespace.path, '_self') - elsif item == "super" - yieldtag.types << '_super' - owner.add_tag YARD::Tags::Tag.new(:yieldparam, - "the result of the method from the superclass", nil, '_super') - else - yieldtag.types << item - end - end - - owner.add_tag(yieldtag) unless yieldtag.types.empty? - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/method_condition_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/method_condition_handler.rb deleted file mode 100644 index 952b9af86d..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/method_condition_handler.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true -# Handles a conditional inside a method -class YARD::Handlers::Ruby::MethodConditionHandler < YARD::Handlers::Ruby::Base - handles :if_mod, :unless_mod - - process do - parse_block(statement.then_block, :owner => owner) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/method_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/method_handler.rb deleted file mode 100644 index f9de11a005..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/method_handler.rb +++ /dev/null @@ -1,104 +0,0 @@ -# frozen_string_literal: true -# Handles a method definition -class YARD::Handlers::Ruby::MethodHandler < YARD::Handlers::Ruby::Base - include YARD::Handlers::Common::MethodHandler - - handles :def, :defs - - process do - meth = statement.method_name(true).to_s - args = format_args - blk = statement.block - nobj = namespace - mscope = scope - if statement.type == :defs - if statement[0][0].type == :ident - raise YARD::Parser::UndocumentableError, 'method defined on object instance' - end - nobj = P(namespace, statement[0].source) if statement[0][0].type == :const - mscope = :class - end - - nobj = P(namespace, nobj.value) while nobj.type == :constant - obj = register MethodObject.new(nobj, meth, mscope) do |o| - o.explicit = true - o.parameters = args - end - - # delete any aliases referencing old method - nobj.aliases.each do |aobj, name| - next unless name == obj.name - nobj.aliases.delete(aobj) - end if nobj.is_a?(NamespaceObject) - - if obj.constructor? - unless obj.has_tag?(:return) - obj.add_tag(YARD::Tags::Tag.new(:return, - "a new instance of #{namespace.name}", namespace.name.to_s)) - end - elsif mscope == :class && obj.docstring.blank? && %w(inherited included - extended method_added method_removed method_undefined).include?(meth) - obj.add_tag(YARD::Tags::Tag.new(:private, nil)) - elsif meth.to_s =~ /\?$/ - add_predicate_return_tag(obj) - end - - if obj.has_tag?(:option) - # create the options parameter if its missing - obj.tags(:option).each do |option| - expected_param = option.name - unless obj.tags(:param).find {|x| x.name == expected_param } - new_tag = YARD::Tags::Tag.new(:param, "a customizable set of options", "Hash", expected_param) - obj.add_tag(new_tag) - end - end - end - - info = obj.attr_info - if info - if meth.to_s =~ /=$/ # writer - info[:write] = obj if info[:read] - elsif info[:write] - info[:read] = obj - end - end - - parse_block(blk, :owner => obj) # mainly for yield/exceptions - end - - def format_args - args = statement.parameters - - params = [] - - if args.unnamed_required_params - params += args.unnamed_required_params.map {|a| [a.source, nil] } - end - - if args.unnamed_optional_params - params += args.unnamed_optional_params.map do |a| - [a[0].source, a[1].source] - end - end - - params << ['*' + args.splat_param.source, nil] if args.splat_param - - if args.unnamed_end_params - params += args.unnamed_end_params.map {|a| [a.source, nil] } - end - - if args.named_params - params += args.named_params.map do |a| - [a[0].source, a[1] ? a[1].source : nil] - end - end - - if args.double_splat_param - params << ['**' + args.double_splat_param.source, nil] - end - - params << ['&' + args.block_param.source, nil] if args.block_param - - params - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/mixin_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/mixin_handler.rb deleted file mode 100644 index f67ebd7a43..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/mixin_handler.rb +++ /dev/null @@ -1,52 +0,0 @@ -# frozen_string_literal: true -# Handles the 'include' statement to mixin a module in the instance scope -class YARD::Handlers::Ruby::MixinHandler < YARD::Handlers::Ruby::Base - handles method_call(:include) - handles method_call(:prepend) - namespace_only - - process do - errors = [] - statement.parameters(false).reverse.each do |mixin| - begin - process_mixin(mixin) - rescue YARD::Parser::UndocumentableError => err - errors << err.message - end - end - unless errors.empty? - msg = errors.size == 1 ? ": #{errors[0]}" : "s: #{errors.join(", ")}" - raise YARD::Parser::UndocumentableError, "mixin#{msg} for class #{namespace.path}" - end - end - - protected - - def process_mixin(mixin) - raise YARD::Parser::UndocumentableError unless mixin.ref? - raise YARD::Parser::UndocumentableError if mixin.first.type == :ident - - case obj = Proxy.new(namespace, mixin.source) - when ConstantObject # If a constant is included, use its value as the real object - obj = Proxy.new(namespace, obj.value, :module) - else - obj = Proxy.new(namespace, mixin.source, :module) - end - - rec = recipient(mixin) - return if rec.nil? || rec.mixins(scope).include?(obj) - - shift = statement.method_name(true) == :include ? :unshift : :push - rec.mixins(scope).send(shift, obj) - end - - def recipient(mixin) - if statement[0].type == :var_ref && statement[0][0] != s(:kw, "self") - statement[0][0].type == :const ? - Proxy.new(namespace, statement.namespace.source) : - nil - else - namespace - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/module_function_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/module_function_handler.rb deleted file mode 100644 index 9d4030f58e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/module_function_handler.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true -# Handles module_function calls to turn methods into public class methods. -# Also creates a private instance copy of the method. -class YARD::Handlers::Ruby::ModuleFunctionHandler < YARD::Handlers::Ruby::Base - handles method_call(:module_function) - namespace_only - - process do - return if statement.jump(:ident) == statement - case statement.type - when :var_ref, :vcall - self.scope = :module - when :fcall, :command - statement[1].traverse do |node| - case node.type - when :symbol; name = node.first.source - when :string_content; name = node.source - else next - end - instance_method = MethodObject.new(namespace, name) - class_method = MethodObject.new(namespace, name, :module) - instance_method.copy_to(class_method) - class_method.visibility = :public - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/module_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/module_handler.rb deleted file mode 100644 index d66d3efe38..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/module_handler.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true -# Handles the declaration of a module -class YARD::Handlers::Ruby::ModuleHandler < YARD::Handlers::Ruby::Base - handles :module - namespace_only - - process do - modname = statement[0].source - mod = register ModuleObject.new(namespace, modname) - parse_block(statement[1], :namespace => mod) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/private_class_method_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/private_class_method_handler.rb deleted file mode 100644 index ea5365abc7..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/private_class_method_handler.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true -# Sets visibility of a class method to private. -class YARD::Handlers::Ruby::PrivateClassMethodHandler < YARD::Handlers::Ruby::Base - include YARD::Handlers::Ruby::DecoratorHandlerMethods - - handles method_call(:private_class_method) - namespace_only - - process do - process_decorator :scope => :class do |method| - method.visibility = :private if method.respond_to? :visibility= - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/private_constant_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/private_constant_handler.rb deleted file mode 100644 index 2f7cbb2758..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/private_constant_handler.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true -module YARD - module Handlers - module Ruby - # Sets visibility of a constant (class, module, const) - class PrivateConstantHandler < YARD::Handlers::Ruby::Base - handles method_call(:private_constant) - namespace_only - - process do - errors = [] - statement.parameters.each do |param| - next unless AstNode === param - begin - privatize_constant(param) - rescue UndocumentableError => err - errors << err.message - end - end - unless errors.empty? - msg = errors.size == 1 ? ": #{errors[0]}" : "s: #{errors.join(", ")}" - raise UndocumentableError, "private constant#{msg} for #{namespace.path}" - end - end - - private - - def privatize_constant(node) - if node.literal? || (node.type == :var_ref && node[0].type == :const) - node = node.jump(:tstring_content, :const) - const = Proxy.new(namespace, node[0]) - ensure_loaded!(const) - const.visibility = :private - else - raise UndocumentableError, "invalid argument to private_constant: #{node.source}" - end - rescue NamespaceMissingError - raise UndocumentableError, "private visibility set on unrecognized constant: #{node[0]}" - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/public_class_method_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/public_class_method_handler.rb deleted file mode 100644 index 83c5271652..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/public_class_method_handler.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true -# Sets visibility of a class method to public. -class YARD::Handlers::Ruby::PublicClassMethodHandler < YARD::Handlers::Ruby::Base - include YARD::Handlers::Ruby::DecoratorHandlerMethods - - handles method_call(:public_class_method) - namespace_only - - process do - process_decorator :scope => :class do |method| - method.visibility = :public if method.respond_to? :visibility - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/struct_handler_methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/struct_handler_methods.rb deleted file mode 100644 index d23b2ad3a6..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/struct_handler_methods.rb +++ /dev/null @@ -1,143 +0,0 @@ -# frozen_string_literal: true -# Helper methods to parse @attr_* tags on a class. -# -# @deprecated The use of +@attr+ tags are deprecated since 0.8.0 in favour of -# the +@!attribute+ directive. This module should not be relied on. -# @since 0.5.6 -module YARD::Handlers::Ruby::StructHandlerMethods - include YARD::CodeObjects - - # Extracts the user's defined @member tag for a given class and its member. Returns - # nil if the user did not define a @member tag for this struct entry. - # - # @param [ClassObject] klass the class whose tags we're searching - # @param [String] member the name of the struct member we need - # @param [Symbol] type reader method, or writer method? - # @return [Tags::Tag, nil] the tag matching the request, or nil if not found - def member_tag_for_member(klass, member, type = :read) - specific_tag = type == :read ? :attr_reader : :attr_writer - (klass.tags(specific_tag) + klass.tags(:attr)).find {|tag| tag.name == member } - end - - # Retrieves all members defined in @attr* tags - # - # @param [ClassObject] klass the class with the attributes - # @return [Array] the list of members defined as attributes on the class - def members_from_tags(klass) - tags = klass.tags(:attr) + klass.tags(:attr_reader) + klass.tags(:attr_writer) - tags.map(&:name).uniq - end - - # Determines whether to create an attribute method based on the class's - # tags. - # - # @param [ClassObject] klass the class whose tags we're searching - # @param [String] member the name of the struct member we need - # @param [Symbol] type (:read) reader method, or writer method? - # @return [Boolean] should the attribute be created? - def create_member_method?(klass, member, type = :read) - return true if (klass.tags(:attr) + klass.tags(:attr_reader) + klass.tags(:attr_writer)).empty? - return true if member_tag_for_member(klass, member, type) - return !member_tag_for_member(klass, member, :write) if type == :read - !member_tag_for_member(klass, member, :read) - end - - # Gets the return type for the member in a nicely formatted string. Used - # to be injected into auto-generated docstrings. - # - # @param [Tags::Tag] member_tag the tag object to check for types - # @return [String] the user-declared type of the struct member, or [Object] if - # the user did not define a type for this member. - def return_type_from_tag(member_tag) - member_tag && member_tag.types ? member_tag.types : "Object" - end - - # Creates the auto-generated docstring for the getter method of a struct's - # member. This is used so the generated documentation will look just like that - # of an attribute defined using attr_accessor. - # - # @param [ClassObject] klass the class whose members we're working with - # @param [String] member the name of the member we're generating documentation for - # @return [String] a docstring to be attached to the getter method for this member - def add_reader_tags(klass, new_method, member) - member_tag = member_tag_for_member(klass, member, :read) - return_type = return_type_from_tag(member_tag) - getter_doc_text = member_tag ? member_tag.text : "Returns the value of attribute #{member}" - new_method.docstring.replace(getter_doc_text) - new_method.add_tag YARD::Tags::Tag.new(:return, "the current value of #{member}", return_type) - end - - # Creates the auto-generated docstring for the setter method of a struct's - # member. This is used so the generated documentation will look just like that - # of an attribute defined using attr_accessor. - # - # @param [ClassObject] klass the class whose members we're working with - # @param [String] member the name of the member we're generating documentation for - # @return [String] a docstring to be attached to the setter method for this member - def add_writer_tags(klass, new_method, member) - member_tag = member_tag_for_member(klass, member, :write) - return_type = return_type_from_tag(member_tag) - setter_doc_text = member_tag ? member_tag.text : "Sets the attribute #{member}" - new_method.docstring.replace(setter_doc_text) - new_method.add_tag YARD::Tags::Tag.new(:param, "the value to set the attribute #{member} to.", return_type, "value") - new_method.add_tag YARD::Tags::Tag.new(:return, "the newly set value", return_type) - end - - # Creates and registers a class object with the given name and superclass name. - # Returns it for further use. - # - # @param [String] classname the name of the class - # @param [String] superclass the name of the superclass - # @return [ClassObject] the class object for further processing/method attaching - def create_class(classname, superclass) - register ClassObject.new(namespace, classname) do |o| - o.superclass = superclass if superclass - o.superclass.type = :class if o.superclass.is_a?(Proxy) - end - end - - # Creates the setter (writer) method and attaches it to the class as an attribute. - # Also sets up the docstring to prettify the documentation output. - # - # @param [ClassObject] klass the class to attach the method to - # @param [String] member the name of the member we're generating a method for - def create_writer(klass, member) - # We want to convert these members into attributes just like - # as if they were declared using attr_accessor. - new_meth = register MethodObject.new(klass, "#{member}=", :instance) do |o| - o.parameters = [['value', nil]] - o.signature ||= "def #{member}=(value)" - o.source ||= "#{o.signature}\n @#{member} = value\nend" - end - add_writer_tags(klass, new_meth, member) - klass.attributes[:instance][member][:write] = new_meth - end - - # Creates the getter (reader) method and attaches it to the class as an attribute. - # Also sets up the docstring to prettify the documentation output. - # - # @param [ClassObject] klass the class to attach the method to - # @param [String] member the name of the member we're generating a method for - def create_reader(klass, member) - new_meth = register MethodObject.new(klass, member, :instance) do |o| - o.signature ||= "def #{member}" - o.source ||= "#{o.signature}\n @#{member}\nend" - end - add_reader_tags(klass, new_meth, member) - klass.attributes[:instance][member][:read] = new_meth - end - - # Creates the given member methods and attaches them to the given ClassObject. - # - # @param [ClassObject] klass the class to generate attributes for - # @param [Array] members a list of member names - def create_attributes(klass, members) - # For each parameter, add reader and writers - members.each do |member| - next if klass.attributes[:instance][member] - klass.attributes[:instance][member] = SymbolHash[:read => nil, :write => nil] - create_writer klass, member if create_member_method?(klass, member, :write) - create_reader klass, member if create_member_method?(klass, member, :read) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/visibility_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/visibility_handler.rb deleted file mode 100644 index 0d13d51272..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/visibility_handler.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true -# Handles 'private', 'protected', and 'public' calls. -class YARD::Handlers::Ruby::VisibilityHandler < YARD::Handlers::Ruby::Base - include YARD::Handlers::Ruby::DecoratorHandlerMethods - - handles method_call(:private) - handles method_call(:protected) - handles method_call(:public) - namespace_only - - process do - return if (ident = statement.jump(:ident)) == statement - case statement.type - when :var_ref, :vcall - self.visibility = ident.first.to_sym - when :fcall, :command - process_decorator do |method| - method.visibility = ident.first if method.respond_to? :visibility= - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/yield_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/yield_handler.rb deleted file mode 100644 index a9e5f81c42..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/handlers/ruby/yield_handler.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true -# Handles 'yield' calls -class YARD::Handlers::Ruby::YieldHandler < YARD::Handlers::Ruby::Base - handles :yield, :yield0 - - process do - return unless owner.is_a?(MethodObject) # Only methods yield - return if owner.has_tag? :yield # Don't override yield tags - return if owner.has_tag? :yieldparam # Same thing. - - yieldtag = YARD::Tags::Tag.new(:yield, "", []) - - if statement.type == :yield - statement.jump(:list).children.each do |item| - if item == s(:var_ref, s(:kw, "self")) - yieldtag.types << '_self' - owner.add_tag YARD::Tags::Tag.new(:yieldparam, - "the object that the method was called on", owner.namespace.path, '_self') - elsif item == s(:zsuper) - yieldtag.types << '_super' - owner.add_tag YARD::Tags::Tag.new(:yieldparam, - "the result of the method from the superclass", nil, '_super') - else - yieldtag.types << item.source - end - end - end - - owner.add_tag(yieldtag) unless yieldtag.types.empty? - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/locale.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/locale.rb deleted file mode 100644 index 6a6cd5ced7..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/locale.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true -module YARD - module I18n - # +Locale+ is a unit of translation. It has {#name} and a set of - # messages. - # - # @since 0.8.2 - class Locale - class << self - # @return [String, nil] the default locale name. - # @since 0.8.4 - attr_accessor :default - - undef default - def default - @@default ||= nil - end - - undef default= - def default=(locale) - @@default = locale - end - end - - # @return [String] the name of the locale. It used IETF language - # tag format +[language[_territory][.codeset][@modifier]]+. - # @see http://tools.ietf.org/rfc/bcp/bcp47.txt - # BCP 47 - Tags for Identifying Languages - attr_reader :name - - # Creates a locale for +name+ locale. - # - # @param [String] name the locale name. - def initialize(name) - @name = name - @messages = {} - end - - # Loads translation messages from +locale_directory+/{#name}.po. - # - # @param [String] locale_directory the directory path that has - # {#name}.po. - # @return [Boolean] +true+ if PO file exists, +false+ otherwise. - def load(locale_directory) - return false if @name.nil? - - po_file = File.join(locale_directory, "#{@name}.po") - return false unless File.exist?(po_file) - - require "yard/i18n/po_parser" - return false unless POParser.available? - - po_parser = POParser.new - @messages.merge!(po_parser.parse(po_file)) - - true - end - - # @param [String] message the translation target message. - # @return [String] translated message. If tarnslation isn't - # registered, the +message+ is returned. - def translate(message) - @messages[message] || message - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/message.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/message.rb deleted file mode 100644 index fa811efa81..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/message.rb +++ /dev/null @@ -1,57 +0,0 @@ -# frozen_string_literal: true -require "set" - -module YARD - module I18n - # +Message+ is a translation target message. It has message ID as - # {#id} and some properties {#locations} and {#comments}. - # - # @since 0.8.1 - class Message - # @return [String] the message ID of the trnslation target message. - attr_reader :id - - # @return [Set] the set of locations. Location is an array of - # path and line number where the message is appeared. - attr_reader :locations - - # @return [Set] the set of comments for the messages. - attr_reader :comments - - # Creates a trasnlate target message for message ID +id+. - # - # @param [String] id the message ID of the translate target message. - def initialize(id) - @id = id - @locations = Set.new - @comments = Set.new - end - - # Adds location information for the message. - # - # @param [String] path the path where the message appears. - # @param [Integer] line the line number where the message appears. - # @return [void] - def add_location(path, line) - @locations << [path, line] - end - - # Adds a comment for the message. - # - # @param [String] comment the comment for the message to be added. - # @return [void] - def add_comment(comment) - @comments << comment unless comment.nil? - end - - # @param [Message] other the +Message+ to be compared. - # @return [Boolean] checks whether this message is equal to another. - def ==(other) - other.is_a?(self.class) && - @id == other.id && - @locations == other.locations && - @comments == other.comments - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/messages.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/messages.rb deleted file mode 100644 index 7a5a455ca7..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/messages.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true -module YARD - module I18n - # Acts as a container for {Message} objects. - # - # @since 0.8.1 - class Messages - include Enumerable - - # Creates a new container. - def initialize - @messages = {} - end - - # Enumerates each {Message} in the container. - # - # @yieldparam [Message] message the next message object in - # the enumeration. - # @return [void] - def each(&block) - @messages.each_value(&block) - end - - # @param [String] id the message ID to perform a lookup on. - # @return [Message, nil] a registered message for the given +id+, - # or nil if no message for the ID is found. - def [](id) - @messages[id] - end - - # Registers a {Message}, the mssage ID of which is +id+. If - # corresponding +Message+ is already registered, the previously - # registered object is returned. - # - # @param [String] id the ID of the message to be registered. - # @return [Message] the registered +Message+. - def register(id) - @messages[id] ||= Message.new(id) - end - - # Checks if this messages list is equal to another messages list. - # - # @param [Messages] other the container to compare. - # @return [Boolean] whether +self+ and +other+ is equivalence or not. - def ==(other) - other.is_a?(self.class) && - @messages == other.messages - end - - protected - - # @return [Hash{String=>Message}] the set of message objects - attr_reader :messages - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/po_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/po_parser.rb deleted file mode 100644 index 1ccd1f88fe..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/po_parser.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true -module YARD - module I18n - # +Locale+ is a wrapper for gettext's PO parsing feature. It hides - # gettext API difference from YARD. - # - # @since 0.8.8 - class POParser - if RUBY_VERSION < "1.9" - begin - require "gettext/tools/poparser" - require "gettext/runtime/mofile" - @@gettext_version = 2 - rescue LoadError - log.warn "Need gettext gem 2.x for i18n feature:\n" \ - "\tgem install gettext -v 2.3.9" - end - else - begin - require "gettext/po_parser" - require "gettext/mo" - @@gettext_version = 3 - rescue LoadError - begin - require "gettext/tools/poparser" - require "gettext/runtime/mofile" - @@gettext_version = 2 - rescue LoadError - log.warn "Need gettext gem for i18n feature:\n" \ - "\tgem install gettext" - end - end - end - - class << self - # @return [Boolean] true if gettext is available, false otherwise. - def available? - !@@gettext_version.nil? - end - end - - # Parses PO file. - # - # @param [String] file path of PO file to be parsed. - # @return [Hash] parsed messages. - def parse(file) - case @@gettext_version - when 2 - parser = GetText::PoParser.new - data = GetText::MoFile.new - when 3 - parser = GetText::POParser.new - data = GetText::MO.new - end - parser.report_warning = false - parser.parse_file(file, data) - data - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/pot_generator.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/pot_generator.rb deleted file mode 100644 index 7a7d93be33..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/pot_generator.rb +++ /dev/null @@ -1,290 +0,0 @@ -# frozen_string_literal: true -require "stringio" - -module YARD - module I18n - # The +PotGenerator+ generates POT format string from - # {CodeObjects::Base} and {CodeObjects::ExtraFileObject}. - # - # == POT and PO - # - # POT is an acronym for "Portable Object Template". POT is a - # template file to create PO file. The extension for POT is - # ".pot". PO file is an acronym for "Portable Object". PO file has - # many parts of message ID (msgid) that is translation target - # message and message string (msgstr) that is translated message - # of message ID. If you want to translate "Hello" in English into - # "Bonjour" in French, "Hello" is the msgid ID and "Bonjour" is - # msgstr. The extension for PO is ".po". - # - # == How to extract msgids - # - # The +PotGenerator+ has two parse methods: - # - # * {#parse_objects} for {CodeObjects::Base} - # * {#parse_files} for {CodeObjects::ExtraFileObject} - # - # {#parse_objects} extracts msgids from docstring and tags of - # {CodeObjects::Base} objects. The docstring of - # {CodeObjects::Base} object is parsed and a paragraph is - # extracted as a msgid. Tag name and tag text are extracted as - # msgids from a tag. - # - # {#parse_files} extracts msgids from - # {CodeObjects::ExtraFileObject} objects. The file content of - # {CodeObjects::ExtraFileObject} object is parsed and a paragraph - # is extracted as a msgid. - # - # == Usage - # - # To create a .pot file by +PotGenerator+, instantiate a - # +PotGenerator+ with a relative working directory path from a - # directory path that has created .pot file, parse - # {CodeObjects::Base} objects and {CodeObjects::ExtraFileObject} - # objects, generate a POT and write the generated POT to a .pot - # file. The relative working directory path is ".." when the - # working directory path is "." and the POT is wrote into - # "po/yard.pot". - # - # @example Generate a .pot file - # po_file_path = "po/yard.pot" - # po_file_directory_pathname = Pathname.new(po_file_path).directory) - # working_directory_pathname = Pathname.new(".") - # relative_base_path = working_directory_pathname.relative_path_from(po_file_directory_pathname).to_s - # # relative_base_path -> ".." - # generator = YARD::I18n::PotGenerator.new(relative_base_path) - # generator.parse_objects(objects) - # generator.parse_files(files) - # pot = generator.generate - # po_file_directory_pathname.mkpath - # File.open(po_file_path, "w") do |pot_file| - # pot_file.print(pot) - # end - # @see http://www.gnu.org/software/gettext/manual/html_node/PO-Files.html - # GNU gettext manual about details of PO file - class PotGenerator - # Extracted messages. - # - # @return [Messages] - # @since 0.8.1 - attr_reader :messages - - # Creates a POT generator that uses +relative_base_path+ to - # generate locations for a msgid. +relative_base_path+ is - # prepended to all locations. - # - # @param [String] relative_base_path a relative working - # directory path from a directory path that has created .pot - # file. - def initialize(relative_base_path) - @relative_base_path = relative_base_path - @extracted_objects = {} - @messages = Messages.new - end - - # Parses {CodeObjects::Base} objects and stores extracted msgids - # into {#messages} - # - # @param [Array] objects a list of - # {CodeObjects::Base} to be parsed. - # @return [void] - def parse_objects(objects) - objects.each do |object| - extract_documents(object) - end - end - - # Parses {CodeObjects::ExtraFileObject} objects and stores - # extracted msgids into {#messages}. - # - # @param [Array] files a list - # of {CodeObjects::ExtraFileObject} objects to be parsed. - # @return [void] - def parse_files(files) - files.each do |file| - extract_paragraphs(file) - end - end - - # Generates POT from +@messages+. - # - # One PO file entry is generated from a +Message+ in - # +@messages+. - # - # Locations of the +Message+ are used to generate the reference - # line that is started with "#: ". +relative_base_path+ passed - # when the generater is created is prepended to each path in location. - # - # Comments of the +Message+ are used to generate the - # translator-comment line that is started with "# ". - # - # @return [String] POT format string - def generate - pot = String.new(header) - sorted_messages = @messages.sort_by do |message| - sorted_locations = message.locations.sort - sorted_locations.first || [] - end - sorted_messages.each do |message| - generate_message(pot, message) - end - pot - end - - private - - def header - <<-EOH -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\\n" -"Report-Msgid-Bugs-To: \\n" -"POT-Creation-Date: #{generate_pot_creation_date_value}\\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n" -"Last-Translator: FULL NAME \\n" -"Language-Team: LANGUAGE \\n" -"Language: \\n" -"MIME-Version: 1.0\\n" -"Content-Type: text/plain; charset=UTF-8\\n" -"Content-Transfer-Encoding: 8bit\\n" - -EOH - end - - def current_time - @current_time ||= Time.now - end - - def generate_pot_creation_date_value - current_time.strftime("%Y-%m-%d %H:%M%z") - end - - def generate_message(pot, message) - message.comments.sort.each do |comment| - pot << "# #{comment}\n" unless comment.empty? - end - message.locations.sort.each do |path, line| - pot << "#: #{@relative_base_path}/#{path}:#{line}\n" - end - escaped_message_id = escape_message_id(message.id) - escaped_message_id = escaped_message_id.gsub(/\n/, "\\\\n\"\n\"") - pot << "msgid \"#{escaped_message_id}\"\n" - pot << "msgstr \"\"\n" - pot << "\n" - pot - end - - def escape_message_id(message_id) - message_id.gsub(/(\\|")/) do - special_character = $1 - "\\#{special_character}" - end - end - - def register_message(id) - @messages.register(id) - end - - def extract_documents(object) - return if @extracted_objects.key?(object) - - @extracted_objects[object] = true - case object - when CodeObjects::NamespaceObject - object.children.each do |child| - extract_documents(child) - end - end - - if object.group - message = register_message(object.group) - object.files.each do |path, line| - message.add_location(path, line) - end - message.add_comment(object.path) unless object.path.empty? - end - - docstring = object.docstring - unless docstring.empty? - text = Text.new(StringIO.new(docstring)) - text.extract_messages do |type, *args| - case type - when :paragraph - paragraph, line_no = *args - message = register_message(paragraph.rstrip) - object.files.each do |path, line| - message.add_location(path, (docstring.line || line) + line_no) - end - message.add_comment(object.path) unless object.path.empty? - else - raise "should not reach here: unexpected type: #{type}" - end - end - end - docstring.tags.each do |tag| - extract_tag_documents(tag) - end - end - - def extract_tag_documents(tag) - extract_tag_name(tag) - extract_tag_text(tag) - - extract_documents(tag) if Tags::OverloadTag === tag - end - - def extract_tag_name(tag) - return if tag.name.nil? - return if tag.name.is_a?(String) && tag.name.empty? - key = "tag|#{tag.tag_name}|#{tag.name}" - message = register_message(key) - tag.object.files.each do |path, line| - message.add_location(path, line) - end - tag_label = String.new("@#{tag.tag_name}") - tag_label << " [#{tag.types.join(', ')}]" if tag.types - message.add_comment(tag_label) - end - - def extract_tag_text(tag) - return if tag.text.nil? - return if tag.text.empty? - message = register_message(tag.text) - tag.object.files.each do |path, line| - message.add_location(path, line) - end - tag_label = String.new("@#{tag.tag_name}") - tag_label << " [#{tag.types.join(', ')}]" if tag.types - tag_label << " #{tag.name}" if tag.name - message.add_comment(tag_label) - end - - def extract_paragraphs(file) - File.open(file.filename) do |input| - text = Text.new(input, :have_header => true) - text.extract_messages do |type, *args| - case type - when :attribute - name, value, line_no = *args - message = register_message(value) - message.add_location(file.filename, line_no) - message.add_comment(name) - when :paragraph - paragraph, line_no = *args - message = register_message(paragraph.rstrip) - message.add_location(file.filename, line_no) - else - raise "should not reach here: unexpected type: #{type}" - end - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/text.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/text.rb deleted file mode 100644 index 229245db09..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/i18n/text.rb +++ /dev/null @@ -1,173 +0,0 @@ -# frozen_string_literal: true -module YARD - module I18n - # Provides some convenient features for translating a text. - class Text - # Creates a text object that has translation related features for - # the input text. - # - # @param [#each_line] input a text to be translated. - # @option options [Boolean] :have_header (false) whether the - # input text has header or not. - def initialize(input, options = {}) - @input = input - @options = options - end - - # Extracts translation target messages from +@input+. - # - # @yield [:attribute, name, value, line_no] the block that - # receives extracted an attribute in header. It may called many - # times. - # @yieldparam [String] name the name of extracted attribute. - # @yieldparam [String] value the value of extracted attribute. - # @yieldparam [Integer] line_no the defined line number of extracted - # attribute. - # @yield [:paragraph, text, start_line_no] the block that - # receives extracted a paragraph in body. Paragraph is a text - # block separated by one or more empty lines. Empty line is a - # line that contains only zero or more whitespaces. It may - # called many times. - # @yieldparam [String] text the text of extracted paragraph. - # @yieldparam [Integer] start_line_no the start line number of - # extracted paragraph. - # @return [void] - def extract_messages - parse do |part| - case part[:type] - when :markup, :empty_line - # ignore - when :attribute - yield(:attribute, part[:name], part[:value], part[:line_no]) - when :paragraph - yield(:paragraph, part[:paragraph], part[:line_no]) - end - end - end - - # Translates into +locale+. - # - # @param [Locale] locale the translation target locale. - # @return [String] translated text. - def translate(locale) - translated_text = String.new("") - parse do |part| - case part[:type] - when :markup - translated_text << part[:line] - when :attribute - prefix = "#{part[:prefix]}#{part[:name]}#{part[:infix]}" - value = locale.translate(part[:value]) - suffix = part[:suffix] - translated_text << "#{prefix}#{value}#{suffix}" - when :paragraph - translated_text << locale.translate(part[:paragraph]) - when :empty_line - translated_text << part[:line] - else - raise "should not reach here: unexpected type: #{type}" - end - end - translated_text - end - - private - - def parse(&block) - paragraph = String.new("") - paragraph_start_line = 0 - line_no = 0 - in_header = @options[:have_header] - - @input.each_line do |line| - line_no += 1 - if in_header - case line - when /^#!\S+\s*$/ - if line_no == 1 - emit_markup_event(line, line_no, &block) - else - in_header = false - end - when /^(\s*#\s*@)(\S+)(\s*)(.+?)(\s*)$/ - emit_attribute_event(Regexp.last_match, line_no, &block) - else - in_header = false - if line.strip.empty? - emit_empty_line_event(line, line_no, &block) - next - end - end - next if in_header - end - - case line - when /^\s*$/ - if paragraph.empty? - emit_empty_line_event(line, line_no, &block) - else - paragraph << line - emit_paragraph_event(paragraph, paragraph_start_line, line_no, - &block) - paragraph = String.new("") - end - else - paragraph_start_line = line_no if paragraph.empty? - paragraph << line - end - end - - unless paragraph.empty? - emit_paragraph_event(paragraph, paragraph_start_line, line_no, &block) - end - end - - def emit_markup_event(line, line_no) - part = { - :type => :markup, - :line => line, - :line_no => line_no - } - yield(part) - end - - def emit_attribute_event(match_data, line_no) - part = { - :type => :attribute, - :prefix => match_data[1], - :name => match_data[2], - :infix => match_data[3], - :value => match_data[4], - :suffix => match_data[5], - :line_no => line_no - } - yield(part) - end - - def emit_empty_line_event(line, line_no) - part = { - :type => :empty_line, - :line => line, - :line_no => line_no - } - yield(part) - end - - def emit_paragraph_event(paragraph, paragraph_start_line, line_no, &block) - paragraph_part = { - :type => :paragraph, - :line_no => paragraph_start_line - } - match_data = /(\s*)\z/.match(paragraph) - if match_data - paragraph_part[:paragraph] = match_data.pre_match - yield(paragraph_part) - emit_empty_line_event(match_data[1], line_no, &block) - else - paragraph_part[:paragraph] = paragraph - yield(paragraph_part) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/logging.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/logging.rb deleted file mode 100644 index 2681b63988..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/logging.rb +++ /dev/null @@ -1,205 +0,0 @@ -# encoding: utf-8 -# frozen_string_literal: true -require 'logger' -require 'thread' - -module YARD - # Handles console logging for info, warnings and errors. - # Uses the stdlib Logger class in Ruby for all the backend logic. - class Logger < ::Logger - # The list of characters displayed beside the progress bar to indicate - # "movement". - # @since 0.8.2 - PROGRESS_INDICATORS = %w(⣷ ⣯ ⣟ ⡿ ⢿ ⣻ ⣽ ⣾) - - # @return [IO] the IO object being logged to - # @since 0.8.2 - def io; @logdev end - def io=(pipe) @logdev = pipe end - - # @return [Boolean] whether backtraces should be shown (by default - # this is on). - def show_backtraces; @show_backtraces || level == DEBUG end - attr_writer :show_backtraces - - # @return [Boolean] whether progress indicators should be shown when - # logging CLIs (by default this is off). - def show_progress - return false if YARD.ruby18? # threading is too ineffective for progress support - return false if YARD.windows? # windows has poor ANSI support - return false unless io.tty? # no TTY support on IO - return false unless level > INFO # no progress in verbose/debug modes - @show_progress - end - attr_writer :show_progress - - # The logger instance - # @return [Logger] the logger instance - def self.instance(pipe = STDOUT) - @logger ||= new(pipe) - end - - # Creates a new logger - def initialize(pipe, *args) - super(pipe, *args) - self.io = pipe - self.show_backtraces = true - self.show_progress = false - self.level = WARN - self.formatter = method(:format_log) - self.warned = false - @progress_indicator = 0 - @mutex = Mutex.new - @progress_msg = nil - @progress_last_update = Time.now - end - - # Changes the debug level to DEBUG if $DEBUG is set - # and writes a debugging message. - def debug(*args) - self.level = DEBUG if $DEBUG - super - end - - # Remembers when a warning occurs and writes a warning message. - def warn(*args) - self.warned = true - super - end - attr_accessor :warned - - # Captures the duration of a block of code for benchmark analysis. Also - # calls {#progress} on the message to display it to the user. - # - # @todo Implement capture storage for reporting of benchmarks - # @param [String] msg the message to display - # @param [Symbol, nil] nontty_log the level to log as if the output - # stream is not a TTY. Use +nil+ for no alternate logging. - # @yield a block of arbitrary code to benchmark - # @return [void] - def capture(msg, nontty_log = :debug) - progress(msg, nontty_log) - yield - ensure - clear_progress - end - - # Displays a progress indicator for a given message. This progress report - # is only displayed on TTY displays, otherwise the message is passed to - # the +nontty_log+ level. - # - # @param [String] msg the message to log - # @param [Symbol, nil] nontty_log the level to log as if the output - # stream is not a TTY. Use +nil+ for no alternate logging. - # @return [void] - # @since 0.8.2 - def progress(msg, nontty_log = :debug) - send(nontty_log, msg) if nontty_log - return unless show_progress - icon = "" - if defined?(::Encoding) - icon = PROGRESS_INDICATORS[@progress_indicator] + " " - end - @mutex.synchronize do - print("\e[2K\e[?25l\e[1m#{icon}#{msg}\e[0m\r") - @progress_msg = msg - if Time.now - @progress_last_update > 0.2 - @progress_indicator += 1 - @progress_indicator %= PROGRESS_INDICATORS.size - @progress_last_update = Time.now - end - end - Thread.new do - sleep(0.05) - progress(msg + ".", nil) if @progress_msg == msg - end - end - - # Clears the progress indicator in the TTY display. - # @return [void] - # @since 0.8.2 - def clear_progress - return unless show_progress - print_no_newline("\e[?25h\e[2K") - @progress_msg = nil - end - - # Displays an unformatted line to the logger output stream, adding - # a newline. - # @param [String] msg the message to display - # @return [void] - # @since 0.8.2 - def puts(msg = '') - print("#{msg}\n") - end - - alias print_no_newline << - private :print_no_newline - - # Displays an unformatted line to the logger output stream. - # @param [String] msg the message to display - # @return [void] - # @since 0.8.2 - def print(msg = '') - clear_line - print_no_newline(msg) - end - alias << print - - # Prints the backtrace +exc+ to the logger as error data. - # - # @param [Array] exc the backtrace list - # @param [Symbol] level_meth the level to log backtrace at - # @return [void] - def backtrace(exc, level_meth = :error) - return unless show_backtraces - send(level_meth, "#{exc.class.class_name}: #{exc.message}") - send(level_meth, "Stack trace:" + - exc.backtrace[0..5].map {|x| "\n\t#{x}" }.join + "\n") - end - - # Warns that the Ruby environment does not support continuations. Applies - # to JRuby, Rubinius and MacRuby. This warning will only display once - # per Ruby process. - # - # @deprecated Continuations are no longer needed by YARD 0.8.0+. - # @return [void] - def warn_no_continuations - end - - # Sets the logger level for the duration of the block - # - # @example - # log.enter_level(Logger::ERROR) do - # YARD.parse_string "def x; end" - # end - # @param [Fixnum] new_level the logger level for the duration of the block. - # values can be found in Ruby's Logger class. - # @yield the block with the logger temporarily set to +new_level+ - def enter_level(new_level = level) - old_level = level - self.level = new_level - yield - ensure - self.level = old_level - end - - private - - # Override this internal Logger method to clear line - def add(*args) - clear_line - super(*args) - end - - def clear_line - return unless @progress_msg - print_no_newline("\e[2K\r") - end - - # Log format (from Logger implementation). Used by Logger internally - def format_log(sev, _time, _prog, msg) - "[#{sev.downcase}]: #{msg}\n" - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/options.rb deleted file mode 100644 index 0dc4eeeace..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/options.rb +++ /dev/null @@ -1,217 +0,0 @@ -# frozen_string_literal: true -module YARD - # Generalized options class for passing around large amounts of options between objects. - # - # The options class exists for better visibility and documentability of options being - # passed through to other objects. Because YARD has parser and template architectures - # that are heavily reliant on options, it is necessary to make these option keys easily - # visible and understood by developers. Since the options class is more than just a - # basic Hash, the subclass can provide aliasing and convenience methods to simplify - # option property access, and, if needed, support backward-compatibility for deprecated - # key names. - # - # == Hash and OpenStruct-like Access - # - # Although the options class allows for Hash-like access (opts[:key]), the recommended - # mechanism for accessing an option key will be via standard method calls on attributes - # - # The options class can also act as an open ended key value storage structure (like a - # Hash or OpenStruct), and allows for setting and getting of unregistered option keys. - # This methodology is not recommended, however, and is only supported for backward - # compatibility inside YARD. Whenever possible, developers should define all keys used - # by an options class. - # - # == Declaring Default Values - # - # Note that the options class can contain default value definitions for certain options, - # but to initialize these defaults, {#reset_defaults} must be called manually after - # initialization; the options object is always created empty until defaults are applied. - # - # @abstract Subclasses should define (and document) custom attributes that are expected - # to be made available as option keys. - # @example Defining an Options class with custom option keys - # class TemplateOptions < YARD::Options - # # @return [Symbol] the output format to generate templates in - # attr_accessor :format - # - # # @return [Symbol] the template to use when generating output - # attr_accessor :template - # end - # @example Initializing default option values - # class TemplateOptions < YARD::Options - # def reset_defaults - # super - # self.format = :html - # self.template = :default - # self.highlight = true - # # ... - # end - # end - # @example Using +default_attr+ to create default attributes - # class TemplateOptions < YARD::Options - # default_attr :format, :html - # default_attr :template, :default - # default_attr :highlight, true - # end - # @example Deprecating an option while still supporting it - # class TemplateOptions < YARD::Options - # # @return [Boolean] if syntax highlighting should be performed on code blocks. - # # Defaults to true. - # attr_accessor :highlight - # - # # @deprecated Use {#highlight} instead. - # # @return [Boolean] if no syntax highlighting should be performs on code blocks. - # # Defaults to false. - # attr_accessor :no_highlight - # def no_highlight=(value) @highlight = !value end - # def no_highlight; !highlight end - # end - class Options - # @!macro [attach] yard.default_attr - # @!attribute $1 - # Defines an attribute named +key+ and sets a default value for it - # - # @example Defining a default option key - # default_attr :name, 'Default Name' - # default_attr :time, lambda { Time.now } - # @param [Symbol] key the option key name - # @param [Object, Proc] default the default object value. If the default - # value is a proc, it is executed upon initialization. - def self.default_attr(key, default) - (@defaults ||= {})[key] = default - attr_accessor(key) - end - - # Delegates calls with Hash syntax to actual method with key name - # - # @example Calling on an option key with Hash syntax - # options[:format] # equivalent to: options.format - # @param [Symbol, String] key the option name to access - # @return the value of the option named +key+ - def [](key) send(key) end - - # Delegates setter calls with Hash syntax to the attribute setter with the key name - # - # @example Setting an option with Hash syntax - # options[:format] = :html # equivalent to: options.format = :html - # @param [Symbol, String] key the optin to set - # @param [Object] value the value to set for the option - # @return [Object] the value being set - def []=(key, value) send("#{key}=", value) end - - # Updates values from an options hash or options object on this object. - # All keys passed should be key names defined by attributes on the class. - # - # @example Updating a set of options on an Options object - # opts.update(:template => :guide, :type => :fulldoc) - # @param [Hash, Options] opts - # @return [self] - def update(opts) - opts = opts.to_hash if Options === opts - opts.each do |key, value| - self[key] = value - end - self - end - - # Creates a new options object and sets options hash or object value - # onto that object. - # - # @param [Options, Hash] opts - # @return [Options] the newly created options object - # @see #update - def merge(opts) - dup.update(opts) - end - - # @return [Hash] Converts options object to an options hash. All keys - # will be symbolized. - def to_hash - opts = {} - instance_variables.each do |ivar| - name = ivar.to_s.sub(/^@/, '') - opts[name.to_sym] = send(name) - end - opts - end - - # Yields over every option key and value - # @yield [key, value] every option key and value - # @yieldparam [Symbol] key the option key - # @yieldparam [Object] value the option value - # @return [void] - def each - instance_variables.each do |ivar| - name = ivar.to_s.sub(/^@/, '') - yield(name.to_sym, send(name)) - end - end - - # Inspects the object - def inspect - "<#{self.class}: #{to_hash.inspect}>" - end - - # @return [Boolean] whether another Options object equals the - # keys and values of this options object - def ==(other) - case other - when Options; to_hash == other.to_hash - when Hash; to_hash == other - else false - end - end - - # Handles setting and accessing of unregistered keys similar - # to an OpenStruct object. - # - # @note It is not recommended to set and access unregistered keys on - # an Options object. Instead, register the attribute before using it. - def method_missing(meth, *args, &block) - if meth.to_s =~ /^(.+)=$/ - log.debug "Attempting to set unregistered key #{$1} on #{self.class}" - instance_variable_set("@#{$1}", args.first) - elsif args.empty? - log.debug "Attempting to access unregistered key #{meth} on #{self.class}" - instance_variable_defined?("@#{meth}") ? instance_variable_get("@#{meth}") : nil - else - super - end - end - - # Resets all values to their defaults. - # - # @abstract Subclasses should override this method to perform custom - # value initialization if not using {default_attr}. Be sure to call - # +super+ so that default initialization can take place. - # @return [void] - def reset_defaults - names_set = {} - self.class.ancestors.each do |klass| # look at all ancestors - defaults = - klass.instance_variable_defined?("@defaults") && - klass.instance_variable_get("@defaults") - next unless defaults - defaults.each do |key, value| - next if names_set[key] - names_set[key] = true - self[key] = Proc === value ? value.call : value - end - end - end - - # Deletes an option value for +key+ - # - # @param [Symbol, String] key the key to delete a value for - # @return [Object] the value that was deleted - def delete(key) - val = self[key] - if instance_variable_defined?("@#{key}") - remove_instance_variable("@#{key}") - end - val - end - - def tap; yield(self); self end unless defined?(tap) # only for 1.8.6 - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/base.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/base.rb deleted file mode 100644 index fdfe2e35f9..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/base.rb +++ /dev/null @@ -1,57 +0,0 @@ -# frozen_string_literal: true -module YARD - module Parser - # Represents the abstract base parser class that parses source code in - # a specific way. A parser should implement {#parse}, {#tokenize} and - # {#enumerator}. - # - # == Registering a Custom Parser - # To register a parser, see {SourceParser.register_parser_type} - # - # @abstract - # @see #parse - # @see #tokenize - # @see #enumerator - # @since 0.5.6 - class Base - # Convenience method to create a new parser and {#parse} - def self.parse(source, filename = nil) - new(source, filename).parse - end - - # This default constructor does nothing. The subclass is responsible for - # storing the source contents and filename if they are required. - # @param [String] source the source contents - # @param [String] filename the name of the file if from disk - def initialize(source, filename) # rubocop:disable Lint/UnusedMethodArgument - raise NotImplementedError, "invalid parser implementation" - end - - # This method should be implemented to parse the source and return itself. - # @abstract - # @return [Base] this method should return itself - def parse - raise NotImplementedError, "#{self.class} must implement #parse" - end - - # This method should be implemented to tokenize given source - # @abstract - # @return [Array] a list/tree of lexical tokens - def tokenize - raise NotImplementedError, "#{self.class} does not support tokenization" - end - - # This method should be implemented to return a list of semantic tokens - # representing the source code to be post-processed. Otherwise the method - # should return nil. - # - # @abstract - # @return [Array] a list of semantic tokens representing the source code - # to be post-processed - # @return [nil] if no post-processing should be done - def enumerator - nil - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/c/c_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/c/c_parser.rb deleted file mode 100644 index 8518d811e2..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/c/c_parser.rb +++ /dev/null @@ -1,235 +0,0 @@ -# frozen_string_literal: true -module YARD - module Parser - module C - class CParser < Base - def initialize(source, file = '(stdin)') - @file = file - @namespaces = {} - @content = source - @index = 0 - @line = 1 - @state = nil - @newline = true - @statements = [] - @last_comment = nil - @last_statement = nil - end - - def parse - parse_toplevel - enumerator - end - - def enumerator - @statements - end - - def tokenize - raise NotImplementedError, "no tokenization support for C/C++ files" - end - - private - - def parse_toplevel - advance_loop do - case char - when /['"]/; consume_quote(char) - when '#'; consume_directive - when '/'; consume_comment - when /\s/; consume_whitespace - when '}'; advance # Skip possible C++ namespace closing brackets. - else consume_toplevel_statement - end - end - end - - def consume_quote(type = '"') - advance - advance_loop do - case char - when "\n"; advance; nextline - when '\\'; advance(2) - when type; advance; return - else advance - end - end - end - - def consume_directive - return(advance) unless @newline - @last_comment = nil - @last_statement = nil - advance_loop do - if char == '\\' && nextchar =~ /[\r\n]/ - advance_loop { advance; break(nextline) if char == "\n" } - elsif char == "\n" - return - end - advance - end - end - - def consume_toplevel_statement - @newline = false - start = @index - line = @line - decl = consume_until(/[{;]/) - return nil if decl =~ /\A\s*\Z/ - # Skip C++ namespace - treat content as top level statement. - return nil if decl =~ /\A(namespace)/ - statement = ToplevelStatement.new(nil, @file, line) - @statements << statement - attach_comment(statement) - stmts = nil - if prevchar == '{' - stmts = consume_body_statements - if decl =~ /\A(typedef|enum|class|#{struct}|union)/ - consume_until(';') - end - end - statement.source = @content[start..@index] - statement.block = stmts - statement.declaration = decl # rubocop:disable Lint/UselessSetterCall - end - - def consume_body_statements - stmts = [] - brace_level = 1 - loop do - strip_non_statement_data - start = @index - line = @line - consume_until(/[{};]/) - brace_level += 1 if prevchar == '{' - brace_level -= 1 if prevchar == '}' - - break if prevchar.empty? || (brace_level <= 0 && prevchar == '}') - src = @content[start...@index] - next unless src && src !~ /\A\s*\Z|\A\}\Z/ - - stmt = BodyStatement.new(src, @file, line) - attach_comment(stmt) - stmts << stmt - end - stmts - end - - def strip_non_statement_data - start = @index - loop do - start = @index - case char - when /\s/; consume_whitespace - when '#'; consume_directive - when '/'; consume_comment - end - - break if start == @index - end - end - - def consume_whitespace - advance_loop { nextline if char == "\n"; break if char =~ /\S/; advance } - end - - def consume_comment(add_comment = true) - return(advance) unless nextchar == '*' || nextchar == '/' - line = @line - type = nextchar == '*' ? :multi : :line - advance(2) - comment = String.new("") - advance_loop do - comment << char - if type == :multi - nextline if char == "\n" - if char(2) == '*/' - if add_comment - comment << '/' - stmt = Comment.new(comment, @file, line) - stmt.type = type - attach_comment(stmt) - @statements << stmt - end - return advance(2) - end - elsif char == "\n" - if add_comment - stmt = Comment.new(comment[0...-1], @file, line) - stmt.type = type - attach_comment(stmt) - @statements << stmt - end - return - end - advance - end - end - - def consume_until(end_char, bracket_level = 0, brace_level = 0, add_comment = true) - end_char = /#{end_char}/ if end_char.is_a?(String) - start = @index - advance_loop do - chr = char - case chr - when /\s/; consume_whitespace - when /['"]/; consume_quote(char) - when '#'; consume_directive - when '/'; consume_comment(add_comment) - when '{'; advance; brace_level += 1 - when '}'; advance; brace_level -= 1 - when '('; advance; bracket_level += 1 - when ')'; advance; bracket_level -= 1 - else advance - end - @newline = false if chr !~ /\s/ - - if chr =~ end_char - break if chr == '{' || chr == '(' - break if bracket_level <= 0 && brace_level <= 0 - end - end - @content[start...@index] - end - - def attach_comment(statement) - if Comment === statement - if @last_statement && @last_statement.line == statement.line - @last_statement.comments = statement - statement.statement = @last_statement - end - @last_comment = statement - @last_statement = nil - else - if @last_comment - statement.comments = @last_comment - @last_comment.statement = statement - end - @last_statement = statement - @last_comment = nil - end - end - - def advance(num = 1) @index += num end - def back(num = 1) @index -= num end - - def advance_loop - yield while @index <= @content.size - end - - def nextline - @line += 1 - @newline = true - end - - def char(num = 1) @content[@index, num] end - def prevchar(num = 1) @content[@index - 1, num] end - def nextchar(num = 1) @content[@index + 1, num] end - - def struct - /struct\s[a-zA-Z0-9]+\s\{/ - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/c/comment_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/c/comment_parser.rb deleted file mode 100644 index 4d8c067107..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/c/comment_parser.rb +++ /dev/null @@ -1,134 +0,0 @@ -# frozen_string_literal: true -module YARD - module Parser - module C - module CommentParser - protected - - def parse_comments(comments) - @overrides = [] - spaces = nil - comments = remove_private_comments(comments) - comments = comments.split(/\r?\n/).map do |line| - line.gsub!(%r{^\s*/?\*/?}, '') - line.gsub!(%r{\*/\s*$}, '') - if line =~ /^\s*$/ - next if spaces.nil? - next "" - end - spaces = (line[/^(\s+)/, 1] || "").size if spaces.nil? - line.gsub(/^\s{0,#{spaces}}/, '').rstrip - end.compact - - comments = parse_overrides(comments) - comments = parse_callseq(comments) - comments.join("\n") - end - - private - - def parse_overrides(comments) - comments.map do |line| - type, name = *line.scan(/^\s*Document-(class|module|method|attr|const):\s*(\S.*)\s*$/).first - if type - @overrides << [type.to_sym, name] - nil - else - line - end - end.compact - end - - def parse_callseq(comments) - return comments unless comments[0] =~ /\Acall-seq:\s*(\S.+)?/ - if $1 - comments[0] = " #{$1}" - else - comments.shift - end - overloads = [] - seen_data = false - while comments.first =~ /^\s+(\S.+)/ || comments.first =~ /^\s*$/ - line = comments.shift.strip - break if line.empty? && seen_data - next if line.empty? - seen_data = true - line.sub!(/^\w+[\.#]/, '') - signature, types = *line.split(/ [-=]> /) - types = parse_types(types) - if signature.sub!(/\[?\s*(\{(?:\s*\|(.+?)\|)?.*\})\s*\]?\s*$/, '') && $1 - blk = $1 - blkparams = $2 - else - blk = nil - blkparams = nil - end - case signature - when /^(\w+)\s*=\s+(\w+)/ - signature = "#{$1}=(#{$2})" - when /^\w+\s+\S/ - signature = signature.split(/\s+/) - signature = "#{signature[1]}#{signature[2] ? '(' + signature[2..-1].join(' ') + ')' : ''}" - when /^\w+\[(.+?)\]\s*(=)?/ - signature = "[]#{$2}(#{$1})" - when /^\w+\s+(#{CodeObjects::METHODMATCH})\s+(\w+)/ - signature = "#{$1}(#{$2})" - end - break unless signature =~ /^#{CodeObjects::METHODNAMEMATCH}/ - signature = signature.rstrip - overloads << "@overload #{signature}" - overloads << " @yield [#{blkparams}]" if blk - overloads << " @return [#{types.join(', ')}]" unless types.empty? - end - - comments + [""] + overloads - end - - def parse_types(types) - if types =~ /true or false/ - ["Boolean"] - else - (types || "").split(/,| or /).map do |t| - case t.strip.gsub(/^an?_/, '') - when "class"; "Class" - when "obj", "object", "anObject"; "Object" - when "arr", "array", "anArray", "ary", "new_ary", /^\[/; "Array" - when /^char\s*\*/, "char", "str", "string", "new_str"; "String" - when "enum", "anEnumerator"; "Enumerator" - when "exc", "exception"; "Exception" - when "proc", "proc_obj", "prc"; "Proc" - when "binding"; "Binding" - when "hsh", "hash", "aHash"; "Hash" - when "ios", "io"; "IO" - when "file"; "File" - when "float"; "Float" - when "time", "new_time"; "Time" - when "dir", "aDir"; "Dir" - when "regexp", "new_regexp"; "Regexp" - when "matchdata"; "MatchData" - when "encoding"; "Encoding" - when "fixnum", "fix"; "Fixnum" - when /^(?:un)?signed$/, /^(?:(?:un)?signed\s*)?(?:short|int|long|long\s+long)$/, "integer", "Integer"; "Integer" - when "num", "numeric", "Numeric", "number"; "Numeric" - when "aBignum"; "Bignum" - when "nil"; "nil" - when "true"; "true" - when "false"; "false" - when "bool", "boolean", "Boolean"; "Boolean" - when "self"; "self" - when /^[-+]?\d/; t - when /[A-Z][_a-z0-9]+/; t - end - end.compact - end - end - - def remove_private_comments(comment) - comment = comment.gsub(%r{/?\*--\n(.*?)/?\*\+\+}m, '') - comment = comment.sub(%r{/?\*--\n.*}m, '') - comment - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/c/statement.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/c/statement.rb deleted file mode 100644 index 8ee3bc0136..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/c/statement.rb +++ /dev/null @@ -1,66 +0,0 @@ -# frozen_string_literal: true -module YARD - module Parser - module C - class Statement - attr_accessor :source - attr_accessor :line - attr_accessor :file - - # @deprecated Groups are now defined by directives - # @see Tags::GroupDirective - attr_accessor :group - - attr_accessor :comments_hash_flag - - def initialize(source, file = nil, line = nil) - @source = source - @file = file - @line = line - end - - def line_range - line...(line + source.count("\n")) - end - - def comments_range - comments.line_range - end - - def first_line - source.split(/\n/).first - end - - alias signature first_line - - def show - "\t#{line}: #{first_line}" - end - end - - class BodyStatement < Statement - attr_accessor :comments - end - - class ToplevelStatement < Statement - attr_accessor :block - attr_accessor :declaration - attr_accessor :comments - end - - class Comment < Statement - include CommentParser - - attr_accessor :type - attr_accessor :overrides - attr_accessor :statement - - def initialize(source, file = nil, line = nil) - super(parse_comments(source), file, line) - end - - def comments; self end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/ast_node.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/ast_node.rb deleted file mode 100644 index 84db76e145..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/ast_node.rb +++ /dev/null @@ -1,551 +0,0 @@ -# frozen_string_literal: true -module YARD - module Parser - module Ruby - # Builds and s-expression by creating {AstNode} objects with - # the type provided by the first argument. - # - # @example An implicit list of keywords - # ast = s(s(:kw, "if"), s(:kw, "else")) - # ast.type # => :list - # @example A method call - # s(:command, s(:var_ref, "mymethod")) - # - # @overload s(*nodes, opts = {}) - # @param [Array] nodes a list of nodes. - # @param [Hash] opts any extra options (docstring, file, source) to - # set on the object - # @return [AstNode] an implicit node where node.type == +:list+ - # @overload s(type, *children, opts = {}) - # @param [Symbol] type the node type - # @param [Array] children any child nodes inside this one - # @param [Hash] opts any extra options to set on the object - # @return [AstNode] a node of type +type+. - # @see AstNode#initialize - def s(*args) - type = Symbol === args.first ? args.shift : :list - opts = Hash === args.last ? args.pop : {} - AstNode.node_class_for(type).new(type, args, opts) - end - - # An AST node is characterized by a type and a list of children. It - # is most easily represented by the s-expression {#s} such as: - # # AST for "if true; 5 end": - # s(s(:if, s(:var_ref, s(:kw, "true")), s(s(:int, "5")), nil)) - # - # The node type is not considered part of the list, only its children. - # So +ast[0]+ does not refer to the type, but rather the first child - # (or object). Items that are not +AstNode+ objects can be part of the - # list, like Strings or Symbols representing names. To return only - # the AstNode children of the node, use {#children}. - class AstNode < Array - attr_accessor :docstring_hash_flag - attr_accessor :docstring, :docstring_range, :source - - # @deprecated Groups are now defined by directives - # @see Tags::GroupDirective - attr_accessor :group - - attr_writer :source_range, :line_range, :file, :full_source - alias comments docstring - alias comments_range docstring_range - alias comments_hash_flag docstring_hash_flag - alias to_s source - - # @return [Symbol] the node's unique symbolic type - attr_accessor :type - - # @return [AstNode, nil] the node's parent or nil if it is a root node. - attr_accessor :parent - - # @return [Range] the character range in {#full_source} represented - # by the node - def source_range - reset_line_info unless @source_range - @source_range - end - - # @return [Range] the line range in {#full_source} represented - # by the node - def line_range - reset_line_info unless @line_range - @line_range - end - - # @return [String] the filename the node was parsed from - def file - return parent.file if parent - @file - end - - # @return [String] the full source that the node was parsed from - def full_source - return parent.full_source if parent - return @full_source if @full_source - return IO.read(@file) if file && File.exist?(file) - end - - # @return [String] the parse of {#full_source} that the node represents - def source - return parent.full_source[source_range] if parent - full_source - end - - # List of all known keywords - # @return [Hash] - KEYWORDS = {:class => true, :alias => true, :lambda => true, :do_block => true, - :def => true, :defs => true, :begin => true, :rescue => true, :rescue_mod => true, - :if => true, :if_mod => true, :else => true, :elsif => true, :case => true, - :when => true, :next => true, :break => true, :retry => true, :redo => true, - :return => true, :throw => true, :catch => true, :until => true, :until_mod => true, - :while => true, :while_mod => true, :yield => true, :yield0 => true, :zsuper => true, - :unless => true, :unless_mod => true, :for => true, :super => true, :return0 => true} - - # @group Creating an AstNode - - # Finds the node subclass that should be instantiated for a specific - # node type - # - # @param [Symbol] type the node type to find a subclass for - # @return [Class] a subclass of AstNode to instantiate the node with. - def self.node_class_for(type) - case type - when :params - ParameterNode - when :call, :fcall, :vcall, :command, :command_call - MethodCallNode - when :if, :elsif, :if_mod, :unless, :unless_mod - ConditionalNode - when :for, :while, :while_mod, :until, :until_mod - LoopNode - when :def, :defs - MethodDefinitionNode - when :class, :sclass - ClassNode - when :module - ModuleNode - else - if type.to_s =~ /_ref\Z/ - ReferenceNode - elsif type.to_s =~ /_literal\Z/ - LiteralNode - elsif KEYWORDS.key?(type) - KeywordNode - else - AstNode - end - end - end - - # Creates a new AST node - # - # @param [Symbol] type the type of node being created - # @param [Array] arr the child nodes - # @param [Hash] opts any extra line options - # @option opts [Fixnum] :line (nil) the line the node starts on in source - # @option opts [String] :char (nil) the character number the node starts on - # in source - # @option opts [Fixnum] :listline (nil) a special key like :line but for - # list nodes - # @option opts [Fixnum] :listchar (nil) a special key like :char but for - # list nodes - # @option opts [Boolean] :token (nil) whether the node represents a token - def initialize(type, arr, opts = {}) - super(arr) - self.type = type - self.line_range = opts[:line] - self.source_range = opts[:char] - @fallback_line = opts[:listline] - @fallback_source = opts[:listchar] - @token = true if opts[:token] - @docstring = nil - end - - # @return [Boolean] whether the node is equal to another by checking - # the list and type - # @private - def ==(other) - super && type == other.type - end - - # @group Traversing a Node - - # Searches through the node and all descendants and returns the - # first node with a type matching any of +node_types+, otherwise - # returns the original node (self). - # - # @example Returns the first method definition in a block of code - # ast = YARD.parse_string("if true; def x; end end").ast - # ast.jump(:def) - # # => s(:def, s(:ident, "x"), s(:params, nil, nil, nil, nil, - # # nil), s(s(:void_stmt, ))) - # @example Returns first 'def' or 'class' statement - # ast = YARD.parse_string("class X; def y; end end") - # ast.jump(:def, :class).first - # # => - # @example If the node types are not present in the AST - # ast = YARD.parse("def x; end") - # ast.jump(:def) - # - # @param [Array] node_types a set of node types to match - # @return [AstNode] the matching node, if one was found - # @return [self] if no node was found - def jump(*node_types) - traverse {|child| return(child) if node_types.include?(child.type) } - self - end - - # @return [Array] the {AstNode} children inside the node - def children - @children ||= select {|e| AstNode === e } - end - - # Traverses the object and yields each node (including descendants) in order. - # - # @yield each descendant node in order - # @yieldparam [AstNode] self, or a child/descendant node - # @return [void] - def traverse - nodes = [self] - until nodes.empty? - node = nodes.pop - yield node - nodes += node.children.reverse unless node.children.empty? - end - end - - # @group Node Meta Types - - # @return [Boolean] whether the node is a token - def token? - @token - end - - # @return [Boolean] whether the node is a reference (variable, - # constant name) - def ref? - false - end - - # @return [Boolean] whether the node is a literal value - def literal? - false - end - - # @return [Boolean] whether the node is a keyword - def kw? - false - end - - # @return [Boolean] whether the node is a method call - def call? - false - end - - # @return [Boolean] whether the node is a method definition - def def? - false - end - - # @return [Boolean] whether the node is a if/elsif/else condition - def condition? - false - end - - # @return [Boolean] whether the node is a loop - def loop? - false - end - - # @return [Boolean] whether the node has a block - def block? - respond_to?(:block) || condition? - end - - # @group Getting Line Information - - # @return [Boolean] whether the node has a {#line_range} set - def has_line? - @line_range ? true : false - end - - # @return [Fixnum] the starting line number of the node - def line - line_range && line_range.first - end - - # @return [String] the first line of source represented by the node. - def first_line - full_source.split(/\r?\n/)[line - 1].strip - end - - # @group Printing a Node - - # @return [String] the first line of source the node represents - def show - "\t#{line}: #{first_line}" - end - - # @return [nil] pretty prints the node - def pretty_print(q) - objs = dup + [:__last__] - objs.unshift(type) if type && type != :list - - options = [] - options << ['docstring', docstring] if @docstring - if @source_range || @line_range - options << ['line', line_range] - options << ['source', source_range] - end - objs.pop if options.empty? - - q.group(3, 's(', ')') do - q.seplist(objs, nil, :each) do |v| - if v == :__last__ - q.seplist(options, nil, :each) do |arr| - k, v2 = *arr - q.group(3) do - q.text k - q.group(3) do - q.text ': ' - q.pp v2 - end - end - end - else - q.pp v - end - end - end - end - - # @return [String] inspects the object - def inspect - typeinfo = type && type != :list ? ':' + type.to_s + ', ' : '' - 's(' + typeinfo + map(&:inspect).join(", ") + ')' - end - - # @group Managing node state - - # Resets node state in tree - def unfreeze - @children = nil - end - - # @endgroup - - private - - # Resets line information - # @return [void] - def reset_line_info - if size == 0 - self.line_range = @fallback_line - self.source_range = @fallback_source - elsif !children.empty? - f = children.first - l = children.last - self.line_range = Range.new(f.line_range.first, l.line_range.last) - self.source_range = Range.new(f.source_range.first, l.source_range.last) - elsif @fallback_line || @fallback_source - self.line_range = @fallback_line - self.source_range = @fallback_source - else - self.line_range = 0...0 - self.source_range = 0...0 - end - end - end - - class ReferenceNode < AstNode - def ref?; true end - - def path - Array.new flatten - end - - def namespace - Array.new flatten[0...-1] - end - end - - class LiteralNode < AstNode - def literal?; true end - end - - class KeywordNode < AstNode - def kw?; true end - end - - class ParameterNode < AstNode - def unnamed_required_params - self[0] - end - - def unnamed_optional_params - return @unnamed_optional_params if defined?(@unnamed_optional_params) - - params = self[1] || [] - if self[-3] && self[-3][0] && self[-3][0].type == :unnamed_optional_arg - params += self[-3] - end - - @unnamed_optional_params = params.empty? ? nil : params - end - - def named_params - return @named_params if defined?(@named_params) - - if YARD.ruby2? && self[-3] && self[-3][0] && self[-3][0].type == :named_arg - @named_params = self[-3] - else - @named_params = nil - end - end - - def splat_param - self[2] ? self[2][0] : nil - end - - def unnamed_end_params - self[3] - end - - def double_splat_param - return nil unless YARD.ruby2? - if (node = self[-2]).is_a?(AstNode) - if node.type == :ident - node - elsif node.type == :kwrest_param - # See https://bugs.ruby-lang.org/issues/12387 - node.last - end - end - end - - def block_param - self[-1] ? self[-1][0] : nil - end - end - - class MethodCallNode < AstNode - def call?; true end - def namespace; first if index_adjust > 0 end - - def method_name(name_only = false) - name = self[index_adjust] - if name == :call - nil - elsif name_only && Array === name - name.jump(:ident).first.to_sym - else - name - end - end - - def parameters(include_block_param = true) - return [] if type == :vcall - params = self[1 + index_adjust] - return [] unless params - params = call_has_paren? ? params.first : params - return [] unless params - include_block_param ? params : params[0...-1] - end - - def block_param; parameters.last end - - def block - last.type == :do_block || last.type == :brace_block ? last : nil - end - - private - - def index_adjust - [:call, :command_call].include?(type) ? 2 : 0 - end - - def call_has_paren? - [:fcall, :call].include?(type) - end - end - - class MethodDefinitionNode < AstNode - def kw?; true end - def def?; true end - def namespace; first if index_adjust > 0 end - - def method_name(name_only = false) - name = self[index_adjust] - name_only ? name.jump(:ident).first.to_sym : name - end - - def parameters(include_block_param = true) - params = self[1 + index_adjust] - params = params[0] if params.type == :paren - include_block_param ? params : params[0...-1] - end - - def signature - params_src = '' - params = self[1 + index_adjust] - if params.first - params_src = params.type == :paren ? '' : ' ' - params_src += params.source.gsub(/\s+(\s|\))/m, '\1') - end - - "def #{method_name(true)}#{params_src}" - end - - alias block last - - private - - def index_adjust - type == :defs ? 2 : 0 - end - end - - class ConditionalNode < KeywordNode - def condition?; true end - def condition; first end - def then_block; self[1] end - - def else_block - return unless self[2] && !cmod? - self[2].type == :elsif ? self[2] : self[2][0] - end - - private - - def cmod?; type =~ /_mod$/ end - end - - class ClassNode < KeywordNode - def class_name; first end - def superclass; type == :sclass ? nil : self[1] end - def block; last end - end - - class ModuleNode < KeywordNode - def module_name; first end - def block; last end - end - - class LoopNode < KeywordNode - def loop?; true end - def condition; type == :for ? s(self[0], self[1]) : first end - def block; last end - end - - # Represents a lone comment block in source - class CommentNode < AstNode - def docstring; first end - def docstring=(value) end - alias comments docstring - - def source; "" end - def first_line; "" end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/irb/slex.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/irb/slex.rb deleted file mode 100644 index 721ebd9eac..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/irb/slex.rb +++ /dev/null @@ -1,276 +0,0 @@ -# frozen_string_literal: false -# -# irb/slex.rb - simple lex analyzer -# $Release Version: 0.9.6$ -# $Revision$ -# by Keiju ISHITSUKA(keiju@ruby-lang.org) -# -# -- -# -# -# - -require "irb/notifier" - -# @private -module IRB - class SLex - DOUT = Notifier::def_notifier("SLex::") - D_WARN = DOUT::def_notifier(1, "Warn: ") - D_DEBUG = DOUT::def_notifier(2, "Debug: ") - D_DETAIL = DOUT::def_notifier(4, "Detail: ") - - DOUT.level = Notifier::D_NOMSG - - def initialize - @head = Node.new("") - end - - def def_rule(token, preproc = nil, postproc = nil, &block) - D_DETAIL.pp token - - postproc = block if block_given? - create(token, preproc, postproc) - end - - def def_rules(*tokens, &block) - if block_given? - p = block - end - for token in tokens - def_rule(token, nil, p) - end - end - - def preproc(token, proc) - node = search(token) - node.preproc=proc - end - - # need a check? - def postproc(token) - node = search(token, proc) - node.postproc=proc - end - - def search(token) - @head.search(token.split(//)) - end - - def create(token, preproc = nil, postproc = nil) - @head.create_subnode(token.split(//), preproc, postproc) - end - - def match(token) - case token - when Array - when String - return match(token.split(//)) - else - return @head.match_io(token) - end - ret = @head.match(token) - D_DETAIL.exec_if{D_DETAIL.printf "match end: %s:%s\n", ret, token.inspect} - ret - end - - def inspect - format("", @head.inspect) - end - - #---------------------------------------------------------------------- - # - # class Node - - # - #---------------------------------------------------------------------- - class Node - # if postproc is nil, this node is an abstract node. - # if postproc is non-nil, this node is a real node. - def initialize(preproc = nil, postproc = nil) - @Tree = {} - @preproc = preproc - @postproc = postproc - end - - attr_accessor :preproc - attr_accessor :postproc - - def search(chrs, opt = nil) - return self if chrs.empty? - ch = chrs.shift - if node = @Tree[ch] - node.search(chrs, opt) - else - if opt - chrs.unshift ch - self.create_subnode(chrs) - else - raise "node nothing" - end - end - end - - def create_subnode(chrs, preproc = nil, postproc = nil) - if chrs.empty? - if @postproc - D_DETAIL.pp node - raise "node already exists" - else - D_DEBUG.puts "change abstract node to real node." - @preproc = preproc - @postproc = postproc - end - return self - end - - ch = chrs.shift - if node = @Tree[ch] - if chrs.empty? - if node.postproc - DebugLogger.pp node - DebugLogger.pp self - DebugLogger.pp ch - DebugLogger.pp chrs - raise "node already exists" - else - D_WARN.puts "change abstract node to real node" - node.preproc = preproc - node.postproc = postproc - end - else - node.create_subnode(chrs, preproc, postproc) - end - else - if chrs.empty? - node = Node.new(preproc, postproc) - else - node = Node.new - node.create_subnode(chrs, preproc, postproc) - end - @Tree[ch] = node - end - node - end - - # - # chrs: String - # character array - # io must have getc()/ungetc(); and ungetc() must be - # able to be called arbitrary number of times. - # - def match(chrs, op = "") - D_DETAIL.print "match>: ", chrs, "op:", op, "\n" - if chrs.empty? - if @preproc.nil? || @preproc.call(op, chrs) - DOUT.printf(D_DETAIL, "op1: %s\n", op) - @postproc.call(op, chrs) - else - nil - end - else - ch = chrs.shift - if node = @Tree[ch] - if ret = node.match(chrs, op+ch) - return ret - else - chrs.unshift ch - if @postproc and @preproc.nil? || @preproc.call(op, chrs) - DOUT.printf(D_DETAIL, "op2: %s\n", op.inspect) - ret = @postproc.call(op, chrs) - return ret - else - return nil - end - end - else - chrs.unshift ch - if @postproc and @preproc.nil? || @preproc.call(op, chrs) - DOUT.printf(D_DETAIL, "op3: %s\n", op) - @postproc.call(op, chrs) - return "" - else - return nil - end - end - end - end - - def match_io(io, op = "") - if op == "" - ch = io.getc - if ch == nil - return nil - end - else - ch = io.getc_of_rests - end - if ch.nil? - if @preproc.nil? || @preproc.call(op, io) - D_DETAIL.printf("op1: %s\n", op) - @postproc.call(op, io) - else - nil - end - else - if node = @Tree[ch] - if ret = node.match_io(io, op+ch) - ret - else - io.ungetc ch - if @postproc and @preproc.nil? || @preproc.call(op, io) - DOUT.exec_if{D_DETAIL.printf "op2: %s\n", op.inspect} - @postproc.call(op, io) - else - nil - end - end - else - io.ungetc ch - if @postproc and @preproc.nil? || @preproc.call(op, io) - D_DETAIL.printf("op3: %s\n", op) - @postproc.call(op, io) - else - nil - end - end - end - end - end - end -end -# :startdoc: - -if $0 == __FILE__ - case $1 - when "1" - tr = SLex.new - print "0: ", tr.inspect, "\n" - tr.def_rule("=") {print "=\n"} - print "1: ", tr.inspect, "\n" - tr.def_rule("==") {print "==\n"} - print "2: ", tr.inspect, "\n" - - print "case 1:\n" - print tr.match("="), "\n" - print "case 2:\n" - print tr.match("=="), "\n" - print "case 3:\n" - print tr.match("=>"), "\n" - - when "2" - tr = SLex.new - print "0: ", tr.inspect, "\n" - tr.def_rule("=") {print "=\n"} - print "1: ", tr.inspect, "\n" - tr.def_rule("==", proc{false}) {print "==\n"} - print "2: ", tr.inspect, "\n" - - print "case 1:\n" - print tr.match("="), "\n" - print "case 2:\n" - print tr.match("=="), "\n" - print "case 3:\n" - print tr.match("=>"), "\n" - end - exit -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/ruby_lex.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/ruby_lex.rb deleted file mode 100644 index 0a843d0f5e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/ruby_lex.rb +++ /dev/null @@ -1,1345 +0,0 @@ -require_relative 'irb/slex' - -module YARD - module Parser::Ruby::Legacy - # Legacy lexical tokenizer module. - module RubyToken - EXPR_BEG = :EXPR_BEG - EXPR_MID = :EXPR_MID - EXPR_END = :EXPR_END - EXPR_ARG = :EXPR_ARG - EXPR_FNAME = :EXPR_FNAME - EXPR_DOT = :EXPR_DOT - EXPR_CLASS = :EXPR_CLASS - - # Represents a token in the Ruby lexer - class Token - # @return [Integer] the line number in the file/stream the token is - # located. - attr_reader :line_no - - # @return [Integer] the character number in the file/stream the token - # is located. - attr_reader :char_no - - # @return [String] the token text value - attr_reader :text - - # @return [Symbol] the lexical state at the token - attr_accessor :lex_state - - # @private - NO_TEXT = "??".freeze - - # Creates a new Token object - # @param [Integer] line_no the line number to initialize the token to - # @param [Integer] char_no the char number to initialize the token to - def initialize(line_no, char_no) - @line_no = line_no - @char_no = char_no - @text = NO_TEXT - end - - # Chainable way to sets the text attribute - # - # @param [String] text the new text - # @return [Token] this token object - def set_text(text) - @text = text - self - end - end - - # Represents a block - class TkBlockContents < Token - def text; '...' end - end - - # Represents an end statement - class TkStatementEnd < Token - def text; '' end - end - - class TkNode < Token - attr :node - end - - # Represents whitespace - class TkWhitespace < Token - end - - # Represents a Ruby identifier - class TkId < Token - def initialize(line_no, char_no, name) - super(line_no, char_no) - @name = name - end - attr :name - end - - # Represents a Ruby keyword - class TkKW < TkId - end - - # Represents a Ruby value - class TkVal < Token - def initialize(line_no, char_no, value = nil) - super(line_no, char_no) - set_text(value) - end - end - - class TkOp < Token - def name - self.class.op_name - end - end - - class TkOPASGN < TkOp - def initialize(line_no, char_no, op) - super(line_no, char_no) - op = TkReading2Token[op] unless op.is_a?(Symbol) - @op = op - end - attr :op - end - - class TkUnknownChar < Token - def initialize(line_no, char_no, _id) - super(line_no, char_no) - @name = char_no > 255 ? '?' : char_no.chr - end - attr :name - end - - class TkError < Token - end - - # @private - def set_token_position(line, char) - @prev_line_no = line - @prev_char_no = char - end - - # @private - def Token(token, value = nil) # rubocop:disable Style/MethodName - tk = nil - case token - when String, Symbol - source = token.is_a?(String) ? TkReading2Token : TkSymbol2Token - if (tk = source[token]).nil? - raise "no key #{token}" - end - tk = Token(tk[0], value) - else - if token - tk = if (token.ancestors & [TkId, TkVal, TkOPASGN, TkUnknownChar]).empty? - token.new(@prev_line_no, @prev_char_no) - else - token.new(@prev_line_no, @prev_char_no, value) - end - end - end - tk - end - - # @private - TokenDefinitions = [ - [:TkCLASS, TkKW, "class", EXPR_CLASS], - [:TkMODULE, TkKW, "module", EXPR_BEG], - [:TkDEF, TkKW, "def", EXPR_FNAME], - [:TkUNDEF, TkKW, "undef", EXPR_FNAME], - [:TkBEGIN, TkKW, "begin", EXPR_BEG], - [:TkRESCUE, TkKW, "rescue", EXPR_MID], - [:TkENSURE, TkKW, "ensure", EXPR_BEG], - [:TkEND, TkKW, "end", EXPR_END], - [:TkIF, TkKW, "if", EXPR_BEG, :TkIF_MOD], - [:TkUNLESS, TkKW, "unless", EXPR_BEG, :TkUNLESS_MOD], - [:TkTHEN, TkKW, "then", EXPR_BEG], - [:TkELSIF, TkKW, "elsif", EXPR_BEG], - [:TkELSE, TkKW, "else", EXPR_BEG], - [:TkCASE, TkKW, "case", EXPR_BEG], - [:TkWHEN, TkKW, "when", EXPR_BEG], - [:TkWHILE, TkKW, "while", EXPR_BEG, :TkWHILE_MOD], - [:TkUNTIL, TkKW, "until", EXPR_BEG, :TkUNTIL_MOD], - [:TkFOR, TkKW, "for", EXPR_BEG], - [:TkBREAK, TkKW, "break", EXPR_END], - [:TkNEXT, TkKW, "next", EXPR_END], - [:TkREDO, TkKW, "redo", EXPR_END], - [:TkRETRY, TkKW, "retry", EXPR_END], - [:TkIN, TkKW, "in", EXPR_BEG], - [:TkDO, TkKW, "do", EXPR_BEG], - [:TkRETURN, TkKW, "return", EXPR_MID], - [:TkYIELD, TkKW, "yield", EXPR_END], - [:TkSUPER, TkKW, "super", EXPR_END], - [:TkSELF, TkKW, "self", EXPR_END], - [:TkNIL, TkKW, "nil", EXPR_END], - [:TkTRUE, TkKW, "true", EXPR_END], - [:TkFALSE, TkKW, "false", EXPR_END], - [:TkAND, TkKW, "and", EXPR_BEG], - [:TkOR, TkKW, "or", EXPR_BEG], - [:TkNOT, TkKW, "not", EXPR_BEG], - [:TkIF_MOD, TkKW], - [:TkUNLESS_MOD, TkKW], - [:TkWHILE_MOD, TkKW], - [:TkUNTIL_MOD, TkKW], - [:TkALIAS, TkKW, "alias", EXPR_FNAME], - [:TkDEFINED, TkKW, "defined?", EXPR_END], - [:TklBEGIN, TkKW, "BEGIN", EXPR_END], - [:TklEND, TkKW, "END", EXPR_END], - [:Tk__LINE__, TkKW, "__LINE__", EXPR_END], - [:Tk__FILE__, TkKW, "__FILE__", EXPR_END], - [:TkIDENTIFIER, TkId], - [:TkFID, TkId], - [:TkGVAR, TkId], - [:TkIVAR, TkId], - [:TkCONSTANT, TkId], - [:TkINTEGER, TkVal], - [:TkFLOAT, TkVal], - [:TkSYMBOL, TkVal], - [:TkLABEL, TkVal], - [:TkSTRING, TkVal], - [:TkXSTRING, TkVal], - [:TkREGEXP, TkVal], - [:TkCOMMENT, TkVal], - [:TkDSTRING, TkNode], - [:TkDXSTRING, TkNode], - [:TkDREGEXP, TkNode], - [:TkNTH_REF, TkId], - [:TkBACK_REF, TkId], - [:TkUPLUS, TkOp, "+@"], - [:TkUMINUS, TkOp, "-@"], - [:TkPOW, TkOp, "**"], - [:TkCMP, TkOp, "<=>"], - [:TkEQ, TkOp, "=="], - [:TkEQQ, TkOp, "==="], - [:TkNEQ, TkOp, "!="], - [:TkGEQ, TkOp, ">="], - [:TkLEQ, TkOp, "<="], - [:TkANDOP, TkOp, "&&"], - [:TkOROP, TkOp, "||"], - [:TkMATCH, TkOp, "=~"], - [:TkNMATCH, TkOp, "!~"], - [:TkDOT2, TkOp, ".."], - [:TkDOT3, TkOp, "..."], - [:TkAREF, TkOp, "[]"], - [:TkASET, TkOp, "[]="], - [:TkLSHFT, TkOp, "<<"], - [:TkRSHFT, TkOp, ">>"], - [:TkCOLON2, TkOp], - [:TkCOLON3, TkOp], - [:OPASGN, TkOp], # +=, -= etc. # - [:TkASSOC, TkOp, "=>"], - [:TkQUESTION, TkOp, "?"], #? - [:TkCOLON, TkOp, ":"], #: - [:TkSTAR], # *arg - [:TkAMPER], # &arg # - [:TkSYMBEG, TkId], - [:TkGT, TkOp, ">"], - [:TkLT, TkOp, "<"], - [:TkPLUS, TkOp, "+"], - [:TkMINUS, TkOp, "-"], - [:TkMULT, TkOp, "*"], - [:TkDIV, TkOp, "/"], - [:TkMOD, TkOp, "%"], - [:TkBITOR, TkOp, "|"], - [:TkBITXOR, TkOp, "^"], - [:TkBITAND, TkOp, "&"], - [:TkBITNOT, TkOp, "~"], - [:TkNOTOP, TkOp, "!"], - [:TkBACKQUOTE, TkOp, "`"], - [:TkASSIGN, Token, "="], - [:TkDOT, Token, "."], - [:TkLPAREN, Token, "("], # (exp) - [:TkLBRACK, Token, "["], # [arry] - [:TkLBRACE, Token, "{"], # {hash} - [:TkRPAREN, Token, ")"], - [:TkRBRACK, Token, "]"], - [:TkRBRACE, Token, "}"], - [:TkCOMMA, Token, ","], - [:TkSEMICOLON, Token, ";"], - [:TkSPACE, TkWhitespace], - [:TkNL, TkWhitespace], - [:TkEND_OF_SCRIPT, TkWhitespace], - [:TkBACKSLASH, TkUnknownChar, "\\"], - [:TkAT, TkUnknownChar, "@"], - [:TkDOLLAR, TkUnknownChar, "\$"] - ] - - # { reading => token_class } - # { reading => [token_class, *opt] } - TkReading2Token = {} - TkSymbol2Token = {} - - # @private - def self.def_token(token_n, super_token = Token, reading = nil, *opts) - token_n = token_n.id2name unless token_n.is_a?(String) - if RubyToken.const_defined?(token_n) - # IRB.fail AlreadyDefinedToken, token_n - end - - token_c = Class.new super_token - RubyToken.const_set token_n, token_c - # token_c.inspect - - if reading - if TkReading2Token[reading] - raise "duplicate #{token_n} #{reading}" - end - if opts.empty? - TkReading2Token[reading] = [token_c] - else - TkReading2Token[reading] = [token_c].concat(opts) - end - end - TkSymbol2Token[token_n.intern] = token_c - - if token_c <= TkOp - token_c.class_eval %{ - def self.op_name; "#{reading}"; end - } - end - end - - for defs in TokenDefinitions - def_token(*defs) - end - - NEWLINE_TOKEN = TkNL.new(0, 0) - NEWLINE_TOKEN.set_text("\n") - end - - # Lexical analyzer for Ruby source - # @private - class RubyLex - # Read an input stream character by character. We allow for unlimited - # ungetting of characters just read. - # - # We simplify the implementation greatly by reading the entire input - # into a buffer initially, and then simply traversing it using - # pointers. - # - # We also have to allow for the here document diversion. This - # little gem comes about when the lexer encounters a here - # document. At this point we effectively need to split the input - # stream into two parts: one to read the body of the here document, - # the other to read the rest of the input line where the here - # document was initially encountered. For example, we might have - # - # do_something(<<-A, <<-B) - # stuff - # for - # A - # stuff - # for - # B - # - # When the lexer encounters the <= @size - ch = @content[@offset, 1] - - @offset += 1 - @hwm = @offset if @hwm < @offset - - if @newline_pending - @line_num += 1 - @last_newline = @offset - 1 - @newline_pending = false - end - - if ch == "\n" - @newline_pending = true - end - ch - end - - def getc_already_read - getc - end - - def ungetc(_ch) - raise "unget past beginning of file" if @offset <= 0 - @offset -= 1 - if @content[@offset] == ?\n - @newline_pending = false - end - end - - def get_read - res = @content[@read_back_offset...@offset] - @read_back_offset = @offset - res - end - - def peek(at) - pos = @offset + at - if pos >= @size - nil - else - @content[pos, 1] - end - end - - def peek_equal(str) - @content[@offset, str.length] == str - end - - def divert_read_from(reserve) - @content[@offset, 0] = reserve - @size = @content.size - end - end - - # end of nested class BufferedReader - - include RubyToken - include IRB - - attr_reader :continue - attr_reader :lex_state - - def self.debug? - false - end - - def initialize(content) - lex_init - - @reader = BufferedReader.new(content) - - @exp_line_no = @line_no = 1 - @base_char_no = 0 - @indent = 0 - - @ltype = nil - @quoted = nil - @lex_state = EXPR_BEG - @space_seen = false - - @continue = false - @line = "" - - @skip_space = false - @read_auto_clean_up = false - @exception_on_syntax_error = true - - @colonblock_seen = false - end - - attr_accessor :skip_space - attr_accessor :read_auto_clean_up - attr_accessor :exception_on_syntax_error - - attr :indent - - # io functions - def line_no - @reader.line_num - end - - def char_no - @reader.column - end - - def get_read - @reader.get_read - end - - def getc - @reader.getc - end - - def getc_of_rests - @reader.getc_already_read - end - - def gets - (c = getc) || return - l = "" - begin - l.concat c unless c == "\r" - break if c == "\n" - end while c = getc # rubocop:disable Lint/Loop - l - end - - def ungetc(c = nil) - @reader.ungetc(c) - end - - def peek_equal?(str) - @reader.peek_equal(str) - end - - def peek(i = 0) - @reader.peek(i) - end - - def lex - catch(:eof) do - until ((tk = token).is_a?(TkNL) || tk.is_a?(TkEND_OF_SCRIPT)) && - !@continue || - tk.nil? - end - line = get_read - - if line == "" && tk.is_a?(TkEND_OF_SCRIPT) || tk.nil? - nil - else - line - end - end - end - - def token - set_token_position(line_no, char_no) - catch(:eof) do - begin - begin - tk = @OP.match(self) - @space_seen = tk.is_a?(TkSPACE) - rescue SyntaxError - abort if @exception_on_syntax_error - tk = TkError.new(line_no, char_no) - end - end while @skip_space && tk.is_a?(TkSPACE) - if @read_auto_clean_up - get_read - end - # throw :eof unless tk - p tk if $DEBUG - tk.lex_state = lex_state if tk - tk - end - end - - ENINDENT_CLAUSE = [ - "case", "class", "def", "do", "for", "if", - "module", "unless", "until", "while", "begin" - ] #, "when" - ACCEPTS_COLON = ["if", "for", "unless", "until", "while"] - DEINDENT_CLAUSE = ["end"] #, "when" - - PERCENT_LTYPE = { - "q" => "\'", - "Q" => "\"", - "x" => "\`", - "r" => "/", - "w" => "]", - "W" => "]" - } - - PERCENT_PAREN = { - "{" => "}", - "[" => "]", - "<" => ">", - "(" => ")" - } - - Ltype2Token = { - "\'" => TkSTRING, - "\"" => TkSTRING, - "\`" => TkXSTRING, - "/" => TkREGEXP, - "]" => TkDSTRING - } - Ltype2Token.default = TkSTRING - - DLtype2Token = { - "\"" => TkDSTRING, - "\`" => TkDXSTRING, - "/" => TkDREGEXP - } - - def lex_init() - @OP = SLex.new - @OP.def_rules("\0", "\004", "\032") do |chars, _io| - Token(TkEND_OF_SCRIPT).set_text(chars) - end - - @OP.def_rules(" ", "\t", "\f", "\r", "\13") do |chars, _io| - @space_seen = true - while (ch = getc) =~ /[ \t\f\r\13]/ - chars << ch - end - ungetc - Token(TkSPACE).set_text(chars) - end - - @OP.def_rule("#") do |_op, _io| - identify_comment - end - - @OP.def_rule("=begin", proc { @prev_char_no == 0 && peek(0) =~ /\s/ }) do |op, _io| - str = String.new(op) - @ltype = "=" - - begin - line = String.new - begin - ch = getc - line << ch - end until ch == "\n" - str << line - end until line =~ /^=end/ - - ungetc - - @ltype = nil - - if str =~ /\A=begin\s+rdoc/i - str.sub!(/\A=begin.*\n/, '') - str.sub!(/^=end.*/m, '') - Token(TkCOMMENT).set_text(str) - else - Token(TkCOMMENT).set_text(str) - end - end - - @OP.def_rule("\n") do - print "\\n\n" if RubyLex.debug? - @colonblock_seen = false - case @lex_state - when EXPR_BEG, EXPR_FNAME, EXPR_DOT - @continue = true - else - @continue = false - @lex_state = EXPR_BEG - end - Token(TkNL).set_text("\n") - end - - @OP.def_rules("*", "**", - "!", "!=", "!~", - "=", "==", "===", - "=~", "<=>", - "<", "<=", - ">", ">=", ">>") do |op, _io| - @lex_state = EXPR_BEG - Token(op).set_text(op) - end - - @OP.def_rules("<<") do |op, _io| - tk = nil - if @lex_state != EXPR_END && @lex_state != EXPR_CLASS && - (@lex_state != EXPR_ARG || @space_seen) - c = peek(0) - tk = identify_here_document if /[-\w\"\'\`]/ =~ c - end - if !tk - @lex_state = EXPR_BEG - tk = Token(op).set_text(op) - end - tk - end - - @OP.def_rules("'", '"') do |op, _io| - identify_string(op) - end - - @OP.def_rules("`") do |op, _io| - if @lex_state == EXPR_FNAME - Token(op).set_text(op) - else - identify_string(op) - end - end - - @OP.def_rules('?') do |op, _io| - if @lex_state == EXPR_END - @lex_state = EXPR_BEG - Token(TkQUESTION).set_text(op) - else - ch = getc - if @lex_state == EXPR_ARG && ch !~ /\s/ - ungetc - @lex_state = EXPR_BEG - Token(TkQUESTION).set_text(op) - else - str = String.new(op) - str << ch - if ch == '\\' #' - str << read_escape - end - @lex_state = EXPR_END - Token(TkINTEGER).set_text(str) - end - end - end - - @OP.def_rules("&", "&&", "|", "||") do |op, _io| - @lex_state = EXPR_BEG - Token(op).set_text(op) - end - - @OP.def_rules("+=", "-=", "*=", "**=", - "&=", "|=", "^=", "<<=", ">>=", "||=", "&&=") do |op, _io| - @lex_state = EXPR_BEG - op =~ /^(.*)=$/ - Token(TkOPASGN, $1).set_text(op) - end - - @OP.def_rule("+@", proc { @lex_state == EXPR_FNAME }) do |op, _io| - Token(TkUPLUS).set_text(op) - end - - @OP.def_rule("-@", proc { @lex_state == EXPR_FNAME }) do |op, _io| - Token(TkUMINUS).set_text(op) - end - - @OP.def_rules("+", "-") do |op, _io| - catch(:RET) do - if @lex_state == EXPR_ARG - if @space_seen && peek(0) =~ /[0-9]/ - throw :RET, identify_number(op) - else - @lex_state = EXPR_BEG - end - elsif @lex_state != EXPR_END && peek(0) =~ /[0-9]/ - throw :RET, identify_number(op) - else - @lex_state = EXPR_BEG - end - Token(op).set_text(op) - end - end - - @OP.def_rule(".") do - @lex_state = EXPR_BEG - if peek(0) =~ /[0-9]/ - ungetc - identify_number("") - else - # for obj.if - @lex_state = EXPR_DOT - Token(TkDOT).set_text(".") - end - end - - @OP.def_rules("..", "...") do |op, _io| - @lex_state = EXPR_BEG - Token(op).set_text(op) - end - - lex_int2 - end - - def lex_int2 - @OP.def_rules("]", "}", ")") do |op, _io| - @lex_state = EXPR_END - @indent -= 1 - Token(op).set_text(op) - end - - @OP.def_rule(":") do - if (@colonblock_seen && @lex_state != EXPR_BEG) || peek(0) =~ /\s/ - @lex_state = EXPR_BEG - tk = Token(TkCOLON) - else - @lex_state = EXPR_FNAME - tk = Token(TkSYMBEG) - end - tk.set_text(":") - end - - @OP.def_rule("::") do - # p @lex_state.id2name, @space_seen - if @lex_state == EXPR_BEG || @lex_state == EXPR_ARG && @space_seen - @lex_state = EXPR_BEG - tk = Token(TkCOLON3) - else - @lex_state = EXPR_DOT - tk = Token(TkCOLON2) - end - tk.set_text("::") - end - - @OP.def_rule("/") do |op, _io| - if @lex_state == EXPR_BEG || @lex_state == EXPR_MID - identify_string(op) - elsif peek(0) == '=' - getc - @lex_state = EXPR_BEG - Token(TkOPASGN, :/).set_text("/=") #") - elsif @lex_state == EXPR_ARG && @space_seen && peek(0) !~ /\s/ - identify_string(op) - else - @lex_state = EXPR_BEG - Token("/").set_text(op) - end - end - - @OP.def_rules("^") do - @lex_state = EXPR_BEG - Token("^").set_text("^") - end - - # @OP.def_rules("^=") do - # @lex_state = EXPR_BEG - # Token(TkOPASGN, :^) - # end - - @OP.def_rules(",", ";") do |op, _io| - @colonblock_seen = false - @lex_state = EXPR_BEG - Token(op).set_text(op) - end - - @OP.def_rule("~") do - @lex_state = EXPR_BEG - Token("~").set_text("~") - end - - @OP.def_rule("~@", proc { @lex_state = EXPR_FNAME }) do - @lex_state = EXPR_BEG - Token("~").set_text("~@") - end - - @OP.def_rule("(") do - @indent += 1 - # if @lex_state == EXPR_BEG || @lex_state == EXPR_MID - # @lex_state = EXPR_BEG - # tk = Token(TkfLPAREN) - # else - @lex_state = EXPR_BEG - tk = Token(TkLPAREN) - # end - tk.set_text("(") - end - - @OP.def_rule("[]", proc { @lex_state == EXPR_FNAME }) do - Token("[]").set_text("[]") - end - - @OP.def_rule("[]=", proc { @lex_state == EXPR_FNAME }) do - Token("[]=").set_text("[]=") - end - - @OP.def_rule("[") do - @indent += 1 - # if @lex_state == EXPR_FNAME - # t = Token(TkfLBRACK) - # else - # if @lex_state == EXPR_BEG || @lex_state == EXPR_MID - # t = Token(TkLBRACK) - # elsif @lex_state == EXPR_ARG && @space_seen - # else - # t = Token(TkfLBRACK) - # end - # end - t = Token(TkLBRACK) - @lex_state = EXPR_BEG - t.set_text("[") - end - - @OP.def_rule("{") do - @indent += 1 - # if @lex_state != EXPR_END && @lex_state != EXPR_ARG - # t = Token(TkLBRACE) - # else - # t = Token(TkfLBRACE) - # end - t = Token(TkLBRACE) - @lex_state = EXPR_BEG - t.set_text("{") - end - - @OP.def_rule('\\') do #' - if getc == "\n" - @space_seen = true - @continue = true - Token(TkSPACE).set_text("\\\n") - else - ungetc - Token("\\").set_text("\\") #" - end - end - - @OP.def_rule('%') do |_op, _io| - if @lex_state == EXPR_BEG || @lex_state == EXPR_MID - identify_quotation('%') - elsif peek(0) == '=' - getc - Token(TkOPASGN, "%").set_text("%=") - elsif @lex_state == EXPR_ARG && @space_seen && peek(0) !~ /\s/ - identify_quotation('%') - else - @lex_state = EXPR_BEG - Token("%").set_text("%") - end - end - - @OP.def_rule('$') do #' - identify_gvar - end - - @OP.def_rule('@') do - if peek(0) =~ /[@\w]/ - ungetc - identify_identifier - else - Token("@").set_text("@") - end - end - - # @OP.def_rule("def", proc{|op, io| /\s/ =~ io.peek(0)}) do - # |op, io| - # @indent += 1 - # @lex_state = EXPR_FNAME - # # @lex_state = EXPR_END - # # until @rests[0] == "\n" or @rests[0] == ";" - # # rests.shift - # # end - # end - - @OP.def_rule("__END__", proc { @prev_char_no == 0 && peek(0) =~ /[\r\n]/ }) do - throw :eof - end - - @OP.def_rule("") do |op, io| - printf "MATCH: start %s: %s\n", op, io.inspect if RubyLex.debug? - if peek(0) =~ /[0-9]/ - t = identify_number("") - elsif peek(0) =~ /[\w]/ - t = identify_identifier - end - printf "MATCH: end %s: %s\n", op, io.inspect if RubyLex.debug? - t - end - - p @OP if RubyLex.debug? - end - - def identify_gvar - @lex_state = EXPR_END - str = String.new("$") - - tk = case ch = getc - when %r{[~_*$?!@/\\;,=:<>".]} - str << ch - Token(TkGVAR, str) - - when "-" - str << "-" << getc - Token(TkGVAR, str) - - when "&", "`", "'", "+" - str << ch - Token(TkBACK_REF, str) - - when /[1-9]/ - str << ch - while (ch = getc) =~ /[0-9]/ - str << ch - end - ungetc - Token(TkNTH_REF) - when /\w/ - ungetc - ungetc - return identify_identifier - else - ungetc - Token("$") - end - tk.set_text(str) - end - - def identify_identifier - token = "" - token.concat getc if peek(0) =~ /[$@]/ - token.concat getc if peek(0) == "@" - - while (ch = getc) =~ /\w|_/ - print ":", ch, ":" if RubyLex.debug? - token.concat ch - end - ungetc - - if ch == "!" || ch == "?" - token.concat getc - end - # fix token - - # $stderr.puts "identifier - #{token}, state = #@lex_state" - - case token - when /^\$/ - return Token(TkGVAR, token).set_text(token) - when /^\@/ - @lex_state = EXPR_END - return Token(TkIVAR, token).set_text(token) - end - - if @lex_state != EXPR_DOT - print token, "\n" if RubyLex.debug? - - token_c, *trans = TkReading2Token[token] - if token_c - # reserved word? - - if @lex_state != EXPR_BEG && - @lex_state != EXPR_FNAME && - trans[1] - # modifiers - token_c = TkSymbol2Token[trans[1]] - @lex_state = trans[0] - else - if @lex_state != EXPR_FNAME - if ENINDENT_CLAUSE.include?(token) - @indent += 1 - - if ACCEPTS_COLON.include?(token) - @colonblock_seen = true - else - @colonblock_seen = false - end - elsif DEINDENT_CLAUSE.include?(token) - @indent -= 1 - @colonblock_seen = false - end - @lex_state = trans[0] - else - @lex_state = EXPR_END - end - end - return Token(token_c, token).set_text(token) - end - end - - if @lex_state == EXPR_FNAME - @lex_state = EXPR_END - if peek(0) == '=' - token.concat getc - end - elsif @lex_state == EXPR_BEG || @lex_state == EXPR_DOT - @lex_state = EXPR_ARG - else - @lex_state = EXPR_END - end - - if token[0, 1] =~ /[A-Z]/ - return Token(TkCONSTANT, token).set_text(token) - elsif token[token.size - 1, 1] =~ /[!?]/ - return Token(TkFID, token).set_text(token) - else - return Token(TkIDENTIFIER, token).set_text(token) - end - end - - def identify_here_document - ch = getc - if ch == "-" - ch = getc - indent = true - end - if /['"`]/ =~ ch # ' - lt = ch - quoted = "" - while (c = getc) && c != lt - quoted.concat c - end - else - lt = '"' - quoted = ch.dup - while (c = getc) && c =~ /\w/ - quoted.concat c - end - ungetc - end - - ltback, @ltype = @ltype, lt - reserve = String.new - - while ch = getc - reserve << ch - if ch == "\\" #" - ch = getc - reserve << ch - elsif ch == "\n" - break - end - end - - str = String.new - while (l = gets) - l.chomp! - l.strip! if indent - break if l == quoted - str << l.chomp << "\n" - end - - @reader.divert_read_from(reserve) - - @ltype = ltback - @lex_state = EXPR_END - Token(Ltype2Token[lt], str).set_text(str.dump) - end - - def identify_quotation(initial_char) - ch = getc - if lt = PERCENT_LTYPE[ch] - initial_char += ch - ch = getc - elsif ch =~ /\W/ - lt = "\"" - else - # RubyLex.fail SyntaxError, "unknown type of %string ('#{ch}')" - end - # if ch !~ /\W/ - # ungetc - # next - # end - # @ltype = lt - @quoted = ch unless @quoted = PERCENT_PAREN[ch] - identify_string(lt, @quoted, ch, initial_char) if lt - end - - def identify_number(start) - str = start.dup - - if start == "+" || start == "-" || start == "" - start = getc - str << start - end - - @lex_state = EXPR_END - - if start == "0" - if peek(0) == "x" - ch = getc - str << ch - match = /[0-9a-f_]/ - else - match = /[0-7_]/ - end - while ch = getc - if ch !~ match - ungetc - break - else - str << ch - end - end - return Token(TkINTEGER).set_text(str) - end - - type = TkINTEGER - allow_point = true - allow_e = true - while ch = getc - case ch - when /[0-9_]/ - str << ch - - when allow_point && "." - type = TkFLOAT - if peek(0) !~ /[0-9]/ - ungetc - break - end - str << ch - allow_point = false - - when allow_e && "e", allow_e && "E" - str << ch - type = TkFLOAT - if peek(0) =~ /[+-]/ - str << getc - end - allow_e = false - allow_point = false - else - ungetc - break - end - end - Token(type).set_text(str) - end - - def identify_string(ltype, quoted = ltype, opener = nil, initial_char = nil) - @ltype = ltype - @quoted = quoted - subtype = nil - - str = String.new - str << initial_char if initial_char - str << (opener || quoted) - - nest = 0 - begin - while ch = getc - str << ch - if @quoted == ch - if nest == 0 - break - else - nest -= 1 - end - elsif opener == ch - nest += 1 - elsif @ltype != "'" && @ltype != "]" && ch == "#" - ch = getc - if ch == "{" - subtype = true - str << ch << skip_inner_expression - else - ungetc(ch) - end - elsif ch == '\\' #' - str << read_escape - end - end - if @ltype == "/" - if peek(0) =~ /i|o|n|e|s/ - str << getc - end - end - if subtype - Token(DLtype2Token[ltype], str) - else - Token(Ltype2Token[ltype], str) - end.set_text(str) - ensure - @ltype = nil - @quoted = nil - @lex_state = EXPR_END - end - end - - def skip_inner_expression - res = String.new - nest = 0 - while (ch = getc) - res << ch - if ch == '}' - break if nest == 0 - nest -= 1 - elsif ch == '{' - nest += 1 - end - end - res - end - - def identify_comment - @ltype = "#" - comment = String.new("#") - while ch = getc - if ch == "\\" - ch = getc - if ch == "\n" - ch = " " - else - comment << "\\" - end - else - if ch == "\n" - @ltype = nil - ungetc - break - end - end - comment << ch - end - Token(TkCOMMENT).set_text(comment) - end - - def read_escape - res = String.new - case ch = getc - when /[0-7]/ - ungetc ch - 3.times do - case ch = getc - when /[0-7]/ - when nil - break - else - ungetc - break - end - res << ch - end - - when "x" - res << ch - 2.times do - case ch = getc - when /[0-9a-fA-F]/ - when nil - break - else - ungetc - break - end - res << ch - end - - when "M" - res << ch - if (ch = getc) != '-' - ungetc - else - res << ch - if (ch = getc) == "\\" #" - res << ch - res << read_escape - else - res << ch - end - end - - when "C", "c" #, "^" - res << ch - if ch == "C" && (ch = getc) != "-" - ungetc - else - res << ch - if (ch = getc) == "\\" #" - res << ch - res << read_escape - else - res << ch - end - end - else - res << ch - end - res - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/ruby_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/ruby_parser.rb deleted file mode 100644 index 9b12efecaf..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/ruby_parser.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true -module YARD - module Parser - module Ruby - module Legacy - # Legacy Ruby parser - # @since 0.5.6 - class RubyParser < Parser::Base - def initialize(source, _filename) - @source = source - end - - def parse - @parse ||= StatementList.new(@source) - self - end - - def tokenize - @tokenize ||= TokenList.new(@source) - end - - def enumerator - @parse - end - - def encoding_line; @parse.encoding_line end - def shebang_line; @parse.shebang_line end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/statement.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/statement.rb deleted file mode 100644 index e02fb34b65..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/statement.rb +++ /dev/null @@ -1,68 +0,0 @@ -# frozen_string_literal: true -module YARD - module Parser::Ruby::Legacy - class Statement - attr_reader :tokens, :comments, :block - attr_accessor :comments_range - - # @deprecated Groups are now defined by directives - # @see Tags::GroupDirective - attr_accessor :group - - attr_accessor :comments_hash_flag - - def initialize(tokens, block = nil, comments = nil) - @tokens = tokens - @block = block - @comments = comments - @comments_hash_flag = false - end - - def first_line - to_s.split(/\n/)[0] - end - - alias signature first_line - - def to_s(include_block = true) - tokens.map do |token| - RubyToken::TkBlockContents === token ? (include_block ? block.to_s : '') : token.text - end.join - end - alias source to_s - - def inspect - l = line - 1 - to_s(false).split(/\n/).map do |text| - "\t#{l += 1}: #{text}" - end.join("\n") - end - - def show - "\t#{line}: #{first_line}" - end - - # @return [Fixnum] the first line of Ruby source - def line - tokens.first.line_no - end - - # @return [Range] the first to last lines of Ruby source - # @since 0.5.4 - def line_range - tokens.first.line_no..tokens.last.line_no - end - - private - - def clean_tokens(tokens) - last_tk = nil - tokens.reject do |tk| - tk.is_a?(RubyToken::TkNL) || - (last_tk.is_a?(RubyToken::TkSPACE) && - last_tk.class == tk.class) && last_tk = tk - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/statement_list.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/statement_list.rb deleted file mode 100644 index 14e212db22..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/statement_list.rb +++ /dev/null @@ -1,394 +0,0 @@ -# frozen_string_literal: true -module YARD - module Parser::Ruby::Legacy - class StatementList < Array - include RubyToken - - attr_accessor :shebang_line, :encoding_line - - # The following list of tokens will require a block to be opened - # if used at the beginning of a statement. - OPEN_BLOCK_TOKENS = [TkCLASS, TkDEF, TkMODULE, TkUNTIL, - TkIF, TkELSIF, TkUNLESS, TkWHILE, TkFOR, TkCASE] - - # Creates a new statement list - # - # @param [TokenList, String] content the tokens to create the list from - def initialize(content) - @shebang_line = nil - @encoding_line = nil - @comments_last_line = nil - if content.is_a? TokenList - @tokens = content.dup - elsif content.is_a? String - @tokens = TokenList.new(content.delete("\r")) - else - raise ArgumentError, "Invalid content for StatementList: #{content.inspect}:#{content.class}" - end - - parse_statements - end - - private - - def parse_statements - loop do - stmt = next_statement - break if stmt.nil? - self << stmt - end - end - - # Returns the next statement in the token stream - # - # @return [Statement] the next statement - def next_statement - @state = :first_statement - @statement_stack = [] - @level = 0 - @block_num = 0 - @done = false - @current_block = nil - @comments_line = nil - @comments_hash_flag = nil - @statement = TokenList.new - @block = nil - @comments = nil - @last_tk = nil - @last_ns_tk = nil - @before_last_tk = nil - @before_last_ns_tk = nil - @first_line = nil - - until @done - tk = @tokens.shift - break if tk.nil? - process_token(tk) - - @before_last_tk = @last_tk - @last_tk = tk # Save last token - unless [TkSPACE, TkNL, TkEND_OF_SCRIPT].include? tk.class - @before_last_ns_tk = @last_ns_tk - @last_ns_tk = tk - end - end - - # Return the code block with starting token and initial comments - # If there is no code in the block, return nil - @comments = @comments.compact if @comments - if @block || !@statement.empty? - sanitize_statement_end - sanitize_block - @statement.pop if [TkNL, TkSPACE, TkSEMICOLON].include?(@statement.last.class) - stmt = Statement.new(@statement, @block, @comments) - if @comments && @comments_line - stmt.comments_range = (@comments_line..(@comments_line + @comments.size - 1)) - stmt.comments_hash_flag = @comments_hash_flag - end - stmt - elsif @comments - @statement << TkCOMMENT.new(@comments_line, 0) - @statement.first.set_text("# " + @comments.join("\n# ")) - Statement.new(@statement, nil, @comments) - end - end - - def sanitize_statement_end - extra = [] - (@statement.size - 1).downto(0) do |index| - token = @statement[index] - next unless TkStatementEnd === token - - while [TkNL, TkSPACE, TkSEMICOLON].include?(@statement[index - 1].class) - extra.unshift(@statement.delete_at(index - 1)) - index -= 1 - end - @statement.insert(index + 1, *extra) - break - end - end - - def sanitize_block - return unless @block - extra = [] - while [TkSPACE, TkNL, TkSEMICOLON].include?(@block.last.class) - next(@block.pop) if TkSEMICOLON === @block.last - extra.unshift(@block.pop) - end - - @statement.each_with_index do |token, index| - if TkBlockContents === token - @statement[index, 1] = [token, *extra] - break - end - end - end - - # Processes a single token - # - # @param [RubyToken::Token] tk the token to process - def process_token(tk) - # p tk.class, tk.text, @state, @level, @current_block, "
" - case @state - when :first_statement - return if process_initial_comment(tk) - return if @statement.empty? && [TkSPACE, TkNL, TkCOMMENT].include?(tk.class) - @comments_last_line = nil - if @statement.empty? && tk.class == TkALIAS - @state = :alias_statement - @alias_values = [] - push_token(tk) - return - end - return if process_simple_block_opener(tk) - push_token(tk) - return if process_complex_block_opener(tk) - - if balances?(tk) - process_statement_end(tk) - else - @state = :balance - end - when :alias_statement - push_token(tk) - @alias_values << tk unless [TkSPACE, TkNL, TkCOMMENT].include?(tk.class) - if @alias_values.size == 2 - @state = :first_statement - if [NilClass, TkNL, TkEND_OF_SCRIPT, TkSEMICOLON].include?(peek_no_space.class) - @done = true - end - end - when :balance - @statement << tk - return unless balances?(tk) - @state = :first_statement - process_statement_end(tk) - when :block_statement - push_token(tk) - return unless balances?(tk) - process_statement_end(tk) - when :pre_block - @current_block = nil - process_block_token(tk) unless tk.class == TkSEMICOLON - @state = :block - when :block - process_block_token(tk) - when :post_block - if tk.class == TkSPACE - @statement << tk - return - end - - process_statement_end(tk) - @state = :block - end - - if @first_line == tk.line_no && !@statement.empty? && TkCOMMENT === tk - process_initial_comment(tk) - end - end - - # Processes a token in a block - # - # @param [RubyToken::Token] tk the token to process - def process_block_token(tk) - if balances?(tk) - @statement << tk - @state = :first_statement - process_statement_end(tk) - elsif @block_num > 1 || (@block.empty? && [TkSPACE, TkNL].include?(tk.class)) - @statement << tk - else - if @block.empty? - @statement << TkBlockContents.new(tk.line_no, tk.char_no) - end - @block << tk - end - end - - # Processes a comment token that comes before a statement - # - # @param [RubyToken::Token] tk the token to process - # @return [Boolean] whether or not +tk+ was processed as an initial comment - def process_initial_comment(tk) - if @statement.empty? && (@comments_last_line || 0) < tk.line_no - 2 - @comments = nil - end - - return unless tk.class == TkCOMMENT - - case tk.text - when Parser::SourceParser::SHEBANG_LINE - if !@last_ns_tk && !@encoding_line - @shebang_line = tk.text - return - end - when Parser::SourceParser::ENCODING_LINE - if (@last_ns_tk.class == TkCOMMENT && @last_ns_tk.text == @shebang_line) || - !@last_ns_tk - @encoding_line = tk.text - return - end - end - - return if !@statement.empty? && @comments - return if @first_line && tk.line_no > @first_line - - if @comments_last_line && @comments_last_line < tk.line_no - 1 - if @comments && @statement.empty? - @tokens.unshift(tk) - return @done = true - end - @comments = nil - end - @comments_line = tk.line_no unless @comments - - # Remove the "#" and up to 1 space before the text - # Since, of course, the convention is to have "# text" - # and not "#text", which I deem ugly (you heard it here first) - @comments ||= [] - if tk.text.start_with?('=begin') - lines = tk.text.count("\n") - @comments += tk.text.gsub(/\A=begin.*\r?\n|\r?\n=end.*\r?\n?\Z/, '').split(/\r?\n/) - @comments_last_line = tk.line_no + lines - else - @comments << tk.text.gsub(/^(#+)\s{0,1}/, '') - @comments_hash_flag = $1 == '##' if @comments_hash_flag.nil? - @comments_last_line = tk.line_no - end - @comments.pop if @comments.size == 1 && @comments.first =~ /^\s*$/ - true - end - - # Processes a simple block-opening token; - # that is, a block opener such as +begin+ or +do+ - # that isn't followed by an expression - # - # @param [RubyToken::Token] tk the token to process - def process_simple_block_opener(tk) - return unless [TkLBRACE, TkDO, TkBEGIN, TkELSE].include?(tk.class) && - # Make sure hashes are parsed as hashes, not as blocks - (@last_ns_tk.nil? || @last_ns_tk.lex_state != EXPR_BEG) - - @level += 1 - @state = :block - @block_num += 1 - if @block.nil? - @block = TokenList.new - tokens = [tk, TkStatementEnd.new(tk.line_no, tk.char_no)] - tokens = tokens.reverse if TkBEGIN === tk.class - @statement.concat(tokens) - else - @statement << tk - end - - true - end - - # Processes a complex block-opening token; - # that is, a block opener such as +while+ or +for+ - # that is followed by an expression - # - # @param [RubyToken::Token] tk the token to process - def process_complex_block_opener(tk) - return unless OPEN_BLOCK_TOKENS.include?(tk.class) - - @current_block = tk.class - @state = :block_statement - - true - end - - # Processes a token that closes a statement - # - # @param [RubyToken::Token] tk the token to process - def process_statement_end(tk) - # Whitespace means that we keep the same value of @new_statement as last token - return if tk.class == TkSPACE - - return unless - # We might be coming after a statement-ending token... - (@last_tk && [TkSEMICOLON, TkNL, TkEND_OF_SCRIPT].include?(tk.class)) || - # Or we might be at the beginning of an argument list - (@current_block == TkDEF && tk.class == TkRPAREN) - - # Continue line ending on . or :: - return if @last_tk && [EXPR_DOT].include?(@last_tk.lex_state) - - # Continue a possible existing new statement unless we just finished an expression... - return unless (@last_tk && [EXPR_END, EXPR_ARG].include?(@last_tk.lex_state)) || - # Or we've opened a block and are ready to move into the body - (@current_block && [TkNL, TkSEMICOLON].include?(tk.class) && - # Handle the case where the block statement's expression is on the next line - # - # while - # foo - # end - @last_ns_tk.class != @current_block && - # And the case where part of the expression is on the next line - # - # while foo || - # bar - # end - @last_tk.lex_state != EXPR_BEG) - - # Continue with the statement if we've hit a comma in a def - return if @current_block == TkDEF && peek_no_space.class == TkCOMMA - - if [TkEND_OF_SCRIPT, TkNL, TkSEMICOLON].include?(tk.class) && @state == :block_statement && - [TkRBRACE, TkEND].include?(@last_ns_tk.class) && @level == 0 - @current_block = nil - end - - unless @current_block - @done = true - return - end - - @state = :pre_block - @level += 1 - @block_num += 1 - unless @block - @block = TokenList.new - @statement << TkStatementEnd.new(tk.line_no, tk.char_no) - end - end - - # Handles the balancing of parentheses and blocks - # - # @param [RubyToken::Token] tk the token to process - # @return [Boolean] whether or not the current statement's parentheses and blocks - # are balanced after +tk+ - def balances?(tk) - unless [TkALIAS, TkDEF].include?(@last_ns_tk.class) || @before_last_ns_tk.class == TkALIAS - if [TkLPAREN, TkLBRACK, TkLBRACE, TkDO, TkBEGIN].include?(tk.class) - @level += 1 - elsif OPEN_BLOCK_TOKENS.include?(tk.class) - @level += 1 unless tk.class == TkELSIF - elsif [TkRPAREN, TkRBRACK, TkRBRACE, TkEND].include?(tk.class) && @level > 0 - @level -= 1 - end - end - - @level == 0 - end - - # Adds a token to the current statement, - # unless it's a newline, semicolon, or comment - # - # @param [RubyToken::Token] tk the token to process - def push_token(tk) - @first_line = tk.line_no if @statement.empty? - @statement << tk unless @level == 0 && [TkCOMMENT].include?(tk.class) - end - - # Returns the next token in the stream that's not a space - # - # @return [RubyToken::Token] the next non-space token - def peek_no_space - return @tokens.first unless @tokens.first.class == TkSPACE - @tokens[1] - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/token_list.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/token_list.rb deleted file mode 100644 index 05e15a892a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/legacy/token_list.rb +++ /dev/null @@ -1,74 +0,0 @@ -# frozen_string_literal: true -module YARD - module Parser::Ruby::Legacy - class TokenList < Array - include RubyToken - - def initialize(content = nil) - self << content if content - end - - def to_s(full_statement = false, show_block = true) - inject([]) do |acc, token| - break acc if !full_statement && TkStatementEnd === token - acc << (!show_block && TkBlockContents === token ? "" : token.text) - end.join - end - - # @param [TokenList, Token, String] tokens - # A list of tokens. If the token is a string, it - # is parsed with {RubyLex}. - def push(*tokens) - tokens.each do |tok| - if tok.is_a?(TokenList) || tok.is_a?(Array) - concat tok - elsif tok.is_a?(Token) - super tok - elsif tok.is_a?(String) - parse_content(tok) - else - raise ArgumentError, "Expecting token, list of tokens or string of code to be tokenized. Got #{tok.class}" - end - end - self - end - alias << push - - def squeeze(type = TkSPACE) - last = nil - TokenList.new(map {|t| x = t.is_a?(type) && last.is_a?(type) ? nil : t; last = t; x }) - end - - private - - def parse_content(content) - lex = RubyLex.new(content) - loop do - tk = lex.token - break if tk.nil? - self << convert_token(lex, tk) - end - end - - def convert_token(lex, tk) - if TkIDENTIFIER === tk && lex.peek == ':' - next_tk = lex.token - sym = TkLABEL.new(tk.line_no, tk.char_no, nil) - sym.lex_state = lex.lex_state - sym.set_text(tk.text + next_tk.text) - elsif TkSYMBEG === tk - next_tk = lex.token - if next_tk - sym = TkSYMBOL.new(tk.line_no, tk.char_no, nil) - sym.lex_state = lex.lex_state - sym.set_text(tk.text + next_tk.text) - else - tk - end - else - tk - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/ruby_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/ruby_parser.rb deleted file mode 100644 index c7e25ee8e6..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/ruby_parser.rb +++ /dev/null @@ -1,701 +0,0 @@ -# frozen_string_literal: true -begin require 'ripper'; rescue LoadError; nil end - -module YARD - module Parser - module Ruby - # Ruby 1.9 parser - # @!attribute [r] encoding_line - # @!attribute [r] frozen_string_line - # @!attribute [r] shebang_line - # @!attribute [r] enumerator - class RubyParser < Parser::Base - def initialize(source, filename) - @parser = RipperParser.new(source, filename) - end - - def parse; @parser.parse end - def tokenize; @parser.tokens end - def enumerator; @parser.enumerator end - def shebang_line; @parser.shebang_line end - def encoding_line; @parser.encoding_line end - def frozen_string_line; @parser.frozen_string_line end - end - - # Internal parser class - # @since 0.5.6 - class RipperParser < Ripper - attr_reader :ast, :charno, :comments, :file, :tokens - attr_reader :shebang_line, :encoding_line, :frozen_string_line - alias root ast - - def initialize(source, filename, *args) - super - @last_ns_token = nil - @file = filename - @source = source - @tokens = [] - @comments = {} - @comments_range = {} - @comments_flags = {} - @heredoc_tokens = nil - @heredoc_state = nil - @map = {} - @ns_charno = 0 - @list = [] - @charno = 0 - @shebang_line = nil - @encoding_line = nil - @frozen_string_line = nil - @file_encoding = nil - @newline = true - @percent_ary = nil - end - - def parse - @ast = super - @ast.full_source = @source - @ast.file = @file - freeze_tree - insert_comments - self - end - - def enumerator - ast.children - end - - def file_encoding - return nil unless defined?(::Encoding) - return @file_encoding if @file_encoding - return Encoding.default_internal unless @encoding_line - match = @encoding_line.match(SourceParser::ENCODING_LINE) - @file_encoding = match.captures.last if match - end - - private - - MAPPINGS = { - :BEGIN => "BEGIN", - :END => "END", - :alias => "alias", - :array => :lbracket, - :arg_paren => :lparen, - :begin => "begin", - :blockarg => "&", - :brace_block => :lbrace, - :break => "break", - :case => "case", - :class => "class", - :def => "def", - :defined => "defined?", - :defs => "def", - :do_block => "do", - :else => "else", - :elsif => "elsif", - :ensure => "ensure", - :for => "for", - :hash => :lbrace, - :if => "if", - :lambda => [:tlambda, "lambda"], - :module => "module", - :next => "next", - :paren => :lparen, - :qwords_literal => :qwords_beg, - :words_literal => :words_beg, - :qsymbols_literal => :qsymbols_beg, - :symbols_literal => :symbols_beg, - :redo => "redo", - :regexp_literal => :regexp_beg, - :rescue => "rescue", - :rest_param => "*", - :retry => "retry", - :return => "return", - :return0 => "return", - :sclass => "class", - :string_embexpr => :embexpr_beg, - :string_literal => [:tstring_beg, :heredoc_beg], - :super => "super", - :symbol => :symbeg, - :top_const_ref => "::", - :undef => "undef", - :unless => "unless", - :until => "until", - :when => "when", - :while => "while", - :xstring_literal => :backtick, - :yield => "yield", - :yield0 => "yield", - :zsuper => "super" - } - REV_MAPPINGS = {} - - AST_TOKENS = [:CHAR, :backref, :const, :cvar, :gvar, :heredoc_end, :ident, - :int, :float, :ivar, :label, :period, :regexp_end, :tstring_content, :backtick] - - MAPPINGS.each do |k, v| - if Array === v - v.each {|vv| (REV_MAPPINGS[vv] ||= []) << k } - else - (REV_MAPPINGS[v] ||= []) << k - end - end - - PARSER_EVENT_TABLE.each do |event, arity| - node_class = AstNode.node_class_for(event) - - if /_new\z/ =~ event.to_s && arity == 0 - module_eval(<<-eof, __FILE__, __LINE__ + 1) - def on_#{event}(*args) - #{node_class}.new(:list, args, :listchar => charno...charno, :listline => lineno..lineno) - end - eof - elsif /_add(_.+)?\z/ =~ event.to_s - module_eval(<<-eof, __FILE__, __LINE__ + 1) - begin; undef on_#{event}; rescue NameError; end - def on_#{event}(list, item) - list.push(item) - list - end - eof - elsif MAPPINGS.key?(event) - module_eval(<<-eof, __FILE__, __LINE__ + 1) - begin; undef on_#{event}; rescue NameError; end - def on_#{event}(*args) - visit_event #{node_class}.new(:#{event}, args) - end - eof - else - module_eval(<<-eof, __FILE__, __LINE__ + 1) - begin; undef on_#{event}; rescue NameError; end - def on_#{event}(*args) - #{node_class}.new(:#{event}, args, :listline => lineno..lineno, :listchar => charno...charno) - end - eof - end - end - - SCANNER_EVENTS.each do |event| - ast_token = AST_TOKENS.include?(event) - module_eval(<<-eof, __FILE__, __LINE__ + 1) - begin; undef on_#{event}; rescue NameError; end - def on_#{event}(tok) - visit_ns_token(:#{event}, tok, #{ast_token.inspect}) - end - eof - end - - REV_MAPPINGS.select {|k, _v| k.is_a?(Symbol) }.each do |pair| - event = pair.first - ast_token = AST_TOKENS.include?(event) - module_eval(<<-eof, __FILE__, __LINE__ + 1) - begin; undef on_#{event}; rescue NameError; end - def on_#{event}(tok) - (@map[:#{event}] ||= []) << [lineno, charno] - visit_ns_token(:#{event}, tok, #{ast_token.inspect}) - end - eof - end - - [:kw, :op].each do |event| - module_eval(<<-eof, __FILE__, __LINE__ + 1) - begin; undef on_#{event}; rescue NameError; end - def on_#{event}(tok) - unless @last_ns_token == [:kw, "def"] || - (@tokens.last && @tokens.last[0] == :symbeg) - (@map[tok] ||= []) << [lineno, charno] - end - visit_ns_token(:#{event}, tok, true) - end - eof - end - - [:nl, :ignored_nl].each do |event| - module_eval(<<-eof, __FILE__, __LINE__ + 1) - begin; undef on_#{event}; rescue NameError; end - def on_#{event}(tok) - add_token(:#{event}, tok) - @newline = true - @charno += tok ? tok.length : 0 - end - eof - end - - undef on_sp - - def on_sp(tok) - add_token(:sp, tok) - @charno += tok.length - end - - def visit_event(node) - map = @map[MAPPINGS[node.type]] - lstart, sstart = *(map ? map.pop : [lineno, @ns_charno - 1]) - node.source_range = Range.new(sstart, @ns_charno - 1) - node.line_range = Range.new(lstart, lineno) - if node.respond_to?(:block) - sr = node.block.source_range - lr = node.block.line_range - node.block.source_range = Range.new(sr.first, @tokens.last[2][1] - 1) - node.block.line_range = Range.new(lr.first, @tokens.last[2][0]) - end - node - end - - def visit_event_arr(node) - mapping = MAPPINGS[node.type].find {|k| @map[k] && !@map[k].empty? } - lstart, sstart = *@map[mapping].pop - node.source_range = Range.new(sstart, @ns_charno - 1) - node.line_range = Range.new(lstart, lineno) - node - end - - def visit_ns_token(token, data, ast_token = false) - add_token(token, data) - ch = charno - @last_ns_token = [token, data] - @charno += data.length - @ns_charno = charno - @newline = [:semicolon, :comment, :kw, :op, :lparen, :lbrace].include?(token) - if ast_token - AstNode.new(token, [data], :line => lineno..lineno, :char => ch..charno - 1, :token => true) - end - end - - def add_token(token, data) - if @percent_ary - if token == :words_sep && data !~ /\s\z/ - rng = @percent_ary.source_range - rng = Range.new(rng.first, rng.last + data.length) - @percent_ary.source_range = rng - @tokens << [token, data, [lineno, charno]] - @percent_ary = nil - return - elsif token == :tstring_end && data =~ /\A\s/ - rng = @percent_ary.source_range - rng = Range.new(rng.first, rng.last + data.length) - @percent_ary.source_range = rng - @tokens << [token, data, [lineno, charno]] - @percent_ary = nil - return - end - end - - if @tokens.last && (@tokens.last[0] == :symbeg || - (@tokens.last[0] == :symbol && token.to_s =~ /^tstring/)) - @tokens[-1] = [:symbol, @tokens.last[1] + data, @tokens.last[2]] - elsif @heredoc_state == :started - @heredoc_tokens << [token, data, [lineno, charno]] - - # fix ripper encoding of heredoc bug - # (see http://bugs.ruby-lang.org/issues/6200) - data.force_encoding(file_encoding) if file_encoding - - @heredoc_state = :ended if token == :heredoc_end - elsif (token == :nl || token == :comment) && @heredoc_state == :ended - @heredoc_tokens.unshift([token, data, [lineno, charno]]) - @tokens += @heredoc_tokens - @heredoc_tokens = nil - @heredoc_state = nil - else - @tokens << [token, data, [lineno, charno]] - if token == :heredoc_beg - @heredoc_state = :started - @heredoc_tokens = [] - end - end - end - - undef on_program - undef on_assoc_new - undef on_array - undef on_hash - undef on_bare_assoc_hash - undef on_assoclist_from_args - undef on_aref - undef on_aref_field - undef on_lbracket - undef on_rbracket - undef on_string_literal - undef on_lambda - undef on_unary - undef on_string_content - undef on_rescue - undef on_void_stmt - undef on_params - undef on_label - undef on_comment - undef on_embdoc_beg - undef on_embdoc - undef on_embdoc_end - undef on_parse_error - undef on_bodystmt - undef on_top_const_ref - undef on_const_path_ref - undef on_dyna_symbol - - def on_program(*args) - args.first - end - - def on_body_stmt(*args) - args.compact.size == 1 ? args.first : AstNode.new(:list, args) - end - alias on_bodystmt on_body_stmt - - def on_assoc_new(*args) - AstNode.new(:assoc, args) - end - - def on_hash(*args) - visit_event AstNode.new(:hash, args.first || []) - end - - def on_bare_assoc_hash(*args) - AstNode.new(:list, args.first) - end - - def on_assoclist_from_args(*args) - args.first - end - - def on_unary(op, val) - map = @map[op.to_s[0, 1]] - lstart, sstart = *(map ? map.pop : [lineno, @ns_charno - 1]) - node = AstNode.node_class_for(:unary).new(:unary, [op, val]) - node.source_range = Range.new(sstart, @ns_charno - 1) - node.line_range = Range.new(lstart, lineno) - node - end - - def on_aref(*args) - @map[:lbracket].pop - ll, lc = *@map[:aref].pop - sr = args.first.source_range.first..lc - lr = args.first.line_range.first..ll - AstNode.new(:aref, args, :char => sr, :line => lr) - end - - def on_aref_field(*args) - @map[:lbracket].pop - AstNode.new(:aref_field, args, - :listline => lineno..lineno, :listchar => charno...charno) - end - - def on_array(other) - node = AstNode.node_class_for(:array).new(:array, [other]) - map = @map[MAPPINGS[node.type]] - if map && !map.empty? - lstart, sstart = *map.pop - node.source_range = Range.new(sstart, @ns_charno - 1) - node.line_range = Range.new(lstart, lineno) - else - sstart = other.source_range.begin - lstart = other.line_range.begin - node.source_range = Range.new(sstart, @ns_charno - 1) - node.line_range = Range.new(lstart, lineno) - node.source_range = other.source_range - node.line_range = other.line_range - end - node - end - - def on_lbracket(tok) - (@map[:lbracket] ||= []) << [lineno, charno] - visit_ns_token(:lbracket, tok, false) - end - - def on_rbracket(tok) - (@map[:aref] ||= []) << [lineno, charno] - visit_ns_token(:rbracket, tok, false) - end - - def on_dyna_symbol(sym) - rng = if sym.source_range.to_a.size == 0 # rubocop:disable Style/ZeroLengthPredicate - (sym.source_range.begin - 3)...sym.source_range.end - else - (sym.source_range.begin - 2)..(sym.source_range.end + 1) - end - AstNode.new(:dyna_symbol, [sym], :line => lineno..lineno, - :listline => lineno..lineno, :listchar => rng, :char => rng) - end - - def on_top_const_ref(*args) - type = :top_const_ref - node = AstNode.node_class_for(type).new(type, args) - mapping = @map[MAPPINGS[type]] - extra_op = mapping.last[1] + 2 == charno ? mapping.pop : nil - lstart, sstart = *mapping.pop - node.source_range = Range.new(sstart, args.last.source_range.last) - node.line_range = Range.new(lstart, args.last.line_range.last) - mapping.push(extra_op) if extra_op - node - end - - def on_const_path_ref(*args) - ReferenceNode.new(:const_path_ref, args, :listline => lineno..lineno, :listchar => charno..charno) - end - - [:if_mod, :unless_mod, :while_mod, :until_mod].each do |kw| - node_class = AstNode.node_class_for(kw) - module_eval(<<-eof, __FILE__, __LINE__ + 1) - begin; undef on_#{kw}; rescue NameError; end - def on_#{kw}(*args) - mapping = @map[#{kw.to_s.sub(/_mod$/, '').inspect}] - mapping.pop if mapping - sr = args.last.source_range.first..args.first.source_range.last - lr = args.last.line_range.first..args.first.line_range.last - #{node_class}.new(:#{kw}, args, :line => lr, :char => sr) - end - eof - end - - %w(symbols qsymbols words qwords).each do |kw| - module_eval(<<-eof, __FILE__, __LINE__ + 1) - begin; undef on_#{kw}_new; rescue NameError; end - def on_#{kw}_new(*args) - node = LiteralNode.new(:#{kw}_literal, args) - @percent_ary = node - if @map[:#{kw}_beg] - lstart, sstart = *@map[:#{kw}_beg].pop - node.source_range = Range.new(sstart, @ns_charno-1) - node.line_range = Range.new(lstart, lineno) - end - node - end - - begin; undef on_#{kw}_add; rescue NameError; end - def on_#{kw}_add(list, item) - last = @source[@ns_charno,1] == "\n" ? @ns_charno - 1 : @ns_charno - list.source_range = (list.source_range.first..last) - list.line_range = (list.line_range.first..lineno) - list.push(item) - list - end - eof - end - - def on_string_literal(*args) - node = visit_event_arr(LiteralNode.new(:string_literal, args)) - if args.size == 1 - r = args[0].source_range - if node.source_range != Range.new(r.first - 1, r.last + 1) - klass = AstNode.node_class_for(node[0].type) - r = Range.new(node.source_range.first + 1, node.source_range.last - 1) - node[0] = klass.new(node[0].type, [@source[r]], :line => node.line_range, :char => r) - end - end - node - end - - def on_lambda(*args) - visit_event_arr AstNode.new(:lambda, args) - end - - def on_string_content(*args) - chr_rng = args.empty? ? charno...charno : charno..charno - AstNode.new(:string_content, args, :listline => lineno..lineno, :listchar => chr_rng) - end - - def on_rescue(exc, *args) - exc = AstNode.new(:list, exc) if exc - visit_event AstNode.new(:rescue, [exc, *args]) - end - - def on_void_stmt - AstNode.new(:void_stmt, [], :line => lineno..lineno, :char => charno...charno) - end - - def on_params(*args) - args.map! do |arg| - next arg unless arg.class == Array - - if arg.first.class == Array - arg.map! do |sub_arg| - next sub_arg unless sub_arg.class == Array - type = sub_arg[0].type == :label ? - :named_arg : :unnamed_optional_arg - AstNode.new(type, sub_arg, :listline => lineno..lineno, :listchar => charno..charno) - end - end - - AstNode.new(:list, arg, :listline => lineno..lineno, :listchar => charno..charno) - end - - ParameterNode.new(:params, args, :listline => lineno..lineno, :listchar => charno..charno) - end - - def on_label(data) - add_token(:label, data) - ch = charno - @charno += data.length - @ns_charno = charno - AstNode.new(:label, [data[0...-1]], :line => lineno..lineno, :char => ch..charno - 1, :token => true) - end - - def on_comment(comment) - not_comment = false - if @last_ns_token.nil? || @last_ns_token.empty? - if comment =~ SourceParser::SHEBANG_LINE && !@encoding_line - @shebang_line = comment - not_comment = true - elsif comment =~ SourceParser::ENCODING_LINE - @encoding_line = comment - not_comment = true - elsif comment =~ SourceParser::FROZEN_STRING_LINE - @frozen_string_line = comment - not_comment = true - end - end - - ch = charno - visit_ns_token(:comment, comment) - if not_comment - @last_ns_token = nil - return - end - - source_range = ch..(charno - 1) - comment = comment.gsub(/^(\#+)\s{0,1}/, '').chomp - append_comment = @comments[lineno - 1] - - hash_flag = $1 == '##' ? true : false - - if append_comment && @comments_last_column && - @comments_last_column == column && comment_starts_line?(ch) - @comments.delete(lineno - 1) - @comments_flags[lineno] = @comments_flags[lineno - 1] - @comments_flags.delete(lineno - 1) - range = @comments_range.delete(lineno - 1) - source_range = range.first..source_range.last - comment = append_comment + "\n" + comment - end - - @comments[lineno] = comment - @comments_range[lineno] = source_range - @comments_flags[lineno] = hash_flag unless append_comment - @comments_last_column = column - end - - def on_embdoc_beg(text) - visit_ns_token(:embdoc_beg, text) - @embdoc_start = charno - text.length - @embdoc = String.new("") - end - - def on_embdoc(text) - visit_ns_token(:embdoc, text) - @embdoc << text - end - - def on_embdoc_end(text) - visit_ns_token(:embdoc_end, text) - @comments_last_column = nil - @comments[lineno] = @embdoc - @comments_range[lineno] = @embdoc_start...charno - @embdoc_start = nil - @embdoc = nil - end - - def on_parse_error(msg) - raise ParserSyntaxError, "syntax error in `#{file}`:(#{lineno},#{column}): #{msg}" - end - alias compile_error on_parse_error - - def comment_starts_line?(charno) - (charno - 1).downto(0) do |i| - ch = @source[i] - break if ch == "\n" - return false if ch != " " && ch != "\t" - end - true - end - - def insert_comments - root.traverse do |node| - next if [:comment, :void_stmt, :list].include?(node.type) || node.parent.type != :list - - # never attach comments to if/unless mod nodes - if node.type == :if_mod || node.type == :unless_mod - node = node.then_block - end - - # check upwards from line before node; check node's line at the end - ((node.line - 1).downto(node.line - 2).to_a + [node.line]).each do |line| - comment = @comments[line] - if comment && !comment.empty? - add_comment(line, node) - break - end - end - - @comments.keys.each do |line| - add_comment(line, nil, node) if node.line > line - end - end - - # insert any lone unadded comments before node - root.traverse do |node| - next if node.type == :list || node.parent.type != :list - @comments.keys.each do |line| - next unless node.line_range.include?(line) - pick = nil - node.traverse do |subnode| - next unless subnode.type == :list - pick ||= subnode - next unless subnode.line_range.include?(line) - pick = subnode - end - add_comment(line, nil, pick, true) if pick - end - end unless @comments.empty? - - # insert all remaining comments - @comments.each do |line, _comment| - add_comment(line, nil, root, true) - end - - @comments = {} - end - - def add_comment(line, node = nil, before_node = nil, into = false) - comment = @comments[line] - source_range = @comments_range[line] - line_range = ((line - comment.count("\n"))..line) - if node.nil? - node = CommentNode.new(:comment, [comment], :line => line_range, :char => source_range) - if into - before_node.push(node) - before_node.unfreeze - node.parent = before_node - elsif before_node - parent_node = before_node.parent - idx = parent_node.index(before_node) - parent_node.insert(idx, node) - parent_node.unfreeze - node.parent = parent_node - end - end - node.docstring = comment - node.docstring_hash_flag = @comments_flags[line] - node.docstring_range = line_range - @comments.delete(line) - @comments_range.delete(line) - @comments_flags.delete(line) - end - - def freeze_tree(node = nil) - @tokens = @tokens.sort_by {|t| t.last } - nodes = [node || root] - until nodes.empty? - p_node = nodes.shift - p_node.children.each do |child| - child.parent = p_node - nodes << child - end - end - end - end if defined?(::Ripper) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/token_resolver.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/token_resolver.rb deleted file mode 100644 index 56421acf53..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/ruby/token_resolver.rb +++ /dev/null @@ -1,158 +0,0 @@ -# frozen_string_literal: true -module YARD - module Parser - module Ruby - # Supports {#each} enumeration over a source's tokens, yielding - # the token and a possible {CodeObjects::Base} associated with the - # constant or identifier token. - class TokenResolver - include Enumerable - include CodeObjects::NamespaceMapper - - # Creates a token resolver for given source. - # - # @param source [String] the source code to tokenize - # @param namespace [CodeObjects::Base] the object/namespace to resolve from - def initialize(source, namespace = Registry.root) - @tokens = RubyParser.parse(source, '(tokenize)').tokens - raise ParserSyntaxError if @tokens.empty? && !source.empty? - @default_namespace = namespace - end - - # Iterates over each token, yielding the token and a possible code - # object that is associated with the token. - # - # @yieldparam token [Array(Symbol,String,Array(Integer,Integer))] the - # current token object being iterated - # @yieldparam object [CodeObjects::Base, nil] the fully qualified code - # object associated with the current token, or nil if there is no object - # for the yielded token. - # @example Yielding code objects - # r = TokenResolver.new("A::B::C") - # r.each do |tok, obj| - # if obj - # puts "#{tok[0]} -> #{obj.path.inspect}" - # else - # puts "No object: #{tok.inspect}" - # end - # end - # - # # Prints: - # # :const -> "A" - # # No object: [:op, "::"] - # # :const -> "A::B" - # # No object: [:op, "::"] - # # :const -> "A::B::C" - def each - @states = [] - push_state - @tokens.each do |token| - yield_obj = false - - if skip_group && [:const, :ident, :op, :period].include?(token[0]) - yield token, nil - next - else - self.skip_group = false - end - - case token[0] - when :const - lookup(token[0], token[1]) - yield_obj = true - self.last_sep = nil - when :ident - lookup(token[0], token[1]) - yield_obj = true - self.last_sep = nil - when :op, :period - self.last_sep = token[1] - unless CodeObjects.types_for_separator(token[1]) - self.object = nil - self.last_sep = nil - end - when :lparen - push_state - when :rparen - pop_state - else - self.object = nil - end - - yield token, (yield_obj ? object : nil) - - if next_object - self.object = next_object - self.next_object = nil - end - self.skip_group = true if yield_obj && object.nil? - end - end - - def self.state_attr(*attrs) - attrs.each do |attr| - define_method(attr) { @states.last[attr.to_sym] } - define_method("#{attr}=") {|v| @states.last[attr.to_sym] = v } - protected attr, :"#{attr}=" - end - end - - private - - def push_state - @states.push :object => nil, :skip_group => false, :last_sep => nil - end - - def pop_state - @states.pop - end - - state_attr :object, :next_object, :skip_group, :last_sep - - def lookup(toktype, name) - types = object_resolved_types - return self.object = nil if types.empty? - - if toktype == :const - types.any? do |type| - prefix = type ? type.path : "" - prefix += last_sep.to_s if separators.include?(last_sep.to_s) - self.object = Registry.resolve(@default_namespace, "#{prefix}#{name}", true) - end - else # ident - types.any? do |type| - obj = Registry.resolve(type, name, true) - if obj.nil? && name == "new" - obj = Registry.resolve(object, "#initialize", true) - self.next_object = object if obj.nil? - end - self.object = obj - end - end - end - - def object_resolved_types(obj = object) - return [obj] unless obj.is_a?(CodeObjects::MethodObject) - - resolved_types = [] - tags = obj.tags(:return) - tags += obj.tags(:overload).map {|o| o.tags(:return) }.flatten - tags.each do |tag| - next if tag.types.nil? - tag.types.each do |type| - type = type.sub(/<.+>/, '') - if type == "self" - resolved_types << obj.parent - else - type_obj = Registry.resolve(obj, type, true) - resolved_types << type_obj if type_obj - end - end - end - - resolved_types - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/source_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/source_parser.rb deleted file mode 100644 index 8d133e1938..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/parser/source_parser.rb +++ /dev/null @@ -1,526 +0,0 @@ -# frozen_string_literal: true -require 'stringio' -require 'ostruct' - -module YARD - module Parser - # Raised when an object is recognized but cannot be documented. This - # generally occurs when the Ruby syntax used to declare an object is - # too dynamic in nature. - class UndocumentableError < RuntimeError; end - - # Raised when the parser sees a Ruby syntax error - class ParserSyntaxError < UndocumentableError; end - - # Responsible for parsing a list of files in order. The - # {#parse} method of this class can be called from the - # {SourceParser#globals} globals state list to re-enter - # parsing for the remainder of files in the list recursively. - # - # @see Processor#parse_remaining_files - class OrderedParser - # @return [Array] the list of remaining files to parse - attr_accessor :files - - # Creates a new OrderedParser with the global state and a list - # of files to parse. - # - # @note OrderedParser sets itself as the +ordered_parser+ key on - # global_state for later use in {Handlers::Processor}. - # @param [OpenStruct] global_state a structure containing all global - # state during parsing - # @param [Array] files the list of files to parse - def initialize(global_state, files) - @global_state = global_state - @files = files.dup - @global_state.ordered_parser = self - end - - # Parses the remainder of the {#files} list. - # - # @see Processor#parse_remaining_files - def parse - until files.empty? - file = files.shift - log.capture("Parsing #{file}") do - SourceParser.new(SourceParser.parser_type, @global_state).parse(file) - end - end - end - end - - # Responsible for parsing a source file into the namespace. Parsing - # also invokes handlers to process the parsed statements and generate - # any code objects that may be recognized. - # - # == Custom Parsers - # SourceParser allows custom parsers to be registered and called when - # a certain filetype is recognized. To register a parser and hook it - # up to a set of file extensions, call {register_parser_type} - # - # @see register_parser_type - # @see Handlers::Base - # @see CodeObjects::Base - class SourceParser - SHEBANG_LINE = /\A\s*#!\S+/ - ENCODING_LINE = %r{\A(?:\s*#*!.*\r?\n)?\s*(?:#+|/\*+|//+).*coding\s*[:=]{1,2}\s*([a-z\d_\-]+)}i - FROZEN_STRING_LINE = /frozen(-|_)string(-|_)literal:\s+(true|false)/i - - # The default glob of files to be parsed. - # @since 0.9.0 - DEFAULT_PATH_GLOB = ["{lib,app}/**/*.rb", "ext/**/*.{c,cc,cxx,cpp,rb}"] - - # Byte order marks for various encodings - # @since 0.7.0 - ENCODING_BYTE_ORDER_MARKS = { - 'utf-8' => String.new("\xEF\xBB\xBF"), - # Not yet supported - # 'utf-16be' => "\xFE\xFF", - # 'utf-16le' => "\xFF\xFE", - # 'utf-32be' => "\x00\x00\xFF\xFE", - # 'utf-32le' => "\xFF\xFE", - } - - class << self - # @return [Symbol] the default parser type (defaults to :ruby) - attr_reader :parser_type - - def parser_type=(value) - @parser_type = validated_parser_type(value) - end - - # Parses a path or set of paths - # - # @param [String, Array] paths a path, glob, or list of paths to - # parse - # @param [Array] excluded a list of excluded path matchers - # @param [Fixnum] level the logger level to use during parsing. See - # {YARD::Logger} - # @return [void] - def parse(paths = DEFAULT_PATH_GLOB, excluded = [], level = log.level) - log.debug("Parsing #{paths.inspect} with `#{parser_type}` parser") - excluded = excluded.map do |path| - case path - when Regexp; path - else Regexp.new(path.to_s, Regexp::IGNORECASE) - end - end - files = [paths].flatten. - map {|p| File.directory?(p) ? "#{p}/**/*.{rb,c,cc,cxx,cpp}" : p }. - map {|p| p.include?("*") ? Dir[p].sort_by {|d| [d.length, d] } : p }.flatten. - reject {|p| !File.file?(p) || excluded.any? {|re| p =~ re } } - - log.enter_level(level) do - parse_in_order(*files.uniq) - end - end - - # Parses a string +content+ - # - # @param [String] content the block of code to parse - # @param [Symbol] ptype the parser type to use. See {parser_type}. - # @return the parser object that was used to parse +content+ - def parse_string(content, ptype = parser_type) - new(ptype).parse(StringIO.new(content)) - end - - # Tokenizes but does not parse the block of code - # - # @param [String] content the block of code to tokenize - # @param [Symbol] ptype the parser type to use. See {parser_type}. - # @return [Array] a list of tokens - def tokenize(content, ptype = parser_type) - new(ptype).tokenize(content) - end - - # Registers a new parser type. - # - # @example Registering a parser for "java" files - # SourceParser.register_parser_type :java, JavaParser, 'java' - # @param [Symbol] type a symbolic name for the parser type - # @param [Base] parser_klass a class that implements parsing and tokenization - # @param [Array, String, Regexp] extensions a list of extensions or a - # regex to match against the file extension - # @return [void] - # @see Parser::Base - def register_parser_type(type, parser_klass, extensions = nil) - unless Base > parser_klass - raise ArgumentError, "expecting parser_klass to be a subclass of YARD::Parser::Base" - end - parser_type_extensions[type.to_sym] = extensions if extensions - parser_types[type.to_sym] = parser_klass - end - - # @return [Hash{Symbol=>Object}] a list of registered parser types - # @private - # @since 0.5.6 - def parser_types; @@parser_types ||= {} end - def parser_types=(value) @@parser_types = value end - - # @return [Hash] a list of registered parser type extensions - # @private - # @since 0.5.6 - def parser_type_extensions; @@parser_type_extensions ||= {} end - def parser_type_extensions=(value) @@parser_type_extensions = value end - - # Finds a parser type that is registered for the extension. If no - # type is found, the default Ruby type is returned. - # - # @return [Symbol] the parser type to be used for the extension - # @since 0.5.6 - def parser_type_for_extension(extension) - type = parser_type_extensions.find do |_t, exts| - [exts].flatten.any? {|ext| ext === extension } - end - validated_parser_type(type ? type.first : :ruby) - end - - # Returns the validated parser type. Basically, enforces that :ruby - # type is never set if the Ripper library is not available - # - # @param [Symbol] type the parser type to set - # @return [Symbol] the validated parser type - # @private - def validated_parser_type(type) - !defined?(::Ripper) && type == :ruby ? :ruby18 : type - end - - # @group Parser Callbacks - - # Registers a callback to be called before a list of files is parsed - # via {parse}. The block passed to this method will be called on - # subsequent parse calls. - # - # @example Installing a simple callback - # SourceParser.before_parse_list do |files, globals| - # puts "Starting to parse..." - # end - # YARD.parse('lib/**/*.rb') - # # prints "Starting to parse..." - # - # @example Setting global state - # SourceParser.before_parse_list do |files, globals| - # globals.method_count = 0 - # end - # SourceParser.after_parse_list do |files, globals| - # puts "Found #{globals.method_count} methods" - # end - # class MyCountHandler < Handlers::Ruby::Base - # handles :def, :defs - # process { globals.method_count += 1 } - # end - # YARD.parse - # # Prints: "Found 37 methods" - # - # @example Using a global callback to cancel parsing - # SourceParser.before_parse_list do |files, globals| - # return false if files.include?('foo.rb') - # end - # - # YARD.parse(['foo.rb', 'bar.rb']) # callback cancels this method - # YARD.parse('bar.rb') # parses normally - # - # @yield [files, globals] the yielded block is called once before - # parsing all files - # @yieldparam [Array] files the list of files that will be parsed. - # @yieldparam [OpenStruct] globals a global structure to store arbitrary - # state for post processing (see {Handlers::Processor#globals}) - # @yieldreturn [Boolean] if the block returns +false+, parsing is - # cancelled. - # @return [Proc] the yielded block - # @see after_parse_list - # @see before_parse_file - # @since 0.7.0 - def before_parse_list(&block) - before_parse_list_callbacks << block - end - - # Registers a callback to be called after a list of files is parsed - # via {parse}. The block passed to this method will be called on - # subsequent parse calls. - # - # @example Printing results after parsing occurs - # SourceParser.after_parse_list do - # puts "Finished parsing!" - # end - # YARD.parse - # # Prints "Finished parsing!" after parsing files - # @yield [files, globals] the yielded block is called once before - # parsing all files - # @yieldparam [Array] files the list of files that will be parsed. - # @yieldparam [OpenStruct] globals a global structure to store arbitrary - # state for post processing (see {Handlers::Processor#globals}) - # @yieldreturn [void] the return value for the block is ignored. - # @return [Proc] the yielded block - # @see before_parse_list - # @see before_parse_file - # @since 0.7.0 - def after_parse_list(&block) - after_parse_list_callbacks << block - end - - # Registers a callback to be called before an individual file is parsed. - # The block passed to this method will be called on subsequent parse - # calls. - # - # To register a callback that is called before the entire list of files - # is processed, see {before_parse_list}. - # - # @example Installing a simple callback - # SourceParser.before_parse_file do |parser| - # puts "I'm parsing #{parser.file}" - # end - # YARD.parse('lib/**/*.rb') - # # prints: - # "I'm parsing lib/foo.rb" - # "I'm parsing lib/foo_bar.rb" - # "I'm parsing lib/last_file.rb" - # - # @example Cancel parsing of any test_*.rb files - # SourceParser.before_parse_file do |parser| - # return false if parser.file =~ /^test_.+\.rb$/ - # end - # - # @yield [parser] the yielded block is called once before each - # file that is parsed. This might happen many times for a single - # codebase. - # @yieldparam [SourceParser] parser the parser object that will {#parse} - # the file. - # @yieldreturn [Boolean] if the block returns +false+, parsing for - # the file is cancelled. - # @return [Proc] the yielded block - # @see after_parse_file - # @see before_parse_list - # @since 0.7.0 - def before_parse_file(&block) - before_parse_file_callbacks << block - end - - # Registers a callback to be called after an individual file is parsed. - # The block passed to this method will be called on subsequent parse - # calls. - # - # To register a callback that is called after the entire list of files - # is processed, see {after_parse_list}. - # - # @example Printing the length of each file after it is parsed - # SourceParser.after_parse_file do |parser| - # puts "#{parser.file} is #{parser.contents.size} characters" - # end - # YARD.parse('lib/**/*.rb') - # # prints: - # "lib/foo.rb is 1240 characters" - # "lib/foo_bar.rb is 248 characters" - # - # @yield [parser] the yielded block is called once after each file - # that is parsed. This might happen many times for a single codebase. - # @yieldparam [SourceParser] parser the parser object that parsed - # the file. - # @yieldreturn [void] the return value for the block is ignored. - # @return [Proc] the yielded block - # @see before_parse_file - # @see after_parse_list - # @since 0.7.0 - def after_parse_file(&block) - after_parse_file_callbacks << block - end - - # @return [Array] the list of callbacks to be called before - # parsing a list of files. Should only be used for testing. - # @since 0.7.0 - def before_parse_list_callbacks - @before_parse_list_callbacks ||= [] - end - - # @return [Array] the list of callbacks to be called after - # parsing a list of files. Should only be used for testing. - # @since 0.7.0 - def after_parse_list_callbacks - @after_parse_list_callbacks ||= [] - end - - # @return [Array] the list of callbacks to be called before - # parsing a file. Should only be used for testing. - # @since 0.7.0 - def before_parse_file_callbacks - @before_parse_file_callbacks ||= [] - end - - # @return [Array] the list of callbacks to be called after - # parsing a file. Should only be used for testing. - # @since 0.7.0 - def after_parse_file_callbacks - @after_parse_file_callbacks ||= [] - end - - # @endgroup - - private - - # Parses a list of files in a queue. - # - # @param [Array] files a list of files to queue for parsing - # @return [void] - def parse_in_order(*files) - global_state = OpenStruct.new - - return if before_parse_list_callbacks.any? do |cb| - cb.call(files, global_state) == false - end - - OrderedParser.new(global_state, files).parse - - after_parse_list_callbacks.each do |cb| - cb.call(files, global_state) - end - end - end - - register_parser_type :ruby, Ruby::RubyParser - register_parser_type :ruby18, Ruby::Legacy::RubyParser - register_parser_type :c, C::CParser, ['c', 'cc', 'cxx', 'cpp'] - - self.parser_type = :ruby - - # @return [String] the filename being parsed by the parser. - attr_accessor :file - - # @return [Symbol] the parser type associated with the parser instance. - # This should be set by the {#initialize constructor}. - attr_reader :parser_type - - # @return [OpenStruct] an open struct containing arbitrary global state - # shared between files and handlers. - # @since 0.7.0 - attr_reader :globals - - # @return [String] the contents of the file to be parsed - # @since 0.7.0 - attr_reader :contents - - # @overload initialize(parser_type = SourceParser.parser_type, globals = nil) - # Creates a new parser object for code parsing with a specific parser type. - # - # @param [Symbol] parser_type the parser type to use - # @param [OpenStruct] globals global state to be re-used across separate source files - def initialize(parser_type = SourceParser.parser_type, globals1 = nil, globals2 = nil) - globals = [true, false].include?(globals1) ? globals2 : globals1 - @file = '(stdin)' - @globals = globals || OpenStruct.new - self.parser_type = parser_type - end - - # The main parser method. This should not be called directly. Instead, - # use the class methods {parse} and {parse_string}. - # - # @param [String, #read, Object] content the source file to parse - # @return [Object, nil] the parser object used to parse the source - def parse(content = __FILE__) - case content - when String - @file = File.cleanpath(content) - content = convert_encoding(String.new(File.read_binary(file))) - checksum = Registry.checksum_for(content) - return if Registry.checksums[file] == checksum - - if Registry.checksums.key?(file) - log.info "File '#{file}' was modified, re-processing..." - end - Registry.checksums[@file] = checksum - self.parser_type = parser_type_for_filename(file) - else - content = content.read if content.respond_to? :read - end - - @contents = content - @parser = parser_class.new(content, file) - - self.class.before_parse_file_callbacks.each do |cb| - return @parser if cb.call(self) == false - end - - @parser.parse - post_process - - self.class.after_parse_file_callbacks.each do |cb| - cb.call(self) - end - - @parser - rescue ArgumentError, NotImplementedError => e - log.warn("Cannot parse `#{file}': #{e.message}") - log.backtrace(e, :warn) - rescue ParserSyntaxError => e - log.warn(e.message.capitalize) - log.backtrace(e, :warn) - end - - # Tokenizes but does not parse the block of code using the current {#parser_type} - # - # @param [String] content the block of code to tokenize - # @return [Array] a list of tokens - def tokenize(content) - @parser = parser_class.new(content, file) - @parser.tokenize - end - - private - - # Searches for encoding line and forces encoding - # @since 0.5.3 - def convert_encoding(content) - return content unless content.respond_to?(:force_encoding) - if content =~ ENCODING_LINE - content.force_encoding($1) - else - content.force_encoding('binary') - ENCODING_BYTE_ORDER_MARKS.each do |encoding, bom| - bom.force_encoding('binary') - if content[0, bom.size] == bom - content.force_encoding(encoding) - return content - end - end - content.force_encoding('utf-8') # UTF-8 is default encoding - content - end - end - - # Runs a {Handlers::Processor} object to post process the parsed statements. - # @return [void] - def post_process - return unless @parser.respond_to?(:enumerator) - - enumerator = @parser.enumerator - if enumerator - post = Handlers::Processor.new(self) - post.process(enumerator) - end - end - - def parser_type=(value) - @parser_type = self.class.validated_parser_type(value) - end - - # Guesses the parser type to use depending on the file extension. - # - # @param [String] filename the filename to use to guess the parser type - # @return [Symbol] a parser type that matches the filename - def parser_type_for_filename(filename) - ext = (File.extname(filename)[1..-1] || "").downcase - type = self.class.parser_type_for_extension(ext) - parser_type == :ruby18 && type == :ruby ? :ruby18 : type - end - - # @since 0.5.6 - def parser_class - klass = self.class.parser_types[parser_type] - unless klass - raise ArgumentError, "invalid parser type '#{parser_type}' or unrecognized file", caller[1..-1] - end - - klass - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rake/yardoc_task.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rake/yardoc_task.rb deleted file mode 100644 index a1597f5f98..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rake/yardoc_task.rb +++ /dev/null @@ -1,81 +0,0 @@ -# frozen_string_literal: true -require 'rake' -require 'rake/tasklib' - -module YARD - module Rake - # The rake task to run {CLI::Yardoc} and generate documentation. - class YardocTask < ::Rake::TaskLib - # The name of the task - # @return [String] the task name - attr_accessor :name - - # Options to pass to {CLI::Yardoc} - # @return [Array] the options passed to the commandline utility - attr_accessor :options - - # Options to pass to {CLI::Stats} - # @return [Array] the options passed to the stats utility - attr_accessor :stats_options - - # The Ruby source files (and any extra documentation files separated by '-') - # to process. - # @example Task files assignment - # YARD::Rake::YardocTask.new do |t| - # t.files = ['app/**/*.rb', 'lib/**/*.rb', '-', 'doc/FAQ.md', 'doc/Changes.md'] - # end - # @return [Array] a list of files - attr_accessor :files - - # Runs a +Proc+ before the task - # @return [Proc] a proc to call before running the task - attr_accessor :before - - # Runs a +Proc+ after the task - # @return [Proc] a proc to call after running the task - attr_accessor :after - - # @return [Verifier, Proc] an optional {Verifier} to run against all objects - # being generated. Any object that the verifier returns false for will be - # excluded from documentation. This attribute can also be a lambda. - # @see Verifier - attr_accessor :verifier - - # Creates a new task with name +name+. - # - # @param [String, Symbol] name the name of the rake task - # @yield a block to allow any options to be modified on the task - # @yieldparam [YardocTask] _self the task object to allow any parameters - # to be changed. - def initialize(name = :yard) - @name = name - @options = [] - @stats_options = [] - @files = [] - - yield self if block_given? - self.options += ENV['OPTS'].split(/[ ,]/) if ENV['OPTS'] - self.files += ENV['FILES'].split(/[ ,]/) if ENV['FILES'] - self.options << '--no-stats' unless stats_options.empty? - - define - end - - protected - - # Defines the rake task - # @return [void] - def define - desc "Generate YARD Documentation" unless ::Rake.application.last_description - task(name) do - before.call if before.is_a?(Proc) - yardoc = YARD::CLI::Yardoc.new - yardoc.options[:verifier] = verifier if verifier - yardoc.run(*(options + files)) - YARD::CLI::Stats.run(*(stats_options + ['--use-cache'])) unless stats_options.empty? - after.call if after.is_a?(Proc) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/registry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/registry.rb deleted file mode 100644 index d70a442eaa..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/registry.rb +++ /dev/null @@ -1,439 +0,0 @@ -# frozen_string_literal: true -require 'fileutils' -require 'digest/sha1' - -module YARD - # The +Registry+ is the centralized data store for all {CodeObjects} created - # during parsing. The storage is a key value store with the object's path - # (see {CodeObjects::Base#path}) as the key and the object itself as the value. - # Object paths must be unique to be stored in the Registry. All lookups for - # objects are done on the singleton Registry instance using the {Registry.at} - # or {Registry.resolve} methods. - # - # == Saving / Loading a Registry - # The registry is saved to a "yardoc file" (actually a directory), which can - # be loaded back to perform any lookups. See {Registry.load!} and - # {Registry.save} for information on saving and loading of a yardoc file. - # - # == Threading Notes - # The registry class is a singleton class that is accessed directly in many - # places across YARD. To mitigate threading issues, YARD (0.6.5+) makes - # the Registry thread local. This means all access to a registry for a specific - # object set must occur in the originating thread. - # - # @example Loading the Registry - # Registry.load!('/path/to/yardocfile') # loads all objects into memory - # Registry.at('YARD::CodeObjects::Base').docstring - # # => "+Base+ is the superclass of all code objects ..." - # @example Getting an object by a specific path - # Registry.at('YARD::CodeObjects::Base#docstring') - # @example Performing a lookup on a method anywhere in the inheritance tree - # Registry.resolve(P('YARD::CodeObjects::Base'), '#docstring', true) - module Registry - DEFAULT_YARDOC_FILE = ".yardoc" - LOCAL_YARDOC_INDEX = File.expand_path(File.join(Config::CONFIG_DIR, 'gem_index')) - DEFAULT_PO_DIR = "po" - - extend Enumerable - - class << self - # @group Getting .yardoc File Locations - - # Returns the .yardoc file associated with a gem. - # - # @param [String] gem the name of the gem to search for - # @param [String] ver_require an optional Gem version requirement - # @param [Boolean] for_writing whether or not the method should search - # for writable locations - # @return [String] if +for_writing+ is set to +true+, returns the best - # location suitable to write the .yardoc file. Otherwise, the first - # existing location associated with the gem's .yardoc file. - # @return [nil] if +for_writing+ is set to false and no yardoc file - # is found, returns nil. - def yardoc_file_for_gem(gem, ver_require = ">= 0", for_writing = false) - specs = YARD::GemIndex.find_all_by_name(gem, ver_require) - return if specs.empty? - - result = nil - specs.reverse.each do |spec| - if gem =~ /^yard-doc-/ - path = File.join(spec.full_gem_path, DEFAULT_YARDOC_FILE) - result = File.exist?(path) && !for_writing ? path : nil - result ? break : next - end - - if for_writing - result = global_yardoc_file(spec, for_writing) || - old_global_yardoc_file(spec, for_writing) || - local_yardoc_file(spec, for_writing) - else - result = local_yardoc_file(spec, for_writing) || - global_yardoc_file(spec, for_writing) || - old_global_yardoc_file(spec, for_writing) - end - - break if result - end - - result - end - - # Gets/sets the yardoc filename - # @return [String] the yardoc filename - # @see DEFAULT_YARDOC_FILE - attr_accessor :yardoc_file - undef yardoc_file, yardoc_file= - def yardoc_file=(v) Thread.current[:__yard_yardoc_file__] = v end - - def yardoc_file - Thread.current[:__yard_yardoc_file__] ||= DEFAULT_YARDOC_FILE - end - - # @group Loading Data from Disk - - # Loads the registry and/or parses a list of files - # - # @example Loads the yardoc file or parses files 'a', 'b' and 'c' (but not both) - # Registry.load(['a', 'b', 'c']) - # @example Reparses files 'a' and 'b' regardless of whether yardoc file exists - # Registry.load(['a', 'b'], true) - # @param [String, Array] files if +files+ is an Array, it should represent - # a list of files that YARD should parse into the registry. If reload is - # set to false and the yardoc file already exists, these files are skipped. - # If files is a String, it should represent the yardoc file to load - # into the registry. - # @param [Boolean] reparse if reparse is false and a yardoc file already - # exists, any files passed in will be ignored. - # @return [Registry] the registry object (for chaining) - # @raise [ArgumentError] if files is not a String or Array - def load(files = [], reparse = false) - if files.is_a?(Array) - if File.exist?(yardoc_file) && !reparse - load_yardoc - else - size = thread_local_store.keys.size - YARD.parse(files) - save if thread_local_store.keys.size > size - end - elsif files.is_a?(String) - load_yardoc(files) - else - raise ArgumentError, "Must take a list of files to parse or the .yardoc file to load." - end - self - end - - # Loads a yardoc file directly - # - # @param [String] file the yardoc file to load. - # @return [Registry] the registry object (for chaining) - def load_yardoc(file = yardoc_file) - clear - thread_local_store.load(file) - self - end - - # Loads a yardoc file and forces all objects cached on disk into - # memory. Equivalent to calling {load_yardoc} followed by {load_all} - # - # @param [String] file the yardoc file to load - # @return [Registry] the registry object (for chaining) - # @see #load_yardoc - # @see #load_all - # @since 0.5.1 - def load!(file = yardoc_file) - clear - thread_local_store.load!(file) - self - end - - # Forces all objects cached on disk into memory - # - # @example Loads all objects from disk - # Registry.load - # Registry.all.count #=> 0 - # Registry.load_all - # Registry.all.count #=> 17 - # @return [Registry] the registry object (for chaining) - # @since 0.5.1 - def load_all - thread_local_store.load_all - self - end - - # @group Saving and Deleting Data from Disk - - # Saves the registry to +file+ - # - # @param [String] file the yardoc file to save to - # @return [Boolean] true if the file was saved - def save(merge = false, file = yardoc_file) - thread_local_store.save(merge, file) - end - - # Deletes the yardoc file from disk - # @return [void] - def delete_from_disk - thread_local_store.destroy - end - - # @group Adding and Deleting Objects from the Registry - - # Registers a new object with the registry - # - # @param [CodeObjects::Base] object the object to register - # @return [CodeObjects::Base] the registered object - def register(object) - return if object.is_a?(CodeObjects::Proxy) - thread_local_store[object.path] = object - end - - # Deletes an object from the registry - # @param [CodeObjects::Base] object the object to remove - # @return [void] - def delete(object) - thread_local_store.delete(object.path) - end - - # Clears the registry - # @return [void] - def clear - self.thread_local_store = RegistryStore.new - end - - # Creates a pessmistic transactional lock on the database for writing. - # Use with {YARD.parse} to ensure the database is not written multiple - # times. - # - # @see locked_for_writing? - def lock_for_writing(file = yardoc_file, &block) - thread_local_store.lock_for_writing(file, &block) - end - - # (see Serializers::YardocSerializer#locked_for_writing?) - def locked_for_writing?(file = yardoc_file) - thread_local_store.locked_for_writing?(file) - end - - # @group Accessing Objects in the Registry - - # Iterates over {all} with no arguments - def each(&block) - all.each(&block) - end - - # Returns all objects in the registry that match one of the types provided - # in the +types+ list (if +types+ is provided). - # - # @example Returns all objects - # Registry.all - # @example Returns all classes and modules - # Registry.all(:class, :module) - # @param [Array] types an optional list of types to narrow the - # objects down by. Equivalent to performing a select: - # +Registry.all.select {|o| types.include(o.type) }+ - # @return [Array] the list of objects found - # @see CodeObjects::Base#type - def all(*types) - if types.empty? - thread_local_store.values.select {|obj| obj != root } - else - list = [] - types.each do |type| - list += thread_local_store.values_for_type(type) - end - list - end - end - - # Returns the paths of all of the objects in the registry. - # @param [Boolean] reload whether to load entire database - # @return [Array] all of the paths in the registry. - def paths(reload = false) - thread_local_store.keys(reload).map(&:to_s) - end - - # Returns the object at a specific path. - # @param [String, :root] path the pathname to look for. If +path+ is +root+, - # returns the {root} object. - # @return [CodeObjects::Base] the object at path - # @return [nil] if no object is found - def at(path) path ? thread_local_store[path] : nil end - alias [] at - - # The root namespace object. - # @return [CodeObjects::RootObject] the root object in the namespace - def root; thread_local_store[:root] end - - # @param [String] name the locale name. - # @return [I18n::Locale] the locale object for +name+. - # @since 0.8.3 - def locale(name) - thread_local_store.locale(name) - end - - # Attempts to find an object by name starting at +namespace+, performing - # a lookup similar to Ruby's method of resolving a constant in a namespace. - # - # @example Looks for instance method #reverse starting from A::B::C - # Registry.resolve(P("A::B::C"), "#reverse") - # @example Looks for a constant in the root namespace - # Registry.resolve(nil, 'CONSTANT') - # @example Looks for a class method respecting the inheritance tree - # Registry.resolve(myclass, 'mymethod', true) - # @example Looks for a constant but returns a proxy if not found - # Registry.resolve(P('A::B::C'), 'D', false, true) # => # - # @example Looks for a complex path from a namespace - # Registry.resolve(P('A::B'), 'B::D') # => # - # @param [CodeObjects::NamespaceObject, nil] namespace the starting namespace - # (module or class). If +nil+ or +:root+, starts from the {root} object. - # @param [String, Symbol] name the name (or complex path) to look for from - # +namespace+. - # @param [Boolean] inheritance Follows inheritance chain (mixins, superclass) - # when performing name resolution if set to +true+. - # @param [Boolean] proxy_fallback If +true+, returns a proxy representing - # the unresolved path (namespace + name) if no object is found. - # @param [Symbol, nil] type the {CodeObjects::Base#type} that the resolved - # object must be equal to. No type checking if nil. - # @return [CodeObjects::Base] the object if it is found - # @return [CodeObjects::Proxy] a Proxy representing the object if - # +proxy_fallback+ is +true+. - # @return [nil] if +proxy_fallback+ is +false+ and no object was found. - # @see P - def resolve(namespace, name, inheritance = false, proxy_fallback = false, type = nil) - thread_local_resolver.lookup_by_path name, - :namespace => namespace, :inheritance => inheritance, - :proxy_fallback => proxy_fallback, :type => type - end - - # @group Managing Source File Checksums - - # @return [Hash{String => String}] a set of checksums for files - def checksums - thread_local_store.checksums - end - - # @param [String] data data to checksum - # @return [String] the SHA1 checksum for data - def checksum_for(data) - Digest::SHA1.hexdigest(data) - end - - # @group Managing Internal State (Advanced / Testing Only) - - # Whether or not the Registry storage should load everything into a - # single object database (for disk efficiency), or spread them out - # (for load time efficiency). - # - # @note Setting this attribute to nil will offload the decision to - # the {RegistryStore storage adapter}. - # @return [Boolean, nil] if this value is set to nil, the storage - # adapter will decide how to store the data. - attr_accessor :single_object_db - undef single_object_db, single_object_db= - def single_object_db=(v) Thread.current[:__yard_single_db__] = v end - def single_object_db; Thread.current[:__yard_single_db__] end - - # The assumed types of a list of paths. This method is used by CodeObjects::Base - # @return [{String => Symbol}] a set of unresolved paths and their assumed type - # @private - # @deprecated The registry no longer globally tracks proxy types. - def proxy_types - thread_local_store.proxy_types - end - - # @group I18n features - - # Gets/sets the directory that has LANG.po files - # @return [String] the directory that has .po files - attr_accessor :po_dir - undef po_dir, po_dir= - def po_dir=(dir) Thread.current[:__yard_po_dir__] = dir end - - def po_dir - Thread.current[:__yard_po_dir__] ||= DEFAULT_PO_DIR - end - - # @group Legacy Methods - - # The registry singleton instance. - # - # @deprecated use Registry.methodname directly. - # @return [Registry] returns the registry instance - def instance; self end - - private - - # @group Accessing Objects in the Registry - - # Attempts to resolve a name in a namespace - # - # @param [CodeObjects::NamespaceObject] namespace the starting namespace - # @param [String] name the name to look for - # @param [Symbol, nil] type the {CodeObjects::Base#type} that the resolved - # object must be equal to - def partial_resolve(namespace, name, type = nil) - obj = at(name) || at('#' + name) if namespace.root? - return obj if obj && (type.nil? || obj.type == type) - [CodeObjects::NSEP, CodeObjects::CSEP, ''].each do |s| - next if s.empty? && name =~ /^\w/ - path = name - path = [namespace.path, name].join(s) if namespace != root - found = at(path) - return found if found && (type.nil? || found.type == type) - end - nil - end - - # @group Retrieving yardoc File Locations - - def global_yardoc_file(spec, for_writing = false) - path = spec.doc_dir - yfile = spec.doc_dir(DEFAULT_YARDOC_FILE) - if for_writing - if File.writable?(path) || - (!File.directory?(path) && File.writable?(File.dirname(path))) - return yfile - end - elsif !for_writing && File.exist?(yfile) - return yfile - end - end - - def old_global_yardoc_file(spec, for_writing = false) - path = spec.full_gem_path - yfile = File.join(path, DEFAULT_YARDOC_FILE) - return yfile if for_writing && File.writable?(path) - return yfile if !for_writing && File.exist?(yfile) - end - - def local_yardoc_file(spec, for_writing = false) - path = Registry::LOCAL_YARDOC_INDEX - FileUtils.mkdir_p(path) if for_writing - path = File.join(path, "#{spec.full_name}.yardoc") - if for_writing - path - else - File.exist?(path) ? path : nil - end - end - - # @group Threading support - - # @since 0.6.5 - def thread_local_store - Thread.current[:__yard_registry__] ||= clear - end - - # @since 0.6.5 - def thread_local_store=(value) - Thread.current[:__yard_registry__] = value - end - - # @since 0.9.1 - def thread_local_resolver - Thread.current[:__yard_resolver__] ||= RegistryResolver.new - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/registry_resolver.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/registry_resolver.rb deleted file mode 100644 index 129d893ffe..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/registry_resolver.rb +++ /dev/null @@ -1,217 +0,0 @@ -# frozen_string_literal: true -module YARD - # Handles all logic for complex lexical and inherited object resolution. - # Used by {Registry.resolve}, so there is no need to use this class - # directly. - # - # @see Registry.resolve - # @since 0.9.1 - class RegistryResolver - include CodeObjects::NamespaceMapper - - # Creates a new resolver object for a registry. - # - # @param registry [Registry] only set this if customizing the registry - # object - def initialize(registry = Registry) - @registry = registry - @default_sep = nil - - # Preload all code objects for separator declarations - YARD::CodeObjects.constants.map {|t| YARD::CodeObjects.const_get(t) } - end - - # Performs a lookup on a given path in the registry. Resolution will occur - # in a similar way to standard Ruby identifier resolution, doing lexical - # lookup, as well as (optionally) through the inheritance chain. A proxy - # object can be returned if the lookup fails for future resolution. The - # proxy will be type hinted with the +type+ used in the original lookup. - # - # @option opts namespace [CodeObjects::Base, :root, nil] (nil) the namespace - # object to start searching from. If root or nil is provided, {Registry.root} - # is assumed. - # @option opts inheritance [Boolean] (false) whether to perform lookups through - # the inheritance chain (includes mixins) - # @option opts proxy_fallback [Boolean] (false) when true, a proxy is returned - # if no match is found - # @option opts type [Symbol] (nil) an optional type hint for the resolver - # to consider when performing a lookup. If a type is provided and the - # resolved object's type does not match the hint, the object is discarded. - # @return [CodeObjects::Base, CodeObjects::Proxy, nil] the first object - # that matches the path lookup. If proxy_fallback is provided, a proxy - # object will be returned in the event of no match, otherwise nil will - # be returned. - # @example A lookup from root - # resolver.lookup_by_path("A::B::C") - # @example A lookup from the A::B namespace - # resolver.lookup_by_path("C", namespace: P("A::B")) - # @example A lookup on a method through the inheritance tree - # resolver.lookup_by_math("A::B#foo", inheritance: true) - def lookup_by_path(path, opts = {}) - path = path.to_s - namespace = opts[:namespace] - inheritance = opts[:inheritance] || false - proxy_fallback = opts[:proxy_fallback] || false - type = opts[:type] - - if namespace.is_a?(CodeObjects::Proxy) - return proxy_fallback ? CodeObjects::Proxy.new(namespace, path, type) : nil - end - - if namespace == :root || !namespace - namespace = @registry.root - else - namespace = namespace.parent until namespace.is_a?(CodeObjects::NamespaceObject) - end - orignamespace = namespace - - if path =~ starts_with_default_separator_match - path = $' - namespace = @registry.root - orignamespace = @registry.root - end - - resolved = nil - lexical_lookup = 0 - while namespace && !resolved - resolved = lookup_path_direct(namespace, path, type) - resolved ||= lookup_path_inherited(namespace, path, type) if inheritance - break if resolved - namespace = namespace.parent - lexical_lookup += 1 - end - - # method objects cannot be resolved through lexical lookup by more than 1 ns - if lexical_lookup > 1 && resolved.is_a?(CodeObjects::MethodObject) - resolved = nil - end - - if proxy_fallback - resolved ||= CodeObjects::Proxy.new(orignamespace, path, type) - end - - resolved - end - - private - - # return [Boolean] if the obj's type matches the provided type. - def validate(obj, type) - !type || (obj && obj.type == type) ? obj : nil - end - - # Performs a lexical lookup from a namespace for a path and a type hint. - def lookup_path_direct(namespace, path, type) - result = namespace.root? && validate(@registry.at(path), type) - return result if result - - if path =~ starts_with_separator_match - return validate(@registry.at(namespace.path + path), type) - end - - separators.each do |sep| - result = validate(@registry.at("#{namespace.path}#{sep}#{path}"), type) - return result if result - end - - nil - end - - # Performs a lookup through the inheritance chain on a path with a type hint. - def lookup_path_inherited(namespace, path, type) - resolved = nil - last_obj = namespace - scopes = [] - last_sep = nil - pos = 0 - - if path =~ starts_with_separator_match - last_sep = $1 - path = $' - end - - path.scan(split_on_separators_match).each do |part, sep| - cur_obj = nil - pos += "#{part}#{sep}".length - parsed_end = pos == path.length - - if !last_obj || (!parsed_end && !last_obj.is_a?(CodeObjects::NamespaceObject)) - break # can't continue - end - - collect_namespaces(last_obj).each do |ns| - next if ns.is_a?(CodeObjects::Proxy) - - found = nil - search_seps = [] - scopes.each do |scope| - search_seps += separators_for_type(scope) - end - - if search_seps.empty? - search_seps = - if ns.type == :root - [""] - elsif last_sep.nil? - separators - else - [@default_sep] - end - end - - ([last_sep] | search_seps).compact.each do |search_sep| - found = @registry.at(ns.path + search_sep.to_s + part) - break if found - end - - break cur_obj = found if found - end - - last_sep = sep - scopes = types_for_separator(sep) || [] - last_obj = cur_obj - resolved = cur_obj if parsed_end && cur_obj && (type.nil? || type == cur_obj.type) - end - - resolved - end - - # Collects and returns all inherited namespaces for a given object - def collect_namespaces(object) - return [] unless object.respond_to?(:inheritance_tree) - - nss = object.inheritance_tree(true) - if object.respond_to?(:superclass) - nss |= [P('Object')] if object.superclass != P('BasicObject') - nss |= [P('BasicObject')] - end - - nss - end - - # @return [Regexp] the regexp match of the default separator - def starts_with_default_separator_match - @@starts_with_default_separator_match ||= /\A#{default_separator}/ - end - - # @return [Regexp] the regexp that matches strings starting with - # a separator - def starts_with_separator_match - @@starts_with_separator_match ||= /\A(#{separators_match})/ - end - - # @return [Regexp] the regexp that can be used to split a string on all - # occurrences of separator tokens - def split_on_separators_match - @@split_on_separators_match ||= /(.+?)(#{separators_match}|$)/ - end - - # Additional invalidations to done when NamespaceMapper API methods are - # called on this class - YARD::CodeObjects::NamespaceMapper.on_invalidate do - @@starts_with_default_separator_match = nil - @@starts_with_separator_match = nil - @@split_on_separators_match = nil - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/registry_store.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/registry_store.rb deleted file mode 100644 index dff048599e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/registry_store.rb +++ /dev/null @@ -1,342 +0,0 @@ -# frozen_string_literal: true -require 'fileutils' - -module YARD - # The data store for the {Registry}. - # - # @see Registry - # @see Serializers::YardocSerializer - class RegistryStore - # @deprecated The registry no longer tracks proxy types - attr_reader :proxy_types - attr_reader :file, :checksums - - def initialize - @file = nil - @checksums = {} - @store = {} - @proxy_types = {} - @object_types = {:root => [:root]} - @notfound = {} - @loaded_objects = 0 - @available_objects = 0 - @locales = {} - @store[:root] = CodeObjects::RootObject.allocate - @store[:root].send(:initialize, nil, :root) - end - - # Gets a {CodeObjects::Base} from the store - # - # @param [String, Symbol] key the path name of the object to look for. - # If it is empty or :root, returns the {#root} object. - # @return [CodeObjects::Base, nil] a code object or nil if none is found - def get(key) - key = :root if key == '' - key = key.to_sym - return @store[key] if @store[key] - return if @loaded_objects >= @available_objects - - # check disk - return if @notfound[key] - obj = @serializer.deserialize(key) - if obj - @loaded_objects += 1 - put(key, obj) - else - @notfound[key] = true - nil - end - end - - # Associates an object with a path - # @param [String, Symbol] key the path name (:root or '' for root object) - # @param [CodeObjects::Base] value the object to store - # @return [CodeObjects::Base] returns +value+ - def put(key, value) - if key == '' - @object_types[:root] = [:root] - @store[:root] = value - else - @notfound.delete(key.to_sym) - (@object_types[value.type] ||= []) << key.to_s - if @store[key.to_sym] - @object_types[@store[key.to_sym].type].delete(key.to_s) - end - @store[key.to_sym] = value - end - end - - alias [] get - alias []= put - - # Deletes an object at a given path - # @param [#to_sym] key the key to delete - # @return [void] - def delete(key) - if @store[key.to_sym] - @object_types[@store[key.to_sym].type].delete(key.to_s) - @store.delete(key.to_sym) - end - end - - # Gets all path names from the store. Loads the entire database - # if +reload+ is +true+ - # - # @param [Boolean] reload if false, does not load the entire database - # before a lookup. - # @return [Array] the path names of all the code objects - def keys(reload = false) load_all if reload; @store.keys end - - # Gets all code objects from the store. Loads the entire database - # if +reload+ is +true+ - # - # @param [Boolean] reload if false, does not load the entire database - # before a lookup. - # @return [Array] all the code objects - def values(reload = false) load_all if reload; @store.values end - - # @param [Symbol] type the type to look for - # @return [Array] a list of object paths with a given - # {CodeObjects::Base#type} - # @since 0.8.0 - def paths_for_type(type, reload = false) - load_all if reload - @object_types[type] || [] - end - - # @param [Symbol] type the type to look for - # @return [Array] a list of objects with a given - # {CodeObjects::Base#type} - # @since 0.8.0 - def values_for_type(type, reload = false) - load_all if reload - paths_for_type(type).map {|t| @store[t.to_sym] } - end - - # @return [CodeObjects::RootObject] the root object - def root; @store[:root] end - - # @param [String] name the locale name. - # @return [I18n::Locale] the locale object for +name+. - # @since 0.8.3 - def locale(name) - @locales[name] ||= load_locale(name) - end - - # @param [String, nil] file the name of the yardoc db to load - # @return [Boolean] whether the database was loaded - def load(file = nil) - initialize - @file = file - @serializer = Serializers::YardocSerializer.new(@file) - load_yardoc - end - - # Loads the .yardoc file and loads all cached objects into memory - # automatically. - # - # @param [String, nil] file the name of the yardoc db to load - # @return [Boolean] whether the database was loaded - # @see #load_all - # @since 0.5.1 - def load!(file = nil) - if load(file) - load_all - true - else - false - end - end - - # Loads all cached objects into memory - # @return [void] - def load_all - return unless @file - return if @loaded_objects >= @available_objects - log.debug "Loading entire database: #{@file} ..." - objects = [] - - all_disk_objects.sort_by(&:size).each do |path| - obj = @serializer.deserialize(path, true) - objects << obj if obj - end - - objects.each do |obj| - put(obj.path, obj) - end - - @loaded_objects += objects.size - log.debug "Loaded database (file='#{@file}' count=#{objects.size} total=#{@available_objects})" - end - - # Saves the database to disk - # @param [Boolean] merge if true, merges the data in memory with the - # data on disk, otherwise the data on disk is deleted. - # @param [String, nil] file if supplied, the name of the file to save to - # @return [Boolean] whether the database was saved - def save(merge = true, file = nil) - if file && file != @file - @file = file - @serializer = Serializers::YardocSerializer.new(@file) - end - destroy unless merge - - sdb = Registry.single_object_db - if sdb == true || sdb.nil? - @serializer.serialize(@store) - else - values(false).each do |object| - @serializer.serialize(object) - end - end - write_proxy_types - write_object_types - write_checksums - write_complete_lock - true - end - - # (see Serializers::YardocSerializer#lock_for_writing) - # @param file [String] if supplied, the path to the database - def lock_for_writing(file = nil, &block) - Serializers::YardocSerializer.new(file || @file).lock_for_writing(&block) - end - - # (see Serializers::YardocSerializer#locked_for_writing?) - # @param file [String] if supplied, the path to the database - def locked_for_writing?(file = nil) - Serializers::YardocSerializer.new(file || @file).locked_for_writing? - end - - # Deletes the .yardoc database on disk - # - # @param [Boolean] force if force is not set to true, the file/directory - # will only be removed if it ends with .yardoc. This helps with - # cases where the directory might have been named incorrectly. - # @return [Boolean] true if the .yardoc database was deleted, false - # otherwise. - def destroy(force = false) - if (!force && file =~ /\.yardoc$/) || force - if File.file?(@file) - # Handle silent upgrade of old .yardoc format - File.unlink(@file) - elsif File.directory?(@file) - FileUtils.rm_rf(@file) - end - true - else - false - end - end - - protected - - def objects_path - @serializer.objects_path - end - - # @deprecated The registry no longer tracks proxy types - def proxy_types_path - @serializer.proxy_types_path - end - - def checksums_path - @serializer.checksums_path - end - - def object_types_path - @serializer.object_types_path - end - - def load_yardoc - return false unless @file - if File.directory?(@file) # new format - @loaded_objects = 0 - @available_objects = all_disk_objects.size - load_proxy_types - load_checksums - load_root - load_object_types - true - elsif File.file?(@file) # old format - load_yardoc_old - true - else - false - end - end - - private - - def load_yardoc_old - @store, @proxy_types = *Marshal.load(File.read_binary(@file)) - end - - # @deprecated The registry no longer tracks proxy types - def load_proxy_types - return unless File.file?(proxy_types_path) - @proxy_types = Marshal.load(File.read_binary(proxy_types_path)) - end - - def load_object_types - if File.file?(object_types_path) - @object_types = Marshal.load(File.read_binary(object_types_path)) - else # migrate db without object_types - values.each do |object| - (@object_types[object.type] ||= []) << object.path - end - end - end - - def load_checksums - return unless File.file?(checksums_path) - lines = File.readlines(checksums_path).map do |line| - line.strip.rpartition(' ').tap { |p| p.delete_at(1) } - end - @checksums = Hash[lines] - end - - def load_root - root = @serializer.deserialize('root') - return if root.nil? - - @loaded_objects += 1 - if root.is_a?(Hash) # single object db - log.debug "Loading single object DB from .yardoc" - @loaded_objects += (root.keys.size - 1) - @store = root - else # just the root object - @store[:root] = root - end - end - - def load_locale(name) - locale = I18n::Locale.new(name) - locale.load(Registry.po_dir) - locale - end - - def all_disk_objects - Dir.glob(File.join(objects_path, '**/*')).select {|f| File.file?(f) } - end - - # @deprecated The registry no longer tracks proxy types - def write_proxy_types - File.open!(proxy_types_path, 'wb') {|f| f.write(Marshal.dump(@proxy_types)) } - end - - def write_object_types - File.open!(object_types_path, 'wb') {|f| f.write(Marshal.dump(@object_types)) } - end - - def write_checksums - File.open!(checksums_path, 'w') do |f| - @checksums.each {|k, v| f.puts("#{k} #{v}") } - end - end - - def write_complete_lock - File.open!(@serializer.complete_lock_path, 'w') {} - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports.rb deleted file mode 100644 index 8d915e2daa..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true -begin - require 'rubygems' - if defined?(Gem::VERSION) && Gem::VERSION >= '1.8.0' - require File.dirname(__FILE__) + '/backports/gem' - require File.dirname(__FILE__) + '/backports/source_index' - end -rescue LoadError - nil # noop -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports/LICENSE.txt b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports/LICENSE.txt deleted file mode 100644 index 8fee9f6d6d..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports/LICENSE.txt +++ /dev/null @@ -1,57 +0,0 @@ -RubyGems is copyrighted free software by Chad Fowler, Rich Kilmer, Jim -Weirich and others. You can redistribute it and/or modify it under -either the terms of the MIT license (see the file MIT.txt), or the -conditions below: - -1. You may make and give away verbatim copies of the source form of the - software without restriction, provided that you duplicate all of the - original copyright notices and associated disclaimers. - -2. You may modify your copy of the software in any way, provided that - you do at least ONE of the following: - - a. place your modifications in the Public Domain or otherwise - make them Freely Available, such as by posting said - modifications to Usenet or an equivalent medium, or by allowing - the author to include your modifications in the software. - - b. use the modified software only within your corporation or - organization. - - c. give non-standard executables non-standard names, with - instructions on where to get the original software distribution. - - d. make other distribution arrangements with the author. - -3. You may distribute the software in object code or executable - form, provided that you do at least ONE of the following: - - a. distribute the executables and library files of the software, - together with instructions (in the manual page or equivalent) - on where to get the original distribution. - - b. accompany the distribution with the machine-readable source of - the software. - - c. give non-standard executables non-standard names, with - instructions on where to get the original software distribution. - - d. make other distribution arrangements with the author. - -4. You may modify and include the part of the software into any other - software (possibly commercial). But some files in the distribution - are not written by the author, so that they are not under these terms. - - For the list of those files and their copying conditions, see the - file LEGAL. - -5. The scripts and library files supplied as input to or produced as - output from the software do not automatically fall under the - copyright of the software, but belong to whomever generated them, - and may be sold commercially, and may be aggregated with this - software. - -6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports/MIT.txt b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports/MIT.txt deleted file mode 100644 index 0e6643ab35..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports/MIT.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) Chad Fowler, Rich Kilmer, Jim Weirich and others. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports/gem.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports/gem.rb deleted file mode 100644 index 391fca8949..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports/gem.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true -module Gem - class << self - undef source_index if method_defined?(:source_index) - # Returns the Gem::SourceIndex of specifications that are in the Gem.path - def source_index - @@source_index ||= SourceIndex.from_installed_gems - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports/source_index.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports/source_index.rb deleted file mode 100644 index c3159503c2..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/backports/source_index.rb +++ /dev/null @@ -1,365 +0,0 @@ -# frozen_string_literal: true -#-- -# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. -# All rights reserved. -# See LICENSE.txt for permissions. -#++ - -require 'rubygems/specification' - -## -# The SourceIndex object indexes all the gems available from a -# particular source (e.g. a list of gem directories, or a remote -# source). A SourceIndex maps a gem full name to a gem -# specification. -# -# NOTE:: The class used to be named Cache, but that became -# confusing when cached source fetchers where introduced. The -# constant Gem::Cache is an alias for this class to allow old -# YAMLized source index objects to load properly. - -class Gem::SourceIndex - # Undef old methods - alias old_initialize initialize - undef old_initialize - %w(all_gems prerelease_gems load_gems_in latest_specs prerelease_specs - released_specs add_spec add_specs remove_spec each specification - index_signature gem_signature size length find_name search released_gems - refresh! outdated == dump gems spec_dirs spec_dirs=).each do |meth| - undef_method(meth) if method_defined?(meth) - end - - include Enumerable - - attr_reader :gems # :nodoc: - - ## - # Directories to use to refresh this SourceIndex when calling refresh! - - attr_accessor :spec_dirs - - class << self - # Undef old methods - %w(from_installed_gems installed_spec_directories - from_gems_in load_specification).each do |meth| - undef_method(meth) if instance_methods(true).find {|m| m.to_s == meth } - end - - ## - # Factory method to construct a source index instance for a given - # path. - # - # deprecated:: - # If supplied, from_installed_gems will act just like - # +from_gems_in+. This argument is deprecated and is provided - # just for backwards compatibility, and should not generally - # be used. - # - # return:: - # SourceIndex instance - - def from_installed_gems(*deprecated) - if deprecated.empty? - from_gems_in(*installed_spec_directories) - else - from_gems_in(*deprecated) # HACK: warn - end - end - - ## - # Returns a list of directories from Gem.path that contain specifications. - - def installed_spec_directories - Gem.path.collect {|dir| File.join(dir, "specifications") } - end - - ## - # Creates a new SourceIndex from the ruby format gem specifications in - # +spec_dirs+. - - def from_gems_in(*spec_dirs) - source_index = new - source_index.spec_dirs = spec_dirs - source_index.refresh! - end - - ## - # Loads a ruby-format specification from +file_name+ and returns the - # loaded spec. - - def load_specification(file_name) - Gem::Specification.load file_name - end - end - - ## - # Constructs a source index instance from the provided specifications, which - # is a Hash of gem full names and Gem::Specifications. - #-- - # TODO merge @gems and @prerelease_gems and provide a separate method - # #prerelease_gems - - def initialize(specifications = {}) - @gems = {} - specifications.each {|_full_name, spec| add_spec spec } - @spec_dirs = nil - end - - # TODO: remove method - def all_gems - @gems - end - - def prerelease_gems - @gems.reject {|_name, gem| !gem.version.prerelease? } - end - - def released_gems - @gems.reject {|_name, gem| gem.version.prerelease? } - end - - ## - # Reconstruct the source index from the specifications in +spec_dirs+. - - def load_gems_in(*spec_dirs) - @gems.clear - - spec_dirs.reverse_each do |spec_dir| - spec_files = Dir.glob File.join(spec_dir, '*.gemspec') - - spec_files.each do |spec_file| - gemspec = Gem::Specification.load spec_file - add_spec gemspec if gemspec - end - end - - self - end - - ## - # Returns an Array specifications for the latest released versions - # of each gem in this index. - - def latest_specs(include_prerelease = false) - result = Hash.new {|h, k| h[k] = [] } - latest = {} - - sort.each do |_, spec| - name = spec.name - curr_ver = spec.version - prev_ver = latest.key?(name) ? latest[name].version : nil - - next if !include_prerelease && curr_ver.prerelease? - next unless prev_ver.nil? || curr_ver >= prev_ver || - latest[name].platform != Gem::Platform::RUBY - - if prev_ver.nil? || - (curr_ver > prev_ver && spec.platform == Gem::Platform::RUBY) - result[name].clear - latest[name] = spec - end - - if spec.platform != Gem::Platform::RUBY - result[name].delete_if do |result_spec| - result_spec.platform == spec.platform - end - end - - result[name] << spec - end - - # TODO: why is this a hash while @gems is an array? Seems like - # structural similarity would be good. - result.values.flatten - end - - ## - # An array including only the prerelease gemspecs - - def prerelease_specs - prerelease_gems.values - end - - ## - # An array including only the released gemspecs - - def released_specs - released_gems.values - end - - ## - # Add a gem specification to the source index. - - def add_spec(gem_spec, name = gem_spec.full_name) - # No idea why, but the Indexer wants to insert them using original_name - # instead of full_name. So we make it an optional arg. - @gems[name] = gem_spec - end - - ## - # Add gem specifications to the source index. - - def add_specs(*gem_specs) - gem_specs.each do |spec| - add_spec spec - end - end - - ## - # Remove a gem specification named +full_name+. - - def remove_spec(full_name) - @gems.delete full_name - end - - ## - # Iterate over the specifications in the source index. - - def each(&block) # :yields: gem.full_name, gem - @gems.each(&block) - end - - ## - # The gem specification given a full gem spec name. - - def specification(full_name) - @gems[full_name] - end - - ## - # The signature for the source index. Changes in the signature indicate a - # change in the index. - - def index_signature - require 'digest' - - Digest::SHA256.new.hexdigest(@gems.keys.sort.join(',')).to_s - end - - ## - # The signature for the given gem specification. - - def gem_signature(gem_full_name) - require 'digest' - - Digest::SHA256.new.hexdigest(@gems[gem_full_name].to_yaml).to_s - end - - def size - @gems.size - end - alias length size - - ## - # Find a gem by an exact match on the short name. - - def find_name(gem_name, requirement = Gem::Requirement.default) - dep = Gem::Dependency.new gem_name, requirement - search dep - end - - ## - # Search for a gem by Gem::Dependency +gem_pattern+. If +only_platform+ - # is true, only gems matching Gem::Platform.local will be returned. An - # Array of matching Gem::Specification objects is returned. - # - # For backwards compatibility, a String or Regexp pattern may be passed as - # +gem_pattern+, and a Gem::Requirement for +platform_only+. This - # behavior is deprecated and will be removed. - - def search(gem_pattern, platform_only = false) - requirement = nil - only_platform = false - - # TODO: Remove support and warning for legacy arguments after 2008/11 - unless Gem::Dependency === gem_pattern - warn "#{Gem.location_of_caller.join ':'}:Warning: Gem::SourceIndex#search support for #{gem_pattern.class} patterns is deprecated, use #find_name" - end - - case gem_pattern - when Regexp then - requirement = platform_only || Gem::Requirement.default - when Gem::Dependency then - only_platform = platform_only - requirement = gem_pattern.requirement - - gem_pattern = if Regexp === gem_pattern.name - gem_pattern.name - elsif gem_pattern.name.empty? - // - else - /^#{Regexp.escape gem_pattern.name}$/ - end - else - requirement = platform_only || Gem::Requirement.default - gem_pattern = /#{gem_pattern}/i - end - - unless Gem::Requirement === requirement - requirement = Gem::Requirement.create requirement - end - - specs = all_gems.values.select do |spec| - spec.name =~ gem_pattern && - requirement.satisfied_by?(spec.version) - end - - if only_platform - specs = specs.select do |spec| - Gem::Platform.match spec.platform - end - end - - specs.sort_by(&:sort_obj) - end - - ## - # Replaces the gems in the source index from specifications in the - # directories this source index was created from. Raises an exception if - # this source index wasn't created from a directory (via from_gems_in or - # from_installed_gems, or having spec_dirs set). - - def refresh! - raise 'source index not created from disk' if @spec_dirs.nil? - load_gems_in(*@spec_dirs) - end - - ## - # Returns an Array of Gem::Specifications that are not up to date. - - def outdated - outdateds = [] - - latest_specs.each do |local| - dependency = Gem::Dependency.new local.name, ">= #{local.version}" - - fetcher = Gem::SpecFetcher.fetcher - remotes = fetcher.find_matching dependency - remotes = remotes.map {|(_, version, _), _| version } - - latest = remotes.sort.last - - outdateds << local.name if latest && local.version < latest - end - - outdateds - end - - def ==(other) # :nodoc: - self.class === other && @gems == other.gems - end - - def dump - Marshal.dump(self) - end -end - -# :stopdoc: -module Gem - ## - # Cache is an alias for SourceIndex to allow older YAMLized source index - # objects to load properly. - - Cache = SourceIndex unless defined?(Cache) -end -# :startdoc: diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/doc_manager.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/doc_manager.rb deleted file mode 100644 index e33f442ab6..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/doc_manager.rb +++ /dev/null @@ -1,90 +0,0 @@ -# frozen_string_literal: true -begin - require 'rubygems/user_interaction' - require 'rubygems/doc_manager' -rescue LoadError - nil # noop -end - -class Gem::DocManager - def self.load_yardoc - require File.expand_path(File.join(File.dirname(__FILE__), *%w(.. .. yard))) - end - - def run_yardoc(*args) - args << '--quiet' - args << '--backtrace' if Gem.configuration.backtrace - unless File.file?(File.join(@spec.full_gem_path, '.yardopts')) - args << @spec.require_paths - unless @spec.extra_rdoc_files.empty? - args << '-' - args += @spec.extra_rdoc_files - end - end - args = args.flatten.map(&:to_s) - - old_pwd = Dir.pwd - Dir.chdir(@spec.full_gem_path) - YARD::CLI::Yardoc.run(*args) - rescue Errno::EACCES => e - dirname = File.dirname e.message.split("-")[1].strip - raise Gem::FilePermissionError, dirname - rescue => ex - alert_error "While generating documentation for #{@spec.full_name}" - ui.errs.puts "... MESSAGE: #{ex}" - ui.errs.puts "... YARDOC args: #{args.join(' ')}" - ui.errs.puts "\t#{ex.backtrace.join("\n\t")}" if Gem.configuration.backtrace - ui.errs.puts "(continuing with the rest of the installation)" - ensure - Dir.chdir(old_pwd) - end - - begin undef setup_rdoc; rescue NameError; nil end - def setup_rdoc - if File.exist?(@doc_dir) && !File.writable?(@doc_dir) - raise Gem::FilePermissionError, @doc_dir - end - - FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir) - - self.class.load_rdoc if @spec.has_rdoc? - self.class.load_yardoc if @spec.has_yardoc? - end - - def install_yardoc - rdoc_dir = File.join(@doc_dir, 'rdoc') - - FileUtils.rm_rf rdoc_dir - - say "Installing YARD documentation for #{@spec.full_name}..." - run_yardoc '-o', rdoc_dir - end - - def install_ri_yard - install_ri_yard_orig if @spec.has_rdoc? - return if @spec.has_rdoc? == false - return if @spec.has_yardoc? - - self.class.load_yardoc - say "Building YARD (yri) index for #{@spec.full_name}..." - run_yardoc '-c', '-n' - end - - begin - alias install_ri_yard_orig install_ri - alias install_ri install_ri_yard - rescue NameError; nil end - - def install_rdoc_yard - if @spec.has_rdoc? - install_rdoc_yard_orig - elsif @spec.has_yardoc? - install_yardoc - end - end - - begin - alias install_rdoc_yard_orig install_rdoc - alias install_rdoc install_rdoc_yard - rescue NameError; nil end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/hook.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/hook.rb deleted file mode 100644 index 4f1e0162f2..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/hook.rb +++ /dev/null @@ -1,197 +0,0 @@ -# frozen_string_literal: true -require 'rubygems' -require 'rubygems/user_interaction' -require 'fileutils' - -## -# Gem::YARDoc provides methods to generate YARDoc and yri data for installed gems -# upon gem installation. -# -# This file is automatically required by RubyGems 1.9 and newer. - -module YARD - class RubygemsHook - include Gem::UserInteraction - extend Gem::UserInteraction - - @yard_version = nil - - ## - # Force installation of documentation? - - attr_accessor :force - - ## - # Generate yard? - - attr_accessor :generate_yard - - ## - # Generate yri data? - - attr_accessor :generate_yri - - class << self - ## - # Loaded version of YARD. Set by ::load_yard - - attr_reader :yard_version - end - - ## - # Post installs hook that generates documentation for each specification in - # +specs+ - - def self.generation_hook(installer, specs) - start = Time.now - types = installer.document - - generate_yard = types.include?('yardoc') || types.include?('yard') - generate_yri = types.include? 'yri' - - specs.each do |spec| - gen_yard = generate_yard - gen_yri = generate_yri - gen_yri = false if gen_yard # never generate both, no need - unless types.empty? # --no-document is not in effect - # look at spec.metadata['yard.run'] for override - run_yard = spec.metadata['yard.run'] - gen_yard = true if run_yard && run_yard != 'yri' - gen_yri = true if run_yard == 'yri' - end - - new(spec, gen_yard, gen_yri).generate - end - - return unless generate_yard || generate_yri - - duration = (Time.now - start).to_i - names = specs.map(&:name).join ', ' - - say "Done installing documentation for #{names} after #{duration} seconds" - end - - ## - # Pre uninstalls hook that removes documentation - # - - def self.removal_hook(uninstaller) - new(uninstaller.spec).remove - end - - ## - # Loads the YARD generator - - def self.load_yard - return if @yard_version - - require 'yard' - - @yard_version = Gem::Version.new ::YARD::VERSION - end - - def initialize(spec, generate_yard = false, generate_yri = true) - @doc_dir = spec.doc_dir - @force = false - @spec = spec - - @generate_yard = generate_yard - @generate_yri = generate_yri - - @yard_dir = spec.doc_dir('yard') - @yri_dir = spec.doc_dir('.yardoc') - end - - def run_yardoc(*args) - args << '--quiet' unless Gem.configuration.really_verbose - args << '--backtrace' if Gem.configuration.backtrace - unless File.file?(File.join(@spec.full_gem_path, '.yardopts')) - args << @spec.require_paths - unless @spec.extra_rdoc_files.empty? - args << '-' - args += @spec.extra_rdoc_files - end - end - args = args.flatten.map(&:to_s) - - Dir.chdir(@spec.full_gem_path) do - YARD::CLI::Yardoc.run(*args) - end - rescue Errno::EACCES => e - dirname = File.dirname e.message.split("-")[1].strip - raise Gem::FilePermissionError, dirname - rescue => ex - alert_error "While generating documentation for #{@spec.full_name}" - ui.errs.puts "... MESSAGE: #{ex}" - ui.errs.puts "... YARDOC args: #{args.join(' ')}" - ui.errs.puts "\t#{ex.backtrace.join("\n\t")}" if Gem.configuration.backtrace - ui.errs.puts "(continuing with the rest of the installation)" - end - - def install_yard - FileUtils.rm_rf @yard_dir - - say "Installing YARD documentation for #{@spec.full_name}..." - run_yardoc '--no-progress', '--db', @yri_dir, '-o', @yard_dir - end - - def install_yri - FileUtils.rm_rf @yri_dir - - say "Building YARD (yri) index for #{@spec.full_name}..." - run_yardoc '--no-progress', '-c', '-n', '--db', @yri_dir - end - - ## - # Generates YARD and yri data - - def generate - return if @spec.default_gem? - return unless @generate_yri || @generate_yard - - setup - - install_yri if @generate_yri && (@force || !File.exist?(@yri_dir)) - - install_yard if @generate_yard && (@force || !File.exist?(@yard_dir)) - end - - ## - # Prepares the spec for documentation generation - - def setup - self.class.load_yard - - if File.exist?(@doc_dir) - raise Gem::FilePermissionError, @doc_dir unless File.writable?(@doc_dir) - else - FileUtils.mkdir_p @doc_dir - end - end - - def uninstall_yard - if File.exist?(@yard_dir) - raise Gem::FilePermissionError, @yard_dir unless File.writable?(@yard_dir) - FileUtils.rm_rf @yard_dir - end - end - - def uninstall_yri - if File.exist?(@yri_dir) - raise Gem::FilePermissionError, @yri_dir unless File.writable?(@yri_dir) - FileUtils.rm_rf @yri_dir - end - end - - ## - # Removes YARD and yri data - - def remove - uninstall_yri - uninstall_yard - end - end -end - -Gem.done_installing(&YARD::RubygemsHook.method(:generation_hook)) -Gem.pre_uninstall(&YARD::RubygemsHook.method(:removal_hook)) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/specification.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/specification.rb deleted file mode 100644 index 905ba067ac..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/rubygems/specification.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true -require 'rubygems/specification' - -class Gem::Specification - # @since 0.5.3 - def has_yardoc=(value) - @has_rdoc = value ? 'yard' : false - end - - def has_yardoc - @has_rdoc == 'yard' - end - - undef has_rdoc? - def has_rdoc? - (@has_rdoc ||= true) && @has_rdoc != 'yard' - end - - alias has_yardoc? has_yardoc - - # has_rdoc should not be ignored! - if respond_to?(:overwrite_accessor) - overwrite_accessor(:has_rdoc) { @has_rdoc ||= true } - overwrite_accessor(:has_rdoc=) {|v| @has_rdoc = v } - else - attr_accessor :has_rdoc - end - - if defined?(Gem::VERSION) && Gem::VERSION >= '1.7.' - def _dump_with_rdoc(limit) - dmp = _dump_without_rdoc(limit) - dmp[15] = @has_rdoc if dmp[15] == true - dmp - end - alias _dump_without_rdoc _dump - alias _dump _dump_with_rdoc - - if class_variable_defined?(:@@default_value) - if @@default_value.frozen? - t = @@default_value.dup - t[:has_rdoc] = true - @@default_value = t.freeze - else - @@default_value[:has_rdoc] = true - end - end - @@attributes << 'has_rdoc' if class_variable_defined?(:@@attributes) - @@nil_attributes << 'has_rdoc' if class_variable_defined?(:@@nil_attributes) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/base.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/base.rb deleted file mode 100644 index 101ee01975..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/base.rb +++ /dev/null @@ -1,83 +0,0 @@ -# frozen_string_literal: true -module YARD - module Serializers - # The abstract base serializer. Serializers allow templates to be - # rendered to various endpoints. For instance, a {FileSystemSerializer} - # would allow template contents to be written to the filesystem - # - # To implement a custom serializer, override the following methods: - # * {#serialize} - # * {#serialized_path} - # - # Optionally, a serializer can implement before and after filters: - # * {#before_serialize} - # * {#after_serialize} - # - # @abstract Override this class to implement a custom serializer. - class Base - # All serializer options are saved so they can be passed to other serializers. - # - # @return [SymbolHash] the serializer options - attr_reader :options - - # @group Creating a New Serializer - - # Creates a new serializer with options - # - # @param [Hash] opts the options to assign to {#options} - def initialize(opts = {}) - @options = SymbolHash.new(false).update(opts) - end - - # @group Serializing an Object - - # Serializes an object. - # - # @abstract This method should implement the logic that serializes - # +data+ to the respective endpoint. This method should also call - # the before and after callbacks {#before_serialize} and {#after_serialize} - # @param [CodeObjects::Base, String] object the object to serialize the - # data for. The object can also be a string (for non-object serialization) - # @param [String] data the contents that should be serialized - def serialize(object, data) end - - # The serialized path of an object - # - # @abstract This method should return the path of the object on the - # endpoint. For instance, for a file serializer, this should return - # the filename that represents the object on disk. - # @param [CodeObjects::Base] object the object to return a path for - # @return [String] the serialized path of an object - def serialized_path(object) end - - # Returns whether an object has been serialized - # - # @abstract This method should return whether the endpoint already exists. - # For instance, a file system serializer would check if the file exists - # on disk. You will most likely use +#basepath+ and {#serialized_path} to - # get the endpoint's location. - # @param [CodeObjects::Base] object the object to check existence of - # @return [Boolean] whether the endpoint exists. - # @since 0.6.0 - def exists?(object) # rubocop:disable Lint/UnusedMethodArgument - false - end - - # @group Callbacks - - # Called before serialization. - # - # @abstract Should run code before serialization. Should return false - # if serialization should not occur. - # @return [Boolean] whether or not serialization should occur - def before_serialize; end - - # Called after serialization. - # - # @abstract Should run code after serialization. - # @param [String] data the data that was serialized. - # @return [void] - def after_serialize(data); end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/file_system_serializer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/file_system_serializer.rb deleted file mode 100644 index c95f585f16..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/file_system_serializer.rb +++ /dev/null @@ -1,123 +0,0 @@ -# frozen_string_literal: true -module YARD - module Serializers - # Implements a serializer that reads from and writes to the filesystem. - class FileSystemSerializer < Base - # The base path to write data to. - # @return [String] a base path - attr_reader :basepath - - def basepath=(value) - @basepath = options[:basepath] = value - end - - # The extension of the filename (defaults to +html+) - # - # @return [String] the extension of the file. Empty string for no extension. - attr_reader :extension - - def extension=(value) - @extension = options[:extension] = value - end - - # Creates a new FileSystemSerializer with options - # - # @option opts [String] :basepath ('doc') the base path to write data to - # @option opts [String] :extension ('html') the extension of the serialized - # path filename. If this is set to the empty string, no extension is used. - def initialize(opts = {}) - super - @name_map = nil - @basepath = (options[:basepath] || 'doc').to_s - @extension = (options.key?(:extension) ? options[:extension] : 'html').to_s - end - - # Serializes object with data to its serialized path (prefixed by the +#basepath+). - # - # @return [String] the written data (for chaining) - def serialize(object, data) - path = File.join(basepath, serialized_path(object)) - log.debug "Serializing to #{path}" - File.open!(path, "wb") {|f| f.write data } - end - - # Implements the serialized path of a code object. - # - # @param [CodeObjects::Base, CodeObjects::ExtraFileObject, String] object - # the object to get a path for. The path of a string is the string itself. - # @return [String] if object is a String, returns - # object, otherwise the path on disk (without the basepath). - def serialized_path(object) - return object if object.is_a?(String) - - if object.is_a?(CodeObjects::ExtraFileObject) - fspath = ['file.' + object.name + (extension.empty? ? '' : ".#{extension}")] - else - objname = object != YARD::Registry.root ? mapped_name(object) : "top-level-namespace" - objname += '_' + object.scope.to_s[0, 1] if object.is_a?(CodeObjects::MethodObject) - fspath = [objname + (extension.empty? ? '' : ".#{extension}")] - if object.namespace && object.namespace.path != "" - fspath.unshift(*object.namespace.path.split(CodeObjects::NSEP)) - end - end - - File.join(encode_path_components(*fspath)) - end - - # Checks the disk for an object and returns whether it was serialized. - # - # @param [CodeObjects::Base] object the object to check - # @return [Boolean] whether an object has been serialized to disk - def exists?(object) - File.exist?(File.join(basepath, serialized_path(object))) - end - - private - - # Builds a filename mapping from object paths to filesystem path names. - # Needed to handle case sensitive YARD objects mapped into a case - # insensitive filesystem. Uses with {#mapped_name} to determine the - # mapping name for a given object. - # - # @note In order to use filesystem name mapping, you must initialize - # the serializer object after preparing the {YARD::Registry}. - def build_filename_map - @name_map = {} - YARD::Registry.all.each do |object| - lpath = nil - if object.parent && object.parent.type != :root - lpath = object.parent.path + "::" + object.name.to_s.downcase - else - lpath = object.path.downcase - end - - @name_map[lpath] ||= {} - size = @name_map[lpath].size - name = "#{object.name}#{size > 0 ? "_" * size : ""}" - @name_map[lpath][object.name] = name - end - end - - # @return [String] the filesystem mapped name of a given object. - def mapped_name(object) - build_filename_map unless @name_map - map = @name_map[object.path.downcase] - map && map[object.name] ? map[object.name] : object.name.to_s - end - - # Remove special chars from filenames. - # Windows disallows \ / : * ? " < > | but we will just remove any - # non alphanumeric (plus period, underscore and dash). - def encode_path_components(*components) - components.map! do |p| - p.gsub(/[^\w\.-]/) do |x| - encoded = String.new('_') - - x.each_byte {|b| encoded << ("%X" % b) } - encoded - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/process_serializer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/process_serializer.rb deleted file mode 100644 index 8c5a626f13..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/process_serializer.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true -module YARD - module Serializers - # Serializes an object to a process (like less) - # - # @example Serializing to a pager (less) - # serializer = ProcessSerializer.new('less') - # serializer.serialize(object, "data!") - class ProcessSerializer < Base - # Creates a new ProcessSerializer for the shell command +cmd+ - # - # @param [String] cmd the command that will accept data on stdin - def initialize(cmd) - @cmd = cmd - end - - # Overrides serialize behaviour and writes data to standard input - # of the associated command - def serialize(_object, data) - IO.popen(@cmd, 'w') {|io| io.write(data) } - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/stdout_serializer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/stdout_serializer.rb deleted file mode 100644 index 343b6ef7d0..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/stdout_serializer.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true -module YARD - module Serializers - # A serializer that writes data to standard output. - class StdoutSerializer < Base - # Creates a serializer to print text to stdout - # - # @param [Fixnum, nil] wrap if wrap is a number, wraps text to +wrap+ - # columns, otherwise no wrapping is done. - def initialize(wrap = nil) - @wrap = wrap - end - - # Overrides serialize behaviour to write data to standard output - def serialize(_object, data) - print(@wrap ? word_wrap(data, @wrap) : data) - end - - private - - # Wraps text to a specific column length - # - # @param [String] text the text to wrap - # @param [Fixnum] _length the column length to wrap to - # @return [String] the wrapped text - def word_wrap(text, _length = 80) - # See ruby-talk/10655 / Ernest Ellingson - text.gsub(/\t/, " ").gsub(/.{1,50}(?:\s|\Z)/) do - ($& + 5.chr).gsub(/\n\005/, "\n").gsub(/\005/, "\n") - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/yardoc_serializer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/yardoc_serializer.rb deleted file mode 100644 index 875d73b836..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/serializers/yardoc_serializer.rb +++ /dev/null @@ -1,152 +0,0 @@ -# frozen_string_literal: true -module YARD - # Stubs marshal dumps and acts a delegate class for an object by path - # - # @private - class StubProxy - instance_methods.each {|m| undef_method(m) unless m.to_s =~ /^__|^object_id$/ } - - def _dump(_depth) @path end - def self._load(str) new(str) end - def hash; @path.hash end - - def initialize(path, transient = false) - @path = path - @transient = transient - end - - def method_missing(meth, *args, &block) - return true if meth == :respond_to? && args.first == :_dump - @object = nil if @transient - @object ||= Registry.at(@path) - @object.send(meth, *args, &block) - rescue NoMethodError => e - e.backtrace.delete_if {|l| l[0, FILELEN] == __FILE__ } - raise - end - - FILELEN = __FILE__.size - end - - module Serializers - class YardocSerializer < FileSystemSerializer - def initialize(yfile) - super(:basepath => yfile, :extension => 'dat') - end - - def objects_path; File.join(basepath, 'objects') end - # @deprecated The registry no longer tracks proxy types - def proxy_types_path; File.join(basepath, 'proxy_types') end - def checksums_path; File.join(basepath, 'checksums') end - def object_types_path; File.join(basepath, 'object_types') end - def complete_lock_path; File.join(basepath, 'complete') end - def processing_path; File.join(basepath, 'processing') end - - def complete? - File.exist?(complete_lock_path) && !locked_for_writing? - end - - # Creates a pessmistic transactional lock on the database for writing. - # Use with {YARD.parse} to ensure the database is not written multiple - # times. - # - # @see #locked_for_writing? - def lock_for_writing - File.open!(processing_path, 'w') {} - yield - ensure - File.unlink(processing_path) if File.exist?(processing_path) - end - - # @return [Boolean] whether the database is currently locked for writing - def locked_for_writing? - File.exist?(processing_path) - end - - def serialized_path(object) - path = - case object - when String, Symbol - object = object.to_s - if object =~ /#/ - object += '_i' - elsif object =~ /\./ - object += '_c' - end - object.split(/::|\.|#/).map do |p| - p.gsub(/[^\w\.-]/) do |x| - encoded = '_' - - x.each_byte {|b| encoded += ("%X" % b) } - encoded - end - end.join('/') + '.' + extension - when YARD::CodeObjects::RootObject - 'root.dat' - else - super(object) - end - - File.join('objects', path) - end - - def serialize(object) - if Hash === object - super(object[:root], dump(object)) if object[:root] - else - super(object, dump(object)) - end - end - - def deserialize(path, is_path = false) - path = File.join(basepath, serialized_path(path)) unless is_path - if File.file?(path) - log.debug "Deserializing #{path}..." - Marshal.load(File.read_binary(path)) - else - log.debug "Could not find #{path}" - nil - end - end - - private - - def dump(object) - object = internal_dump(object, true) unless object.is_a?(Hash) - Marshal.dump(object) - end - - def internal_dump(object, first_object = false) - if !first_object && object.is_a?(CodeObjects::Base) && - !(Tags::OverloadTag === object) - return StubProxy.new(object.path) - end - - if object.is_a?(Hash) || object.is_a?(Array) || - object.is_a?(CodeObjects::Base) || - !object.instance_variables.empty? - object = object.dup - end - - object.instance_variables.each do |ivar| - ivar_obj = object.instance_variable_get(ivar) - ivar_obj_dump = internal_dump(ivar_obj) - object.instance_variable_set(ivar, ivar_obj_dump) - end - - case object - when Hash - list = object.map do |k, v| - [k, v].map {|item| internal_dump(item) } - end - object.replace(Hash[list]) - when Array - list = object.map {|item| internal_dump(item) } - object.replace(list) - end - - object - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server.rb deleted file mode 100644 index b8f323a0ed..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true -module YARD - module Server - # Registers a static path to be used in static asset lookup. - # @param [String] path the pathname to register - # @return [void] - # @since 0.6.2 - def self.register_static_path(path) - static_paths = Commands::StaticFileCommand::STATIC_PATHS - static_paths.push(path) unless static_paths.include?(path) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/adapter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/adapter.rb deleted file mode 100644 index 0dced5f806..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/adapter.rb +++ /dev/null @@ -1,100 +0,0 @@ -# frozen_string_literal: true -module YARD - module Server - # Short circuits a request by raising an error. This exception is caught - # by {Commands::Base#call} to immediately end a request and return a response. - class FinishRequest < RuntimeError; end - - # Raises an error if a resource is not found. This exception is caught by - # {Commands::Base#call} to immediately end a request and return a 404 response - # code. If a message is provided, the body is set to the exception message. - class NotFoundError < RuntimeError; end - - # This class implements the bridge between the {Router} and the server - # backend for a specific server type. YARD implements concrete adapters - # for WEBrick and Rack respectively, though other adapters can be made - # for other server architectures. - # - # == Subclassing Notes - # To create a concrete adapter class, implement the {#start} method to - # initiate the server backend. - # - # @abstract - class Adapter - # @return [String] the location where static files are located, if any. - # To set this field on initialization, pass +:DocumentRoot+ to the - # +server_opts+ argument in {#initialize} - attr_accessor :document_root - - # @return [Hash{String=>Array}] a map of libraries. - # @see LibraryVersion LibraryVersion for information on building a list of libraries - # @see #add_library - attr_accessor :libraries - - # @return [Hash] options passed and processed by adapters. The actual - # options mostly depend on the adapters themselves. - attr_accessor :options - - # @return [Hash] a set of options to pass to the server backend. Note - # that +:DocumentRoot+ also sets the {#document_root}. - attr_accessor :server_options - - # @return [Router] the router object used to route URLs to commands - attr_accessor :router - - # Performs any global initialization for the adapter. - # @note If you subclass this method, make sure to call +super+. - # @return [void] - def self.setup - Templates::Template.extra_includes |= [YARD::Server::DocServerHelper] - Templates::Engine.template_paths |= [File.dirname(__FILE__) + '/templates'] - end - - # Performs any global shutdown procedures for the adapter. - # @note If you subclass this method, make sure to call +super+. - # @return [void] - def self.shutdown - Templates::Template.extra_includes -= [YARD::Server::DocServerHelper] - Templates::Engine.template_paths -= [File.dirname(__FILE__) + '/templates'] - end - - # Creates a new adapter object - # - # @param [Hash{String=>Array}] libs a list of libraries, - # see {#libraries} for formulating this list. - # @param [Hash] opts extra options to pass to the adapter - # @option opts [Class] :router (Router) the router class to initialize as the - # adapter's router. - # @option opts [Boolean] :caching (false) whether or not caching is enabled - # @option opts [Boolean] :single_library (false) whether to server documentation - # for a single or multiple libraries (changes URL structure) - def initialize(libs, opts = {}, server_opts = {}) - self.class.setup - self.libraries = libs - self.options = opts - self.server_options = server_opts - self.document_root = server_options[:DocumentRoot] - self.router = (options[:router] || Router).new(self) - options[:adapter] = self - log.debug "Serving libraries using #{self.class}: #{libraries.keys.join(', ')}" - log.debug "Caching on" if options[:caching] - log.debug "Document root: #{document_root}" if document_root - end - - # Adds a library to the {#libraries} mapping for a given library object. - # @example Adding a new library to an adapter - # adapter.add_library LibraryVersion.new('mylib', '1.0', '/path/to/.yardoc') - # @param [LibraryVersion] library a library to add - def add_library(library) - libraries[library.name] ||= [] - libraries[library.name] |= [library] - end - - # Implement this method to connect your adapter to your server. - # @abstract - def start - raise NotImplementedError - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/base.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/base.rb deleted file mode 100644 index 10e2320ae6..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/base.rb +++ /dev/null @@ -1,209 +0,0 @@ -# frozen_string_literal: true -require 'fileutils' - -module YARD - module Server - module Commands - # This is the base command class used to implement custom commands for - # a server. A command will be routed to by the {Router} class and return - # a Rack-style response. - # - # == Attribute Initializers - # All attributes can be initialized via options passed into the {#initialize} - # method. When creating a custom command, the {Adapter#options} will - # automatically be mapped to attributes by the same name on your class. - # - # class MyCommand < Base - # attr_accessor :myattr - # end - # - # Adapter.new(libs, {:myattr => 'foo'}).start - # - # # when a request comes in, cmd.myattr == 'foo' - # - # == Subclassing Notes - # To implement a custom command, override the {#run} method, not {#call}. - # In your implementation, you should set the body and status for requests. - # See details in the +#run+ method documentation. - # - # Note that if your command deals directly with libraries, you should - # consider subclassing the more specific {LibraryCommand} class instead. - # - # @abstract - # @see #run - class Base - # @group Basic Command and Adapter Options - - # @return [Hash] the options passed to the command's constructor - attr_accessor :command_options - - # @return [Adapter] the server adapter - attr_accessor :adapter - - # @return [Boolean] whether to cache - attr_accessor :caching - - # @group Attributes Set Per Request - - # @return [Rack::Request] request object - attr_accessor :request - - # @return [String] the path after the command base URI - attr_accessor :path - - # @return [Hash{String => String}] response headers - attr_accessor :headers - - # @return [Numeric] status code. Defaults to 200 per request - attr_accessor :status - - # @return [String] the response body. Defaults to empty string. - attr_accessor :body - - # @group Instance Method Summary - - # Creates a new command object, setting attributes named by keys - # in the options hash. After initialization, the options hash - # is saved in {#command_options} for further inspection. - # - # @example Creating a Command - # cmd = DisplayObjectCommand.new(:caching => true, :library => mylib) - # cmd.library # => mylib - # cmd.command_options # => {:caching => true, :library => mylib} - # @param [Hash] opts the options hash, saved to {#command_options} - # after initialization. - def initialize(opts = {}) - opts.each do |key, value| - send("#{key}=", value) if respond_to?("#{key}=") - end - self.command_options = opts - end - - # The main method called by a router with a request object. - # - # @note This command should not be overridden by subclasses. Implement - # the callback method {#run} instead. - # @param [Adapter Dependent] request the request object - # @return [Array(Numeric,Hash,Array)] a Rack-style response - # of status, headers, and body wrapped in an array. - def call(request) - self.request = request - self.path ||= request.path_info[1..-1] - self.headers = {'Content-Type' => 'text/html'} - self.body = '' - self.status = 200 - add_cache_control - begin - run - rescue FinishRequest - nil # noop - rescue NotFoundError => e - self.body = e.message if e.message != e.class.to_s - not_found - end - - # keep this to support commands setting status manually. - not_found if status == 404 - - [status, headers, body.is_a?(Array) ? body : [body]] - end - - # @group Abstract Methods - - # Subclass this method to implement a custom command. This method - # should set the {#status} and {#body}, and optionally modify the - # {#headers}. Note that +#status+ defaults to 200. - # - # @example A custom command - # class ErrorCommand < Base - # def run - # self.body = 'ERROR! The System is down!' - # self.status = 500 - # self.headers['Conten-Type'] = 'text/plain' - # end - # end - # - # @abstract - # @return [void] - def run - raise NotImplementedError - end - - protected - - # @group Helper Methods - - # Renders a specific object if provided, or a regular template rendering - # if object is not provided. - # - # @todo This method is dependent on +#options+, it should be in {LibraryCommand}. - # @param [CodeObjects::Base, nil] object calls {CodeObjects::Base#format} if - # an object is provided, or {Templates::Engine.render} if object is nil. Both - # receive +#options+ as an argument. - # @return [String] the resulting output to display - def render(object = nil) - case object - when CodeObjects::Base - cache object.format(options) - when nil - cache Templates::Engine.render(options) - else - cache object - end - end - - # Override this method to implement custom caching mechanisms for - # - # @example Caching to memory - # $memory_cache = {} - # def cache(data) - # $memory_cache[path] = data - # end - # @param [String] data the data to cache - # @return [String] the same cached data (for chaining) - # @see StaticCaching - def cache(data) - if caching && adapter.document_root - path = File.join(adapter.document_root, request.path_info.sub(/\.html$/, '') + '.html') - path = path.sub(%r{/\.html$}, '.html') - FileUtils.mkdir_p(File.dirname(path)) - log.debug "Caching data to #{path}" - File.open(path, 'wb') {|f| f.write(data) } - end - self.body = data - end - - # Sets the body and headers for a 404 response. Does not modify the - # body if already set. - # - # @return [void] - def not_found - self.status = 404 - return unless body.empty? - self.body = "Not found: #{request.path}" - headers['Content-Type'] = 'text/plain' - headers['X-Cascade'] = 'pass' - headers['Cache-Control'] = 'nocache' - end - - # Sets the headers and status code for a redirection to a given URL - # @param [String] url the URL to redirect to - # @raise [FinishRequest] causes the request to terminate. - def redirect(url) - headers['Location'] = url - self.status = 302 - raise FinishRequest - end - - private - - # Add a conservative cache control policy to reduce load on - # requests served with "?1234567890" style timestamp query strings. - def add_cache_control - return if request.query_string.to_i == 0 - headers['Cache-Control'] ||= 'public, max-age=300' - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/display_file_command.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/display_file_command.rb deleted file mode 100644 index b7828e4983..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/display_file_command.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true -module YARD - module Server - module Commands - # Displays a README or extra file. - # - # @todo Implement better support for detecting binary (image) filetypes - class DisplayFileCommand < LibraryCommand - attr_accessor :index - - def run - filename = File.cleanpath(File.join(library.source_path, path)) - raise NotFoundError unless File.file?(filename) - if filename =~ /\.(jpe?g|gif|png|bmp|svg)$/i - headers['Content-Type'] = StaticFileCommand::DefaultMimeTypes[$1.downcase] || 'text/html' - render File.read_binary(filename) - else - file = CodeObjects::ExtraFileObject.new(filename) - options.update :object => Registry.root, - :type => :layout, - :file => file, - :index => index ? true : false - render - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/display_object_command.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/display_object_command.rb deleted file mode 100644 index 3f2e7e246b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/display_object_command.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true -module YARD - module Server - module Commands - # Displays documentation for a specific object identified by the path - class DisplayObjectCommand < LibraryCommand - include DocServerHelper - - def run - if path.empty? - if options.readme - filename = options.readme.filename - opts = adapter.options.merge( - :index => true, :library => library, - :path => filename.sub(%r{^#{library.source_path.to_s}/}, '') - ) - self.status, self.headers, self.body = - *DisplayFileCommand.new(opts).call(request) - cache(body) - return - else - self.path = 'index' - end - end - return index if path == 'index' - - object = Registry.at(object_path) - if object - options.update(:type => :layout) - render(object) - else - not_found - end - end - - def index - Registry.load_all - - options.update( - :object => '_index.html', - :objects => Registry.all(:module, :class), - :type => :layout - ) - render - end - - def not_found - super - self.body = "Could not find object: #{object_path}" - end - - private - - def object_path - return @object_path if @object_path - if path == "toplevel" - @object_path = :root - else - @object_path = path.sub(':', '#').gsub('/', '::').sub(/^toplevel\b/, '').sub(/\.html$/, '') - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/frames_command.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/frames_command.rb deleted file mode 100644 index a895e25f26..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/frames_command.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true -module YARD - module Server - module Commands - # Displays an object wrapped in frames - class FramesCommand < DisplayObjectCommand - def run - options.update(:frames => true, :type => :fulldoc) - tpl = fulldoc_template - tpl.generate_frameset - cache(tpl.contents) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/library_command.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/library_command.rb deleted file mode 100644 index 34b84d89b3..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/library_command.rb +++ /dev/null @@ -1,187 +0,0 @@ -# frozen_string_literal: true -require 'thread' - -module YARD - module Server - module Commands - class LibraryOptions < CLI::YardocOptions - def adapter; @command.adapter end - def library; @command.library end - def single_library; @command.single_library end - def serializer; @command.serializer end - def serialize; false end - - attr_accessor :command - attr_accessor :frames - - def each(&block) - super(&block) - yield(:adapter, adapter) - yield(:library, library) - yield(:single_library, single_library) - yield(:serializer, serializer) - end - end - - # This is the base command for all commands that deal directly with libraries. - # Some commands do not, but most (like {DisplayObjectCommand}) do. If your - # command deals with libraries directly, subclass this class instead. - # See {Base} for notes on how to subclass a command. - # - # @abstract - class LibraryCommand < Base - begin - Process.fork { exit 0 } - CAN_FORK = true - rescue Exception # rubocop:disable Lint/RescueException - CAN_FORK = false - end - - # @return [LibraryVersion] the object containing library information - attr_accessor :library - - # @return [LibraryOptions] default options for the library - attr_accessor :options - - # @return [Serializers::Base] the serializer used to perform file linking - attr_accessor :serializer - - # @return [Boolean] whether router should route for multiple libraries - attr_accessor :single_library - - # @return [Boolean] whether to reparse data - attr_accessor :incremental - - # @return [Boolean] whether or not this adapter calls +fork+ when serving - # library requests. Defaults to false. - attr_accessor :use_fork - - # Needed to synchronize threads in {#setup_yardopts} - # @private - @@library_chdir_lock = Mutex.new - - def initialize(opts = {}) - super - self.serializer = DocServerSerializer.new - end - - def call(request) - if can_fork? - call_with_fork(request) { super } - else - begin - save_default_template_info - call_without_fork(request) { super } - ensure - restore_template_info - end - end - end - - private - - def call_without_fork(request) - self.request = request - self.options = LibraryOptions.new - options.reset_defaults - options.command = self - setup_library - options.title = "Documentation for #{library.name} " + - (library.version ? '(' + library.version + ')' : '') - yield - rescue LibraryNotPreparedError - not_prepared - end - - def call_with_fork(request, &block) - reader, writer = IO.pipe - - fork do - log.debug "[pid=#{Process.pid}] fork serving: #{request.path}" - reader.close - writer.print(Marshal.dump(call_without_fork(request, &block))) - end - - writer.close - Marshal.load(reader.read) - end - - def can_fork? - CAN_FORK && use_fork - end - - def save_default_template_info - @old_template_paths = Templates::Engine.template_paths.dup - @old_extra_includes = Templates::Template.extra_includes.dup - end - - def restore_template_info - Templates::Engine.template_paths = @old_template_paths - Templates::Template.extra_includes = @old_extra_includes - end - - def setup_library - library.prepare! if request.xhr? && request.query['process'] - load_yardoc - setup_yardopts - true - end - - def setup_yardopts - @@library_chdir_lock.synchronize do - Dir.chdir(library.source_path) do - yardoc = CLI::Yardoc.new - if incremental - yardoc.run('-c', '-n', '--no-stats') - else - yardoc.parse_arguments - end - yardoc.send(:verify_markup_options) - yardoc.options.delete(:serializer) - yardoc.options.delete(:serialize) - options.update(yardoc.options.to_hash) - end - end - end - - def load_yardoc - raise LibraryNotPreparedError unless library.ready? - if Thread.current[:__yard_last_yardoc__] == library.yardoc_file - log.debug "Reusing yardoc file: #{library.yardoc_file}" - return - end - Registry.clear - Templates::ErbCache.clear! - Registry.load_yardoc(library.yardoc_file) - Thread.current[:__yard_last_yardoc__] = library.yardoc_file - end - - def not_prepared - options.update(:template => :doc_server, :type => :processing) - self.caching = false - self.status = 202 - self.body = render - self.headers = {'Content-Type' => 'text/html'} - [status, headers, [body]] - end - - # Hack to load a custom fulldoc template object that does - # not do any rendering/generation. We need this to access the - # generate_*_list methods. - def fulldoc_template - tplopts = [options.template, :fulldoc, options.format] - tplclass = Templates::Engine.template(*tplopts) - obj = Object.new.extend(tplclass) - class << obj; define_method(:init) {} end - obj.class = tplclass - obj.send(:initialize, options) - class << obj - attr_reader :contents - define_method(:asset) {|_, contents| @contents = contents } - end - obj - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/library_index_command.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/library_index_command.rb deleted file mode 100644 index b26eae19b0..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/library_index_command.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true -module YARD - module Server - module Commands - class LibraryIndexOptions < CLI::YardocOptions - attr_accessor :adapter, :libraries - default_attr :template, :doc_server - default_attr :type, :library_list - default_attr :serialize, false - end - - # Returns the index of libraries served by the server. - class LibraryIndexCommand < Base - attr_accessor :options - - def run - return unless path.empty? - - self.options = LibraryIndexOptions.new - options.adapter = adapter - options.libraries = adapter.libraries - options.reset_defaults - render - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/list_command.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/list_command.rb deleted file mode 100644 index cdaacd2565..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/list_command.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true -module YARD - module Server - module Commands - # Returns a list of objects of a specific type - class ListCommand < LibraryCommand - include Templates::Helpers::BaseHelper - - def run - Registry.load_all - options.update(:objects => run_verifier(Registry.all(:class, :module))) - list_type = request.path.split('/').last - meth = "generate_#{list_type}_list" - tpl = fulldoc_template - if tpl.respond_to?(meth) - tpl.send(meth) - cache(tpl.contents) - else - not_found - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/root_request_command.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/root_request_command.rb deleted file mode 100644 index c6164dac05..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/root_request_command.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true -module YARD - module Server - module Commands - # Serves requests from the root of the server - class RootRequestCommand < Base - include StaticFileHelpers - - def run - static_template_file? || favicon? || not_found - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/search_command.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/search_command.rb deleted file mode 100644 index 433514b474..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/search_command.rb +++ /dev/null @@ -1,79 +0,0 @@ -# frozen_string_literal: true -module YARD - module Server - module Commands - # Performs a search over the objects inside of a library and returns - # the results as HTML or plaintext - class SearchCommand < LibraryCommand - include Templates::Helpers::BaseHelper - include Templates::Helpers::ModuleHelper - include DocServerHelper - - attr_accessor :results, :query - - def run - Registry.load_all - self.query = request.query['q'] - redirect(abs_url(adapter.router.docs_prefix, single_library ? library : '')) if query.nil? || query =~ /\A\s*\Z/ - - found = Registry.at(query) - redirect(url_for(found)) if found - - search_for_object - request.xhr? ? serve_xhr : serve_normal - end - - def visible_results - results[0, 10] - end - - private - - def url_for(object) - abs_url(base_path(router.docs_prefix), - serializer.serialized_path(object)) - end - - def serve_xhr - headers['Content-Type'] = 'text/plain' - self.body = visible_results.map {|o| - [(o.type == :method ? o.name(true) : o.name).to_s, - o.path, - o.namespace.root? ? '' : o.namespace.path, - url_for(o)].join(",") - }.join("\n") - end - - def serve_normal - options.update( - :visible_results => visible_results, - :query => query, - :results => results, - :template => :doc_server, - :type => :search - ) - self.body = Templates::Engine.render(options) - end - - def search_for_object - # rubocop:disable Style/MultilineBlockChain - self.results = run_verifier(Registry.all).select do |o| - o.path.downcase.include?(query.downcase) - end.reject do |o| - name = (o.type == :method ? o.name(true) : o.name).to_s.downcase - !name.include?(query.downcase) || - case o.type - when :method - !(query =~ /[#.]/) && query.include?("::") - when :class, :module, :constant, :class_variable - query =~ /[#.]/ - end - end.sort_by do |o| - name = (o.type == :method ? o.name(true) : o.name).to_s - name.length.to_f / query.length.to_f - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/static_file_command.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/static_file_command.rb deleted file mode 100644 index c7f4b7e680..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/static_file_command.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true -module YARD - module Server - module Commands - # Serves static content when no other router matches a request - class StaticFileCommand < LibraryCommand - include StaticFileHelpers - - DefaultMimeTypes['js'] = 'text/javascript' - - # Defines the paths used to search for static assets. To define an - # extra path, use {YARD::Server.register_static_path} rather than - # modifying this constant directly. Also note that files in the - # document root will always take precedence over these paths. - STATIC_PATHS = [] - - def run - static_template_file? || not_found - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/static_file_helpers.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/static_file_helpers.rb deleted file mode 100644 index 285fc81685..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/commands/static_file_helpers.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true -require 'webrick/httputils' - -module YARD - module Server - module Commands - # Include this module to get access to {#static_template_file?} - # and {favicon?} helpers. - module StaticFileHelpers - include WEBrick::HTTPUtils - - # Serves an empty favicon. - # @raise [FinishRequest] finalizes an empty body if the path matches - # /favicon.ico so browsers don't complain. - def favicon? - return unless request.path == '/favicon.ico' - headers['Content-Type'] = 'image/png' - self.status = 200 - self.body = '' - raise FinishRequest - end - - # Attempts to route a path to a static template file. - # - # @raise [FinishRequest] if a file was found and served - # @return [void] - def static_template_file? - # this const was defined in StaticFileCommand originally - default_mime_types = StaticFileCommand::DefaultMimeTypes - - file = find_file(adapter, path) - - if file - ext = "." + (path[/\.(\w+)$/, 1] || "html") - headers['Content-Type'] = mime_type(ext, default_mime_types) - self.body = File.read(file) - raise FinishRequest - end - end - - module_function - - def find_file(adapter, url) - # this const was defined in StaticFileCommand originally - static_paths = StaticFileCommand::STATIC_PATHS - - file = nil - ([adapter.document_root] + static_paths.reverse).compact.each do |path_prefix| - file = File.join(path_prefix, url) - break if File.exist?(file) - file = nil - end - - # Search in default/fulldoc/html template if nothing in static asset paths - assets_template = Templates::Engine.template(:default, :fulldoc, :html) - file || assets_template.find_file(url) - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/doc_server_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/doc_server_helper.rb deleted file mode 100644 index 9256afcaf6..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/doc_server_helper.rb +++ /dev/null @@ -1,91 +0,0 @@ -# frozen_string_literal: true -module YARD - module Server - # A module that is mixed into {Templates::Template} in order to customize - # certain template methods. - module DocServerHelper - # Modifies {Templates::Helpers::HtmlHelper#url_for} to return a URL instead - # of a disk location. - # @param (see Templates::Helpers::HtmlHelper#url_for) - # @return (see Templates::Helpers::HtmlHelper#url_for) - def url_for(obj, anchor = nil, relative = false) # rubocop:disable Lint/UnusedMethodArgument - return '' if obj.nil? - return url_for_index if obj == '_index.html' - return abs_url(base_path(router.static_prefix), obj) if String === obj - url = super(obj, anchor, false) - return unless url - abs_url(base_path(router.docs_prefix), url) - end - - # Modifies {Templates::Helpers::HtmlHelper#url_for_file} to return a URL instead - # of a disk location. - # @param (see Templates::Helpers::HtmlHelper#url_for_file) - # @return (see Templates::Helpers::HtmlHelper#url_for_file) - def url_for_file(filename, anchor = nil) - if filename.is_a?(CodeObjects::ExtraFileObject) - filename = filename.filename - end - fname = filename.sub(%r{^#{@library.source_path.to_s}/}, '') - fname += "##{anchor}" if anchor && !anchor.empty? - abs_url(base_path(router.docs_prefix), 'file', fname) - end - - # Modifies {Templates::Helpers::HtmlHelper#url_for_list} to return a URL - # based on the list prefix instead of a HTML filename. - # @param (see Templates::Helpers::HtmlHelper#url_for_list) - # @return (see Templates::Helpers::HtmlHelper#url_for_list) - def url_for_list(type) - abs_url(base_path(router.list_prefix), type.to_s) - end - - # Returns the frames URL for the page - # @return (see Templates::Helpers::HtmlHelper#url_for_frameset) - def url_for_frameset - options.file ? url_for_file(options.file) : url_for(object) - end - - # Returns the main URL, first checking a readme and then linking to the index - # @return (see Templates::Helpers::HtmlHelper#url_for_main) - def url_for_main - options.readme ? url_for_file(options.readme) : url_for_index - end - - # Returns the URL for the alphabetic index page - # @return (see Templates::Helpers::HtmlHelper#url_for_index) - def url_for_index - abs_url(base_path(router.docs_prefix), 'index') - end - - # @param path_components [Array] components of a URL - # @return [String] the absolute path from any mounted base URI. - def abs_url(*path_components) - File.join(router.request.script_name, *path_components) - end - - # @example The base path for a library 'foo' - # base_path('docs') # => 'docs/foo' - # @param [String] path the path prefix for a base path URI - # @return [String] the base URI for a library with an extra +path+ prefix - def base_path(path) - libname = router.request.version_supplied ? @library.to_s : @library.name - path + (@single_library ? '' : "/#{libname}") - end - - # @return [Router] convenience method for accessing the router - def router; @adapter.router end - - # @return [String] a timestamp for a given file - def mtime(file) - file = YARD::Server::Commands::StaticFileHelpers.find_file(@adapter, file) - file ? File.mtime(file).to_i : nil - end - - # @return [String] a URL for a file with a timestamp - def mtime_url(file) - url = url_for(file) - time = mtime(file) - url + (time ? "?#{time}" : "") - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/doc_server_serializer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/doc_server_serializer.rb deleted file mode 100644 index 131cda8078..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/doc_server_serializer.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true -module YARD - module Server - # A custom {Serializers::Base serializer} which returns resource URLs instead of - # static relative paths to files on disk. - class DocServerSerializer < Serializers::FileSystemSerializer - def initialize(_command = nil) - super(:basepath => '', :extension => '') - end - - def serialized_path(object) - case object - when CodeObjects::RootObject - "toplevel" - when CodeObjects::ExtendedMethodObject - serialized_path(object.namespace) + ':' + urlencode(object.name.to_s) - when CodeObjects::MethodObject - serialized_path(object.namespace) + - (object.scope == :instance ? ":" : ".") + urlencode(object.name.to_s) - when CodeObjects::ConstantObject, CodeObjects::ClassVariableObject - serialized_path(object.namespace) + "##{object.name}-#{object.type}" - when CodeObjects::ExtraFileObject - super(object).gsub(/^file\./, 'file/') - else - super(object) - end - end - - private - - def urlencode(name) - if name.respond_to?(:force_encoding) - name = name.dup.force_encoding('binary') - end - Templates::Helpers::HtmlHelper.urlencode(name) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/library_version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/library_version.rb deleted file mode 100644 index a3ab31b4d9..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/library_version.rb +++ /dev/null @@ -1,277 +0,0 @@ -# frozen_string_literal: true -require 'fileutils' -require 'thread' - -module YARD - module Server - # This exception is raised when {LibraryVersion#prepare!} fails, or discovers - # that the library is not "prepared" to be served by - class LibraryNotPreparedError < RuntimeError; end - - # A library version encapsulates a library's documentation at a specific version. - # Although the version is optional, this allows for creating multiple documentation - # points for a specific library, each representing a unique version. The term - # "library" used in other parts of the YARD::Server documentation refers to - # objects of this class unless otherwise noted. - # - # A library points to a location where a {#yardoc_file} is located so that - # its documentation may be loaded and served. Optionally, a {#source_path} is - # given to point to a location where any extra files (and {YARD::CLI::Yardoc .yardopts}) - # should be loaded from. Both of these methods may not be known immediately, - # since the yardoc file may not be built until later. Resolving the yardoc - # file and source path are dependent on the specific library "source type" used. - # Source types (known as "library source") are discussed in detail below. - # - # == Using with Adapters - # A list of libraries need to be passed into adapters upon creation. In - # most cases, you will never do this manually, but if you use a {RackMiddleware}, - # you will need to pass in this list yourself. To build this list of libraries, - # you should create a hash of library names mapped to an *Array* of LibraryVersion - # objects. For example: - # - # {'mylib' => [LibraryVersion.new('mylib', '1.0', ...), - # LibraryVersion.new('mylib', '2.0', ...)]} - # - # Note that you can also use {Adapter#add_library} for convenience. - # - # The "array" part is required, even for just one library version. - # - # == Library Sources - # The {#source} method represents the library source type, ie. where the - # library "comes from". It might come from "disk", or it might come from a - # "gem" (technically the disk, but a separate type nonetheless). In these - # two cases, the yardoc file sits somewhere on your filesystem, though - # it may also be built dynamically if it does not yet exist. This behaviour - # is controlled through the {#prepare!} method, which prepares the yardoc file - # given a specific library source. We will see how this works in detail in - # the following section. - # - # == Implementing a Custom Library Source - # YARD can be extended to support custom library sources in order to - # build or retrieve a yardoc file at runtime from many different locations. - # - # To implement this behaviour, 3 methods can be added to the +LibraryVersion+ - # class, +#load_yardoc_from_SOURCE+, +#yardoc_file_for_SOURCE+, and - # +#source_path_for_SOURCE+. In all cases, "SOURCE" represents the source - # type used in {#source} when creating the library object. The - # +#yardoc_file_for_SOURCE+ and +#source_path_for_SOURCE+ methods are called upon - # creation and should return the location where the source code for the library - # lives. The load method is called from {#prepare!} if there is no yardoc file - # and should set {#yardoc_file}. Below is a full example for - # implementing a custom library source, +:http+, which reads packaged .yardoc - # databases from zipped archives off of an HTTP server. - # - # Note that only +#load_yardoc_from_SOURCE+ is required. The other two - # methods are optional and can be set manually (via {#source_path=} and - # {#yardoc_file=}) on the object at any time. - # - # @example Implementing a Custom Library Source - # # Adds the source type "http" for .yardoc files zipped on HTTP servers - # class LibraryVersion - # def load_yardoc_from_http - # Thread.new do - # # zip/unzip method implementations are not shown - # download_zip_file("http://mysite.com/yardocs/#{self}.zip") - # unzip_file_to("/path/to/yardocs/#{self}") - # end - # - # # tell the server it's not ready yet (but it might be next time) - # raise LibraryNotPreparedError - # end - # - # def yardoc_file_for_http - # "/path/to/yardocs/#{self}/.yardoc" - # end - # - # def source_path_for_http - # File.dirname(yardoc_file) - # end - # end - # - # # Creating a library of this source type: - # LibraryVersion.new('name', '1.0', nil, :http) - # - class LibraryVersion - # @return [String] the name of the library - attr_accessor :name - - # @return [String] the version of the specific library - attr_accessor :version - - # @return [String] the location of the yardoc file used to load the object - # information from. - # @return [nil] if no yardoc file exists yet. In this case, {#prepare!} will - # be called on this library to build the yardoc file. - # @note To implement a custom yardoc file getter, implement - def yardoc_file - @yardoc_file ||= load_yardoc_file - end - attr_writer :yardoc_file - - # @return [Symbol] the source type representing where the yardoc should be - # loaded from. Defaults are +:disk+ and +:gem+, though custom sources - # may be implemented. This value is used to inform {#prepare!} about how - # to load the necessary data in order to display documentation for an object. - # @see LibraryVersion LibraryVersion documentation for "Implementing a Custom Library Source" - attr_accessor :source - - # @return [String] the location of the source code for a library. This - # value is filled by calling +#source_path_for_SOURCE+ on this class. - # @return [nil] if there is no source code - # @see LibraryVersion LibraryVersion documentation for "Implementing a Custom Library Source" - def source_path - @source_path ||= load_source_path - end - attr_writer :source_path - - # @param [String] name the name of the library - # @param [String] version the specific (usually, but not always, numeric) library - # version - # @param [String] yardoc the location of the yardoc file, or nil if it is - # generated later - # @param [Symbol] source the location of the files used to build the yardoc. - # Builtin source types are +:disk+ or +:gem+. - def initialize(name, version = nil, yardoc = nil, source = :disk) - self.name = name - self.yardoc_file = yardoc - self.version = version - self.source = source - end - - # @param [Boolean] url_format if true, returns the string in a URI-compatible - # format (for appending to a URL). Otherwise, it is given in a more human - # readable format. - # @return [String] the string representation of the library. - def to_s(url_format = true) - version ? "#{name}#{url_format ? '/' : '-'}#{version}" : name.to_s - end - - # @return [Fixnum] used for Hash mapping. - def hash; to_s.hash end - - # @return [Boolean] whether another LibraryVersion is equal to this one - def eql?(other) - other.is_a?(LibraryVersion) && other.name == name && - other.version == version && other.yardoc_file == yardoc_file - end - alias == eql? - alias equal? eql? - - # @return [Boolean] whether the library has been completely processed - # and is ready to be served - def ready? - return false if yardoc_file.nil? - serializer.complete? - end - - # @note You should not directly override this method. Instead, implement - # +load_yardoc_from_SOURCENAME+ when implementing loading for a specific - # source type. See the {LibraryVersion} documentation for "Implementing - # a Custom Library Source" - # - # Prepares a library to be displayed by the server. This callback is - # performed before each request on a library to ensure that it is loaded - # and ready to be viewed. If any steps need to be performed prior to loading, - # they are performed through this method (though they should be implemented - # through the +load_yardoc_from_SOURCE+ method). - # - # @raise [LibraryNotPreparedError] if the library is not ready to be - # displayed. Usually when raising this error, you would simultaneously - # begin preparing the library for subsequent requests, although this - # is not necessary. - def prepare! - return if ready? - meth = "load_yardoc_from_#{source}" - send(meth) if respond_to?(meth, true) - end - - # @return [Gem::Specification] a gemspec object for a given library. Used - # for :gem source types. - # @return [nil] if there is no installed gem for the library - def gemspec - ver = version ? "= #{version}" : ">= 0" - YARD::GemIndex.find_all_by_name(name, ver).last - end - - protected - - @@chdir_mutex = Mutex.new - - # Called when a library of source type "disk" is to be prepared. In this - # case, the {#yardoc_file} should already be set, but the library may not - # be prepared. Run preparation if not done. - # - # @raise [LibraryNotPreparedError] if the yardoc file has not been - # prepared. - def load_yardoc_from_disk - return if ready? - - @@chdir_mutex.synchronize do - Dir.chdir(source_path_for_disk) do - Thread.new do - CLI::Yardoc.run('--no-stats', '-n', '-b', yardoc_file) - end - end - end - - raise LibraryNotPreparedError - end - - # Called when a library of source type "gem" is to be prepared. In this - # case, the {#yardoc_file} needs to point to the correct location for - # the installed gem. The yardoc file is built if it has not been done. - # - # @raise [LibraryNotPreparedError] if the gem does not have an existing - # yardoc file. - def load_yardoc_from_gem - return if ready? - ver = version ? "= #{version}" : ">= 0" - - @@chdir_mutex.synchronize do - Thread.new do - # Build gem docs on demand - log.debug "Building gem docs for #{to_s(false)}" - CLI::Gems.run(name, ver) - log.debug "Done building gem docs for #{to_s(false)}" - end - end - - raise LibraryNotPreparedError - end - - # @return [String] the source path for a disk source - def source_path_for_disk - File.dirname(yardoc_file) if yardoc_file - end - - # @return [String] the source path for a gem source - def source_path_for_gem - gemspec.full_gem_path if gemspec - end - - # @return [String] the yardoc file for a gem source - def yardoc_file_for_gem - require 'rubygems' - ver = version ? "= #{version}" : ">= 0" - Registry.yardoc_file_for_gem(name, ver) - end - - private - - def load_source_path - meth = "source_path_for_#{source}" - send(meth) if respond_to?(meth, true) - end - - def load_yardoc_file - meth = "yardoc_file_for_#{source}" - send(meth) if respond_to?(meth, true) - end - - def serializer - return if yardoc_file.nil? - Serializers::YardocSerializer.new(yardoc_file) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/rack_adapter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/rack_adapter.rb deleted file mode 100644 index 0fadf8ede4..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/rack_adapter.rb +++ /dev/null @@ -1,89 +0,0 @@ -# frozen_string_literal: true -require 'rack' -require 'webrick/httputils' - -module YARD - module Server - # This class wraps the {RackAdapter} into a Rack-compatible middleware. - # See {#initialize} for a list of options to pass via Rack's +#use+ method. - # - # @note You must pass a +:libraries+ option to the RackMiddleware via +#use+. To - # read about how to return a list of libraries, see {LibraryVersion} or look - # at the example below. - # @example Using the RackMiddleware in a Rack application - # libraries = {:mylib => [YARD::Server::LibraryVersion.new('mylib', nil, '/path/to/.yardoc')]} - # use YARD::Server::RackMiddleware, :libraries => libraries - # - class RackMiddleware - # Creates a new Rack-based middleware for serving YARD documentation. - # - # @param app the next Rack middleware in the stack - # @option opts [Hash{String=>Array}] :libraries ({}) - # the map of libraries to serve through the adapter. This option is *required*. - # @option opts [Hash] :options ({}) a list of options to pass to the adapter. - # See {Adapter#options} for a list. - # @option opts [Hash] :server_options ({}) a list of options to pass to the server. - # See {Adapter#server_options} for a list. - def initialize(app, opts = {}) - args = [opts[:libraries] || {}, opts[:options] || {}, opts[:server_options] || {}] - @app = app - @adapter = RackAdapter.new(*args) - end - - def call(env) - status, headers, body = *@adapter.call(env) - if status == 404 - @app.call(env) - else - [status, headers, body] - end - end - end - - # A server adapter to respond to requests using the Rack server infrastructure. - class RackAdapter < Adapter - include WEBrick::HTTPUtils - - # Responds to Rack requests and builds a response with the {Router}. - # @return [Array(Numeric,Hash,Array)] the Rack-style response - def call(env) - request = Rack::Request.new(env) - request.path_info = unescape(request.path_info) # unescape things like %3F - router.call(request) - rescue StandardError => ex - log.backtrace(ex) - [500, {'Content-Type' => 'text/plain'}, - [ex.message + "\n" + ex.backtrace.join("\n")]] - end - - # Starts the +Rack::Server+. This method will pass control to the server and - # block. - # @return [void] - def start - server = Rack::Server.new(server_options) - server.instance_variable_set("@app", self) - print_start_message(server) - server.start - end - - private - - def print_start_message(server) - opts = server.default_options.merge(server.options) - log.puts ">> YARD #{YARD::VERSION} documentation server at http://#{opts[:Host]}:#{opts[:Port]}" - - # Only happens for Mongrel - return unless server.server.to_s == "Rack::Handler::Mongrel" - log.puts ">> #{server.server.class_name} web server (running on Rack)" - log.puts ">> Listening on #{opts[:Host]}:#{opts[:Port]}, CTRL+C to stop" - end - end - end -end - -# @private -class Rack::Request - attr_accessor :version_supplied - alias query params - def xhr?; (env['HTTP_X_REQUESTED_WITH'] || "").casecmp("xmlhttprequest") == 0 end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/router.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/router.rb deleted file mode 100644 index c12753cebe..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/router.rb +++ /dev/null @@ -1,187 +0,0 @@ -# frozen_string_literal: true -module YARD - module Server - # A router class implements the logic used to recognize a request for a specific - # URL and run specific {Commands::Base commands}. - # - # == Subclassing Notes - # To create a custom router, subclass this class and pass it into the adapter - # options through {Adapter#initialize} or by directly modifying {Adapter#router}. - # - # The most general customization is to change the URL prefixes recognized by - # routing, which can be done by overriding {#docs_prefix}, {#list_prefix}, - # {#static_prefix}, and {#search_prefix}. - # - # == Implementing Custom Caching - # By default, the Router class performs static disk-based caching on all - # requests through the +#check_static_cache+. To override this behaviour, - # or create your own caching mechanism, mixin your own custom module with - # this method implemented as per {StaticCaching#check_static_cache}. - # - # @example Creating a subclassed router - # # Adds 'my' to all routing prefixes - # class MyRouter < YARD::Server::Router - # def docs_prefix; 'mydocs' end - # def list_prefix; 'mylist' end - # def static_prefix; 'mystatic' end - # def search_prefix; 'mysearch' end - # end - # - # # Using it: - # WebrickAdapter.new(libraries, :router => MyRouter).start - class Router - include StaticCaching - include Commands - - # @return [Adapter Dependent] the request data coming in with the routing - attr_accessor :request - - # @return [Adapter] the adapter used by the router - attr_accessor :adapter - - # Creates a new router for a specific adapter - # - # @param [Adapter] adapter the adapter to route requests to - def initialize(adapter) - self.adapter = adapter - end - - # Perform routing on a specific request, serving the request as a static - # file through {Commands::RootRequestCommand} if no route is found. - # - # @param [Adapter Dependent] request the request object - # @return [Array(Numeric,Hash,Array)] the Rack-style server response data - def call(request) - self.request = request - result = check_static_cache || route - result ? result : RootRequestCommand.new(adapter.options).call(request) - end - - # @group Route Prefixes - - # @return [String] the URI prefix for all object documentation requests - def docs_prefix; 'docs' end - - # @return [String] the URI prefix for all class/method/file list requests - def list_prefix; 'list' end - - # @return [String] the URI prefix for all search requests - def search_prefix; 'search' end - - # @return [String] the URI prefix for all static assets (templates) - def static_prefix; 'static' end - - # @group Routing Methods - - # @return [Array(LibraryVersion, Array)] the library followed - # by the rest of the path components in the request path. LibraryVersion - # will be nil if no matching library was found. - def parse_library_from_path(paths) - return [adapter.libraries.values.first.first, paths] if adapter.options[:single_library] - library = nil - paths = paths.dup - libs = adapter.libraries[paths.first] - if libs - paths.shift - library = libs.find {|l| l.version == paths.first } - if library - request.version_supplied = true if request - paths.shift - else # use the last lib in the list - request.version_supplied = false if request - library = libs.last - end - end - [library, paths] - end - - protected - - # Performs routing algorithm to find which prefix is called, first - # parsing out library name/version information. - # - # @return [Array(Numeric,Hash,Array)] the Rack-style response - # @return [nil] if no route is matched - def route(path = request.path_info) - path = path.gsub(%r{//+}, '/').gsub(%r{^/|/$}, '') - return route_index if path.empty? || path == docs_prefix - case path - when %r{^(#{docs_prefix}|#{list_prefix}|#{search_prefix}|#{static_prefix})(/.*|$)} - prefix = $1 - paths = $2.gsub(%r{^/|/$}, '').split('/') - library, paths = *parse_library_from_path(paths) - return unless library - return case prefix - when docs_prefix; route_docs(library, paths) - when list_prefix; route_list(library, paths) - when search_prefix; route_search(library, paths) - when static_prefix; route_static(library, paths) - end - end - nil - end - - # Routes requests from {#docs_prefix} and calls the appropriate command - # @param [LibraryVersion] library the library to route for - # @param [Array] paths path components (split by '/') - # @return (see #route) - def route_docs(library, paths) - return route_index if library.nil? - case paths.first - when "frames" - paths.shift - cmd = DisplayObjectCommand - when "file" - paths.shift - cmd = DisplayFileCommand - else - cmd = DisplayObjectCommand - end - cmd = cmd.new(final_options(library, paths)) - cmd.call(request) - end - - # Routes for the index of a library / multiple libraries - # @return (see #route) - def route_index - if adapter.options[:single_library] - route_docs(adapter.libraries.values.first.first, []) - else - LibraryIndexCommand.new(adapter.options.merge(:path => '')).call(request) - end - end - - # Routes requests from {#list_prefix} and calls the appropriate command - # @param (see #route_docs) - # @return (see #route_docs) - def route_list(library, paths) - return if paths.empty? - ListCommand.new(final_options(library, paths)).call(request) - end - - # Routes requests from {#search_prefix} and calls the appropriate command - # @param (see #route_docs) - # @return (see #route_docs) - def route_search(library, paths) - return unless paths.empty? - SearchCommand.new(final_options(library, paths)).call(request) - end - - def route_static(library, paths) - StaticFileCommand.new(final_options(library, paths)).call(request) - end - - # @group Utility Methods - - # Adds extra :library/:path option keys to the adapter options. - # Use this method when passing options to a command. - # - # @param (see #route_docs) - # @return [Hash] finalized options - def final_options(library, paths) - path = File.cleanpath(paths.join('/')).gsub(%r{^(\.\./)+}, '') - adapter.options.merge(:library => library, :path => path) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/static_caching.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/static_caching.rb deleted file mode 100644 index ca43b15aca..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/static_caching.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true -module YARD - module Server - # Implements static caching for requests. - # - # @see Router Router documentation for "Caching" - module StaticCaching - # Called by a router to return the cached object. By default, this - # method performs disk-based caching. To perform other forms of caching, - # implement your own +#check_static_cache+ method and mix the module into - # the Router class. - # - # Note that caching does not occur here. This method simply checks for - # the existence of cached data. To actually cache a response, see - # {Commands::Base#cache}. - # - # @example Implementing In-Memory Cache Checking - # module MemoryCaching - # def check_static_cache - # # $memory_cache is filled by {Commands::Base#cache} - # cached_data = $memory_cache[request.path] - # if cached_data - # [200, {'Content-Type' => 'text/html'}, [cached_data]] - # else - # nil - # end - # end - # end - # - # class YARD::Server::Router; include MemoryCaching; end - # @return [Array(Numeric,Hash,Array)] the Rack-style response - # @return [nil] if no cache is available and routing should continue - # @see Commands::Base#cache - def check_static_cache - return nil unless adapter.document_root - cache_path = File.join(adapter.document_root, request.path.sub(/\.html$/, '') + '.html') - cache_path = cache_path.sub(%r{/\.html$}, '.html') - if File.file?(cache_path) - log.debug "Loading cache from disk: #{cache_path}" - return [200, {'Content-Type' => 'text/html'}, [File.read_binary(cache_path)]] - end - nil - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/fulldoc/html/css/custom.css b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/fulldoc/html/css/custom.css deleted file mode 100644 index 2b4ef60253..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/fulldoc/html/css/custom.css +++ /dev/null @@ -1,127 +0,0 @@ -#search_results h1 { margin-bottom: 0; } -#search_results p { margin-top: 0; margin-bottom: 25px; } -#search_results ul { list-style-position: inside; padding-left: 0; list-style: none; } -#search_results ul li { padding: 7px 15px; font-size: 1.1em; } - -form.search { - z-index: 8000; - position: absolute; - color: #fff; - border: 1px solid #99f; width: 210px; background: #05a; - border-radius: 4px; border-top-left-radius: 0; border-top-right-radius: 0; -} -form.search input { - height: 25px; - padding: 0; - padding-left: 4px; - margin: 4px; - margin-right: 0; - width: 202px; - border: 1px solid #99f; - border-radius: 3px; - font-size: 1.1em; - box-sizing: border-box; - -webkit-appearance: none; -} - -@media (max-width: 920px) { - form.search { - position: absolute; - color: #fff; - width: 100%; - margin-top: 0; - background: #05a; - border-radius: 0; - border: 0; - margin-bottom: 10px; - left: 0; - top: 0; - } - form.search input { - margin-top: 9px; - margin-bottom: 11px; - margin-left: 12px; - padding-left: 6px; - border: 1px solid #eaf0ff; - } - #menu { margin-top: 41px; } - #search a { - border-top-left-radius: 3px; border-top-right-radius: 3px; - background: none; - border: 0; - box-shadow: none; - margin-top: 4px; - padding-bottom: 5px; - color: #eaf0ff; fill: #eaf0ff; - } - #search a.active { - background: #048; border: 0; - } -} - -@media (min-width: 920px) { - form.search { right: 12px; top: 0; } -} - -#menu { padding-top: 5px; } -#content h1 { margin-top: 15px; border-top: 0; } - -#content.error { font-size: 1.2em; } -#content.error p tt { font-size: 1.2em; } -#content.error .note { padding: 12px; } - -.signature .permalink { float: right; font-size: 0.9em; } - -/* autocomplete */ -.ac_results { - padding: 0px; - border: 1px solid black; - width: 500px; - overflow: hidden; - z-index: 99999; -} - -.ac_results ul { - width: 100%; - list-style-position: outside; - list-style: none; - padding: 0; - margin: 0; -} - -.ac_results li { - cursor: pointer; - margin: 0px; - padding: 3px; - display: block; - font-family: sans-serif; - font-size: 12px; - line-height: 16px; - overflow: hidden; - -} - -.ac_loading { - background: white url('/images/processing.gif') right center no-repeat; -} - -.ac_even { - background: #fafafa; border: 1px dotted #fafafa; border-left-width: 0; border-right-width: 0; -} - -.ac_odd { - background: #f0f0f0; border: 1px dotted #f0f0f0; border-left-width: 0; border-right-width: 0; -} - -.ac_over { - background: #ddd; cursor: pointer; border: 1px dotted #fff; border-left-width: 0; border-right-width: 0; -} - -#fade { display: none; position: absolute; top: 0px; left: 0; background: #eee; z-index: -1; width: 100%; height: 100%; border-top: 1px solid #e0e0e0; } -#processing { - position: absolute; width: 400px; height: 200px; margin: auto; background: #fff; padding: 10px 30px; z-index: 20; - -webkit-box-shadow: 0px 0px 20px #444; -moz-box-shadow: 0px 0px 20px #444; - -webkit-border-radius: 4px; - display: none; -} -#processing img { display: block; position: absolute; bottom: 30px; left: 44%; } diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/fulldoc/html/images/processing.gif b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/fulldoc/html/images/processing.gif deleted file mode 100644 index 787eede8c633ba0e1651fd295d88e9c9b27ed130..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1251 zcmZ?wbhEHblxL7<_$tKkqurY32|ROq61kX-j1e zsT7)BmR-r_6qYKWQ0A;4P{2O9a^W^-!AiFR-u;2R1?~j_$DH{JJPOvFU0vW=FzJdA ze}UJnv#dAn-$`X3Mib^+?02%tW)j zQiu93s>cT_J;^Fzy(-`udCI11i*93cm84)s*QfSHT8@zt3bUHnmwH+>+}KgrS#;3L zESY8RnvM&8qWl*6{0Dxev2+R*GrzmZ$pi``RxSnw1|0!l81Vxk1FK(xBaf59+>EX@ zuM?MOo#x}zIr(YPfgNW)?49~#vxBWrUz?B9!V0Tx94rTOg7g@o&t~P`P?6=EzUikI zS8~_m)hBya#-I6-w5><`*?|fnm=%f)I${j044e$2z-Wj%Fu~wR08cx|5v4*OHFlwe zmoqsU6@rgAN}N<;QuI{T7O>jHoT%h2V7IAtag4-*8*hadKFwRtVOS#~t|%qh$f3yE zD8eTz(LZ|a0t^BWAF+i4V_l<0q3<};#2F59oTnEa z?v!w8DiN0~|-b71g;fD0b0RT2)SX#DtII8or){|X@B4X*!GI z8;`dkZIO&8l^q5nnv=kM ze8+}{71!mRn)c2U;QPkG=fu>&E2PNSz#-_w-XNf$$kyc~RA1)K$z58+#p4bOG_Y;Z zB*zv8%9bSxdQ&+IIWlrI0$v1N+Uc_XbnEjj)w&(AolT02?ya4yOo4rA2Gbe}HpET0 sWaYgWus(P>do726LNH?!hhVS}Qxk8uP)RM{1ePYw39L>06C4?=0ZOQ%3jhEB diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/fulldoc/html/js/autocomplete.js b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/fulldoc/html/js/autocomplete.js deleted file mode 100644 index 2d86fdd4b1..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/fulldoc/html/js/autocomplete.js +++ /dev/null @@ -1,12 +0,0 @@ -/* - * jQuery Autocomplete plugin 1.1 - * - * Copyright (c) 2009 Jörn Zaefferer - * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $ - */ -eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';(3($){$.2e.1u({19:3(b,d){5 c=W b=="1B";d=$.1u({},$.M.1T,{Y:c?b:P,y:c?P:b,1J:c?$.M.1T.1J:10,X:d&&!d.1D?10:48},d);d.1y=d.1y||3(a){6 a};d.1v=d.1v||d.1R;6 A.I(3(){1M $.M(A,d)})},L:3(a){6 A.11("L",a)},1k:3(a){6 A.14("1k",[a])},2b:3(){6 A.14("2b")},28:3(a){6 A.14("28",[a])},24:3(){6 A.14("24")}});$.M=3(o,r){5 t={2Y:38,2S:40,2N:46,2I:9,2E:13,2B:27,2x:3I,2v:33,2p:34,2n:8};5 u=$(o).3r("19","3o").Q(r.2Q);5 p;5 m="";5 n=$.M.3c(r);5 s=0;5 k;5 h={1F:C};5 l=$.M.32(r,o,1Z,h);5 j;$.1Y.2X&&$(o.2U).11("45.19",3(){4(j){j=C;6 C}});u.11(($.1Y.2X?"43":"42")+".19",3(a){s=1;k=a.2M;3V(a.2M){O t.2Y:a.1d();4(l.N()){l.30()}w{12(0,D)}R;O t.2S:a.1d();4(l.N()){l.2D()}w{12(0,D)}R;O t.2v:a.1d();4(l.N()){l.2C()}w{12(0,D)}R;O t.2p:a.1d();4(l.N()){l.2A()}w{12(0,D)}R;O r.17&&$.1c(r.S)==","&&t.2x:O t.2I:O t.2E:4(1Z()){a.1d();j=D;6 C}R;O t.2B:l.Z();R;3J:1P(p);p=1O(12,r.1J);R}}).2t(3(){s++}).3E(3(){s=0;4(!h.1F){2r()}}).2q(3(){4(s++>1&&!l.N()){12(0,D)}}).11("1k",3(){5 c=(1r.7>1)?1r[1]:P;3 1N(q,a){5 b;4(a&&a.7){16(5 i=0;i1){5 f=r.S.7;5 c=$(o).18().1I;5 d,1H=0;$.I(b,3(i,a){1H+=a.7;4(c<=1H){d=i;6 C}1H+=f});b[d]=v;v=b.3f(r.S)}v+=r.S}u.K(v);1l();u.14("L",[e.y,e.F]);6 D}3 12(b,c){4(k==t.2N){l.Z();6}5 a=u.K();4(!c&&a==m)6;m=a;a=1m(a);4(a.7>=r.29){u.Q(r.26);4(!r.1s)a=a.J();21(a,3a,1l)}w{1q();l.Z()}};3 15(b){4(!b)6[""];4(!r.17)6[$.1c(b)];6 $.4h(b.23(r.S),3(a){6 $.1c(b).7?$.1c(a):P})}3 1m(a){4(!r.17)6 a;5 c=15(a);4(c.7==1)6 c[0];5 b=$(o).18().1I;4(b==a.7){c=15(a)}w{c=15(a.22(a.37(b),""))}6 c[c.7-1]}3 1G(q,a){4(r.1G&&(1m(u.K()).J()==q.J())&&k!=t.2n){u.K(u.K()+a.37(1m(m).7));$(o).18(m.7,m.7+a.7)}};3 2r(){1P(p);p=1O(1l,4g)};3 1l(){5 c=l.N();l.Z();1P(p);1q();4(r.36){u.1k(3(a){4(!a){4(r.17){5 b=15(u.K()).1n(0,-1);u.K(b.3f(r.S)+(b.7?r.S:""))}w{u.K("");u.14("L",P)}}})}};3 3a(q,a){4(a&&a.7&&s){1q();l.35(a,q);1G(q,a[0].F);l.20()}w{1l()}};3 21(f,d,g){4(!r.1s)f=f.J();5 e=n.31(f);4(e&&e.7){d(f,e)}w 4((W r.Y=="1B")&&(r.Y.7>0)){5 c={4f:+1M 4e()};$.I(r.2Z,3(a,b){c[a]=W b=="3"?b():b});$.4d({4c:"4b",4a:"19"+o.49,2V:r.2V,Y:r.Y,y:$.1u({q:1m(f),47:r.X},c),44:3(a){5 b=r.1A&&r.1A(a)||1A(a);n.1i(f,b);d(f,b)}})}w{l.2T();g(f)}};3 1A(c){5 d=[];5 b=c.23("\\n");16(5 i=0;i]*)("+a.22(/([\\^\\$\\(\\)\\[\\]\\{\\}\\*\\.\\+\\?\\|\\\\])/2K,"\\\\$1")+")(?![^<>]*>)(?![^&;]+;)","2K"),"<2J>$1")},1D:D,1E:3S};$.M.3c=3(g){5 h={};5 j=0;3 1f(s,a){4(!g.1s)s=s.J();5 i=s.2H(a);4(g.1w=="3R"){i=s.J().1k("\\\\b"+a.J())}4(i==-1)6 C;6 i==0||g.1w};3 1i(q,a){4(j>g.1g){1o()}4(!h[q]){j++}h[q]=a}3 1e(){4(!g.y)6 C;5 f={},2G=0;4(!g.Y)g.1g=1;f[""]=[];16(5 i=0,2F=g.y.7;i<2F;i++){5 c=g.y[i];c=(W c=="1B")?[c]:c;5 d=g.1v(c,i+1,g.y.7);4(d===C)1V;5 e=d.3Q(0).J();4(!f[e])f[e]=[];5 b={F:d,y:c,L:g.1z&&g.1z(c)||d};f[e].1U(b);4(2G++0){5 c=h[k];$.I(c,3(i,x){4(1f(x.F,q)){a.1U(x)}})}}6 a}w 4(h[q]){6 h[q]}w 4(g.1f){16(5 i=q.7-1;i>=g.29;i--){5 c=h[q.3O(0,i)];4(c){5 a=[];$.I(c,3(i,x){4(1f(x.F,q)){a[a.7]=x}});6 a}}}6 P}}};$.M.32=3(e,g,f,k){5 h={H:"3N"};5 j,z=-1,y,1t="",1S=D,G,B;3 2y(){4(!1S)6;G=$("<3M/>").Z().Q(e.2P).T("3L","3K").1Q(1K.2w);B=$("<3H/>").1Q(G).3G(3(a){4(U(a).2u&&U(a).2u.3F()==\'2s\'){z=$("1L",B).1h(h.H).3D(U(a));$(U(a)).Q(h.H)}}).2q(3(a){$(U(a)).Q(h.H);f();g.2t();6 C}).3C(3(){k.1F=D}).3B(3(){k.1F=C});4(e.E>0)G.T("E",e.E);1S=C}3 U(a){5 b=a.U;3A(b&&b.3z!="2s")b=b.3y;4(!b)6[];6 b}3 V(b){j.1n(z,z+1).1h(h.H);2o(b);5 a=j.1n(z,z+1).Q(h.H);4(e.1D){5 c=0;j.1n(0,z).I(3(){c+=A.1a});4((c+a[0].1a-B.1b())>B[0].3x){B.1b(c+a[0].1a-B.3w())}w 4(c=j.1j()){z=0}}3 2m(a){6 e.X&&e.X").3v(e.1y(a,1t)).Q(i%2==0?"3u":"3P").1Q(B)[0];$.y(c,"2k",y[i])}j=B.3t("1L");4(e.1X){j.1n(0,1).Q(h.H);z=0}4($.2e.2W)B.2W()}6{35:3(d,q){2y();y=d;1t=q;2l()},2D:3(){V(1)},30:3(){V(-1)},2C:3(){4(z!=0&&z-8<0){V(-z)}w{V(-8)}},2A:3(){4(z!=j.1j()-1&&z+8>j.1j()){V(j.1j()-1-z)}w{V(8)}},Z:3(){G&&G.Z();j&&j.1h(h.H);z=-1},N:3(){6 G&&G.3s(":N")},3q:3(){6 A.N()&&(j.2j("."+h.H)[0]||e.1X&&j[0])},20:3(){5 a=$(g).3p();G.T({E:W e.E=="1B"||e.E>0?e.E:$(g).E(),2i:a.2i+g.1a,1W:a.1W}).20();4(e.1D){B.1b(0);B.T({2L:e.1E,3n:\'3X\'});4($.1Y.3m&&W 1K.2w.3l.2L==="1x"){5 c=0;j.I(3(){c+=A.1a});5 b=c>e.1E;B.T(\'3k\',b?e.1E:c);4(!b){j.E(B.E()-2R(j.T("2O-1W"))-2R(j.T("2O-3j")))}}}},2g:3(){5 a=j&&j.2j("."+h.H).1h(h.H);6 a&&a.7&&$.y(a[0],"2k")},2T:3(){B&&B.2z()},1p:3(){G&&G.3i()}}};$.2e.18=3(b,f){4(b!==1x){6 A.I(3(){4(A.2d){5 a=A.2d();4(f===1x||b==f){a.4n("2c",b);a.3h()}w{a.4m(D);a.4l("2c",b);a.4k("2c",f);a.3h()}}w 4(A.3g){A.3g(b,f)}w 4(A.1C){A.1C=b;A.3e=f}})}5 c=A[0];4(c.2d){5 e=1K.18.4j(),3d=c.F,2a="<->",2f=e.3b.7;e.3b=2a;5 d=c.F.2H(2a);c.F=3d;A.18(d,d+2f);6{1I:d,39:d+2f}}w 4(c.1C!==1x){6{1I:c.1C,39:c.3e}}}})(4i);',62,272,'|||function|if|var|return|length|||||||||||||||||||||||||else||data|active|this|list|false|true|width|value|element|ACTIVE|each|toLowerCase|val|result|Autocompleter|visible|case|null|addClass|break|multipleSeparator|css|target|moveSelect|typeof|max|url|hide||bind|onChange||trigger|trimWords|for|multiple|selection|autocomplete|offsetHeight|scrollTop|trim|preventDefault|populate|matchSubset|cacheLength|removeClass|add|size|search|hideResultsNow|lastWord|slice|flush|unbind|stopLoading|arguments|matchCase|term|extend|formatMatch|matchContains|undefined|highlight|formatResult|parse|string|selectionStart|scroll|scrollHeight|mouseDownOnSelect|autoFill|progress|start|delay|document|li|new|findValueCallback|setTimeout|clearTimeout|appendTo|formatItem|needsInit|defaults|push|continue|left|selectFirst|browser|selectCurrent|show|request|replace|split|unautocomplete||loadingClass||setOptions|minChars|teststring|flushCache|character|createTextRange|fn|textLength|selected|in|top|filter|ac_data|fillList|limitNumberOfItems|BACKSPACE|movePosition|PAGEDOWN|click|hideResults|LI|focus|nodeName|PAGEUP|body|COMMA|init|empty|pageDown|ESC|pageUp|next|RETURN|ol|nullData|indexOf|TAB|strong|gi|maxHeight|keyCode|DEL|padding|resultsClass|inputClass|parseInt|DOWN|emptyList|form|dataType|bgiframe|opera|UP|extraParams|prev|load|Select|||display|mustMatch|substring||end|receiveData|text|Cache|orig|selectionEnd|join|setSelectionRange|select|remove|right|height|style|msie|overflow|off|offset|current|attr|is|find|ac_even|html|innerHeight|clientHeight|parentNode|tagName|while|mouseup|mousedown|index|blur|toUpperCase|mouseover|ul|188|default|absolute|position|div|ac_over|substr|ac_odd|charAt|word|180|RegExp|100|switch|400|auto|ac_loading|ac_results||ac_input|keydown|keypress|success|submit||limit|150|name|port|abort|mode|ajax|Date|timestamp|200|map|jQuery|createRange|moveEnd|moveStart|collapse|move'.split('|'),0,{})) \ No newline at end of file diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/layout/html/breadcrumb.erb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/layout/html/breadcrumb.erb deleted file mode 100644 index 02d6d1a7fb..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/layout/html/breadcrumb.erb +++ /dev/null @@ -1,37 +0,0 @@ - - - - diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/layout/html/script_setup.erb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/layout/html/script_setup.erb deleted file mode 100644 index a2870824c7..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/layout/html/script_setup.erb +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/layout/html/setup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/layout/html/setup.rb deleted file mode 100644 index e81992a9f5..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/layout/html/setup.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true -def javascripts - super + %w(js/autocomplete.js) -end - -def stylesheets - super + %w(css/custom.css) -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/method_details/html/permalink.erb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/method_details/html/permalink.erb deleted file mode 100644 index a994c24607..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/method_details/html/permalink.erb +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/method_details/html/setup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/method_details/html/setup.rb deleted file mode 100644 index 42520913b5..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/default/method_details/html/setup.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true -def init - super - sections.place(:permalink).after_any(:method_signature) -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/headers.erb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/headers.erb deleted file mode 100644 index 42884907bb..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/headers.erb +++ /dev/null @@ -1,8 +0,0 @@ - -YARD Documentation Server <%= YARD::VERSION %> - Library Listing - - - diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/library_list.erb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/library_list.erb deleted file mode 100644 index c45ed6c3b9..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/library_list.erb +++ /dev/null @@ -1,14 +0,0 @@ - - - - <%= erb(:headers) %> - - -
-
- <%= yieldall %> -
-
- - diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/listing.erb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/listing.erb deleted file mode 100644 index c1ada1d424..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/listing.erb +++ /dev/null @@ -1,13 +0,0 @@ -
    - <% @libraries.sort_by {|name, y| name.downcase }.each do |name, library_versions| %> -
  • - <% library_versions = library_versions.dup %> - <% first_lib = library_versions.pop %> - <%= name %> - <% if first_lib.version %> - (<%= first_lib.version %><% if library_versions.size > 0 %>, - <%= library_versions.reverse.map {|lib| "#{lib.version}" }.join(', ') %><% end %>) - <% end %> -
  • - <% end %> -
diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/setup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/setup.rb deleted file mode 100644 index a13cdeac6d..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/setup.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true -include T('default/layout/html') - -def init - sections :library_list, [:title, :listing, :footer] -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/title.erb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/title.erb deleted file mode 100644 index d58b51c600..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/library_list/html/title.erb +++ /dev/null @@ -1,2 +0,0 @@ -

YARD Documentation Server <%= YARD::VERSION %>

-

Library Listing

diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/processing/html/processing.erb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/processing/html/processing.erb deleted file mode 100644 index 4175bbe5a5..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/processing/html/processing.erb +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - Processing <%= @library.to_s(false) %> - - - -
-
-

Processing <%= @library.name %>

-

- <%= @library.name %> <% if @library.version %>(<%= @library.version %>)<% end %> is being processed. - You'll be redirected when the pages are built, it shouldn't take much longer. -

- -
- - diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/processing/html/setup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/processing/html/setup.rb deleted file mode 100644 index 3d200ef006..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/processing/html/setup.rb +++ /dev/null @@ -1,4 +0,0 @@ -# frozen_string_literal: true -def init - sections :processing -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/search/html/search.erb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/search/html/search.erb deleted file mode 100644 index 1ada2abd74..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/search/html/search.erb +++ /dev/null @@ -1,18 +0,0 @@ -
-

Search Results (for '<%= h @query %>')

-

Showing <%= @visible_results.size %> of <%= @results.size %> results

-
    - <% n = 1 %> - <% @visible_results.each do |result| %> - <% name = result.type == :method ? result.name(true).to_s : result.name.to_s %> - <% path = name.gsub(/(#{Regexp.quote @query})/i, '\1') %> -
  • - <%= path %> - <% if !result.namespace.root? %> - (<%= result.namespace.path %>) - <% end %> -
  • - <% n = n == 2 ? 1 : 2 %> - <% end %> -
-
diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/search/html/setup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/search/html/setup.rb deleted file mode 100644 index d4483a5dab..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/templates/doc_server/search/html/setup.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true -def init - sections :search, [T('../default/layout')] -end - -def search - options.breadcrumb_title = h("Search for '#{@query}'") - yieldall :contents => erb(:search) -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/webrick_adapter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/webrick_adapter.rb deleted file mode 100644 index 568e22fd86..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/server/webrick_adapter.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true -require 'webrick' - -module YARD - module Server - # The main adapter to initialize a WEBrick server. - class WebrickAdapter < Adapter - # Initializes a WEBrick server. If {Adapter#server_options} contains a - # +:daemonize+ key set to true, the server will be daemonized. - def start - server_options[:ServerType] = WEBrick::Daemon if server_options[:daemonize] - server = WEBrick::HTTPServer.new(server_options) - server.mount('/', WebrickServlet, self) - trap("INT") { server.shutdown } - server.start - end - end - - # The main WEBrick servlet implementation, accepting only GET requests. - class WebrickServlet < WEBrick::HTTPServlet::AbstractServlet - attr_accessor :adapter - - def initialize(server, adapter) - super - self.adapter = adapter - end - - # @private - def do_GET(request, response) # rubocop:disable Style/MethodName - status, headers, body = *adapter.router.call(request) - response.status = status - response.body = body.is_a?(Array) ? body[0] : body - headers.each do |key, value| - response[key] = value - end - end - end - end -end - -# @private -class WEBrick::HTTPRequest - attr_accessor :version_supplied - def xhr?; (self['X-Requested-With'] || "").casecmp('xmlhttprequest') == 0 end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/default_factory.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/default_factory.rb deleted file mode 100644 index 78bfce41e1..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/default_factory.rb +++ /dev/null @@ -1,191 +0,0 @@ -# frozen_string_literal: true -module YARD - module Tags - class DefaultFactory - TYPELIST_OPENING_CHARS = '[({<' - TYPELIST_CLOSING_CHARS = '>})]' - - # Parses tag text and creates a new tag with descriptive text - # - # @param tag_name the name of the tag to parse - # @param [String] text the raw tag text - # @return [Tag] a tag object with the tag_name and text values filled - def parse_tag(tag_name, text) - Tag.new(tag_name, text.strip) - end - - # Parses tag text and creates a new tag with a key name and descriptive text - # - # @param tag_name the name of the tag to parse - # @param [String] text the raw tag text - # @return [Tag] a tag object with the tag_name, name and text values filled - def parse_tag_with_name(tag_name, text) - name, text = *extract_name_from_text(text) - Tag.new(tag_name, text, nil, name) - end - - # Parses tag text and creates a new tag with formally declared types and - # descriptive text - # - # @param tag_name the name of the tag to parse - # @param [String] text the raw tag text - # @return [Tag] a tag object with the tag_name, types and text values filled - def parse_tag_with_types(tag_name, text) - name, types, text = *extract_types_and_name_from_text(text) - raise TagFormatError, "cannot specify a name before type list for '@#{tag_name}'" if name - Tag.new(tag_name, text, types) - end - - # Parses tag text and creates a new tag with formally declared types, a key - # name and descriptive text - # - # @param tag_name the name of the tag to parse - # @param [String] text the raw tag text - # @return [Tag] a tag object with the tag_name, name, types and text values filled - def parse_tag_with_types_and_name(tag_name, text) - name, types, text = *extract_types_and_name_from_text(text) - name, text = *extract_name_from_text(text) unless name - Tag.new(tag_name, text, types, name) - end - - # Parses tag text and creates a new tag with formally declared types, a title - # on the first line and descriptive text - # - # @param tag_name the name of the tag to parse - # @param [String] text the raw tag text - # @return [Tag] a tag object with the tag_name, name, types and text values filled - def parse_tag_with_types_and_title(tag_name, text) - name, types, text = *extract_types_and_name_from_text_unstripped(text) - if name - title = name - desc = text - else - title, desc = *extract_title_and_desc_from_text(text) - end - Tag.new(tag_name, desc, types, title) - rescue TagFormatError - Tag.new(tag_name, '', types, nil) - end - - def parse_tag_with_title_and_text(tag_name, text) - title, desc = *extract_title_and_desc_from_text(text) - Tag.new(tag_name, desc, nil, title) - end - - def parse_tag_with_types_name_and_default(tag_name, text) - # Can't allow () in a default tag, otherwise the grammar is too ambiguous when types is omitted. - open = TYPELIST_OPENING_CHARS.delete('(') - close = TYPELIST_CLOSING_CHARS.delete(')') - name, types, text = *extract_types_and_name_from_text(text, open, close) - name, text = *extract_name_from_text(text) unless name - if text && text.start_with?('(') - _, default, text = *extract_types_and_name_from_text(text, '(', ')') - DefaultTag.new(tag_name, text, types, name, default) - else - DefaultTag.new(tag_name, text, types, name, nil) - end - end - - def parse_tag_with_options(tag_name, text) - name, text = *extract_name_from_text(text) - OptionTag.new(tag_name, name, parse_tag_with_types_name_and_default(tag_name, text)) - end - - private - - # Extracts the name from raw tag text returning the name and remaining value - # - # @param [String] text the raw tag text - # @return [Array] an array holding the name as the first element and the - # value as the second element - def extract_name_from_text(text) - text.strip.split(/\s+/, 2) - end - - def extract_title_and_desc_from_text(text) - raise TagFormatError if text.nil? || text.empty? - title = nil - desc = nil - if text =~ /\A[ \t]\n/ - desc = text - else - text = text.split(/\r?\n/) - title = text.shift.squeeze(' ').strip - desc = text.join("\n") - end - [title, desc] - end - - # Parses a [], <>, {} or () block at the beginning of a line of text - # into a list of comma delimited values. - # - # @example - # obj.parse_types('[String, Array, nil]') # => [nil, ['String', 'Array', 'nil'], ""] - # obj.parse_types('b A string') # => ['b', ['String'], 'A string'] - # - # @return [Array(String, Array, String)] the text before the type - # list (or nil), followed by the type list parsed into an array of - # strings, followed by the text following the type list. - def extract_types_and_name_from_text(text, opening_types = TYPELIST_OPENING_CHARS, closing_types = TYPELIST_CLOSING_CHARS) - before, list, text = *extract_types_and_name_from_text_unstripped(text, opening_types, closing_types) - if list.nil? - [nil, nil, text.strip] - else - [before ? before.strip : nil, list.map(&:strip), text.strip] - end - end - - def extract_types_and_name_from_text_unstripped(text, opening_types = TYPELIST_OPENING_CHARS, closing_types = TYPELIST_CLOSING_CHARS) - e = 0 - before = String.new("") - list = [String.new("")] - level = 0 - seen_space = false - i = 0 - last_seen = '' - while i < text.length - c = text[i, 1] - - if (c == '"' || c == "'") && text[i..-1] =~ /#{c}.+?#{c}/ - list.last << $& - i += $&.length - next - end - - if level > 0 && c == '#' && text[i + 1..-1] =~ CodeObjects::METHODNAMEMATCH - list.last << c + $& - i += $&.length + 1 - next - elsif opening_types.include?(c) - list.last << c if level > 0 - level += 1 - elsif closing_types.include?(c) - level -= 1 unless last_seen == '=' && c == '>' - break e = i if level == 0 - list.last << c - elsif c == ',' && level == 1 - list.push String.new("") - elsif c =~ /\S/ && level == 0 - break e = i if seen_space && list == [''] - before << c - elsif c =~ /[ \t]/ && level == 0 && !before.empty? - seen_space = true - elsif level >= 1 - list.last << c - elsif level == 0 && c == "\n" - break e = i - end - last_seen = c - i += 1 - end - - before = before.empty? ? nil : before - if list.size == 1 && list.first == '' - [nil, nil, text] - else - [before, list, text[(e + 1)..-1]] - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/default_tag.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/default_tag.rb deleted file mode 100644 index c04f59df00..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/default_tag.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true -module YARD - module Tags - class DefaultTag < Tag - attr_reader :defaults - - def initialize(tag_name, text, types = nil, name = nil, defaults = nil) - super(tag_name, text, types, name) - @defaults = defaults - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/directives.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/directives.rb deleted file mode 100644 index a76ea40060..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/directives.rb +++ /dev/null @@ -1,616 +0,0 @@ -# frozen_string_literal: true -require 'ostruct' - -module YARD - module Tags - # The base directive class. Subclass this class to create a custom - # directive, registering it with {Library.define_directive}. Directive - # classes are executed via the {#call} method, which perform all directive - # processing on the object. - # - # If processing occurs within a handler, the {#handler} attribute is - # available to access more information about parsing context and state. - # Handlers are only available when parsing from {Parser::SourceParser}, - # not when parsing directly from {DocstringParser}. If the docstring is - # attached to an object declaration, {#object} will be set and available - # to modify the generated code object directly. Note that both of these - # attributes may be nil, and directives should test their existence - # before attempting to use them. - # - # @abstract Subclasses should implement {#call}. - # @see Library.define_directive - # @since 0.8.0 - class Directive - # @return [Tag] the meta-data tag containing data input to the directive - attr_accessor :tag - - # Set this field to replace the directive definition inside of a docstring - # with arbitrary text. For instance, the {MacroDirective} uses this field - # to expand its macro data in place of the call to a +@!macro+. - # - # @return [String] the text to expand in the original docstring in place - # of this directive definition. - # @return [nil] if no expansion should take place for this directive - attr_accessor :expanded_text - - # @return [DocstringParser] the parser that is parsing all tag - # information out of the docstring - attr_accessor :parser - - # @!attribute [r] object - # @return [CodeObjects::Base, nil] the object the parent docstring is - # attached to. May be nil. - def object; parser.object end - - # @!attribute [r] handler - # @return [Handlers::Base, nil] the handler object the docstring parser - # might be attached to. May be nil. Only available when parsing - # through {Parser::SourceParser}. - def handler; parser.handler end - - # @!endgroup - - # @param [Tag] tag the meta-data tag containing all input to the docstring - # @param [DocstringParser] parser the docstring parser object - def initialize(tag, parser) - self.tag = tag - self.parser = parser - self.expanded_text = nil - end - - # @!group Parser callbacks - - # Called when processing the directive. Subclasses should implement - # this method to perform all functionality of the directive. - # - # @abstract implement this method to perform all data processing for - # the directive. - # @return [void] - def call; raise NotImplementedError end - - # Called after parsing all directives and tags in the docstring. Used - # to perform any cleanup after all directives perform their main task. - # @return [void] - def after_parse; end - - protected :parser - end - - # Ends a group listing definition. Group definition automatically end - # when class or module blocks are closed, and defining a new group overrides - # the last group definition, but occasionally you need to end the current - # group to return to the default listing. Use {tag:!group} to begin a - # group listing. - # - # @example - # class Controller - # # @!group Callbacks - # - # def before_filter; end - # def after_filter; end - # - # # @!endgroup - # - # def index; end - # end - # @see tag:!group - # @since 0.6.0 - class EndGroupDirective < Directive - def call - return unless handler - handler.extra_state.group = nil - end - end - - # Defines a group listing. All methods (and attributes) seen after this - # directive are placed into a group with the given description as the - # group name. The group listing is used by templates to organize methods - # and attributes into respective logical groups. To end a group listing - # use {tag:!endgroup}. - # - # @note A group definition only applies to the scope it is defined in. - # If a new class or module is opened after the directive, this directive - # will not apply to methods in that class or module. - # @example - # # @!group Callbacks - # - # def before_filter; end - # def after_filter; end - # @see tag:!endgroup - # @since 0.6.0 - class GroupDirective < Directive - def call - return unless handler - handler.extra_state.group = tag.text - end - end - - # Defines a block of text to be expanded whenever the macro is called by name - # in subsequent docstrings. The macro data can be any arbitrary text data, be - # it regular documentation, meta-data tags or directives. - # - # == Defining a Macro - # - # A macro must first be defined in order to be used. Note that a macro is also - # expanded upon definition if it defined on an object (the docstring of a - # method, class, module or constant object as opposed to a free standing - # comment). To define a macro, use the "new" or "attach" identifier in the - # types specifier list. A macro will also automatically be created if an - # indented macro data block is given, so the keywords are not strictly needed. - # - # === Anonymous Macros - # - # In addition to standard named macros, macros can be defined anonymously if - # no name is given. In this case, they can not be re-used in future docstrings, - # but they will expand in the first definition. This is useful when needing - # to take advantage of the macro expansion variables (described below). - # - # == Using a Macro - # - # To re-use a macro in another docstring after it is defined, simply use - # @!macro the_name with no indented block of macro data. The resulting - # data will be expanded in place. - # - # == Attaching a Macro to a DSL Method - # - # Macros can be defined to auto-expand on DSL-style class method calls. To - # define a macro to be auto expanded in this way, use the "attach" keyword - # in the type specifier list ("new" is implied). - # - # Attached macros can also be attached directly on the class method declaration - # that provides the DSL method to its subclasses. The syntax in either case - # is the same. - # - # == Macro Expansion Variables - # - # In the case of using macros on DSL-style method calls, a number of expansion - # variables can be used for interpolation inside of the macro data. The variables, - # similar in syntax to Ruby's global variables, are as follows: - # - # * $0 - the method name being called - # * $1, $2, $3, ... - the Nth argument in the method call - # * $& - the full source line - # - # The following example shows what the expansion variables might hold for a given - # DSL method call: - # - # property :foo, :a, :b, :c, String - # # $0 => "property" - # # $1 => "foo" - # # $2 => "a" - # # $& => "property :foo, :a, :b, :c, String" - # - # === Ranges - # - # Ranges are also acceptable with the syntax ${N-M}. Negative values - # on either N or M are valid, and refer to indexes from the end of the list. - # Consider a DSL method that creates a method using the first argument with - # argument names following, ending with the return type of the method. This - # could be documented as: - # - # # @!macro dsl_method - # # @!method $1(${2--2}) - # # @return [${-1}] the return value of $0 - # create_method_with_args :foo, :a, :b, :c, String - # - # As described, the method is using the signature foo(a, b, c) and the return - # type from the last argument, +String+. When using ranges, tokens are joined - # with commas. Note that this includes using $0: - # - # !!!plain - # $0-1 # => Interpolates to "create_method_with_args, foo" - # - # If you want to separate them with spaces, use $1 $2 $3 $4 .... Note that - # if the token cannot be expanded, it will return the empty string (not an error), - # so it would be safe to list $1 $2 ... $10, for example. - # - # === Escaping Interpolation - # - # Interpolation can be escaped by prefixing the +$+ with +\\\+, like so: - # - # # @!macro foo - # # I have \$2.00 USD. - # - # @example Defining a simple macro - # # @!macro [new] returnself - # # @return [self] returns itself - # @example Using a simple macro in multiple docstrings - # # Documentation for map - # # ... - # # @macro returnself - # def map; end - # - # # Documentation for filter - # # ... - # # @macro returnself - # def filter; end - # @example Attaching a macro to a class method (for DSL usage) - # class Resource - # # Defines a new property - # # @param [String] name the property name - # # @param [Class] type the property's type - # # @!macro [attach] property - # # @return [$2] the $1 property - # def self.property(name, type) end - # end - # - # class Post < Resource - # property :title, String - # property :view_count, Integer - # end - # @example Attaching a macro directly to a DSL method - # class Post < Resource - # # @!macro [attach] property - # # @return [$2] the $1 property - # property :title, String - # - # # Macro will expand on this definition too - # property :view_count, Integer - # end - # @since 0.7.0 - class MacroDirective < Directive - def call - raise TagFormatError if tag.name.nil? && tag.text.to_s.empty? - macro_data = find_or_create - unless macro_data - warn - return - end - - self.expanded_text = expand(macro_data) - end - - private - - def new? - (tag.types && tag.types.include?('new')) || - (tag.text && !tag.text.strip.empty?) - end - - def attach? - new? && # must have data or there is nothing to attach - class_method? || # always attach to class methods - (tag.types && tag.types.include?('attach')) - end - - def class_method? - object && object.is_a?(CodeObjects::MethodObject) && - object.scope == :class - end - - def anonymous? - tag.name.nil? || tag.name.empty? - end - - def expand(macro_data) - return if attach? && class_method? - return if !anonymous? && new? && - (!handler || handler.statement.source.empty?) - call_params = [] - caller_method = nil - full_source = '' - if handler - call_params = handler.call_params - caller_method = handler.caller_method - full_source = handler.statement.source - end - all_params = ([caller_method] + call_params).compact - CodeObjects::MacroObject.expand(macro_data, all_params, full_source) - end - - def find_or_create - if new? || attach? - if handler && attach? - if object && object.is_a?(CodeObjects::NamespaceObject) - log.warn "Attaching macros to non-methods is unsupported, ignoring: " \ - "#{object.path} (#{handler.parser.file}:#{handler.statement.line})" - obj = nil - else - obj = object ? object : - P("#{handler.namespace}.#{handler.caller_method}") - end - else - obj = nil - end - - return tag.text || "" if anonymous? # anonymous macro - macro = CodeObjects::MacroObject.create(tag.name, tag.text, obj) - else - macro = CodeObjects::MacroObject.find(tag.name) - end - - macro ? macro.macro_data : nil - end - - def warn - if object && handler - log.warn "Invalid/missing macro name for " \ - "#{object.path} (#{handler.parser.file}:#{handler.statement.line})" - end - end - end - - # Defines a method object with a given method signature, using indented - # block data as the method's docstring. The signature is similar to the - # {tag:overload} tag. The comment containing this directive does not need - # to be attached to any source, but if it is, that source code will be - # used as the method's source. - # - # To define an attribute method, see {tag:!attribute} - # - # @note This directive should only be used if there is no explicit - # declaration for the method in any source files (i.e., the method - # is declared dynamically via meta-programming). In all other cases, add - # documentation to the method definition itself. - # @note For backwards compatibility support, you do not need to indent - # the method's docstring text. If a +@!method+ directive is seen with - # no indented block, the entire docstring is used as the new method's - # docstring text. - # @example Defining a simple method - # # @!method quit(username, message = "Quit") - # # Sends a quit message to the server for a +username+. - # # @param [String] username the username to quit - # # @param [String] message the quit message - # quit_message_method - # @example Attaching multiple methods to the same source - # # @!method method1 - # # @!method method2 - # create_methods :method1, :method2 - # @see tag:!attribute - # @since 0.7.0 - class MethodDirective < Directive - SCOPE_MATCH = /\A\s*self\s*\.\s*/ - - def call; end - - def after_parse - return unless handler - use_indented_text - create_object - end - - protected - - def method_name - sig = sanitized_tag_signature - if sig && sig =~ /^#{CodeObjects::METHODNAMEMATCH}(\s|\(|$)/ - sig[/\A\s*([^\(; \t]+)/, 1] - else - handler.call_params.first - end - end - - def method_signature - "def #{sanitized_tag_signature || method_name}" - end - - def sanitized_tag_signature - if tag.name && tag.name =~ SCOPE_MATCH - parser.state.scope = :class - $' - else - tag.name - end - end - - def use_indented_text - return if tag.text.empty? - handler = parser.handler - object = parser.object - self.parser = parser.class.new(parser.library) - parser.state.inside_directive = true - parser.parse(tag.text, object, handler) - parser.state.inside_directive = false - end - - def create_object - name = method_name - scope = parser.state.scope || handler.scope - visibility = parser.state.visibility || handler.visibility - ns = CodeObjects::NamespaceObject === object ? object : handler.namespace - obj = CodeObjects::MethodObject.new(ns, name, scope) - handler.register_file_info(obj) - handler.register_source(obj) - handler.register_visibility(obj, visibility) - handler.register_group(obj) - obj.signature = method_signature - obj.parameters = OverloadTag.new(:overload, method_signature).parameters - obj.docstring = Docstring.new!(parser.text, parser.tags, obj, - parser.raw_text, parser.reference) - handler.register_module_function(obj) - old_obj = parser.object - parser.object = obj - parser.post_process - parser.object = old_obj - obj - end - end - - # Defines an attribute with a given name, using indented block data as the - # attribute's docstring. If the type specifier is supplied with "r", "w", or - # "rw", the attribute is made readonly, writeonly or readwrite respectively. - # A readwrite attribute is the default, if no type is specified. The comment - # containing this directive does not need to be attached to any source, but - # if it is, that source code will be used as the method's source. - # - # To define a regular method, see {tag:!method} - # - # @note This directive should only be used if there is no explicit +attr_*+ - # declaration for the attribute in any source files (i.e., the attribute - # is declared dynamically via meta-programming). In all other cases, add - # documentation to the attribute declaration itself. - # @note For backwards compatibility support, you do not need to indent - # the attribute's docstring text. If an +@!attribute+ directive is seen with - # no indented block, the entire docstring is used as the new attribute's - # docstring text. - # @example Defining a simple readonly attribute - # # @!attribute [r] count - # # @return [Fixnum] the size of the list - # @example Defining a simple readwrite attribute - # # @!attribute name - # # @return [String] the name of the user - # @see tag:!method - # @since 0.7.0 - class AttributeDirective < MethodDirective - def after_parse - return unless handler - use_indented_text - create_attribute_data(create_object) - end - - protected - - def method_name - name = sanitized_tag_signature || handler.call_params.first - name += '=' unless readable? - name - end - - def method_signature - if readable? - "def #{method_name}" - else - "def #{method_name}(value)" - end - end - - private - - def create_attribute_data(object) - return unless object - clean_name = object.name.to_s.sub(/=$/, '') - attrs = object.namespace.attributes[object.scope] - attrs[clean_name] ||= SymbolHash[:read => nil, :write => nil] - attrs[clean_name][:read] = object if readable? - if writable? - if object.name.to_s[-1, 1] == '=' - writer = object - writer.parameters = [['value', nil]] - else - writer = CodeObjects::MethodObject.new(object.namespace, - object.name.to_s + '=', object.scope) - writer.signature = "def #{object.name}=(value)" - writer.visibility = object.visibility - writer.dynamic = object.dynamic - writer.source = object.source - writer.group = object.group - writer.parameters = [['value', nil]] - writer.docstring = object.base_docstring - handler.register_file_info(writer) - end - attrs[clean_name][:write] = writer - end - end - - def writable? - !tag.types || tag.types.join.include?('w') - end - - def readable? - !tag.types || tag.types.join =~ /(?!w)r/ - end - end - - # Parses a block of code as if it were present in the source file at that - # location. This directive is useful if a class has dynamic meta-programmed - # behaviour that cannot be recognized by YARD. - # - # You can specify the language of the code block using the types - # specification list. By default, the code language is "ruby". - # - # @example Documenting dynamic module inclusion - # class User - # # includes "UserMixin" and extends "UserMixin::ClassMethods" - # # using the UserMixin.included callback. - # # @!parse include UserMixin - # # @!parse extend UserMixin::ClassMethods - # end - # @example Declaring a method as an attribute - # # This should really be an attribute - # # @!parse attr_reader :foo - # def object; @parent.object end - # @example Parsing C code - # # @!parse [c] - # # void Init_Foo() { - # # rb_define_method(rb_cFoo, "method", method, 0); - # # } - # @since 0.8.0 - class ParseDirective < Directive - def call - lang = tag.types ? tag.types.first.to_sym : - (handler ? handler.parser.parser_type : :ruby) - if handler && lang == handler.parser.parser_type - pclass = Parser::SourceParser.parser_types[handler.parser.parser_type] - pobj = pclass.new(tag.text, handler.parser.file) - pobj.parse - handler.parser.process(pobj.enumerator) - else # initialize a new parse chain - src_parser = Parser::SourceParser.new(lang, handler ? handler.globals : nil) - src_parser.file = handler.parser.file if handler - src_parser.parse(StringIO.new(tag.text)) - end - end - end - - # Modifies the current parsing scope (class or instance). If this - # directive is defined on a docstring attached to an object definition, - # it is applied only to that object. Otherwise, it applies the scope - # to all future objects in the namespace. - # - # @example Modifying the scope of a DSL method - # # @!scope class - # cattr_accessor :subclasses - # @example Modifying the scope of a set of methods - # # @!scope class - # - # # Documentation for method1 - # def method1; end - # - # # Documentation for method2 - # def method2; end - # @since 0.7.0 - class ScopeDirective < Directive - def call - if %w(class instance module).include?(tag.text) - if object.is_a?(CodeObjects::MethodObject) - object.scope = tag.text.to_sym - else - parser.state.scope = tag.text.to_sym - end - end - end - end - - # Modifies the current parsing visibility (public, protected, or private). - # If this directive is defined on a docstring attached to an object - # definition, it is applied only to that object. Otherwise, it applies - # the visibility to all future objects in the namespace. - # - # @example Modifying the visibility of a DSL method - # # @!visibility private - # cattr_accessor :subclasses - # @example Modifying the visibility of a set of methods - # # Note that Ruby's "protected" is recommended over this directive - # # @!visibility protected - # - # # Documentation for method1 - # def method1; end - # - # # Documentation for method2 - # def method2; end - # @since 0.7.0 - class VisibilityDirective < Directive - def call - if %w(public protected private).include?(tag.text) - if object.is_a?(CodeObjects::Base) - object.visibility = tag.text.to_sym - elsif handler && !parser.state.inside_directive - handler.visibility = tag.text.to_sym - else - parser.state.visibility = tag.text.to_sym - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/library.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/library.rb deleted file mode 100644 index 807962608b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/library.rb +++ /dev/null @@ -1,633 +0,0 @@ -# frozen_string_literal: true -module YARD - module Tags - # Keeps track of all the registered meta-data tags and directives. - # Also allows for defining of custom tags and customizing the tag parsing - # syntax. - # - # == Defining Custom Meta-Data Tags - # - # To define a custom tag, use {define_tag}. You should pass the tag - # name and the factory method to use when creating the tag. If you do not - # provide a factory method to use, it will default to {DefaultFactory#parse_tag} - # - # You can also define tag objects manually by simply implementing a "tagname_tag" - # method that returns a {Tag} object, but they will not take advantage of tag factory - # parsing: - # - # def mytag_tag(text) - # Tag.new(:mytag, text) - # end - # - # == Defining Custom Directives - # - # Directives can be defined by calling the {define_directive} method, taking - # the directive name, an optional tag factory parser method (to parse the - # data in the directive into a temporary {Tag} object) and a {Directive} subclass - # that performs the directive processing. For more information on creating a - # Directive subclass, see the {Directive} class documentation. - # - # Similar to tags, Directives can also be defined manually, in this case using - # the method name "mydirective_directive" and returning a new {Directive} object: - # - # def mydirective_directive(tag, parser) - # MyDirective.new(tag, parser) - # end - # - # == Namespaced Tags - # - # In YARD 0.8.0+, tags can be namespaced using the '.' character. It is recommended - # to namespace project specific tags, like +@yard.tag_name+, so that tags do not - # collide with other plugins or new built-in tags. - # - # == Adding/Changing the Tag Syntax - # - # If you have specialized tag parsing needs you can substitute the {#factory} - # object with your own by setting {Library.default_factory= Library.default_factory} - # to a new class with its own parsing methods before running YARD. This is useful - # if you want to change the syntax of existing tags (@see, @since, etc.) - # - # @example Defining a custom tag - # define_tag "Parameter", :param, :with_types_and_name - # define_tag "Author", :author - # @example Defining a custom directive - # define_directive :method, :with_title_and_text, MethodDirective - # @see DefaultFactory - # @see define_tag - # @see define_directive - # @see Directive - class Library - class << self - # @return [SymbolHash{Symbol=>String}] the map of tag names and their - # respective display labels. - attr_reader :labels - - # @!attribute instance - # @return [Library] the main Library instance object. - def instance - @instance ||= new - end - - # @!attribute default_factory - # Replace the factory object responsible for parsing tags by setting - # this to an object (or class) that responds to +parse_TAGNAME+ methods - # where +TAGNAME+ is the name of the tag. - # - # You should set this value before performing any source parsing with - # YARD, otherwise your factory class will not be used. - # - # @example - # YARD::Tags::Library.default_factory = MyFactory - # - # @see DefaultFactory - def default_factory - @default_factory ||= DefaultFactory.new - end - - def default_factory=(factory) - @default_factory = factory.is_a?(Class) ? factory.new : factory - end - - # Returns the factory method used to parse the tag text for a specific tag - # - # @param [Symbol] tag the tag name - # @return [Symbol] the factory method name for the tag - # @return [Class,Symbol] the Tag class to use to parse the tag - # or the method to call on the factory class - # @return [nil] if the tag is freeform text - # @since 0.6.0 - def factory_method_for(tag) - @factory_methods[tag] - end - - # Returns the factory method used to parse the tag text for a specific - # directive - # - # @param [Symbol] directive the directive name - # @return [Symbol] the factory method name for the tag - # @return [Class,Symbol] the Tag class to use to parse the tag or - # the methods to call on the factory class - # @return [nil] if the tag is freeform text - # @since 0.8.0 - def factory_method_for_directive(directive) - @directive_factory_classes[directive] - end - - # Sets the list of tags to display when rendering templates. The order of - # tags in the list is also significant, as it represents the order that - # tags are displayed in templates. - # - # You can use the {Array#place} to insert new tags to be displayed in - # the templates at specific positions: - # - # Library.visible_tags.place(:mytag).before(:return) - # - # @return [Array] a list of ordered tags - # @since 0.6.0 - attr_accessor :visible_tags - - # Sets the list of tags that should apply to any children inside the - # namespace they are defined in. For instance, a "@since" tag should - # apply to all methods inside a module it is defined in. Transitive - # tags can be overridden by directly defining a tag on the child object. - # - # @return [Array] a list of transitive tags - # @since 0.6.0 - attr_accessor :transitive_tags - - # Sorts the labels lexically by their label name, often used when displaying - # the tags. - # - # @return [Array, String] the sorted labels as an array of the tag name and label - def sorted_labels - labels.sort_by {|a| a.last.downcase } - end - - # Convenience method to define a new tag using one of {Tag}'s factory methods, or the - # regular {DefaultFactory#parse_tag} factory method if none is supplied. - # - # @!macro [attach] yard.tag - # @!method $2_tag - # @!visibility private - # @yard.tag $2 [$3] $1 - # @param [#to_s] label the label used when displaying the tag in templates - # @param [#to_s] tag the tag name to create - # @param [#to_s, Class] meth the {Tag} factory method to call when - # creating the tag or the name of the class to directly create a tag for - def define_tag(label, tag, meth = nil) - tag_meth = tag_method_name(tag) - if meth.is_a?(Class) && Tag > meth - class_eval(<<-eof, __FILE__, __LINE__ + 1) - def #{tag_meth}(text) - #{meth}.new(#{tag.inspect}, text) - end - eof - else - class_eval(<<-eof, __FILE__, __LINE__ + 1) - begin; undef #{tag_meth}; rescue NameError; end - def #{tag_meth}(text) - send_to_factory(#{tag.inspect}, #{meth.inspect}, text) - end - eof - end - - @labels ||= SymbolHash.new(false) - @labels.update(tag => label) - @factory_methods ||= SymbolHash.new(false) - @factory_methods.update(tag => meth) - tag - end - - # @macro [attach] yard.directive - # @!method $1_directive - # @!visibility private - # @yard.directive $1 [$2] $-1 - # @overload define_directive(tag, tag_meth = nil, directive_class) - # Convenience method to define a new directive using a {Tag} factory - # method and {Directive} subclass that implements the directive - # callbacks. - # - # @param [#to_s] tag the tag name of the directive - # @param [#to_s] tag_meth the tag factory method to use when - # parsing tag information - # @param [Class] the directive class that implements the - # directive behaviour - # @see define_tag - def define_directive(tag, tag_meth = nil, directive_class = nil) - directive_meth = directive_method_name(tag) - if directive_class.nil? - directive_class = tag_meth - tag_meth = nil - end - class_eval <<-eof, __FILE__, __LINE__ - def #{directive_meth}(tag, parser) - directive_call(tag, parser) - end - eof - - @factory_methods ||= SymbolHash.new(false) - @factory_methods.update(tag => tag_meth) - @directive_factory_classes ||= SymbolHash.new(false) - @directive_factory_classes.update(tag => directive_class) - - tag - end - - def tag_method_name(tag_name) - tag_or_directive_method_name(tag_name) - end - - def directive_method_name(tag_name) - tag_or_directive_method_name(tag_name, 'directive') - end - - private - - def tag_or_directive_method_name(tag_name, type = 'tag') - "#{tag_name.to_s.tr('.', '_')}_#{type}" - end - end - - private - - def send_to_factory(tag_name, meth, text) - meth = meth.to_s - send_name = "parse_tag" + (meth.empty? ? "" : "_" + meth) - if @factory.respond_to?(send_name) - @factory.send(send_name, tag_name, text) - else - raise NoMethodError, "Factory #{@factory.class_name} does not implement factory method :#{meth}." - end - end - - # @return [Directive] - def directive_call(tag, parser) - meth = self.class.factory_method_for_directive(tag.tag_name) - if meth <= Directive - meth = meth.new(tag, parser) - meth.call - meth - else - meth.call(tag, parser) - end - end - - public - - # A factory class to handle parsing of tags, defaults to {default_factory} - attr_accessor :factory - - def initialize(factory = Library.default_factory) - self.factory = factory - end - - # @param [#to_s] tag_name the name of the tag to look for - # @return [Boolean] whether a tag by the given name is registered in - # the library. - def has_tag?(tag_name) - tag_name && respond_to?(self.class.tag_method_name(tag_name)) - end - - # Creates a new {Tag} object with a given tag name and data - # @return [Tag] the newly created tag object - def tag_create(tag_name, tag_buf) - send(self.class.tag_method_name(tag_name), tag_buf) - end - - # @param [#to_s] tag_name the name of the tag to look for - # @return [Boolean] whether a directive by the given name is registered in - # the library. - def has_directive?(tag_name) - tag_name && respond_to?(self.class.directive_method_name(tag_name)) - end - - # Creates a new directive with tag information and a docstring parser - # object. - # @param [String] tag_name the name of the tag - # @param [String] tag_buf the tag data - # @param [DocstringParser] parser the parser object parsing the docstring - # @return [Directive] the newly created directive - def directive_create(tag_name, tag_buf, parser) - meth = self.class.factory_method_for(tag_name) - tag = send_to_factory(tag_name, meth, tag_buf) - meth = self.class.directive_method_name(tag_name) - send(meth, tag, parser) - end - - # @!macro yard.tag.transitive - # @note This tag is *transitive*. If it is applied on a - # namespace (module or class), it will immediately be - # applied to all children objects of that namespace unless - # it is redefined on the child object. - - # Marks a class/module/method as abstract with optional - # implementor information. - # - # @example - # # @abstract Subclass and override {#run} to implement - # # a custom Threadable class. - # class Runnable - # def run; raise NotImplementedError end - # end - define_tag "Abstract", :abstract - - # Declares the API that the object belongs to. Does not display in - # output, but useful for performing queries (+yardoc --query+). Any text is - # allowable in this tag, and there are no predefined values. - # - # @!macro yard.tag.transitive - # @note The special name +@api private+ does display a notice in - # documentation if it is listed, letting users know that the - # method is not to be used by external components. - # @example - # class Post - # # @api private - # def reset_table!; table.flush end - # end - define_tag "API Visibility", :api - - # Declares a readwrite attribute on a Struct or class. - # - # @note This attribute is only applicable on class docstrings - # @deprecated Use the more powerful {tag:!attribute} directive instead. - # @example - # # @attr [String] name the name of the structure - # # @attr [Fixnum] size the size of the structure - # class MyStruct < Struct; end - define_tag "Attribute", :attr, :with_types_and_name - - # Declares a readonly attribute on a Struct or class. - # - # @note This attribute is only applicable on class docstrings - # @deprecated Use the more powerful {tag:!attribute} directive instead. - # @example - # # @attr_reader [String] name the name of the structure - # # @attr_reader [Fixnum] size the size of the structure - # class MyStruct < Struct; end - define_tag "Attribute Getter", :attr_reader, :with_types_and_name - - # Declares a writeonly attribute on a Struct or class. - # - # @note This attribute is only applicable on class docstrings - # @deprecated Use the more powerful {tag:!attribute} directive instead. - # @example - # # @attr_reader [String] name the name of the structure - # # @attr_reader [Fixnum] size the size of the structure - # class MyStruct < Struct; end - define_tag "Attribute Setter", :attr_writer, :with_types_and_name - - # List the author or authors of a class, module, or method. - # - # @example - # # @author Foo Bar - # class MyClass; end - define_tag "Author", :author - - # Marks a method/class as deprecated with an optional description. - # The description should be used to inform users of the recommended - # migration path, and/or any useful information about why the object - # was marked as deprecated. - # - # @example Deprecate a method with a replacement API - # # @deprecated Use {#bar} instead. - # def foo; end - # @example Deprecate a method with no replacement - # class Thread - # # @deprecated Exiting a thread in this way is not reliable and - # # can cause a program crash. - # def kill; end - # end - define_tag "Deprecated", :deprecated - - # Show an example snippet of code for an object. The first line - # is an optional title. - # - # @example - # # @example Reverse a String - # # "mystring".reverse #=> "gnirtsym" - # def reverse; end - # @yard.signature Optional title - # Code block - define_tag "Example", :example, :with_title_and_text - - # Adds an emphasized note at the top of the docstring for the object - # - # @example - # # @note This method should only be used in outer space. - # def eject; end - # @see tag:todo - define_tag "Note", :note - - # Describe an options hash in a method. The tag takes the - # name of the options parameter first, followed by optional types, - # the option key name, a default value for the key and a - # description of the option. The default value should be placed within - # parentheses and is optional (can be omitted). - # - # Note that a +@param+ tag need not be defined for the options - # hash itself, though it is useful to do so for completeness. - # - # @note For keyword parameters, use +@param+, not +@option+. - # - # @example - # # @param [Hash] opts the options to create a message with. - # # @option opts [String] :subject The subject - # # @option opts [String] :from ('nobody') From address - # # @option opts [String] :to Recipient email - # # @option opts [String] :body ('') The email's body - # def send_email(opts = {}) end - # @yard.signature name [Types] option_key (default_value) description - define_tag "Options Hash", :option, :with_options - - # Describe that your method can be used in various - # contexts with various parameters or return types. The first - # line should declare the new method signature, and the following - # indented tag data will be a new documentation string with its - # own tags adding metadata for such an overload. - # - # @example - # # @overload set(key, value) - # # Sets a value on key - # # @param key [Symbol] describe key param - # # @param value [Object] describe value param - # # @overload set(value) - # # Sets a value on the default key +:foo+ - # # @param value [Object] describe value param - # def set(*args) end - # @yard.signature method_signature(parameters) - # Indented docstring for overload method - define_tag "Overloads", :overload, OverloadTag - - # Documents a single method parameter (either regular or keyword) with a given name, type - # and optional description. - # - # @example - # # @param url [String] the URL of the page to download - # # @param directory [String] the name of the directory to save to - # def load_page(url, directory: 'pages') end - define_tag "Parameters", :param, :with_types_and_name - - # Declares that the _logical_ visibility of an object is private. - # In other words, it specifies that this method should be marked - # private but cannot due to Ruby's visibility restrictions. This - # exists for classes, modules and constants that do not obey Ruby's - # visibility rules. For instance, an inner class might be considered - # "private", though Ruby would make no such distinction. - # - # This tag is meant to be used in conjunction with the +--no-private+ - # command-line option, and is required to actually remove these objects - # from documentation output. See {file:README.md} for more information on - # switches. - # - # If you simply want to set the API visibility of a method, you should - # look at the {tag:api} tag instead. - # - # @note This method is not recommended for hiding undocumented or - # "unimportant" methods. This tag should only be used to mark objects - # private when Ruby visibility rules cannot do so. In Ruby 1.9.3, you - # can use +private_constant+ to declare constants (like classes or - # modules) as private, and should be used instead of +@private+. - # @macro yard.tag.transitive - # @example - # # @private - # class InteralImplementation; end - # @see tag:api - # @yard.signature - define_tag "Private", :private - - # Describes that a method may raise a given exception, with - # an optional description of what it may mean. - # - # @example - # # @raise [AccountBalanceError] if the account does not have - # # sufficient funds to perform the transaction - # def withdraw(amount) end - define_tag "Raises", :raise, :with_types - - # Describes the return value (and type or types) of a method. - # You can list multiple return tags for a method in the case - # where a method has distinct return cases. In this case, each - # case should begin with "if ...". - # - # @example A regular return value - # # @return [Fixnum] the size of the file - # def size; @file.size end - # @example A method returns an Array or a single object - # # @return [String] if a single object was returned - # # from the database. - # # @return [Array] if multiple objects were - # # returned. - # def find(query) end - define_tag "Returns", :return, :with_types - - # "See Also" references for an object. Accepts URLs or - # other code objects with an optional description at the end. - # Note that the URL or object will be automatically linked by - # YARD and does not need to be formatted with markup. - # - # @example - # # Synchronizes system time using NTP. - # # @see http://ntp.org/documentation.html NTP Documentation - # # @see NTPHelperMethods - # class NTPUpdater; end - define_tag "See Also", :see, :with_name - - # Lists the version that the object was first added. - # - # @!macro yard.tag.transitive - # @example - # # @since 1.2.4 - # def clear_routes; end - define_tag "Since", :since - - # Marks a TODO note in the object being documented. - # For reference, objects with TODO items can be enumerated - # from the command line with a simple command: - # - # !!!sh - # mocker$ yard list --query '@todo' - # lib/mocker/mocker.rb:15: Mocker - # lib/mocker/report/html.rb:5: Mocker::Report::Html - # - # YARD can also be used to enumerate the TODO items from - # a short script: - # - # !!!ruby - # require 'yard' - # YARD::Registry.load!.all.each do |o| - # puts o.tag(:todo).text if o.tag(:todo) - # end - # - # @example - # # @todo Add support for Jabberwocky service. - # # There is an open source Jabberwocky library available - # # at http://jbrwcky.org that can be easily integrated. - # class Wonderlander; end - # @see tag:note - define_tag "Todo Item", :todo - - # Lists the version of a class, module or method. This is - # similar to a library version, but at finer granularity. - # In some cases, version of specific modules, classes, methods - # or generalized components might change independently between - # releases. A version tag is used to infer the API compatibility - # of a specific object. - # - # @example - # # The public REST API for http://jbrwcky.org - # # @version 2.0 - # class JabberwockyAPI; end - define_tag "Version", :version - - # Describes what a method might yield to a given block. - # The types specifier list should not list types, but names - # of the parameters yielded to the block. If you define - # parameters with +@yieldparam+, you do not need to define - # the parameters in the type specification of +@yield+ as - # well. - # - # @example - # # For a block {|a,b,c| ... } - # # @yield [a, b, c] Gives 3 random numbers to the block - # def provide3values(&block) yield(42, 42, 42) end - # @see tag:yieldparam - # @see tag:yieldreturn - # @yard.signature [parameters] description - define_tag "Yields", :yield, :with_types - - # Defines a parameter yielded by a block. If you define the - # parameters with +@yieldparam+, you do not need to define - # them via +@yield+ as well. - # - # @example - # # @yieldparam [String] name the name that is yielded - # def with_name(name) yield(name) end - define_tag "Yield Parameters", :yieldparam, :with_types_and_name - - # Documents the value and type that the block is expected - # to return to the method. - # - # @example - # # @yieldreturn [Fixnum] the number to add 5 to. - # def add5_block(&block) 5 + yield end - # @see tag:return - define_tag "Yield Returns", :yieldreturn, :with_types - - # @yard.signature [r | w | rw] attribute_name - # Indented attribute docstring - define_directive :attribute, :with_types_and_title, AttributeDirective - - # @yard.signature - define_directive :endgroup, EndGroupDirective - - define_directive :group, GroupDirective - - # @yard.signature [attach | new] optional_name - # Optional macro expansion data - define_directive :macro, :with_types_and_title, MacroDirective - - # @yard.signature method_signature(parameters) - # Indented method docstring - define_directive :method, :with_title_and_text, MethodDirective - - # @yard.signature [language] code - define_directive :parse, :with_types, ParseDirective - - # Sets the scope of a DSL method. Only applicable to DSL method - # calls. Acceptable values are 'class' or 'instance' - # @yard.signature class | instance - define_directive :scope, ScopeDirective - - # Sets the visibility of a DSL method. Only applicable to - # DSL method calls. Acceptable values are public, protected, or private. - # @yard.signature public | protected | private - define_directive :visibility, VisibilityDirective - - self.visible_tags = [:abstract, :deprecated, :note, :todo, :example, :overload, - :param, :option, :yield, :yieldparam, :yieldreturn, :return, :raise, - :see, :author, :since, :version] - - self.transitive_tags = [:since, :api] - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/option_tag.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/option_tag.rb deleted file mode 100644 index a63c8a96d9..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/option_tag.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true -module YARD - module Tags - class OptionTag < Tag - attr_accessor :pair - - def initialize(tag_name, name, pair) - super(tag_name, nil, nil, name) - @pair = pair - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/overload_tag.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/overload_tag.rb deleted file mode 100644 index 2d7ec6ae1a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/overload_tag.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true -module YARD - module Tags - class OverloadTag < Tag - attr_reader :signature, :parameters, :docstring - - def initialize(tag_name, text) - super(tag_name, nil) - parse_tag(text) - parse_signature - end - - def tag(name) docstring.tag(name) end - def tags(name = nil) docstring.tags(name) end - def has_tag?(name) docstring.has_tag?(name) end - - def object=(value) - super(value) - docstring.object = value - docstring.tags.each {|tag| tag.object = value } - end - - def name(prefix = false) - return @name unless prefix - object.scope == :class ? @name.to_s : "#{object.send(:sep)}#{@name}" - end - - def method_missing(*args, &block) - object.send(*args, &block) - end - - def type - object.type - end - - def is_a?(other) - object.is_a?(other) || self.class >= other.class || false - end - alias kind_of? is_a? - - private - - def parse_tag(text) - @signature, text = *text.split(/\r?\n/, 2) - @signature.strip! - text ||= String.new("") - numspaces = text[/\A(\s*)/, 1].length - text.gsub!(/^[ \t]{#{numspaces}}/, '') - text.strip! - @docstring = Docstring.new(text, nil) - end - - def parse_signature - if signature =~ /^(?:def\s)?\s*(#{CodeObjects::METHODMATCH})(?:(?:\s+|\s*\()(.*)(?:\)\s*$)?)?/m - meth = $1 - args = $2 - meth.gsub!(/\s+/, '') - # FIXME: refactor this code to not make use of the Handlers::Base class (tokval_list should be moved) - toks = YARD::Parser::Ruby::Legacy::TokenList.new(args) - args = YARD::Handlers::Ruby::Legacy::Base.new(nil, nil).send(:tokval_list, toks, :all) - args = args.map do |a| - k, v = *a.split(/:|=/, 2) - [k.strip.to_s + (a[k.size, 1] == ':' ? ':' : ''), (v ? v.strip : nil)] - end if args - @name = meth.to_sym - @parameters = args - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/ref_tag.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/ref_tag.rb deleted file mode 100644 index 0d1ebd744e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/ref_tag.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true -module YARD - module Tags - module RefTag - attr_accessor :owner - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/ref_tag_list.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/ref_tag_list.rb deleted file mode 100644 index 933e9e6e36..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/ref_tag_list.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true -module YARD - module Tags - class RefTagList - attr_accessor :owner, :tag_name, :name - - def initialize(tag_name, owner, name = nil) - @owner = CodeObjects::Proxy === owner ? owner : P(owner) - @tag_name = tag_name.to_s - @name = name - end - - def tags - if owner.is_a?(CodeObjects::Base) - o = owner.tags(tag_name) - o = o.select {|t| t.name.to_s == name.to_s } if name - o.each do |t| - t.extend(RefTag) - t.owner = owner - end - o - else - [] - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/tag.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/tag.rb deleted file mode 100644 index 516b2910b0..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/tag.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true -module YARD - module Tags - # Represents a metadata tag value (+@tag+). Tags can have any combination of - # {#types}, {#name} and {#text}, or none of the above. - # - # @example Programmatic tag creation - # # The following docstring syntax: - # # @param [String, nil] arg an argument - # # - # # is equivalent to: - # Tag.new(:param, 'an argument', ['String', 'nil'], 'arg') - class Tag - # @return [String] the name of the tag - attr_accessor :tag_name - - # @return [String] the tag text associated with the tag - # @return [nil] if no tag text is supplied - attr_accessor :text - - # @return [Array] a list of types associated with the tag - # @return [nil] if no types are associated with the tag - attr_accessor :types - - # @return [String] a name associated with the tag - attr_accessor :name - - # @return [CodeObjects::Base] the associated object - attr_accessor :object - - # Creates a new tag object with a tag name and text. Optionally, formally declared types - # and a key name can be specified. - # - # Types are mainly for meta tags that rely on type information, such as +param+, +return+, etc. - # - # Key names are for tags that declare meta data for a specific key or name, such as +param+, - # +raise+, etc. - # - # @param [#to_s] tag_name the tag name to create the tag for - # @param [String] text the descriptive text for this tag - # @param [Array] types optional type list of formally declared types - # for the tag - # @param [String] name optional key name which the tag refers to - def initialize(tag_name, text, types = nil, name = nil) - @tag_name = tag_name.to_s - @text = text - @name = name - @types = (types ? [types].flatten.compact : nil) - end - - # Convenience method to access the first type specified. This should mainly - # be used for tags that only specify one type. - # - # @return [String] the first of the list of specified types - # @see #types - def type - types.first - end - - # Provides a plain English summary of the type specification, or nil - # if no types are provided or parseable. - # - # @return [String] a plain English description of the associated types - # @return [nil] if no types are provided or not parseable - def explain_types - return nil if !types || types.empty? - TypesExplainer.explain(*types) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/tag_format_error.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/tag_format_error.rb deleted file mode 100644 index 51f276f811..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/tag_format_error.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true -module YARD - module Tags - class TagFormatError < RuntimeError - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/types_explainer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/types_explainer.rb deleted file mode 100644 index a72d1a703f..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/tags/types_explainer.rb +++ /dev/null @@ -1,162 +0,0 @@ -# frozen_string_literal: true -require 'strscan' - -module YARD - module Tags - class TypesExplainer - # (see Tag#explain_types) - # @param types [Array] a list of types to parse and summarize - def self.explain(*types) - explain!(*types) - rescue SyntaxError - nil - end - - # (see explain) - # @raise [SyntaxError] if the types are not parseable - def self.explain!(*types) - Parser.parse(types.join(", ")).join("; ") - end - - class << self - private :new - end - - # @private - class Type - attr_accessor :name - - def initialize(name) - @name = name - end - - def to_s(singular = true) - if name[0, 1] == "#" - singular ? "an object that responds to #{name}" : "objects that respond to #{name}" - elsif name[0, 1] =~ /[A-Z]/ - singular ? "a#{name[0, 1] =~ /[aeiou]/i ? 'n' : ''} " + name : "#{name}#{name[-1, 1] =~ /[A-Z]/ ? "'" : ''}s" - else - name - end - end - - private - - def list_join(list) - index = 0 - list.inject(String.new) do |acc, el| - acc << el.to_s - acc << ", " if index < list.size - 2 - acc << " or " if index == list.size - 2 - index += 1 - acc - end - end - end - - # @private - class CollectionType < Type - attr_accessor :types - - def initialize(name, types) - @name = name - @types = types - end - - def to_s(_singular = true) - "a#{name[0, 1] =~ /[aeiou]/i ? 'n' : ''} #{name} of (" + list_join(types.map {|t| t.to_s(false) }) + ")" - end - end - - # @private - class FixedCollectionType < CollectionType - def to_s(_singular = true) - "a#{name[0, 1] =~ /[aeiou]/i ? 'n' : ''} #{name} containing (" + types.map(&:to_s).join(" followed by ") + ")" - end - end - - # @private - class HashCollectionType < Type - attr_accessor :key_types, :value_types - - def initialize(name, key_types, value_types) - @name = name - @key_types = key_types - @value_types = value_types - end - - def to_s(_singular = true) - "a#{name[0, 1] =~ /[aeiou]/i ? 'n' : ''} #{name} with keys made of (" + - list_join(key_types.map {|t| t.to_s(false) }) + - ") and values of (" + list_join(value_types.map {|t| t.to_s(false) }) + ")" - end - end - - # @private - class Parser - include CodeObjects - - TOKENS = { - :collection_start => / />/, - :fixed_collection_start => /\(/, - :fixed_collection_end => /\)/, - :type_name => /#{ISEP}#{METHODNAMEMATCH}|#{NAMESPACEMATCH}|\w+/, - :type_next => /[,;]/, - :whitespace => /\s+/, - :hash_collection_start => /\{/, - :hash_collection_next => /=>/, - :hash_collection_end => /\}/, - :parse_end => nil - } - - def self.parse(string) - new(string).parse - end - - def initialize(string) - @scanner = StringScanner.new(string) - end - - def parse - types = [] - type = nil - name = nil - loop do - found = false - TOKENS.each do |token_type, match| - # TODO: cleanup this code. - # rubocop:disable Lint/AssignmentInCondition - next unless (match.nil? && @scanner.eos?) || (match && token = @scanner.scan(match)) - found = true - case token_type - when :type_name - raise SyntaxError, "expecting END, got name '#{token}'" if name - name = token - when :type_next - raise SyntaxError, "expecting name, got '#{token}' at #{@scanner.pos}" if name.nil? - type = Type.new(name) unless type - types << type - type = nil - name = nil - when :fixed_collection_start, :collection_start - name ||= "Array" - klass = token_type == :collection_start ? CollectionType : FixedCollectionType - type = klass.new(name, parse) - when :hash_collection_start - name ||= "Hash" - type = HashCollectionType.new(name, parse, parse) - when :hash_collection_next, :hash_collection_end, :fixed_collection_end, :collection_end, :parse_end - raise SyntaxError, "expecting name, got '#{token}'" if name.nil? - type = Type.new(name) unless type - types << type - return types - end - end - raise SyntaxError, "invalid character at #{@scanner.peek(1)}" unless found - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/engine.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/engine.rb deleted file mode 100644 index 1f5570700f..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/engine.rb +++ /dev/null @@ -1,186 +0,0 @@ -# frozen_string_literal: true -require 'ostruct' - -module YARD - module Templates - # This module manages all creation, handling and rendering of {Template} - # objects. - # - # * To create a template object at a path, use {template}. - # * To render a template, call {render}. - # * To register a template path in the lookup paths, call {register_template_path}. - module Engine - class << self - # @return [Array] the list of registered template paths - attr_accessor :template_paths - - # Registers a new template path in {template_paths} - # - # @param [String] path a new template path - # @return [void] - def register_template_path(path) - template_paths.push(path) unless template_paths.include?(path) - end - - # Creates a template module representing the path. Searches on disk - # for the first directory named +path+ (joined by '/') within the - # template paths and builds a template module for. All other matching - # directories in other template paths will be included in the - # generated module as mixins (for overriding). - # - # @param [Array] path a list of path components - # @raise [ArgumentError] if the path does not exist within one of the - # {template_paths} on disk. - # @return [Template] the module representing the template - def template(*path) - from_template = nil - from_template = path.shift if path.first.is_a?(Template) - path = path.join('/') - full_paths = find_template_paths(from_template, path) - - path = File.cleanpath(path).gsub('../', '') - raise ArgumentError, "No such template for #{path}" if full_paths.empty? - mod = template!(path, full_paths) - - mod - end - - # Forces creation of a template at +path+ within a +full_path+. - # - # @param [String] path the path name of the template - # @param [Array] full_paths the full path on disk of the template - # @return [Template] the template module representing the +path+ - def template!(path, full_paths = nil) - full_paths ||= [path] - full_paths = [full_paths] unless full_paths.is_a?(Array) - name = template_module_name(full_paths.first) - begin; return const_get(name); rescue NameError; nil end - - mod = const_set(name, Module.new) - mod.send(:include, Template) - mod.send(:initialize, path, full_paths) - mod - end - - # Renders a template on a {CodeObjects::Base code object} using - # a set of default (overridable) options. Either the +:object+ - # or +:type+ keys must be provided. - # - # If a +:serializer+ key is provided and +:serialize+ is not set to - # false, the rendered contents will be serialized through the {Serializers::Base} - # object. See {with_serializer}. - # - # @example Renders an object with html formatting - # Engine.render(:format => :html, :object => obj) - # @example Renders without an object - # Engine.render(:type => :fulldoc, :otheropts => somevalue) - # @param [Hash] options the options hash - # @option options [Symbol] :format (:text) the default format - # @option options [Symbol] :type (nil) the :object's type. - # @option options [Symbol] :template (:default) the default template - # @return [String] the rendered template - def render(options = {}) - options = set_default_options(options) - mod = template(options.template, options.type, options.format) - - if options.serializer && options.serialize != false - with_serializer(options.object, options.serializer) { mod.run(options) } - else - mod.run(options) - end - end - - # Passes a set of objects to the +:fulldoc+ template for full documentation generation. - # This is called by {CLI::Yardoc} to most commonly perform HTML - # documentation generation. - # - # @param [Array] objects a list of {CodeObjects::Base} - # objects to pass to the template - # @param [Hash] options (see {render}) - # @return [void] - def generate(objects, options = {}) - options = set_default_options(options) - options.objects = objects - options.object = Registry.root - template(options.template, :fulldoc, options.format).run(options) - end - - # Serializes the results of a block with a +serializer+ object. - # - # @param [CodeObjects::Base] object the code object to serialize - # @param [Serializers::Base] serializer the serializer object - # @yield a block whose result will be serialize - # @yieldreturn [String] the contents to serialize - # @see Serializers::Base - def with_serializer(object, serializer) - output = nil - filename = serializer.serialized_path(object) - if serializer.respond_to?(:basepath) - filename = File.join(serializer.basepath, filename) - end - log.capture("Generating #{filename}", nil) do - serializer.before_serialize if serializer - output = yield - if serializer - serializer.serialize(object, output) - serializer.after_serialize(output) - end - end - output - end - - private - - # Sets default options on the options hash - # - # @param [Hash] options the options hash - # @option options [Symbol] :format (:text) the default format - # @option options [Symbol] :type (nil) the :object's type, if provided - # @option options [Symbol] :template (:default) the default template - # @return [void] - def set_default_options(options = {}) - if options.is_a?(Hash) - options = TemplateOptions.new.tap do |o| - o.reset_defaults - o.update(options) - end - end - options.type ||= options.object.type if options.object - options - end - - # Searches through the registered {template_paths} and returns - # all full directories that have the +path+ within them on disk. - # - # @param [Template] from_template if provided, allows a relative - # path to be specified from this template's full path. - # @param [String] path the path component to search for in the - # {template_paths} - # @return [Array] a list of full paths that are existing - # candidates for a template module - def find_template_paths(from_template, path) - paths = template_paths.dup - paths = from_template.full_paths + paths if from_template - - paths.inject([]) do |acc, tp| - full_path = File.cleanpath(File.join(tp, path)) - acc.unshift(full_path) if File.directory?(full_path) - acc - end.uniq - end - - # The name of the module that represents a +path+ - # - # @param [String] path the path to generate a module name for - # @return [String] the module name - def template_module_name(path) - 'Template_' + path.to_s.gsub(/[^a-z0-9]/i, '_') - end - end - - self.template_paths = [] - end - - Engine.register_template_path(File.join(YARD::ROOT, '..', 'templates')) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/erb_cache.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/erb_cache.rb deleted file mode 100644 index 8e7a998929..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/erb_cache.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true -module YARD - module Templates - # @since 0.5.4 - module ErbCache - def self.method_for(filename) - @methods ||= {} - return @methods[filename] if @methods[filename] - @methods[filename] = name = "_erb_cache_#{@methods.size}" - erb = yield.src - encoding = erb[/\A(#coding[:=].*\r?\n)/, 1] || '' - module_eval "#{encoding}def #{name}; #{erb}; end", filename - - name - end - - def self.clear! - return unless defined?(@methods) && @methods - @methods.clear - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/base_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/base_helper.rb deleted file mode 100644 index 537497cbad..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/base_helper.rb +++ /dev/null @@ -1,215 +0,0 @@ -# frozen_string_literal: true -module YARD::Templates::Helpers - # The base helper module included in all templates. - module BaseHelper - attr_accessor :object, :serializer - - # @return [CodeObjects::Base] the object representing the current generated - # page. Might not be the current {#object} when inside sub-templates. - attr_reader :owner - undef owner - def owner; (defined?(@owner) && @owner) || object.namespace end - - # @group Managing Global Template State - - # An object that keeps track of global state throughout the entire template - # rendering process (including any sub-templates). - # - # @return [OpenStruct] a struct object that stores state - # @since 0.6.0 - def globals; options.globals end - - # @group Running the Verifier - - # Runs a list of objects against the {Verifier} object passed into the - # template and returns the subset of verified objects. - # - # @param [Array] list a list of code objects - # @return [Array] a list of code objects that match - # the verifier. If no verifier is supplied, all objects are returned. - def run_verifier(list) - options.verifier ? options.verifier.run(list) : list - end - - # @group Escaping Text - - # Escapes text. This is used a lot by the HtmlHelper and there should - # be some helper to "clean up" text for whatever, this is it. - def h(text) - text - end - - # @group Linking Objects and URLs - - # Links objects or URLs. This method will delegate to the correct +link_+ - # method depending on the arguments passed in. - # - # @example Linking a URL - # linkify('http://example.com') - # @example Including docstring contents of an object - # linkify('include:YARD::Docstring') - # @example Linking to an extra file - # linkify('file:README') - # @example Linking an object by path - # linkify('YARD::Docstring') - def linkify(*args) - if args.first.is_a?(String) - case args.first - when %r{://}, /^mailto:/ - link_url(args[0], args[1], {:target => '_parent'}.merge(args[2] || {})) - when /^include:file:(\S+)/ - file = $1 - relpath = File.relative_path(Dir.pwd, File.expand_path(file)) - if relpath =~ /^\.\./ - log.warn "Cannot include file from path `#{file}'" - "" - elsif File.file?(file) - link_include_file(file) - else - log.warn "Cannot find file at `#{file}' for inclusion" - "" - end - when /^include:(\S+)/ - path = $1 - obj = YARD::Registry.resolve(object.namespace, path) - if obj - link_include_object(obj) - else - log.warn "Cannot find object at `#{path}' for inclusion" - "" - end - when /^render:(\S+)/ - path = $1 - obj = YARD::Registry.resolve(object, path) - if obj - opts = options.dup - opts.delete(:serializer) - obj.format(opts) - else - '' - end - when /^file:(\S+?)(?:#(\S+))?$/ - link_file($1, args[1] ? args[1] : nil, $2) - else - link_object(*args) - end - else - link_object(*args) - end - end - - # Includes an object's docstring into output. - # @since 0.6.0 - # @param [CodeObjects::Base] obj the object to include - # @return [String] the object's docstring (no tags) - def link_include_object(obj) - obj.docstring - end - - # Include a file as a docstring in output - # @since 0.7.0 - # @param [String] file the filename to include - # @return [String] the file's contents - def link_include_file(file) - File.read(file) - end - - # Links to an object with an optional title - # - # @param [CodeObjects::Base] obj the object to link to - # @param [String] title the title to use for the link - # @return [String] the linked object - def link_object(obj, title = nil) - return title if title - - case obj - when YARD::CodeObjects::Base, YARD::CodeObjects::Proxy - obj.title - when String, Symbol - P(obj).title - else - obj - end - end - - # Links to a URL - # - # @param [String] url the URL to link to - # @param [String] title the optional title to display the link as - # @param [Hash] params optional parameters for the link - # @return [String] the linked URL - def link_url(url, title = nil, params = nil) # rubocop:disable Lint/UnusedMethodArgument - url - end - - # Links to an extra file - # - # @param [String] filename the filename to link to - # @param [String] title the title of the link - # @param [String] anchor optional anchor - # @return [String] the link to the file - # @since 0.5.5 - def link_file(filename, title = nil, anchor = nil) # rubocop:disable Lint/UnusedMethodArgument - return filename.filename if CodeObjects::ExtraFileObject === filename - filename - end - - # @group Formatting Object Attributes - - # Formats a list of return types for output and links each type. - # - # @example Formatting types - # format_types(['String', 'Array']) #=> "(String, Array)" - # @example Formatting types without surrounding brackets - # format_types(['String', 'Array'], false) #=> "String, Array" - # @param [Array] list a list of types - # @param [Boolean] brackets whether to surround the types in brackets - # @return [String] the formatted list of Ruby types - def format_types(list, brackets = true) - list.nil? || list.empty? ? "" : (brackets ? "(#{list.join(", ")})" : list.join(", ")) - end - - # @example Formatted type of an exception class - # o = ClassObject.new(:root, :MyError) - # o.superclass = P('RuntimeError') - # format_object_type(o) # => "Exception" - # @example Formatted type of a method - # o = MethodObject.new(:root, :to_s) - # format_object_type(o) # => "Method" - # @param [CodeObjects::Base] object the object to retrieve the type for - # @return [String] the human-readable formatted {CodeObjects::Base#type #type} - # for the object - def format_object_type(object) - case object - when YARD::CodeObjects::ClassObject - object.is_exception? ? "Exception" : "Class" - else - object.type.to_s.capitalize - end - end - - # @example - # s = format_object_title ModuleObject.new(:root, :MyModuleName) - # s # => "Module: MyModuleName" - # @param [CodeObjects::Base] object the object to retrieve a title for - # @return [String] the page title name for a given object - def format_object_title(object) - case object - when YARD::CodeObjects::RootObject - "Top Level Namespace" - else - format_object_type(object) + ": " + object.title - end - end - - # Indents and formats source code - # - # @param [String] value the input source code - # @return [String] formatted source code - def format_source(value) - sp = value.split("\n").last[/^(\s+)/, 1] - num = sp ? sp.size : 0 - value.gsub(/^\s{#{num}}/, '') - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/filter_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/filter_helper.rb deleted file mode 100644 index 707fb0ceeb..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/filter_helper.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true -module YARD - module Templates::Helpers - # Helpers for various object types - module FilterHelper - # @return [Boolean] whether an object is a method - def is_method?(object) - object.type == :method - end - - # @return [Boolean] whether an object is a namespace - def is_namespace?(object) - object.is_a?(CodeObjects::NamespaceObject) - end - - # @return [Boolean] whether an object is a class - def is_class?(object) - object.is_a?(CodeObjects::ClassObject) - end - - # @return [Boolean] whether an object is a module - def is_module?(object) - object.is_a?(CodeObjects::ModuleObject) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/html_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/html_helper.rb deleted file mode 100644 index a282544806..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/html_helper.rb +++ /dev/null @@ -1,670 +0,0 @@ -# frozen_string_literal: true -require 'cgi' - -module YARD - module Templates::Helpers - # The helper module for HTML templates. - module HtmlHelper - include MarkupHelper - include HtmlSyntaxHighlightHelper - - # @private - URLMATCH = /[^\w\s~!\*'\(\):;@&=\$,\[\]<>-]/ - - # @private - ASCIIDOC_ATTRIBUTES = {"env" => "yard", "env-yard" => ""}.freeze - - # @group Escaping Template Data - - # Escapes HTML entities - # - # @param [String] text the text to escape - # @return [String] the HTML with escaped entities - def h(text) - CGI.escapeHTML(text.to_s) - end - - # Escapes a URL - # - # @param [String] text the URL - # @return [String] the escaped URL - def urlencode(text) - text = text.dup - enc = nil - if text.respond_to?(:force_encoding) - enc = text.encoding - text = text.force_encoding('binary') - end - - text = text.gsub(/%[a-z0-9]{2}|#{URLMATCH}/i) do - $&.size > 1 ? $& : "%" + $&.ord.to_s(16).upcase - end.tr(' ', '+') - - text = text.force_encoding(enc) if enc - text - end - - module_function :urlencode - - # @group Converting Markup to HTML - - # Turns text into HTML using +markup+ style formatting. - # - # @param [String] text the text to format - # @param [Symbol] markup examples are +:markdown+, +:textile+, +:rdoc+. - # To add a custom markup type, see {MarkupHelper} - # @return [String] the HTML - def htmlify(text, markup = options.markup) - markup_meth = "html_markup_#{markup}" - return text unless respond_to?(markup_meth) - return "" unless text - return text unless markup - html = send(markup_meth, text).dup - if html.respond_to?(:encode) - html = html.force_encoding(text.encoding) # for libs that mess with encoding - html = html.encode(:invalid => :replace, :replace => '?') - end - html = resolve_links(html) - unless [:text, :none, :pre, :ruby].include?(markup) - html = parse_codeblocks(html) - end - html - end - - # Converts Markdown to HTML - # @param [String] text input Markdown text - # @return [String] output HTML - # @since 0.6.0 - def html_markup_markdown(text) - # TODO: other libraries might be more complex - provider = markup_class(:markdown) - if provider.to_s == 'RDiscount' - provider.new(text, :autolink).to_html - elsif provider.to_s == 'RedcarpetCompat' - provider.new(text, :autolink, - :fenced_code, - :gh_blockcode, - :lax_spacing, - :tables, - :with_toc_data, - :no_intraemphasis).to_html - else - provider.new(text).to_html - end - end - - # Converts org-mode to HTML - # @param [String] text input org-mode text - # @return [String] output HTML - def html_markup_org(text) - markup_class(:org).new(text).to_html - end - - # Converts Asciidoc to HTML - # @param [String] text input Asciidoc text - # @return [String] output HTML - def html_markup_asciidoc(text) - options = {:attributes => ASCIIDOC_ATTRIBUTES} - markup_class(:asciidoc).convert(text, options) - end - - # Converts Textile to HTML - # @param [String] text the input Textile text - # @return [String] output HTML - # @since 0.6.0 - def html_markup_textile(text) - doc = markup_class(:textile).new(text) - doc.hard_breaks = false if doc.respond_to?(:hard_breaks=) - doc.to_html - end - - # Converts plaintext to strict Textile (hard breaks) - # @param [String] text the input textile data - # @return [String] the output HTML - # @since 0.6.0 - def html_markup_textile_strict(text) - markup_class(:textile).new(text).to_html - end - - # Converts RDoc formatting (SimpleMarkup) to HTML - # @param [String] text the input RDoc formatted text - # @return [String] output HTML - # @since 0.6.0 - def html_markup_rdoc(text) - doc = markup_class(:rdoc).new(text) - doc.from_path = url_for(object) if doc.respond_to?(:from_path=) - doc.to_html - end - - # Converts plaintext to pre-formatted HTML - # @param [String] text the input text - # @return [String] the output HTML - # @since 0.6.0 - def html_markup_pre(text) - "
" + h(text) + "
" - end - - # Converts plaintext to regular HTML - # @param [String] text the input text - # @return [String] the output HTML - # @since 0.6.0 - def html_markup_text(text) - h(text).gsub(/\r?\n/, '
') - end - - # @return [String] the same text with no markup - # @since 0.6.6 - def html_markup_none(text) - h(text) - end - - # Converts HTML to HTML - # @param [String] text input html - # @return [String] output HTML - # @since 0.6.0 - def html_markup_html(text) - text - end - - # Highlights Ruby source. Similar to {#html_syntax_highlight}, but - # this method is meant to be called from {#htmlify} when markup is - # set to "ruby". - # - # @param [String] source the Ruby source - # @return [String] the highlighted HTML - # @since 0.7.0 - def html_markup_ruby(source) - '
' + html_syntax_highlight(source, :ruby) + '
' - end - - # @return [String] HTMLified text as a single line (paragraphs removed) - def htmlify_line(*args) - "
" + htmlify(*args) + "
" - end - - # @group Syntax Highlighting Source Code - - # Syntax highlights +source+ in language +type+. - # - # @note To support a specific language +type+, implement the method - # +html_syntax_highlight_TYPE+ in this class. - # - # @param [String] source the source code to highlight - # @param [Symbol, String] type the language type (:ruby, :plain, etc). Use - # :plain for no syntax highlighting. - # @return [String] the highlighted source - def html_syntax_highlight(source, type = nil) - return "" unless source - return h(source) unless options.highlight - - new_type, source = parse_lang_for_codeblock(source) - type ||= new_type || :ruby - meth = "html_syntax_highlight_#{type}" - respond_to?(meth) ? send(meth, source) : h(source) - end - - # @return [String] unhighlighted source - def html_syntax_highlight_plain(source) - h(source) - end - - # @group Linking Objects and URLs - - # Resolves any text in the form of +{Name}+ to the object specified by - # Name. Also supports link titles in the form +{Name title}+. - # - # @example Linking to an instance method - # resolve_links("{MyClass#method}") # => "MyClass#method" - # @example Linking to a class with a title - # resolve_links("{A::B::C the C class}") # => "the c class" - # @param [String] text the text to resolve links in - # @return [String] HTML with linkified references - def resolve_links(text) - code_tags = 0 - text.gsub(%r{<(/)?(pre|code|tt)|(\\|!)?\{(?!\})(\S+?)(?:\s([^\}]*?\S))?\}(?=[\W<]|.+.*\s*(.*)\Z} - name = $1 - title = $2 - title = nil if title.empty? - end - - name = CGI.unescapeHTML(name) - - if object.is_a?(String) - object - else - link = linkify(name, title) - if (link == name || link == title) && (name + ' ' + link !~ /\A/) - match = /(.+)?(\{#{Regexp.quote name}(?:\s.*?)?\})(.+)?/.match(text) - file = (defined?(@file) && @file ? @file.filename : object.file) || '(unknown)' - line = (defined?(@file) && @file ? 1 : (object.docstring.line_range ? object.docstring.line_range.first : 1)) + (match ? $`.count("\n") : 0) - log.warn "In file `#{file}':#{line}: Cannot resolve link to #{name} from text" + (match ? ":" : ".") + - "\n\t" + (match[1] ? '...' : '') + match[2].delete("\n") + (match[3] ? '...' : '') if match - end - - link - end - end - end - - # (see BaseHelper#link_file) - def link_file(filename, title = nil, anchor = nil) - if CodeObjects::ExtraFileObject === filename - file = filename - else - contents = File.file?(filename) ? nil : '' - file = CodeObjects::ExtraFileObject.new(filename, contents) - end - return title || file.title unless serializer - link_url(url_for_file(file, anchor), title || file.title) - end - - # (see BaseHelper#link_include_file) - def link_include_file(file) - unless file.is_a?(CodeObjects::ExtraFileObject) - file = CodeObjects::ExtraFileObject.new(file) - end - file.attributes[:markup] ||= markup_for_file('', file.filename) - insert_include(file.contents, file.attributes[:markup] || options.markup) - end - - # (see BaseHelper#link_include_object) - def link_include_object(obj) - insert_include(obj.docstring) - end - - # Inserts an include link while respecting inlining - def insert_include(text, markup = options.markup) - htmlify(text, markup).gsub(%r{\A\s*

|

\s*\Z}, '') - end - - # (see BaseHelper#link_object) - def link_object(obj, title = nil, anchor = nil, relative = true) - return title if obj.nil? - obj = Registry.resolve(object, obj, true, true) if obj.is_a?(String) - if title - title = title.to_s - elsif object.is_a?(CodeObjects::Base) - # Check if we're linking to a class method in the current - # object. If we are, create a title in the format of - # "CurrentClass.method_name" - if obj.is_a?(CodeObjects::MethodObject) && obj.scope == :class && obj.parent == object - title = h([object.name, obj.sep, obj.name].join) - elsif obj.title != obj.path - title = h(obj.title) - else - title = h(object.relative_path(obj)) - end - else - title = h(obj.title) - end - return title unless serializer - return title if obj.is_a?(CodeObjects::Proxy) - - link = url_for(obj, anchor, relative) - link = link ? link_url(link, title, :title => h("#{obj.title} (#{obj.type})")) : title - "" + link + "" - rescue Parser::UndocumentableError - log.warn "The namespace of link #{obj.inspect} is a constant or invalid." - title || obj.to_s - end - - # (see BaseHelper#link_url) - def link_url(url, title = nil, params = {}) - title ||= url - title = title.gsub(/[\r\n]/, ' ') - params = SymbolHash.new(false).update( - :href => url, - :title => h(title) - ).update(params) - params[:target] ||= '_parent' if url =~ %r{^(\w+)://} - "#{title}".gsub(/[\r\n]/, ' ') - end - - # @group URL Helpers - - # @param [CodeObjects::Base] object the object to get an anchor for - # @return [String] the anchor for a specific object - def anchor_for(object) - case object - when CodeObjects::MethodObject - "#{object.name}-#{object.scope}_#{object.type}" - when CodeObjects::ClassVariableObject - "#{object.name.to_s.gsub('@@', '')}-#{object.type}" - when CodeObjects::Base - "#{object.name}-#{object.type}" - when CodeObjects::Proxy - object.path - else - object.to_s - end - end - - # Returns the URL for an object. - # - # @param [String, CodeObjects::Base] obj the object (or object path) to link to - # @param [String] anchor the anchor to link to - # @param [Boolean] relative use a relative or absolute link - # @return [String] the URL location of the object - def url_for(obj, anchor = nil, relative = true) - link = nil - return link unless serializer - return link if obj.is_a?(CodeObjects::Base) && run_verifier([obj]).empty? - - if obj.is_a?(CodeObjects::Base) && !obj.is_a?(CodeObjects::NamespaceObject) - # If the obj is not a namespace obj make it the anchor. - anchor = obj - obj = obj.namespace - end - - objpath = serializer.serialized_path(obj) - return link unless objpath - - relative = false if object == Registry.root - if relative - fromobj = object - if object.is_a?(CodeObjects::Base) && - !object.is_a?(CodeObjects::NamespaceObject) - fromobj = owner - end - - from = serializer.serialized_path(fromobj) - link = File.relative_path(from, objpath) - else - link = objpath - end - - link + (anchor ? '#' + urlencode(anchor_for(anchor)) : '') - end - - alias mtime_url url_for - def mtime(_file) nil end - - # Returns the URL for a specific file - # - # @param [String, CodeObjects::ExtraFileObject] filename the filename to link to - # @param [String] anchor optional anchor - # @return [String] the URL pointing to the file - def url_for_file(filename, anchor = nil) - return '' unless serializer - fromobj = object - if CodeObjects::Base === fromobj && !fromobj.is_a?(CodeObjects::NamespaceObject) - fromobj = fromobj.namespace - end - from = serializer.serialized_path(fromobj) - path = filename == options.readme ? - 'index.html' : serializer.serialized_path(filename) - link = File.relative_path(from, path) - link += (anchor ? '#' + urlencode(anchor) : '') - link - end - - # Returns the URL for a list type - # - # @param [String, Symbol] type the list type to generate a URL for - # @return [String] the URL pointing to the list - # @since 0.8.0 - def url_for_list(type) - url_for_file("#{type}_list.html") - end - - # Returns the URL for the frameset page - # - # @return [String] the URL pointing to the frames page - # @since 0.8.0 - def url_for_frameset - url_for_file("frames.html") - end - - # Returns the URL for the main page (README or alphabetic index) - # - # @return [String] the URL pointing to the first main page the - # user should see. - def url_for_main - url_for_file("index.html") - end - - # Returns the URL for the alphabetic index page - # - # @return [String] the URL pointing to the first main page the - # user should see. - def url_for_index - url_for_file("_index.html") - end - - # @group Formatting Objects and Attributes - - # Formats a list of objects and links them - # @return [String] a formatted list of objects - def format_object_name_list(objects) - objects.sort_by {|o| o.name.to_s.downcase }.map do |o| - "" + linkify(o, o.name) + "" - end.join(", ") - end - - # Formats a list of types from a tag. - # - # @param [Array, FalseClass] typelist - # the list of types to be formatted. - # - # @param [Boolean] brackets omits the surrounding - # brackets if +brackets+ is set to +false+. - # - # @return [String] the list of types formatted - # as [Type1, Type2, ...] with the types linked - # to their respective descriptions. - # - def format_types(typelist, brackets = true) - return unless typelist.is_a?(Array) - list = typelist.map do |type| - type = type.gsub(/([<>])/) { h($1) } - type = type.gsub(/([\w:]+)/) { $1 == "lt" || $1 == "gt" ? $1 : linkify($1, $1) } - "" + type + "" - end - list.empty? ? "" : (brackets ? "(#{list.join(", ")})" : list.join(", ")) - end - - # Get the return types for a method signature. - # - # @param [CodeObjects::MethodObject] meth the method object - # @param [Boolean] link whether to link the types - # @return [String] the signature types - # @since 0.5.3 - def signature_types(meth, link = true) - meth = convert_method_to_overload(meth) - if meth.respond_to?(:object) && !meth.has_tag?(:return) - meth = meth.object - end - - type = options.default_return || "" - if meth.tag(:return) && meth.tag(:return).types - types = meth.tags(:return).map {|t| t.types ? t.types : [] }.flatten.uniq - first = link ? h(types.first) : format_types([types.first], false) - if types.size == 2 && types.last == 'nil' - type = first + '?' - elsif types.size == 2 && types.last =~ /^(Array)?<#{Regexp.quote types.first}>$/ - type = first + '+' - elsif types.size > 2 - type = [first, '...'].join(', ') - elsif types == ['void'] && options.hide_void_return - type = "" - else - type = link ? h(types.join(", ")) : format_types(types, false) - end - elsif !type.empty? - type = link ? h(type) : format_types([type], false) - end - type = "#{type} " unless type.empty? - type - end - - # Formats the signature of method +meth+. - # - # @param [CodeObjects::MethodObject] meth the method object to list - # the signature of - # @param [Boolean] link whether to link the method signature to the details view - # @param [Boolean] show_extras whether to show extra meta-data (visibility, attribute info) - # @param [Boolean] full_attr_name whether to show the full attribute name - # ("name=" instead of "name") - # @return [String] the formatted method signature - def signature(meth, link = true, show_extras = true, full_attr_name = true) - meth = convert_method_to_overload(meth) - - type = signature_types(meth, link) - type = "⇒ #{type}" if type && !type.empty? - scope = meth.scope == :class ? "." : "#" - name = full_attr_name ? meth.name : meth.name.to_s.gsub(/^(\w+)=$/, '\1') - blk = format_block(meth) - args = !full_attr_name && meth.writer? ? "" : format_args(meth) - extras = [] - extras_text = '' - if show_extras - rw = meth.attr_info - if rw - attname = [rw[:read] ? 'read' : nil, rw[:write] ? 'write' : nil].compact - attname = attname.size == 1 ? attname.join('') + 'only' : nil - extras << attname if attname - end - extras << meth.visibility if meth.visibility != :public - extras_text = ' (' + extras.join(", ") + ')' unless extras.empty? - end - title = "%s%s%s %s %s" % [scope, h(name), args, blk, type] - if link - if meth.is_a?(YARD::CodeObjects::MethodObject) - link_title = "#{h meth.name(true)} (#{meth.scope} #{meth.type})" - else - link_title = "#{h name} (#{meth.type})" - end - obj = meth.respond_to?(:object) ? meth.object : meth - url = url_for(object, obj) - link_url(url, title, :title => link_title) + extras_text - else - title + extras_text - end - end - - # @group Getting the Character Encoding - - # Returns the current character set. The default value can be overridden - # by setting the +LANG+ environment variable or by overriding this - # method. In Ruby 1.9 you can also modify this value by setting - # +Encoding.default_external+. - # - # @return [String] the current character set - # @since 0.5.4 - def charset - has_encoding = defined?(::Encoding) - if defined?(@file) && @file && has_encoding - lang = @file.contents.encoding.to_s - else - return 'utf-8' unless has_encoding || ENV['LANG'] - lang = - if has_encoding - ::Encoding.default_external.name.downcase - else - ENV['LANG'].downcase.split('.').last - end - end - - case lang - when "ascii-8bit", "us-ascii", "ascii-7bit"; 'iso-8859-1' - when "utf8"; 'utf-8' - else; lang - end - end - - # @endgroup - - private - - # Converts a set of hash options into HTML attributes for a tag - # - # @param [Hash{String => String}] opts the tag options - # @return [String] the tag attributes of an HTML tag - def tag_attrs(opts = {}) - opts.sort_by {|k, _v| k.to_s }.map {|k, v| "#{k}=#{v.to_s.inspect}" if v }.join(" ") - end - - # Converts a {CodeObjects::MethodObject} into an overload object - # @since 0.5.3 - def convert_method_to_overload(meth) - # use first overload tag if it has a return type and method itself does not - if !meth.tag(:return) && meth.tags(:overload).size == 1 && meth.tag(:overload).tag(:return) - return meth.tag(:overload) - end - meth - end - - # Parses !!!lang out of codeblock, returning the codeblock language - # followed by the source code. - # - # @param [String] source the source code whose language to determine - # @return [Array(String, String)] the language, if any, and the - # remaining source - # @since 0.7.5 - def parse_lang_for_codeblock(source) - type = nil - if source =~ /\A(?:[ \t]*\r?\n)?[ \t]*!!!([\w.+-]+)[ \t]*\r?\n/ - type = $1 - source = $' - end - - [type, source] - end - - # Parses code blocks out of html and performs syntax highlighting - # on code inside of the blocks. - # - # @param [String] html the html to search for code in - # @return [String] highlighted html - # @see #html_syntax_highlight - def parse_codeblocks(html) - html.gsub(%r{(?:\s*)?(.+?)(?:\s*)?}m) do - string = $3 - - # handle !!!LANG prefix to send to html_syntax_highlight_LANG - language, = parse_lang_for_codeblock(string) - language ||= detect_lang_in_codeblock_attributes($1, $2) - language ||= object.source_type - - if options.highlight - string = html_syntax_highlight(CGI.unescapeHTML(string), language) - end - classes = ['code', language].compact.join(' ') - %(
#{string}
) - end - end - - # Parses code block's HTML attributes in order to detect the programming - # language of what's enclosed in that code block. - # - # @param [String, nil] pre_html_attrs HTML attribute list of +pre+ element - # @param [String, nil] code_html_attrs HTML attribute list of +code+ - # element - # @return [String, nil] detected programming language - def detect_lang_in_codeblock_attributes(pre_html_attrs, code_html_attrs) - detected = nil - detected ||= (/\bdata-lang="(.+?)"/ =~ code_html_attrs && $1) - detected ||= (/\blang="(.+?)"/ =~ pre_html_attrs && $1) - detected ||= (/\bclass="(.+?)"/ =~ code_html_attrs && $1) - detected - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/html_syntax_highlight_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/html_syntax_highlight_helper.rb deleted file mode 100644 index 07ab9be797..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +++ /dev/null @@ -1,78 +0,0 @@ -# frozen_string_literal: true -module YARD - module Templates - module Helpers - # Helper methods for syntax highlighting. - module HtmlSyntaxHighlightHelper - include ModuleHelper - - # Highlights Ruby source - # @param [String] source the Ruby source code - # @return [String] the highlighted Ruby source - def html_syntax_highlight_ruby(source) - if Parser::SourceParser.parser_type == :ruby - html_syntax_highlight_ruby_ripper(source) - else - html_syntax_highlight_ruby_legacy(source) - end - end - - private - - def html_syntax_highlight_ruby_ripper(source) - resolver = Parser::Ruby::TokenResolver.new(source, object) - output = String.new("") - resolver.each do |s, token_obj| - token_obj = clean_token_object(token_obj) - output << "" if [:tstring_beg, :regexp_beg].include?(s[0]) - case s.first - when :nl, :ignored_nl, :sp - output << h(s[1]) - when :ident, :const - klass = s.first == :ident ? "id identifier rubyid_#{h(s[1])}" : s.first - val = token_obj ? link_object(token_obj, s[1]) : h(s[1]) - output << "#{val}" - else - output << "#{h(s[1])}" - end - output << "" if [:tstring_end, :regexp_end].include?(s[0]) - end - output - rescue Parser::ParserSyntaxError - source =~ /^#{prettyval}" - else - "#{h s.text}" - end - end.join - end - - def clean_token_object(token_obj) - return unless token_obj - if token_obj == object - token_obj = nil - elsif token_obj.is_a?(CodeObjects::MethodObject) - token_obj = prune_method_listing([token_obj], false).first - else - token_obj = run_verifier([token_obj]).first - end - - token_obj - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/markup/rdoc_markdown.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/markup/rdoc_markdown.rb deleted file mode 100644 index 03f9645fbc..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/markup/rdoc_markdown.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true -module YARD - module Templates - module Helpers - module Markup - begin require 'rdoc'; rescue LoadError; nil end - begin - require 'rdoc/markdown' - rescue LoadError - raise NameError, "could not load RDoc Markdown support (rdoc is too old)" - end - - class RDocMarkdown < RDocMarkup - def initialize(text) - super RDoc::Markdown.new.parse(text) - end - - def fix_typewriter(html) html end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/markup/rdoc_markup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/markup/rdoc_markup.rb deleted file mode 100644 index 764d41fa5b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/markup/rdoc_markup.rb +++ /dev/null @@ -1,110 +0,0 @@ -# frozen_string_literal: true -require 'thread' - -module YARD - module Templates - module Helpers - module Markup - begin require 'rdoc'; rescue LoadError; nil end - begin - require 'rdoc/markup' - require 'rdoc/markup/to_html' - class RDocMarkup; MARKUP = RDoc::Markup end - class RDocMarkupToHtml < RDoc::Markup::ToHtml - if defined?(RDoc::VERSION) && RDoc::VERSION >= '4.0.0' && - defined?(RDoc::Options) - def initialize - options = RDoc::Options.new - options.pipe = true - super(options) - end - end - end - rescue LoadError - begin - require 'rdoc/markup/simple_markup' - require 'rdoc/markup/simple_markup/to_html' - class RDocMarkup; MARKUP = SM::SimpleMarkup end - class RDocMarkupToHtml < SM::ToHtml; end - rescue LoadError - raise NameError, "could not load RDocMarkup (rdoc is not installed)" - end - end - - class RDocMarkup - attr_accessor :from_path - - @@mutex = Mutex.new - @@formatter = nil - @@markup = nil - - def initialize(text) - @text = text - - @@mutex.synchronize do - @@formatter ||= RDocMarkupToHtml.new - @@markup ||= MARKUP.new - end - end - - def to_html - html = nil - @@mutex.synchronize do - @@formatter.from_path = from_path - html = @@markup.convert(@text, @@formatter) - end - html = fix_dash_dash(html) - html = fix_typewriter(html) - html - end - - private - - # Fixes RDoc behaviour with ++ only supporting alphanumeric text. - # - # @todo Refactor into own SimpleMarkup subclass - def fix_typewriter(text) - code_tags = 0 - text.gsub(%r{<(/)?(pre|code|tt)|(\s|^|>)\+(?! )([^\n\+]{1,900})(?! )\+}) do |str| - closed = $1 - tag = $2 - first_text = $3 - type_text = $4 - - if tag - code_tags += (closed ? -1 : 1) - next str - end - next str unless code_tags == 0 - first_text + '' + type_text + '' - end - end - - # Don't allow -- to turn into — element. The chances of this being - # some --option is far more likely than the typographical meaning. - # - # @todo Refactor into own SimpleMarkup subclass - def fix_dash_dash(text) - text.gsub(/—(?=\S)/, '--') - end - end - - class RDocMarkupToHtml - attr_accessor :from_path - - # Disable auto-link of URLs - def handle_special_HYPERLINK(special) # rubocop:disable Style/MethodName - @hyperlink ? special.text : super - end - - def accept_paragraph(*args) - par = args.last - text = par.respond_to?(:txt) ? par.txt : par.text - @hyperlink = text =~ /\{(https?:|mailto:|link:|www\.)/ ? true : false - super - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/markup_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/markup_helper.rb deleted file mode 100644 index 58f884a03b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/markup_helper.rb +++ /dev/null @@ -1,172 +0,0 @@ -# frozen_string_literal: true -require 'rubygems' - -module YARD - module Templates::Helpers - # Helper methods for loading and managing markup types. - module MarkupHelper - class << self - # Clears the markup provider cache information. Mainly used for testing. - # @return [void] - def clear_markup_cache - self.markup_cache = {} - end - - # @return [Hash{Symbol=>{(:provider,:class)=>Object}}] the cached markup providers - # @private - # @since 0.6.4 - attr_accessor :markup_cache - end - - MarkupHelper.clear_markup_cache - - # The default list of markup providers for each markup type - MARKUP_PROVIDERS = { - :markdown => [ - {:lib => :redcarpet, :const => 'RedcarpetCompat'}, - {:lib => :rdiscount, :const => 'RDiscount'}, - {:lib => :kramdown, :const => 'Kramdown::Document'}, - {:lib => :bluecloth, :const => 'BlueCloth'}, - {:lib => :maruku, :const => 'Maruku'}, - {:lib => :'rpeg-markdown', :const => 'PEGMarkdown'}, - {:lib => :rdoc, :const => 'YARD::Templates::Helpers::Markup::RDocMarkdown'} - ], - :textile => [ - {:lib => :redcloth, :const => 'RedCloth'} - ], - :textile_strict => [ - {:lib => :redcloth, :const => 'RedCloth'} - ], - :rdoc => [ - {:lib => nil, :const => 'YARD::Templates::Helpers::Markup::RDocMarkup'} - ], - :org => [ - {:lib => :'org-ruby', :const => 'Orgmode::Parser'} - ], - :asciidoc => [ - {:lib => :asciidoctor, :const => 'Asciidoctor'} - ], - :ruby => [], - :text => [], - :pre => [], - :html => [], - :none => [] - } - - # Returns a list of extensions for various markup types. To register - # extensions for a type, add them to the array of extensions for the - # type. - # @since 0.6.0 - MARKUP_EXTENSIONS = { - :html => ['htm', 'html', 'shtml'], - :text => ['txt'], - :textile => ['textile', 'txtile'], - :asciidoc => ['asciidoc', 'ad', 'adoc', 'asc'], - :markdown => ['markdown', 'md', 'mdown', 'mkd'], - :rdoc => ['rdoc'], - :org => ['org'], - :ruby => ['rb', 'ru'] - } - - # Contains the Regexp object that matches the shebang line of extra - # files to detect the markup type. - MARKUP_FILE_SHEBANG = /\A#!(\S+)\s*$/ - - # Attempts to load the first valid markup provider in {MARKUP_PROVIDERS}. - # If a provider is specified, immediately try to load it. - # - # On success this sets `@markup_provider` and `@markup_class` to - # the provider name and library constant class/module respectively for - # the loaded provider. - # - # On failure this method will inform the user that no provider could be - # found and exit the program. - # - # @return [Boolean] whether the markup provider was successfully loaded. - def load_markup_provider(type = options.markup) - return true if MarkupHelper.markup_cache[type] - MarkupHelper.markup_cache[type] ||= {} - - providers = MARKUP_PROVIDERS[type.to_sym] - return true if providers && providers.empty? - if providers && options.markup_provider - providers = providers.select {|p| p[:lib] == options.markup_provider } - end - - if providers.nil? || providers.empty? - log.error "Invalid markup type '#{type}' or markup provider " \ - "(#{options.markup_provider}) is not registered." - return false - end - - # Search for provider, return the library class name as const if found - providers.each do |provider| - begin require provider[:lib].to_s; rescue LoadError; next end if provider[:lib] - begin klass = eval("::" + provider[:const]); rescue NameError; next end # rubocop:disable Lint/Eval - MarkupHelper.markup_cache[type][:provider] = provider[:lib] # Cache the provider - MarkupHelper.markup_cache[type][:class] = klass - return true - end - - # Show error message telling user to install first potential provider - lib = providers.first[:lib] || type - log.error "Missing '#{lib}' gem for #{type.to_s.capitalize} formatting. Install it with `gem install #{lib}`" - false - end - - # Checks for a shebang or looks at the file extension to determine - # the markup type for the file contents. File extensions are registered - # for a markup type in {MARKUP_EXTENSIONS}. - # - # A shebang should be on the first line of a file and be in the form: - # - # #!markup_type - # - # Standard markup types are text, html, rdoc, markdown, textile - # - # @param [String] contents Unused. Was necessary prior to 0.7.0. - # Newer versions of YARD use {CodeObjects::ExtraFileObject#contents} - # @return [Symbol] the markup type recognized for the file - # @see MARKUP_EXTENSIONS - # @since 0.6.0 - def markup_for_file(contents, filename) - return $1.to_sym if contents && contents =~ MARKUP_FILE_SHEBANG # Shebang support - - ext = (File.extname(filename)[1..-1] || '').downcase - MARKUP_EXTENSIONS.each do |type, exts| - return type if exts.include?(ext) - end - options.markup - end - - # Strips any shebang lines on the file contents that pertain to - # markup or preprocessing data. - # - # @deprecated Use {CodeObjects::ExtraFileObject#contents} instead - # @return [String] the file contents minus any preprocessing tags - # @since 0.6.0 - def markup_file_contents(contents) - contents =~ MARKUP_FILE_SHEBANG ? $' : contents - end - - # Gets the markup provider class/module constant for a markup type - # Call {#load_markup_provider} before using this method. - # - # @param [Symbol] type the markup type (:rdoc, :markdown, etc.) - # @return [Class] the markup class - def markup_class(type = options.markup) - load_markup_provider(type) - MarkupHelper.markup_cache[type][:class] - end - - # Gets the markup provider name for a markup type - # Call {#load_markup_provider} before using this method. - # - # @param [Symbol] type the markup type (:rdoc, :markdown, etc.) - # @return [Symbol] the markup provider name (usually the gem name of the library) - def markup_provider(type = options.markup) - MarkupHelper.markup_cache[type][:provider] - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/method_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/method_helper.rb deleted file mode 100644 index 2bae466029..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/method_helper.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: true -module YARD - module Templates::Helpers - # Helper methods for method objects. - module MethodHelper - # @return [String] formatted arguments for a method - def format_args(object) - return if object.parameters.nil? - params = object.parameters - if object.has_tag?(:yield) || object.has_tag?(:yieldparam) - params.reject! do |param| - param[0].to_s[0, 1] == "&" && - !object.tags(:param).any? {|t| t.name == param[0][1..-1] } - end - end - - if params.empty? - "" - else - args = params.map do |n, v| - v ? "#{n}#{n[-1, 1] == ':' ? '' : ' ='} #{v}" : n.to_s - end.join(", ") - h("(#{args})") - end - end - - # @return [String] formatted and linked return types for a method - def format_return_types(object) - return unless object.has_tag?(:return) && object.tag(:return).types - return if object.tag(:return).types.empty? - format_types [object.tag(:return).types.first], false - end - - # @return [String] formatted block if one exists - def format_block(object) - if object.has_tag?(:yield) && object.tag(:yield).types - params = object.tag(:yield).types - elsif object.has_tag?(:yieldparam) - params = object.tags(:yieldparam).map(&:name) - elsif object.has_tag?(:yield) - return "{ ... }" - else - params = nil - end - - params ? h("{|" + params.join(", ") + "| ... }") : "" - end - - # @return [String] formats line numbers for source code of an object - def format_lines(object) - return "" if object.source.nil? || object.line.nil? - i = -1 - object.source.split(/\n/).map { object.line + (i += 1) }.join("\n") - end - - # @return [String] formats source of an object - def format_code(object, _show_lines = false) - i = -1 - lines = object.source.split(/\n/) - longestline = (object.line + lines.size).to_s.length - lines.map do |line| - lineno = object.line + (i += 1) - (" " * (longestline - lineno.to_s.length)) + lineno.to_s + " " + line - end.join("\n") - end - - # @return [String] formats source code of a constant value - def format_constant(value) - sp = value.split("\n").last[/^(\s+)/, 1] - num = sp ? sp.size : 0 - html_syntax_highlight value.gsub(/^\s{#{num}}/, '') - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/module_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/module_helper.rb deleted file mode 100644 index e464b9459a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/module_helper.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true -module YARD - module Templates - module Helpers - # Helper methods for managing module objects. - module ModuleHelper - # Prunes the method listing by running the verifier and removing attributes/aliases - # @param [Array] list a list of methods - # @param [Boolean] hide_attributes whether to prune attribute methods from the list - # @return [Array] a pruned list of methods - def prune_method_listing(list, hide_attributes = true) - list = run_verifier(list) - list = list.reject {|o| run_verifier([o.parent]).empty? } - list = list.reject {|o| o.is_alias? unless CodeObjects::Proxy === o.namespace } - list = list.reject {|o| o.is_attribute? unless CodeObjects::Proxy === o.namespace } if hide_attributes - list - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/text_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/text_helper.rb deleted file mode 100644 index 7d829afdaa..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/text_helper.rb +++ /dev/null @@ -1,112 +0,0 @@ -# frozen_string_literal: true -module YARD - module Templates - module Helpers - # Helper methods for text template formats. - module TextHelper - # @return [String] escapes text - def h(text) - out = String.new("") - text = resolve_links(text) - text = text.split(/\n/) - text.each_with_index do |line, i| - out << - case line - when /^\s*$/; "\n\n" - when /^\s+\S/, /^=/; line + "\n" - else; line + (text[i + 1] =~ /^\s+\S/ ? "\n" : " ") - end - end - out - end - - # @return [String] wraps text at +col+ columns. - def wrap(text, col = 72) - text.gsub(/(.{1,#{col}})( +|$\n?)|(.{1,#{col}})/, "\\1\\3\n") - end - - # @return [String] indents +text+ by +len+ characters. - def indent(text, len = 4) - text.gsub(/^/, ' ' * len) - end - - # @return [String] aligns a title to the right - def title_align_right(text, col = 72) - align_right(text, '-', col) - end - - # @return [String] aligns text to the right - def align_right(text, spacer = ' ', col = 72) - text = text[0, col - 4] + '...' if (col - 1 - text.length) < 0 - spacer * (col - 1 - text.length) + " " + text - end - - # @return [String] returns a horizontal rule for output - def hr(col = 72, sep = "-") - sep * col - end - - # @return [String] the formatted signature for a method - def signature(meth) - # use first overload tag if it has a return type and method itself does not - if !meth.tag(:return) && meth.tag(:overload) && meth.tag(:overload).tag(:return) - meth = meth.tag(:overload) - end - - type = options.default_return || "" - rmeth = meth - if !rmeth.has_tag?(:return) && rmeth.respond_to?(:object) - rmeth = meth.object - end - if rmeth.tag(:return) && rmeth.tag(:return).types - types = rmeth.tags(:return).map {|t| t.types ? t.types : [] }.flatten.uniq - first = types.first - if types.size == 2 && types.last == 'nil' - type = first + '?' - elsif types.size == 2 && types.last =~ /^(Array)?<#{Regexp.quote types.first}>$/ - type = first + '+' - elsif types.size > 2 - type = [first, '...'].join(', ') - elsif types == ['void'] && options.hide_void_return - type = "" - else - type = types.join(", ") - end - end - type = "(#{type})" if type.include?(',') - type = " -> #{type} " unless type.empty? - scope = meth.scope == :class ? "#{meth.namespace.name}." : "#{meth.namespace.name.to_s.downcase}." - name = meth.name - blk = format_block(meth) - args = format_args(meth) - extras = [] - extras_text = '' - rw = meth.namespace.attributes[meth.scope][meth.name] - if rw - attname = [rw[:read] ? 'read' : nil, rw[:write] ? 'write' : nil].compact - attname = attname.size == 1 ? attname.join('') + 'only' : nil - extras << attname if attname - end - extras << meth.visibility if meth.visibility != :public - extras_text = '(' + extras.join(", ") + ')' unless extras.empty? - title = "%s%s%s %s%s%s" % [scope, name, args, blk, type, extras_text] - title.gsub(/\s+/, ' ') - end - - private - - def resolve_links(text) - text.gsub(/(\\|!)?\{(?!\})(\S+?)(?:\s([^\}]*?\S))?\}(?=[\W]|$)/m) do |_str| - escape = $1 - name = $2 - title = $3 - match = $& - next(match[1..-1]) if escape - next(match) if name[0, 1] == '|' - linkify(name, title) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/uml_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/uml_helper.rb deleted file mode 100644 index a295ace174..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/helpers/uml_helper.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true -module YARD - module Templates::Helpers - # Helpers for UML template format - module UMLHelper - # Official UML visibility prefix syntax for an object given its visibility - # @param [CodeObjects::Base] object the object to retrieve visibility for - # @return [String] the UML visibility prefix - def uml_visibility(object) - case object.visibility - when :public; '+' - when :protected; '#' - when :private; '-' - end - end - - # Formats the path of an object for Graphviz syntax - # @param [CodeObjects::Base] object an object to format the path of - # @return [String] the encoded path - def format_path(object) - object.path.gsub('::', '_') - end - - # Encodes text in escaped Graphviz syntax - # @param [String] text text to encode - # @return [String] the encoded text - def h(text) - text.to_s.gsub(/(\W)/, '\\\\\1') - end - - # Tidies data by formatting and indenting text - # @param [String] data pre-formatted text - # @return [String] tidied text. - def tidy(data) - indent = 0 - data.split(/\n/).map do |line| - line.gsub!(/^\s*/, '') - next if line.empty? - indent -= 1 if line =~ /^\s*\}\s*$/ - line = (' ' * (indent * 2)) + line - indent += 1 if line =~ /\{\s*$/ - line - end.compact.join("\n") + "\n" - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/section.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/section.rb deleted file mode 100644 index ca42adddc7..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/section.rb +++ /dev/null @@ -1,103 +0,0 @@ -# frozen_string_literal: true -module YARD - module Templates - # Abstracts the structure for a section and its subsections into an ordered - # list of sections and subsections. - # @since 0.6.0 - class Section < Array - attr_accessor :name - - def initialize(name, *args) - self.name = name - replace(parse_sections(args)) - end - - def dup - obj = super - obj.name = name - obj - end - - def [](*args) - if args.first.is_a?(Range) || args.size > 1 - return self.class.new(name, *super(*args)) - elsif args.first.is_a?(Integer) - return super(*args) - end - find {|o| o.name == args.first } - end - - def eql?(other) - super(other) && name == other.name - end - - def ==(other) - case other - when Section - eql?(other) - when Array - to_a == other - else - name == other - end - end - - def push(*args) - super(*parse_sections(args)) - end - alias << push - - def unshift(*args) - super(*parse_sections(args)) - end - - def inspect - n = name.respond_to?(:path) ? "T('#{name.path}')" : name.inspect - subsects = empty? ? "" : ", subsections=#{super}" - "Section(#{n}#{subsects})" - end - - def place(*args) - super(*parse_sections(args)) - end - - def to_a - list = [name] - unless empty? - subsects = [] - each {|s| subsects += s.to_a } - list << subsects - end - list - end - - def any(item) - find do |section| - return section if section == item - return section.any(item) unless section.empty? - end - nil - end - - private - - def parse_sections(args) - if args.size == 1 && args.first.is_a?(Array) && !args.first.is_a?(Section) - args = args.first - end - sections = [] - args.each_with_index do |name, index| - case name - when Section; sections << name - when Array; next - else - subsections = args[index + 1].is_a?(Array) ? args[index + 1] : [] - subsections = [] if subsections.is_a?(Section) - sections << Section.new(name, subsections) - end - end - sections - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/template.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/template.rb deleted file mode 100644 index 975be87c54..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/template.rb +++ /dev/null @@ -1,418 +0,0 @@ -# frozen_string_literal: true -require 'erb' - -module YARD - module Templates - module Template - attr_accessor :class, :section - attr_reader :options - - class << self - # Extra includes are mixins that are included after a template is created. These - # mixins can be registered by plugins to operate on templates and override behaviour. - # - # Note that this array can be filled with modules or proc objects. If a proc object - # is given, the proc will be called with the {Template#options} hash containing - # relevant template information like the object, format, and more. The proc should - # return a module or nil if there is none. - # - # @example Adding in extra mixins to include on a template - # Template.extra_includes << MyHelper - # @example Conditionally including a mixin if the format is html - # Template.extra_includes << proc {|opts| MyHelper if opts.format == :html } - # @return [Array] a list of modules to be automatically included - # into any new template module - attr_accessor :extra_includes - - # @!parse extend ClassMethods - # @private - def included(klass) - klass.extend(ClassMethods) - end - - # Includes the {extra_includes} modules into the template object. - # - # @param [Template] template the template object to mixin the extra includes. - # @param [SymbolHash] options the options hash containing all template information - # @return [void] - def include_extra(template, options) - extra_includes.each do |mod| - mod = mod.call(options) if mod.is_a?(Proc) - next unless mod.is_a?(Module) - template.extend(mod) - end - end - end - - self.extra_includes = [ - proc do |options| - {:html => Helpers::HtmlHelper, - :text => Helpers::TextHelper, - :dot => Helpers::UMLHelper}[options.format] - end - ] - - include ErbCache - include Helpers::BaseHelper - include Helpers::MethodHelper - - module ClassMethods - attr_accessor :path, :full_path - - # @return [Array] a list of full paths - # @note This method caches path results. Paths should not be modified - # after this method is called; call {#reset_full_paths} to reset cache. - def full_paths - reset_full_paths unless defined? @cached_included_modules - return @full_paths if included_modules == @cached_included_modules - - @cached_included_modules = included_modules - @full_paths = included_modules.inject([full_path]) do |paths, mod| - paths |= mod.full_paths if mod.respond_to?(:full_paths) - paths - end - end - - # Resets cache for {#full_paths} - def reset_full_paths - @cached_included_modules = nil - end - - def initialize(path, full_paths) - full_path = full_paths.shift - self.path = path - self.full_path = full_path - include_inherited(full_paths) - include_parent - load_setup_rb - end - - # Searches for a file identified by +basename+ in the template's - # path as well as any mixed in template paths. Equivalent to calling - # {ClassMethods#find_nth_file} with index of 1. - # - # @param [String] basename the filename to search for - # @return [String] the full path of a file on disk with filename - # +basename+ in one of the template's paths. - # @see find_nth_file - def find_file(basename) - find_nth_file(basename) - end - - # Searches for the nth file (where n = +index+) identified - # by basename in the template's path and any mixed in template paths. - # - # @param [String] basename the filename to search for - # @param [Fixnum] index the nth existing file to return - # @return [String] the full path of the nth file on disk with - # filename +basename+ in one of the template paths - def find_nth_file(basename, index = 1) - n = 1 - full_paths.each do |path| - file = File.join(path, basename) - if File.file?(file) - return file if index == n - n += 1 - end - end - - nil - end - - def is_a?(klass) - return true if klass == Template - super(klass) - end - - # Creates a new template object to be rendered with {Template#run} - def new(*args) - obj = Object.new.extend(self) - obj.class = self - obj.send(:initialize, *args) - obj - end - - def run(*args) - new(*args).run - end - - # rubocop:disable Style/MethodName - - # Alias for creating {Engine.template}. - def T(*path) - Engine.template(*path) - end - - # Alias for creating a {Section} with arguments - # @see Section#initialize - # @since 0.6.0 - def S(*args) - Section.new(*args) - end - - # rubocop:enable Style/MethodName - - private - - def include_parent - pc = path.to_s.split('/') - if pc.size > 1 - pc.pop - pc = pc.join('/') - begin - include Engine.template(pc) - rescue ArgumentError - include Engine.template!(pc, full_path.gsub(%r{/[^/]+$}, '')) - end - end - end - - def include_inherited(full_paths) - full_paths.reverse.each do |full_path| - include Engine.template!(path, full_path) - end - end - - def load_setup_rb - setup_file = File.join(full_path, 'setup.rb') - if File.file? setup_file - module_eval(File.read(setup_file).taint, setup_file, 1) - end - end - end - - def initialize(opts = TemplateOptions.new) - opts_class = opts.class - opts_class = TemplateOptions if opts_class == Hash - @cache = {} - @cache_filename = {} - @sections = [] - @options = opts_class.new - add_options(opts) - Template.include_extra(self, options) - init - end - - # Loads a template specified by path. If +:template+ or +:format+ is - # specified in the {#options} hash, they are prepended and appended - # to the path respectively. - # - # @param [Array] path the path of the template - # @return [Template] the loaded template module - def T(*path) # rubocop:disable Style/MethodName - path.unshift(options.template) if options.template - path.push(options.format) if options.format - self.class.T(*path) - end - - # Sets the sections (and subsections) to be rendered for the template - # - # @example Sets a set of erb sections - # sections :a, :b, :c # searches for a.erb, b.erb, c.erb - # @example Sets a set of method and erb sections - # sections :a, :b, :c # a is a method, the rest are erb files - # @example Sections with subsections - # sections :header, [:name, :children] - # # the above will call header.erb and only renders the subsections - # # if they are yielded by the template (see #yieldall) - # @param [Array] args the sections - # to use to render the template. For symbols and strings, the - # section will be executed as a method (if one exists), or rendered - # from the file "name.erb" where name is the section name. For - # templates, they will have {Template::ClassMethods#run} called on them. - # Any subsections can be yielded to using yield or {#yieldall} - def sections(*args) - @sections = Section.new(nil, *args) unless args.empty? - @sections - end - - # Initialization called on the template. Override this in a 'setup.rb' - # file in the template's path to implement a template - # - # @example A default set of sections - # def init - # sections :section1, :section2, [:subsection1, :etc] - # end - # @see #sections - def init - end - - # Runs a template on +sects+ using extra options. This method should - # not be called directly. Instead, call the class method {ClassMethods#run} - # - # @param [Hash, nil] opts any extra options to apply to sections - # @param [Section, Array] sects a section list of sections to render - # @param [Fixnum] start_at the index in the section list to start from - # @param [Boolean] break_first if true, renders only the first section - # @yield [opts] calls for the subsections to be rendered - # @yieldparam [Hash] opts any extra options to yield - # @return [String] the rendered sections joined together - def run(opts = nil, sects = sections, start_at = 0, break_first = false, &block) - out = String.new("") - return out if sects.nil? - sects = sects[start_at..-1] if start_at > 0 - sects = Section.new(nil, sects) unless sects.is_a?(Section) - add_options(opts) do - sects.each do |s| - self.section = s - subsection_index = 0 - value = render_section(section) do |*args| - value = with_section do - run(args.first, section, subsection_index, true, &block) - end - subsection_index += 1 - value - end - out << (value || "") - break if break_first - end - end - out - end - - # Yields all subsections with any extra options - # - # @param [Hash] opts extra options to be applied to subsections - def yieldall(opts = nil, &block) - with_section { run(opts, section, &block) } - end - - # @param [String, Symbol] section the section name - # @yield calls subsections to be rendered - # @return [String] the contents of the ERB rendered section - def erb(section, &block) - method_name = ErbCache.method_for(cache_filename(section)) do - erb_with(cache(section), cache_filename(section)) - end - send(method_name, &block) - end - - # Returns the contents of a file. If +allow_inherited+ is set to +true+, - # use +{{{__super__}}}+ inside the file contents to insert the contents - # of the file from an inherited template. For instance, if +templates/b+ - # inherits from +templates/a+ and file "test.css" exists in both directories, - # both file contents can be retrieved by having +templates/b/test.css+ look - # like: - # - # {{{__super__}}} - # ... - # body { css styles here } - # p.class { other styles } - # - # @param [String] basename the name of the file - # @param [Boolean] allow_inherited whether inherited templates can - # be inserted with +{{{__super__}}}+ - # @return [String] the contents of a file identified by +basename+. All - # template paths (including any mixed in templates) are searched for - # the file - # @see ClassMethods#find_file - # @see ClassMethods#find_nth_file - def file(basename, allow_inherited = false) - file = self.class.find_file(basename) - raise ArgumentError, "no file for '#{basename}' in #{self.class.path}" unless file - - data = IO.read(file) - if allow_inherited - superfile = self.class.find_nth_file(basename, 2) - data.gsub!('{{{__super__}}}', superfile ? IO.read(superfile) : "") - end - - data - end - - # Calls the ERB file from the last inherited template with {#section}.erb - # - # @param [Symbol, String] sect if provided, uses a specific section name - # @return [String] the rendered ERB file in any of the inherited template - # paths. - def superb(sect = section, &block) - filename = self.class.find_nth_file(erb_file_for(sect), 2) - return "" unless filename - method_name = ErbCache.method_for(filename) { erb_with(IO.read(filename), filename) } - send(method_name, &block) - end - - def options=(value) - @options = value - set_ivars - end - - def inspect - "Template(#{self.class.path}) [section=#{section.name}]" - end - - protected - - def erb_file_for(section) - "#{section}.erb" - end - - def erb_with(content, filename = nil) - erb = if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+ - ERB.new(content, :trim_mode => options.format == :text ? '<>' : nil) - else - ERB.new(content, nil, options.format == :text ? '<>' : nil) - end - erb.filename = filename if filename - erb - end - - private - - def render_section(section, &block) - section = section.name if section.is_a?(Section) - case section - when Section, String, Symbol - if respond_to?(section) - send(section, &block) - else - erb(section, &block) - end - when Module, Template - section.run(options, &block) if section.is_a?(Template) - end || "" - end - - def cache(section) - content = @cache[section.to_sym] - return content if content - - file = cache_filename(section) - @cache_filename[section.to_sym] = file - raise ArgumentError, "no template for section '#{section}' in #{self.class.path}" unless file - @cache[section.to_sym] = IO.read(file) - end - - def cache_filename(section) - @cache_filename[section.to_sym] ||= - self.class.find_file(erb_file_for(section)) - end - - def set_ivars - options.each do |k, v| - instance_variable_set("@#{k}", v) - end - end - - def add_options(opts = nil) - return(yield) if opts.nil? && block_given? - cur_opts = options if block_given? - - self.options = options.merge(opts) - - if block_given? - value = yield - self.options = cur_opts - value - end - end - - def with_section - sect = section - value = yield - self.section = sect - value - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/template_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/template_options.rb deleted file mode 100644 index 98cee34587..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/templates/template_options.rb +++ /dev/null @@ -1,92 +0,0 @@ -# frozen_string_literal: true -require 'ostruct' - -module YARD - module Templates - # An Options class containing default options for base template rendering. For - # options specific to generation of HTML output, see {CLI::YardocOptions}. - # - # @see CLI::YardocOptions - class TemplateOptions < YARD::Options - # @return [Symbol] the template output format - default_attr :format, :text - - # @return [Symbol] the template name used to render output - default_attr :template, :default - - # @return [Symbol] the markup format to use when parsing docstrings - default_attr :markup, :rdoc # default is :rdoc but falls back on :none - - # @return [String] the default return type for a method with no return tags - default_attr :default_return, "Object" - - # @return [Boolean] whether void methods should show "void" in their signature - default_attr :hide_void_return, false - - # @return [Boolean] whether code blocks should be syntax highlighted - default_attr :highlight, true - - # @return [Class] the markup provider class for the markup format - attr_accessor :markup_provider - - # @return [OpenStruct] an open struct containing any global state across all - # generated objects in a template. - default_attr :globals, lambda { OpenStruct.new } - alias __globals globals - - # @return [CodeObjects::Base] the main object being generated in the template - attr_accessor :object - - # @return [CodeObjects::Base] the owner of the generated object - attr_accessor :owner - - # @return [Symbol] the template type used to generate output - attr_accessor :type - - # @return [Boolean] whether serialization should be performed - default_attr :serialize, true - - # @return [Serializers::Base] the serializer used to generate links and serialize - # output. Serialization output only occurs if {#serialize} is +true+. - attr_accessor :serializer - - # @deprecated use {#highlight} instead. - # @return [Boolean] whether highlighting should be ignored - attr_reader :no_highlight - undef no_highlight - def no_highlight; !highlight end - def no_highlight=(value) self.highlight = !value end - - # @return [String] the title of a given page - attr_accessor :page_title - - # @return [Boolean] whether the page is the "index" - attr_accessor :index - - # @example A list of mixin path names (including wildcards) - # opts.embed_mixins #=> ['ClassMethods', '*Helper', 'YARD::*'] - # @return [Array] an array of module name wildcards to embed into - # class documentation as if their methods were defined directly in the class. - # Useful for modules like ClassMethods. If the name contains '::', the module - # is matched against the full mixin path, otherwise only the module name is used. - default_attr :embed_mixins, lambda { [] } - - # @param [CodeObjects::Base] mixin accepts any code object, but returns - # nil unless the object is a module. - # @return [Boolean] whether a mixin matches the embed_mixins list - # @return [nil] if the mixin is not a module object - def embed_mixins_match?(mixin) - return true if mixin == object # the method is not inherited - return nil unless mixin.is_a?(CodeObjects::ModuleObject) - embed_mixins.any? do |embed_mixin| - re = /\A#{Regexp.quote(embed_mixin).gsub('\*', '.*')}\Z/ - matchstr = embed_mixin.include?("::") ? mixin.path : mixin.name - re.match(matchstr.to_s) - end - end - - # @return [Verifier] the verifier object - attr_accessor :verifier - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/verifier.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/verifier.rb deleted file mode 100644 index 37d45129f0..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/verifier.rb +++ /dev/null @@ -1,151 +0,0 @@ -# frozen_string_literal: true -module YARD - # Similar to a Proc, but runs a set of Ruby expressions using a small - # DSL to make tag lookups easier. - # - # The syntax is as follows: - # * All syntax is Ruby compatible - # * +object+ (+o+ for short) exist to access the object being verified - # * +@TAGNAME+ is translated into +object.tag('TAGNAME')+ - # * +@@TAGNAME+ is translated into +object.tags('TAGNAME')+ - # * +object+ can be omitted as target for method calls (it is implied) - # - # @example Create a verifier to check for objects that don't have @private tags - # verifier = Verifier.new('!@private') - # verifier.call(object) # => true (no @private tag) - # @example Create a verifier to find any return tag with an empty description - # Verifier.new('@return.text.empty?') - # # Equivalent to: - # Verifier.new('object.tag(:return).text.empty?') - # @example Check if there are any @param tags - # Verifier.new('@@param.empty?') - # # Equivalent to: - # Verifier.new('object.tags(:param).empty?') - # @example Using +object+ or +o+ to look up object attributes directly - # Verifier.new('object.docstring == "hello world"') - # # Equivalent to: - # Verifier.new('o.docstring == "hello world"') - # @example Without using +object+ or +o+ - # Verifier.new('tag(:return).size == 1 || has_tag?(:author)') - # @example Specifying multiple expressions - # Verifier.new('@return', '@param', '@yield') - # # Equivalent to: - # Verifier.new('@return && @param && @yield') - class Verifier - # @return [Array] a list of all expressions the verifier checks for - # @since 0.5.6 - attr_reader :expressions - - def expressions=(value) - @expressions = value - create_method_from_expressions - end - - # Creates a verifier from a set of expressions - # - # @param [Array] expressions a list of Ruby expressions to - # parse. - def initialize(*expressions) - @expressions = [] - add_expressions(*expressions) - end - - # Adds a set of expressions and recompiles the verifier - # - # @param [Array] expressions a list of expressions - # @return [void] - # @since 0.5.6 - def add_expressions(*expressions) - self.expressions += expressions.flatten - end - - # Passes any method calls to the object from the {#call} - def method_missing(sym, *args, &block) - if object.respond_to?(sym) - object.send(sym, *args, &block) - else - super - end - end - - # Tests the expressions on the object. - # - # @note If the object is a {CodeObjects::Proxy} the result will always be true. - # @param [CodeObjects::Base] object the object to verify - # @return [Boolean] the result of the expressions - def call(object) - return true if object.is_a?(CodeObjects::Proxy) - modify_nilclass - @object = object - retval = __execute ? true : false - unmodify_nilclass - retval - end - - # Runs a list of objects against the verifier and returns the subset - # of verified objects. - # - # @param [Array] list a list of code objects - # @return [Array] a list of code objects that match - # the verifier. - def run(list) - list.reject {|item| call(item).is_a?(FalseClass) } - end - - protected - - # @return [CodeObjects::Base] the current object being tested - attr_reader :object - alias o object - - private - - # @private - NILCLASS_METHODS = [:type, :method_missing] - - # Modifies nil to not throw NoMethodErrors. This allows - # syntax like object.tag(:return).text to work if the #tag - # call returns nil, which means users don't need to perform - # stringent nil checking - # - # @return [void] - def modify_nilclass - NILCLASS_METHODS.each do |meth| - NilClass.send(:define_method, meth) {|*args| } - end - end - - # Returns the state of NilClass back to normal - # @return [void] - def unmodify_nilclass - NILCLASS_METHODS.each do |meth| - next unless nil.respond_to?(meth) - NilClass.send(:remove_method, meth) - end - end - - # Creates the +__execute+ method by evaluating the expressions - # as Ruby code - # @return [void] - def create_method_from_expressions - expr = expressions.map {|e| "(#{parse_expression(e)})" }.join(" && ") - - instance_eval(<<-eof, __FILE__, __LINE__ + 1) - begin; undef __execute; rescue NameError; end - def __execute; #{expr}; end - eof - end - - # Parses a single expression, handling some of the DSL syntax. - # - # The syntax "@tag" should be turned into object.tag(:tag), - # and "@@tag" should be turned into object.tags(:tag) - # - # @return [String] the parsed expression - def parse_expression(expr) - expr = expr.gsub(/@@(?:(\w+)|\{([\w\.]+)\})/, 'object.tags("\1\2")') - expr = expr.gsub(/@(?:(\w+)|\{([\w\.]+)\})/, 'object.tag("\1\2")') - expr - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/version.rb deleted file mode 100644 index 2d3fa96fb8..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-0.9.26/lib/yard/version.rb +++ /dev/null @@ -1,6 +0,0 @@ - -# frozen_string_literal: true - -module YARD - VERSION = '0.9.26' -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet.rb deleted file mode 100644 index 1c351cb5dc..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet.rb +++ /dev/null @@ -1,14 +0,0 @@ -# typed: strong -# frozen_string_literal: true - -require 'sorbet-runtime' -require 'yard' - -require_relative 'yard-sorbet/version' - -require_relative 'yard-sorbet/directives' -require_relative 'yard-sorbet/handlers' -require_relative 'yard-sorbet/node_utils' -require_relative 'yard-sorbet/sig_to_yard' -require_relative 'yard-sorbet/t_struct_prop' -require_relative 'yard-sorbet/tag_utils' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/directives.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/directives.rb deleted file mode 100644 index ad29c83066..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/directives.rb +++ /dev/null @@ -1,30 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -module YARDSorbet - # Extract & re-add directives to a docstring - module Directives - extend T::Sig - - sig { params(docstring: T.nilable(String)).returns([YARD::Docstring, T::Array[String]]) } - def self.extract_directives(docstring) - parser = YARD::DocstringParser.new.parse(docstring) - # Directives are already parsed at this point, and there doesn't - # seem to be an API to tweeze them from one node to another without - # managing YARD internal state. Instead, we just extract them from - # the raw text and re-attach them. - directives = parser.raw_text&.split("\n")&.select do |line| - line.start_with?('@!') - end || [] - - [parser.to_docstring, directives] - end - - sig { params(docstring: String, directives: T::Array[String]).void } - def self.add_directives(docstring, directives) - directives.each do |directive| - docstring.concat("\n#{directive}") - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers.rb deleted file mode 100644 index 6c250f3959..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers.rb +++ /dev/null @@ -1,16 +0,0 @@ -# typed: strong -# frozen_string_literal: true - -module YARDSorbet - # Custom YARD Handlers - # @see https://rubydoc.info/gems/yard/YARD/Handlers/Base YARD Base Handler documentation - module Handlers; end -end - -require_relative 'handlers/abstract_dsl_handler' -require_relative 'handlers/enums_handler' -require_relative 'handlers/include_handler' -require_relative 'handlers/mixes_in_class_methods_handler' -require_relative 'handlers/sig_handler' -require_relative 'handlers/struct_class_handler' -require_relative 'handlers/struct_prop_handler' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/abstract_dsl_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/abstract_dsl_handler.rb deleted file mode 100644 index 2e8f182340..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/abstract_dsl_handler.rb +++ /dev/null @@ -1,30 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -module YARDSorbet - module Handlers - # Apllies an `@abstract` tag to `abstract!`/`interface!` modules (if not alerady present). - class AbstractDSLHandler < YARD::Handlers::Ruby::Base - extend T::Sig - - handles method_call(:abstract!), method_call(:interface!) - namespace_only - - # The text accompanying the `@abstract` tag. - # @see https://github.com/lsegal/yard/blob/main/templates/default/docstring/html/abstract.erb - # The `@abstract` tag template - TAG_TEXT = 'Subclasses must implement the `abstract` methods below.' - # Extra text for class namespaces - CLASS_TAG_TEXT = T.let("It cannont be directly instantiated. #{TAG_TEXT}", String) - - sig { void } - def process - return if namespace.has_tag?(:abstract) - - text = namespace.is_a?(YARD::CodeObjects::ClassObject) ? CLASS_TAG_TEXT : TAG_TEXT - tag = YARD::Tags::Tag.new(:abstract, text) - namespace.add_tag(tag) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/enums_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/enums_handler.rb deleted file mode 100644 index c36879973c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/enums_handler.rb +++ /dev/null @@ -1,34 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -module YARDSorbet - module Handlers - # Handle `enums` calls, registering enum values as constants - class EnumsHandler < YARD::Handlers::Ruby::Base - extend T::Sig - - handles method_call(:enums) - namespace_only - - sig { void } - def process - statement.traverse do |node| - if const_assign_node?(node) - register YARD::CodeObjects::ConstantObject.new(namespace, node.first.source) do |obj| - obj.docstring = node.docstring - obj.source = node - obj.value = node.last.source - end - end - end - end - - private - - sig { params(node: YARD::Parser::Ruby::AstNode).returns(T::Boolean) } - def const_assign_node?(node) - node.type == :assign && node[0][0].type == :const - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/include_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/include_handler.rb deleted file mode 100644 index 86d83f5f46..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/include_handler.rb +++ /dev/null @@ -1,37 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -module YARDSorbet - module Handlers - # Extends any modules included via `mixes_in_class_methods` - # @see https://sorbet.org/docs/abstract#interfaces-and-the-included-hook - # Sorbet `mixes_in_class_methods` documentation - class IncludeHandler < YARD::Handlers::Ruby::Base - extend T::Sig - - handles method_call(:include) - namespace_only - - sig { void } - def process - return unless extra_state.mix_in_class_methods - - statement.parameters(false).each do |mixin| - obj = YARD::CodeObjects::Proxy.new(namespace, mixin.source) - class_methods_namespace = extra_state.mix_in_class_methods[obj.to_s] - next unless class_methods_namespace - - included_in.mixins(:class) << YARD::CodeObjects::Proxy.new(obj, class_methods_namespace) - end - end - - private - - # @return the namespace object that is including the module - sig { returns(YARD::CodeObjects::NamespaceObject) } - def included_in - statement.namespace ? YARD::CodeObjects::Proxy.new(namespace, statement.namespace.source) : namespace - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/mixes_in_class_methods_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/mixes_in_class_methods_handler.rb deleted file mode 100644 index a9ed10fc5c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/mixes_in_class_methods_handler.rb +++ /dev/null @@ -1,22 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -module YARDSorbet - module Handlers - # Tracks modules that invoke `mixes_in_class_methods` for use in {IncludeHandler} - # @see https://sorbet.org/docs/abstract#interfaces-and-the-included-hook - # Sorbet `mixes_in_class_methods` documentation - class MixesInClassMethodsHandler < YARD::Handlers::Ruby::Base - extend T::Sig - - handles method_call(:mixes_in_class_methods) - namespace_only - - sig { void } - def process - extra_state.mix_in_class_methods ||= {} - extra_state.mix_in_class_methods[namespace.to_s] = statement.parameters(false)[0].source - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/sig_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/sig_handler.rb deleted file mode 100644 index 8eb3477f70..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/sig_handler.rb +++ /dev/null @@ -1,70 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -module YARDSorbet - module Handlers - # A YARD Handler for Sorbet type declarations - class SigHandler < YARD::Handlers::Ruby::Base - extend T::Sig - - handles method_call(:sig) - namespace_only - - # These node types attached to sigs represent attr_* declarations - ATTR_NODE_TYPES = T.let(%i[command fcall], T::Array[Symbol]) - private_constant :ATTR_NODE_TYPES - - # Swap the method definition docstring and the sig docstring. - # Parse relevant parts of the `sig` and include them as well. - sig { void } - def process - method_node = NodeUtils.get_method_node(NodeUtils.sibling_node(statement)) - docstring, directives = Directives.extract_directives(statement.docstring) - parse_sig(method_node, docstring) - method_node.docstring = docstring.to_raw - Directives.add_directives(method_node.docstring, directives) - statement.docstring = nil - end - - private - - sig { params(method_node: YARD::Parser::Ruby::AstNode, docstring: YARD::Docstring).void } - def parse_sig(method_node, docstring) - NodeUtils.bfs_traverse(statement) do |n| - case n.source - when 'abstract' - YARDSorbet::TagUtils.upsert_tag(docstring, 'abstract') - when 'params' - parse_params(method_node, n, docstring) - when 'returns', 'void' - parse_return(n, docstring) - end - end - end - - sig do - params( - method_node: YARD::Parser::Ruby::AstNode, - node: YARD::Parser::Ruby::AstNode, - docstring: YARD::Docstring - ).void - end - def parse_params(method_node, node, docstring) - return if ATTR_NODE_TYPES.include?(method_node.type) - - sibling = NodeUtils.sibling_node(node) - sibling[0][0].each do |p| - param_name = p[0][0] - types = SigToYARD.convert(p.last) - TagUtils.upsert_tag(docstring, 'param', types, param_name) - end - end - - sig { params(node: YARD::Parser::Ruby::AstNode, docstring: YARD::Docstring).void } - def parse_return(node, docstring) - type = node.source == 'void' ? ['void'] : SigToYARD.convert(NodeUtils.sibling_node(node)) - TagUtils.upsert_tag(docstring, 'return', type) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/struct_class_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/struct_class_handler.rb deleted file mode 100644 index 4ed8a411e2..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/struct_class_handler.rb +++ /dev/null @@ -1,72 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -module YARDSorbet - module Handlers - # Class-level handler that folds all `const` and `prop` declarations into the constructor documentation - # this needs to be injected as a module otherwise the default Class handler will overwrite documentation - # - # @note this module is included in `YARD::Handlers::Ruby::ClassHandler` - module StructClassHandler - extend T::Sig - - sig { void } - def process - super - return if extra_state.prop_docs.nil? - - # lookup the full YARD path for the current class - class_ns = YARD::CodeObjects::ClassObject.new(namespace, statement[0].source.gsub(/\s/, '')) - props = extra_state.prop_docs[class_ns] - return if props.empty? - - process_t_struct_props(props, class_ns) - end - - private - - # Create a virtual `initialize` method with all the `prop`/`const` arguments - sig { params(props: T::Array[TStructProp], class_ns: YARD::CodeObjects::ClassObject).void } - def process_t_struct_props(props, class_ns) - # having the name :initialize & the scope :instance marks this as the constructor. - object = YARD::CodeObjects::MethodObject.new(class_ns, :initialize, :instance) - # There is a chance that there is a custom initializer, so make sure we steal the existing docstring - # and source - docstring, directives = Directives.extract_directives(object.docstring) - object.tags.each { |tag| docstring.add_tag(tag) } - props.each do |prop| - TagUtils.upsert_tag(docstring, 'param', prop.types, prop.prop_name, prop.doc) - end - TagUtils.upsert_tag(docstring, 'return', ['void']) - decorate_t_struct_init(object, props, docstring, directives) - end - - sig do - params( - object: YARD::CodeObjects::MethodObject, - props: T::Array[TStructProp], - docstring: YARD::Docstring, - directives: T::Array[String] - ).void - end - def decorate_t_struct_init(object, props, docstring, directives) - # Use kwarg style arguments, with optionals being marked with a default (unless an actual default was specified) - object.parameters = to_object_parameters(props) - # The "source" of our constructor is the field declarations - object.source ||= props.map(&:source).join("\n") - object.docstring = docstring - Directives.add_directives(object.docstring, directives) - end - - sig { params(props: T::Array[TStructProp]).returns(T::Array[[String, T.nilable(String)]]) } - def to_object_parameters(props) - props.map do |prop| - default = prop.default || (prop.types.include?('nil') ? 'nil' : nil) - ["#{prop.prop_name}:", default] - end - end - end - end -end - -YARD::Handlers::Ruby::ClassHandler.include YARDSorbet::Handlers::StructClassHandler diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/struct_class_handler.rbi b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/struct_class_handler.rbi deleted file mode 100644 index e0c2c3d161..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/struct_class_handler.rbi +++ /dev/null @@ -1,5 +0,0 @@ -# typed: strict -# This is in an rbi so the runtime doesn't depend on experimental sorbet features -module YARDSorbet::Handlers::StructClassHandler - requires_ancestor { YARD::Handlers::Ruby::ClassHandler } -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/struct_prop_handler.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/struct_prop_handler.rb deleted file mode 100644 index 7f8fbe8c96..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/handlers/struct_prop_handler.rb +++ /dev/null @@ -1,72 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -module YARDSorbet - module Handlers - # Handles all `const`/`prop` calls, creating accessor methods, and compiles them for later usage at the class level - # in creating a constructor - class StructPropHandler < YARD::Handlers::Ruby::Base - extend T::Sig - - handles method_call(:const), method_call(:prop) - namespace_only - - sig { void } - def process - name = statement.parameters.first.last.last.source - prop = make_prop(name) - update_state(prop) - object = YARD::CodeObjects::MethodObject.new(namespace, name, scope) - decorate_object(object, prop) - register_attrs(object, name) - end - - private - - # Add the source and docstring to the method object - sig { params(object: YARD::CodeObjects::MethodObject, prop: TStructProp).void } - def decorate_object(object, prop) - object.source = prop.source - # TODO: this should use `+` to delimit the attribute name when markdown is disabled - reader_docstring = prop.doc.empty? ? "Returns the value of attribute `#{prop.prop_name}`." : prop.doc - docstring = YARD::DocstringParser.new.parse(reader_docstring).to_docstring - docstring.add_tag(YARD::Tags::Tag.new(:return, '', prop.types)) - object.docstring = docstring.to_raw - end - - # Get the default prop value - sig { returns(T.nilable(String)) } - def default_value - default_node = statement.traverse { |n| break n if n.type == :label && n.source == 'default:' } - default_node.parent[1].source if default_node - end - - sig { params(name: String).returns(TStructProp) } - def make_prop(name) - TStructProp.new( - default: default_value, - doc: statement.docstring.to_s, - prop_name: name, - source: statement.source, - types: SigToYARD.convert(statement.parameters[1]) - ) - end - - # Register the field explicitly as an attribute. - # While `const` attributes are immutable, `prop` attributes may be reassigned. - sig { params(object: YARD::CodeObjects::MethodObject, name: String).void } - def register_attrs(object, name) - # Create the virtual method in our current scope - write = statement.method_name(true) == :prop ? object : nil - namespace.attributes[scope][name] ||= SymbolHash[read: object, write: write] - end - - # Store the prop for use in the constructor definition - sig { params(prop: TStructProp).void } - def update_state(prop) - extra_state.prop_docs ||= Hash.new { |h, k| h[k] = [] } - extra_state.prop_docs[namespace] << prop - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/node_utils.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/node_utils.rb deleted file mode 100644 index 6f39ddff5b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/node_utils.rb +++ /dev/null @@ -1,62 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -module YARDSorbet - # Helper methods for working with `YARD` AST Nodes - module NodeUtils - extend T::Sig - - # Command node types that can have type signatures - ATTRIBUTE_METHODS = T.let(%i[attr attr_accessor attr_reader attr_writer].freeze, T::Array[Symbol]) - # Node types that can have type signatures - SIGABLE_NODE = T.type_alias do - T.any(YARD::Parser::Ruby::MethodDefinitionNode, YARD::Parser::Ruby::MethodCallNode) - end - # Skip these method contents during BFS node traversal, they can have their own nested types via `T.Proc` - SKIP_METHOD_CONTENTS = T.let(%i[params returns], T::Array[Symbol]) - - private_constant :ATTRIBUTE_METHODS, :SIGABLE_NODE - - # Traverese AST nodes in breadth-first order - # @note This will skip over some node types. - # @yield [YARD::Parser::Ruby::AstNode] - sig do - params( - node: YARD::Parser::Ruby::AstNode, - _blk: T.proc.params(n: YARD::Parser::Ruby::AstNode).void - ).void - end - def self.bfs_traverse(node, &_blk) - queue = [node] - until queue.empty? - n = T.must(queue.shift) - yield n - n.children.each { |c| queue.push(c) } - queue.pop if n.is_a?(YARD::Parser::Ruby::MethodCallNode) && SKIP_METHOD_CONTENTS.include?(n.method_name(true)) - end - end - - # Gets the node that a sorbet `sig` can be attached do, bypassing visisbility modifiers and the like - sig { params(node: YARD::Parser::Ruby::AstNode).returns(SIGABLE_NODE) } - def self.get_method_node(node) - case node - when YARD::Parser::Ruby::MethodDefinitionNode - return node - when YARD::Parser::Ruby::MethodCallNode - return node if ATTRIBUTE_METHODS.include?(node.method_name(true)) - end - - node.jump(:def, :defs) - end - - # Find and return the adjacent node (ascending) - # @raise [IndexError] if the node does not have an adjacent sibling (ascending) - sig { params(node: YARD::Parser::Ruby::AstNode).returns(YARD::Parser::Ruby::AstNode) } - def self.sibling_node(node) - siblings = node.parent.children - siblings.each_with_index.find do |sibling, i| - return siblings.fetch(i + 1) if sibling.equal?(node) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/sig_to_yard.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/sig_to_yard.rb deleted file mode 100644 index f8677cc4bb..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/sig_to_yard.rb +++ /dev/null @@ -1,130 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -module YARDSorbet - # Translate `sig` type syntax to `YARD` type syntax. - module SigToYARD - extend T::Sig - - # @see https://yardoc.org/types.html - sig { params(node: YARD::Parser::Ruby::AstNode).returns(T::Array[String]) } - def self.convert(node) - # scrub newlines, as they break the YARD parser - convert_node(node).map { |type| type.gsub(/\n\s*/, ' ') } - end - - sig { params(node: YARD::Parser::Ruby::AstNode).returns(T::Array[String]) } - private_class_method def self.convert_node(node) - case node - when YARD::Parser::Ruby::MethodCallNode then convert_call(node) - when YARD::Parser::Ruby::ReferenceNode then convert_ref(node) - else convert_node_type(node) - end - end - - sig { params(node: YARD::Parser::Ruby::AstNode).returns(T::Array[String]) } - private_class_method def self.convert_node_type(node) - case node.type - when :aref then convert_aref(node) - when :arg_paren then convert_node(node.first) - when :array then convert_array(node) - # Fixed hashes as return values are unsupported: - # https://github.com/lsegal/yard/issues/425 - # - # Hash key params can be individually documented with `@option`, but - # sig translation is currently unsupported. - when :hash then ['Hash'] - # seen when sig methods omit parentheses - when :list then convert_list(node) - else convert_unknown(node) - end - end - - sig { params(node: YARD::Parser::Ruby::AstNode).returns(String) } - private_class_method def self.build_generic_type(node) - return node.source if node.empty? || node.type != :aref - - collection_type = node.first.source - member_type = node.last.children.map { |child| build_generic_type(child) }.join(', ') - - "#{collection_type}[#{member_type}]" - end - - sig { params(node: YARD::Parser::Ruby::AstNode).returns(T::Array[String]) } - private_class_method def self.convert_aref(node) - # https://www.rubydoc.info/gems/yard/file/docs/Tags.md#Parametrized_Types - case node.first.source - when 'T::Array', 'T::Enumerable', 'T::Range', 'T::Set' then convert_collection(node) - when 'T::Hash' then convert_hash(node) - else - log.info("Unsupported sig aref node #{node.source}") - [build_generic_type(node)] - end - end - - sig { params(node: YARD::Parser::Ruby::AstNode).returns(T::Array[String]) } - private_class_method def self.convert_array(node) - # https://www.rubydoc.info/gems/yard/file/docs/Tags.md#Order-Dependent_Lists - member_types = node.first.children.map { |n| convert_node(n) } - sequence = member_types.map { |mt| mt.size == 1 ? mt[0] : mt.to_s.tr('"', '') }.join(', ') - ["Array(#{sequence})"] - end - - sig { params(node: YARD::Parser::Ruby::MethodCallNode).returns(T::Array[String]) } - private_class_method def self.convert_call(node) - node.namespace.source == 'T' ? convert_t_method(node) : [node.source] - end - - sig { params(node: YARD::Parser::Ruby::AstNode).returns(T::Array[String]) } - private_class_method def self.convert_collection(node) - collection_type = node.first.source.split('::').last - member_type = convert_node(node.last.first).join(', ') - ["#{collection_type}<#{member_type}>"] - end - - sig { params(node: YARD::Parser::Ruby::AstNode).returns(T::Array[String]) } - private_class_method def self.convert_hash(node) - kv = node.last.children - key_type = convert_node(kv.first).join(', ') - value_type = convert_node(kv.last).join(', ') - ["Hash{#{key_type} => #{value_type}}"] - end - - sig { params(node: YARD::Parser::Ruby::AstNode).returns(T::Array[String]) } - private_class_method def self.convert_list(node) - node.children.size == 1 ? convert_node(node.children.first) : [node.source] - end - - sig { params(node: YARD::Parser::Ruby::AstNode).returns(T::Array[String]) } - private_class_method def self.convert_ref(node) - source = node.source - case source - when 'T::Boolean' then ['Boolean'] # YARD convention for booleans - # YARD convention is use singleton objects when applicable: - # https://www.rubydoc.info/gems/yard/file/docs/Tags.md#Literals - when 'FalseClass' then ['false'] - when 'NilClass' then ['nil'] - when 'TrueClass' then ['true'] - else [source] - end - end - - sig { params(node: YARD::Parser::Ruby::MethodCallNode).returns(T::Array[String]) } - private_class_method def self.convert_t_method(node) - case node.method_name(true) - when :any then node.last.first.children.map { |n| convert_node(n) }.flatten - # Order matters here, putting `nil` last results in a more concise - # return syntax in the UI (superscripted `?`) - # https://github.com/lsegal/yard/blob/cfa62ae/lib/yard/templates/helpers/html_helper.rb#L499-L500 - when :nilable then convert_node(node.last) + ['nil'] - else [node.source] - end - end - - sig { params(node: YARD::Parser::Ruby::AstNode).returns(T::Array[String]) } - private_class_method def self.convert_unknown(node) - log.warn("Unsupported sig #{node.type} node #{node.source}") - [node.source] - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/t_struct_prop.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/t_struct_prop.rb deleted file mode 100644 index 0115f8b82d..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/t_struct_prop.rb +++ /dev/null @@ -1,13 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -module YARDSorbet - # Used to store the details of a `T::Struct` `prop` definition - class TStructProp < T::Struct - const :default, T.nilable(String) - const :doc, String - const :prop_name, String - const :source, String - const :types, T::Array[String] - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/tag_utils.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/tag_utils.rb deleted file mode 100644 index 4a9db30078..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/tag_utils.rb +++ /dev/null @@ -1,44 +0,0 @@ -# typed: strict -# frozen_string_literal: true - -module YARDSorbet - # Helper methods for working with `YARD` tags - module TagUtils - extend T::Sig - - # @return the tag with the matching `tag_name` and `name`, or `nil` - sig do - params(docstring: YARD::Docstring, tag_name: String, name: T.nilable(String)) - .returns(T.nilable(YARD::Tags::Tag)) - end - def self.find_tag(docstring, tag_name, name) - docstring.tags.find { |t| t.tag_name == tag_name && t.name == name } - end - - # Create or update a `YARD` tag with type information - sig do - params( - docstring: YARD::Docstring, - tag_name: String, - types: T.nilable(T::Array[String]), - name: T.nilable(String), - text: String - ).void - end - def self.upsert_tag(docstring, tag_name, types = nil, name = nil, text = '') - tag = find_tag(docstring, tag_name, name) - if tag - return unless types - - # Updating a tag in place doesn't seem to work, so we'll delete it, add the types, and re-add it - docstring.delete_tag_if { |t| t == tag } - # overwrite any existing type annotation (sigs should win) - tag.types = types - tag.text = text unless text.empty? - else - tag = YARD::Tags::Tag.new(tag_name, text, types, name) - end - docstring.add_tag(tag) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/version.rb deleted file mode 100644 index 8a2d7248d9..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/yard-sorbet-0.6.0/lib/yard-sorbet/version.rb +++ /dev/null @@ -1,8 +0,0 @@ -# typed: strong -# frozen_string_literal: true - -# Types are documentation -module YARDSorbet - # {https://rubygems.org/gems/yard-sorbet Version history} - VERSION = '0.6.0' -end From 026a4b4822183341a1f531c62e41a87626ed814f Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Sat, 23 Oct 2021 01:28:52 +0100 Subject: [PATCH 2/2] yard/ignore_directives: remove now unneeded RBI --- Library/Homebrew/yard/ignore_directives.rbi | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 Library/Homebrew/yard/ignore_directives.rbi diff --git a/Library/Homebrew/yard/ignore_directives.rbi b/Library/Homebrew/yard/ignore_directives.rbi deleted file mode 100644 index caf505de9c..0000000000 --- a/Library/Homebrew/yard/ignore_directives.rbi +++ /dev/null @@ -1,6 +0,0 @@ -# typed: strict - -module YARD - class Docstring; end - class DocstringParser; end -end