From 3789741f266d18758cda8576942bb0ce82ab7b26 Mon Sep 17 00:00:00 2001 From: Alexander Momchilov Date: Thu, 5 Feb 2026 12:54:42 -0500 Subject: [PATCH 01/17] Switch to minitest-spec --- Rakefile | 6 +++++- test/test_helper.rb => spec/spec_helper.rb | 1 + spec/type_toolkit_spec.rb | 15 +++++++++++++++ test/test_type_toolkit.rb | 13 ------------- 4 files changed, 21 insertions(+), 14 deletions(-) rename test/test_helper.rb => spec/spec_helper.rb (85%) create mode 100644 spec/type_toolkit_spec.rb delete mode 100644 test/test_type_toolkit.rb diff --git a/Rakefile b/Rakefile index 2bf771f..9b707af 100644 --- a/Rakefile +++ b/Rakefile @@ -3,7 +3,11 @@ require "bundler/gem_tasks" require "minitest/test_task" -Minitest::TestTask.create +Minitest::TestTask.create do |t| + t.libs.delete("test") + t.libs << "spec" + t.test_globs = ["spec/**/*_spec.rb"] +end require "rubocop/rake_task" diff --git a/test/test_helper.rb b/spec/spec_helper.rb similarity index 85% rename from test/test_helper.rb rename to spec/spec_helper.rb index 3d86539..e0fe08b 100644 --- a/test/test_helper.rb +++ b/spec/spec_helper.rb @@ -4,3 +4,4 @@ require "type_toolkit" require "minitest/autorun" +require "minitest/spec" diff --git a/spec/type_toolkit_spec.rb b/spec/type_toolkit_spec.rb new file mode 100644 index 0000000..94e7e8d --- /dev/null +++ b/spec/type_toolkit_spec.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require "spec_helper" + +module TypeToolkit + class TypeToolkitSpec < Minitest::Spec + it "has a version number" do + refute_nil ::TypeToolkit::VERSION + end + + it "does something useful" do + assert false + end + end +end diff --git a/test/test_type_toolkit.rb b/test/test_type_toolkit.rb deleted file mode 100644 index 90845c6..0000000 --- a/test/test_type_toolkit.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -require "test_helper" - -class TestTypeToolkit < Minitest::Test - def test_that_it_has_a_version_number - refute_nil ::TypeToolkit::VERSION - end - - def test_it_does_something_useful - assert false - end -end From e6a99b8bbd011bc17d99a7c422da4ecdabd92810 Mon Sep 17 00:00:00 2001 From: Alexander Momchilov Date: Mon, 23 Feb 2026 17:02:09 -0500 Subject: [PATCH 02/17] Enable new cops by default --- .rubocop.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.rubocop.yml b/.rubocop.yml index ae378d0..c47c488 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,6 @@ AllCops: TargetRubyVersion: 3.2 + NewCops: enable Style/StringLiterals: EnforcedStyle: double_quotes From 3a05a8541fe407cee8aadc716c8cb6d5aa594e49 Mon Sep 17 00:00:00 2001 From: Alexander Momchilov Date: Thu, 5 Feb 2026 12:08:45 -0500 Subject: [PATCH 03/17] Add `rubocop-shopify` --- .rubocop.yml | 9 +++------ Gemfile | 1 + Gemfile.lock | 4 ++++ Rakefile | 2 +- spec/spec_helper.rb | 2 +- type_toolkit.gemspec | 4 ++-- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index c47c488..ba7af45 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,9 +1,6 @@ +inherit_gem: + rubocop-shopify: rubocop.yml + AllCops: TargetRubyVersion: 3.2 NewCops: enable - -Style/StringLiterals: - EnforcedStyle: double_quotes - -Style/StringLiteralsInInterpolation: - EnforcedStyle: double_quotes diff --git a/Gemfile b/Gemfile index c43e3f0..43bdb6e 100644 --- a/Gemfile +++ b/Gemfile @@ -11,3 +11,4 @@ gem "rake", "~> 13.0" gem "minitest", "~> 5.16" gem "rubocop", "~> 1.21" +gem "rubocop-shopify", require: false diff --git a/Gemfile.lock b/Gemfile.lock index cffb190..9e46b28 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -54,6 +54,8 @@ GEM rubocop-ast (1.49.0) parser (>= 3.3.7.2) prism (~> 1.7) + rubocop-shopify (2.18.0) + rubocop (~> 1.62) ruby-progressbar (1.13.0) stringio (3.2.0) tsort (0.2.0) @@ -70,6 +72,7 @@ DEPENDENCIES minitest (~> 5.16) rake (~> 13.0) rubocop (~> 1.21) + rubocop-shopify type_toolkit! CHECKSUMS @@ -96,6 +99,7 @@ CHECKSUMS reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835 rubocop (1.84.2) sha256=5692cea54168f3dc8cb79a6fe95c5424b7ea893c707ad7a4307b0585e88dbf5f rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd + rubocop-shopify (2.18.0) sha256=dafa25e5617ce4600ff86b1de3d5b78e43ab3d58cc5729df38e492b8e10294eb ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1 tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f diff --git a/Rakefile b/Rakefile index 9b707af..330846b 100644 --- a/Rakefile +++ b/Rakefile @@ -13,4 +13,4 @@ require "rubocop/rake_task" RuboCop::RakeTask.new -task default: %i[test rubocop] +task default: [:test, :rubocop] diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e0fe08b..5a76288 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -$LOAD_PATH.unshift File.expand_path("../lib", __dir__) +$LOAD_PATH.unshift(File.expand_path("../lib", __dir__)) require "type_toolkit" require "minitest/autorun" diff --git a/type_toolkit.gemspec b/type_toolkit.gemspec index c04de8f..5f20457 100644 --- a/type_toolkit.gemspec +++ b/type_toolkit.gemspec @@ -22,10 +22,10 @@ Gem::Specification.new do |spec| # Specify which files should be added to the gem when it is released. # The `git ls-files -z` loads the files in the RubyGem that have been added into git. gemspec = File.basename(__FILE__) - spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls| + spec.files = IO.popen(["git", "ls-files", "-z"], chdir: __dir__, err: IO::NULL) do |ls| ls.readlines("\x0", chomp: true).reject do |f| (f == gemspec) || - f.start_with?(*%w[bin/ Gemfile .gitignore test/ .rubocop.yml]) + f.start_with?("bin/", "Gemfile", ".gitignore", "test/", ".rubocop.yml") end end spec.bindir = "exe" From 446795287a81c54df4c3542762333e6bcc2ae2bb Mon Sep 17 00:00:00 2001 From: Alexander Momchilov Date: Mon, 23 Feb 2026 16:54:56 -0500 Subject: [PATCH 04/17] Add `rubocop-minitest` --- .rubocop.yml | 3 +++ Gemfile | 1 + Gemfile.lock | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index ba7af45..117c843 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,9 @@ inherit_gem: rubocop-shopify: rubocop.yml +plugins: + - rubocop-minitest + AllCops: TargetRubyVersion: 3.2 NewCops: enable diff --git a/Gemfile b/Gemfile index 43bdb6e..4c85649 100644 --- a/Gemfile +++ b/Gemfile @@ -12,3 +12,4 @@ gem "minitest", "~> 5.16" gem "rubocop", "~> 1.21" gem "rubocop-shopify", require: false +gem "rubocop-minitest", require: false diff --git a/Gemfile.lock b/Gemfile.lock index 9e46b28..aa6d561 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -54,6 +54,10 @@ GEM rubocop-ast (1.49.0) parser (>= 3.3.7.2) prism (~> 1.7) + rubocop-minitest (0.38.2) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) rubocop-shopify (2.18.0) rubocop (~> 1.62) ruby-progressbar (1.13.0) @@ -72,6 +76,7 @@ DEPENDENCIES minitest (~> 5.16) rake (~> 13.0) rubocop (~> 1.21) + rubocop-minitest rubocop-shopify type_toolkit! @@ -99,6 +104,7 @@ CHECKSUMS reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835 rubocop (1.84.2) sha256=5692cea54168f3dc8cb79a6fe95c5424b7ea893c707ad7a4307b0585e88dbf5f rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd + rubocop-minitest (0.38.2) sha256=5a9dfb5a538973d0601aa51e59637d3998bb8df81233edf1ff421504c6280068 rubocop-shopify (2.18.0) sha256=dafa25e5617ce4600ff86b1de3d5b78e43ab3d58cc5729df38e492b8e10294eb ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1 From ba516f9c0ff0e32cd1ebdb7a2d188fba931cee63 Mon Sep 17 00:00:00 2001 From: Alexander Momchilov Date: Mon, 23 Feb 2026 17:07:56 -0500 Subject: [PATCH 05/17] Add `rubocop-rake` --- .rubocop.yml | 1 + Gemfile | 1 + Gemfile.lock | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 117c843..f36f418 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -3,6 +3,7 @@ inherit_gem: plugins: - rubocop-minitest + - rubocop-rake AllCops: TargetRubyVersion: 3.2 diff --git a/Gemfile b/Gemfile index 4c85649..7357e29 100644 --- a/Gemfile +++ b/Gemfile @@ -13,3 +13,4 @@ gem "minitest", "~> 5.16" gem "rubocop", "~> 1.21" gem "rubocop-shopify", require: false gem "rubocop-minitest", require: false +gem "rubocop-rake", require: false diff --git a/Gemfile.lock b/Gemfile.lock index aa6d561..1a5a3ed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -58,6 +58,9 @@ GEM lint_roller (~> 1.1) rubocop (>= 1.75.0, < 2.0) rubocop-ast (>= 1.38.0, < 2.0) + rubocop-rake (0.7.1) + lint_roller (~> 1.1) + rubocop (>= 1.72.1) rubocop-shopify (2.18.0) rubocop (~> 1.62) ruby-progressbar (1.13.0) @@ -77,6 +80,7 @@ DEPENDENCIES rake (~> 13.0) rubocop (~> 1.21) rubocop-minitest + rubocop-rake rubocop-shopify type_toolkit! @@ -105,6 +109,7 @@ CHECKSUMS rubocop (1.84.2) sha256=5692cea54168f3dc8cb79a6fe95c5424b7ea893c707ad7a4307b0585e88dbf5f rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd rubocop-minitest (0.38.2) sha256=5a9dfb5a538973d0601aa51e59637d3998bb8df81233edf1ff421504c6280068 + rubocop-rake (0.7.1) sha256=3797f2b6810c3e9df7376c26d5f44f3475eda59eb1adc38e6f62ecf027cbae4d rubocop-shopify (2.18.0) sha256=dafa25e5617ce4600ff86b1de3d5b78e43ab3d58cc5729df38e492b8e10294eb ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1 From d499ee538b52ab64ec0bbcd9ac21bc79527a7e78 Mon Sep 17 00:00:00 2001 From: Alexander Momchilov Date: Thu, 5 Feb 2026 12:10:53 -0500 Subject: [PATCH 06/17] Add `spec/.rubocop.yml` --- spec/.rubocop.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 spec/.rubocop.yml diff --git a/spec/.rubocop.yml b/spec/.rubocop.yml new file mode 100644 index 0000000..3a47427 --- /dev/null +++ b/spec/.rubocop.yml @@ -0,0 +1,13 @@ +inherit_from: ../.rubocop.yml + +Style/MethodCallWithArgsParentheses: + inherit_mode: + merge: + - AllowedPatterns + - AllowedMethods + AllowedMethods: + - assert + - refute + AllowedPatterns: + - "^assert_" + - "^refute_" From 8f574eeba3cd5150d8ac9e2dd55c921a1c83bf13 Mon Sep 17 00:00:00 2001 From: Alexander Momchilov Date: Wed, 18 Feb 2026 19:06:22 -0500 Subject: [PATCH 07/17] Add Sorbet and Tapioca for static typechecking --- Gemfile | 2 ++ Gemfile.lock | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 7357e29..e8ab1c2 100644 --- a/Gemfile +++ b/Gemfile @@ -8,6 +8,8 @@ gemspec gem "irb" gem "rake", "~> 13.0" +gem "sorbet" +gem "tapioca", ">= 0.17", require: false gem "minitest", "~> 5.16" gem "rubocop", "~> 1.21" diff --git a/Gemfile.lock b/Gemfile.lock index 1a5a3ed..5fa8fc1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,8 +7,10 @@ GEM remote: https://rubygems.org/ specs: ast (2.4.3) + benchmark (0.5.0) date (3.5.1) erb (6.0.1) + erubi (1.13.1) io-console (0.8.2) irb (1.17.0) pp (>= 0.6.0) @@ -18,7 +20,9 @@ GEM json (2.18.1) language_server-protocol (3.17.0.5) lint_roller (1.1.0) + logger (1.7.0) minitest (5.27.0) + netrc (0.11.0) parallel (1.27.0) parser (3.3.10.2) ast (~> 2.4.1) @@ -33,6 +37,13 @@ GEM racc (1.8.1) rainbow (3.1.1) rake (13.3.1) + rbi (0.3.9) + prism (~> 1.0) + rbs (>= 3.4.4) + rbs (4.0.0.dev.5) + logger + prism (>= 1.3.0) + tsort rdoc (7.2.0) erb psych (>= 4.0.0) @@ -40,6 +51,8 @@ GEM regexp_parser (2.11.3) reline (0.6.3) io-console (~> 0.5) + require-hooks (0.2.2) + rexml (3.4.4) rubocop (1.84.2) json (~> 2.3) language_server-protocol (~> 3.17.0.2) @@ -64,15 +77,46 @@ GEM rubocop-shopify (2.18.0) rubocop (~> 1.62) ruby-progressbar (1.13.0) + sorbet (0.6.12945) + sorbet-static (= 0.6.12945) + sorbet-runtime (0.6.12945) + sorbet-static (0.6.12945-universal-darwin) + sorbet-static-and-runtime (0.6.12945) + sorbet (= 0.6.12945) + sorbet-runtime (= 0.6.12945) + spoom (1.7.11) + erubi (>= 1.10.0) + prism (>= 0.28.0) + rbi (>= 0.3.3) + rbs (>= 4.0.0.dev.4) + rexml (>= 3.2.6) + sorbet-static-and-runtime (>= 0.5.10187) + thor (>= 0.19.2) stringio (3.2.0) + tapioca (0.17.10) + benchmark + bundler (>= 2.2.25) + netrc (>= 0.11.0) + parallel (>= 1.21.0) + rbi (>= 0.3.7) + require-hooks (>= 0.2.2) + sorbet-static-and-runtime (>= 0.5.11087) + spoom (>= 1.7.9) + thor (>= 1.2.0) + yard-sorbet + thor (1.5.0) tsort (0.2.0) unicode-display_width (3.2.0) unicode-emoji (~> 4.1) unicode-emoji (4.2.0) + yard (0.9.38) + yard-sorbet (0.9.0) + sorbet-runtime + yard PLATFORMS + arm64-darwin-23 arm64-darwin-24 - ruby DEPENDENCIES irb @@ -82,18 +126,24 @@ DEPENDENCIES rubocop-minitest rubocop-rake rubocop-shopify + sorbet + tapioca (>= 0.17) type_toolkit! CHECKSUMS ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383 + benchmark (0.5.0) sha256=465df122341aedcb81a2a24b4d3bd19b6c67c1530713fd533f3ff034e419236c date (3.5.1) sha256=750d06384d7b9c15d562c76291407d89e368dda4d4fff957eb94962d325a0dc0 erb (6.0.1) sha256=28ecdd99c5472aebd5674d6061e3c6b0a45c049578b071e5a52c2a7f13c197e5 + erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9 io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc irb (1.17.0) sha256=168c4ddb93d8a361a045c41d92b2952c7a118fa73f23fe14e55609eb7a863aae json (2.18.1) sha256=fe112755501b8d0466b5ada6cf50c8c3f41e897fa128ac5d263ec09eedc9f986 language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87 + logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203 minitest (5.27.0) sha256=2d3b17f8a36fe7801c1adcffdbc38233b938eb0b4966e97a6739055a45fa77d5 + netrc (0.11.0) sha256=de1ce33da8c99ab1d97871726cba75151113f117146becbe45aa85cb3dabee3f parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130 parser (3.3.10.2) sha256=6f60c84aa4bdcedb6d1a2434b738fe8a8136807b6adc8f7f53b97da9bc4e9357 pp (0.6.3) sha256=2951d514450b93ccfeb1df7d021cae0da16e0a7f95ee1e2273719669d0ab9df6 @@ -103,20 +153,33 @@ CHECKSUMS racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c + rbi (0.3.9) sha256=d6a187bd0b376e999d3d82a5e5798a61178be98b894b7b35741c14162c9ea015 + rbs (4.0.0.dev.5) rdoc (7.2.0) sha256=8650f76cd4009c3b54955eb5d7e3a075c60a57276766ebf36f9085e8c9f23192 regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4 reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835 + require-hooks (0.2.2) + rexml (3.4.4) sha256=19e0a2c3425dfbf2d4fc1189747bdb2f849b6c5e74180401b15734bc97b5d142 rubocop (1.84.2) sha256=5692cea54168f3dc8cb79a6fe95c5424b7ea893c707ad7a4307b0585e88dbf5f rubocop-ast (1.49.0) sha256=49c3676d3123a0923d333e20c6c2dbaaae2d2287b475273fddee0c61da9f71fd rubocop-minitest (0.38.2) sha256=5a9dfb5a538973d0601aa51e59637d3998bb8df81233edf1ff421504c6280068 rubocop-rake (0.7.1) sha256=3797f2b6810c3e9df7376c26d5f44f3475eda59eb1adc38e6f62ecf027cbae4d rubocop-shopify (2.18.0) sha256=dafa25e5617ce4600ff86b1de3d5b78e43ab3d58cc5729df38e492b8e10294eb ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 + sorbet (0.6.12945) sha256=40fd8c121f7e9ded24462daf757707dc588889646daed478a47b7359d2969d84 + sorbet-runtime (0.6.12945) sha256=3ddd992650437557fb87deb13c94d7250aeeab326812e7a863dfd4955f0758f3 + sorbet-static (0.6.12945-universal-darwin) sha256=766038d71e0ab7f8a60eb298b742d4e5fb9bd364034c651443f825fb4d61f11e + sorbet-static-and-runtime (0.6.12945) sha256=6a0ae4ac59ddc874e9438ff6e0f23b4eb78569c6d412ced4e043f3a6db6b44d0 + spoom (1.7.11) stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1 + tapioca (0.17.10) + thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73 tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f type_toolkit (0.0.2) unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42 unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f + yard (0.9.38) sha256=721fb82afb10532aa49860655f6cc2eaa7130889df291b052e1e6b268283010f + yard-sorbet (0.9.0) sha256=03d1aa461b9e9c82b886919a13aa3e09fcf4d1852239d2967ed97e92723ffe21 BUNDLED WITH 4.0.3 From d6edf527e2ab64d7f1f5d59a164e3ea6cb5aad07 Mon Sep 17 00:00:00 2001 From: Alexander Momchilov Date: Wed, 18 Feb 2026 19:10:09 -0500 Subject: [PATCH 08/17] `bundle exec tapioca init` --- bin/tapioca | 16 + sorbet/config | 4 + sorbet/rbi/annotations/.gitattributes | 1 + sorbet/rbi/annotations/minitest.rbi | 120 + sorbet/rbi/annotations/rainbow.rbi | 269 + sorbet/rbi/gems/.gitattributes | 1 + sorbet/rbi/gems/ast@2.4.3.rbi | 586 + sorbet/rbi/gems/benchmark@0.5.0.rbi | 637 + sorbet/rbi/gems/date@3.5.1.rbi | 403 + sorbet/rbi/gems/erb@6.0.1.rbi | 816 + sorbet/rbi/gems/erubi@1.13.1.rbi | 157 + sorbet/rbi/gems/io-console@0.8.2.rbi | 9 + sorbet/rbi/gems/json@2.18.1.rbi | 2340 + .../language_server-protocol@3.17.0.5.rbi | 9 + sorbet/rbi/gems/lint_roller@1.1.0.rbi | 119 + sorbet/rbi/gems/logger@1.7.0.rbi | 963 + sorbet/rbi/gems/minitest@5.27.0.rbi | 1549 + sorbet/rbi/gems/netrc@0.11.0.rbi | 177 + sorbet/rbi/gems/parallel@1.27.0.rbi | 291 + sorbet/rbi/gems/parser@3.3.10.2.rbi | 5537 ++ sorbet/rbi/gems/pp@0.6.3.rbi | 376 + sorbet/rbi/gems/prettyprint@0.2.0.rbi | 477 + sorbet/rbi/gems/prism@1.9.0.rbi | 43414 +++++++++++ sorbet/rbi/gems/psych@5.3.1.rbi | 2542 + sorbet/rbi/gems/racc@1.8.1.rbi | 168 + sorbet/rbi/gems/rainbow@3.1.1.rbi | 403 + sorbet/rbi/gems/rake@13.3.1.rbi | 3036 + sorbet/rbi/gems/rbi@0.3.9.rbi | 5238 ++ sorbet/rbi/gems/rbs@4.0.0.dev.5.rbi | 8393 ++ sorbet/rbi/gems/rdoc@7.2.0.rbi | 13378 ++++ sorbet/rbi/gems/regexp_parser@2.11.3.rbi | 3883 + sorbet/rbi/gems/reline@0.6.3.rbi | 2995 + sorbet/rbi/gems/require-hooks@0.2.2.rbi | 110 + sorbet/rbi/gems/rexml@3.4.4.rbi | 5258 ++ sorbet/rbi/gems/rubocop-ast@1.49.0.rbi | 7456 ++ sorbet/rbi/gems/rubocop-minitest@0.38.2.rbi | 2649 + sorbet/rbi/gems/rubocop-rake@0.7.1.rbi | 328 + sorbet/rbi/gems/rubocop-shopify@2.18.0.rbi | 9 + sorbet/rbi/gems/rubocop@1.84.2.rbi | 64803 ++++++++++++++++ sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi | 1318 + sorbet/rbi/gems/spoom@1.7.11.rbi | 5878 ++ sorbet/rbi/gems/stringio@3.2.0.rbi | 9 + sorbet/rbi/gems/tapioca@0.17.10.rbi | 3513 + sorbet/rbi/gems/thor@1.5.0.rbi | 4476 ++ sorbet/rbi/gems/tsort@0.2.0.rbi | 393 + .../rbi/gems/unicode-display_width@3.2.0.rbi | 132 + sorbet/rbi/gems/unicode-emoji@4.2.0.rbi | 254 + sorbet/rbi/gems/yard-sorbet@0.9.0.rbi | 430 + sorbet/rbi/gems/yard@0.9.38.rbi | 18425 +++++ sorbet/rbi/todo.rbi | 8 + sorbet/tapioca/config.yml | 13 + sorbet/tapioca/require.rb | 4 + 52 files changed, 213773 insertions(+) create mode 100755 bin/tapioca create mode 100644 sorbet/config create mode 100644 sorbet/rbi/annotations/.gitattributes create mode 100644 sorbet/rbi/annotations/minitest.rbi create mode 100644 sorbet/rbi/annotations/rainbow.rbi create mode 100644 sorbet/rbi/gems/.gitattributes create mode 100644 sorbet/rbi/gems/ast@2.4.3.rbi create mode 100644 sorbet/rbi/gems/benchmark@0.5.0.rbi create mode 100644 sorbet/rbi/gems/date@3.5.1.rbi create mode 100644 sorbet/rbi/gems/erb@6.0.1.rbi create mode 100644 sorbet/rbi/gems/erubi@1.13.1.rbi create mode 100644 sorbet/rbi/gems/io-console@0.8.2.rbi create mode 100644 sorbet/rbi/gems/json@2.18.1.rbi create mode 100644 sorbet/rbi/gems/language_server-protocol@3.17.0.5.rbi create mode 100644 sorbet/rbi/gems/lint_roller@1.1.0.rbi create mode 100644 sorbet/rbi/gems/logger@1.7.0.rbi create mode 100644 sorbet/rbi/gems/minitest@5.27.0.rbi create mode 100644 sorbet/rbi/gems/netrc@0.11.0.rbi create mode 100644 sorbet/rbi/gems/parallel@1.27.0.rbi create mode 100644 sorbet/rbi/gems/parser@3.3.10.2.rbi create mode 100644 sorbet/rbi/gems/pp@0.6.3.rbi create mode 100644 sorbet/rbi/gems/prettyprint@0.2.0.rbi create mode 100644 sorbet/rbi/gems/prism@1.9.0.rbi create mode 100644 sorbet/rbi/gems/psych@5.3.1.rbi create mode 100644 sorbet/rbi/gems/racc@1.8.1.rbi create mode 100644 sorbet/rbi/gems/rainbow@3.1.1.rbi create mode 100644 sorbet/rbi/gems/rake@13.3.1.rbi create mode 100644 sorbet/rbi/gems/rbi@0.3.9.rbi create mode 100644 sorbet/rbi/gems/rbs@4.0.0.dev.5.rbi create mode 100644 sorbet/rbi/gems/rdoc@7.2.0.rbi create mode 100644 sorbet/rbi/gems/regexp_parser@2.11.3.rbi create mode 100644 sorbet/rbi/gems/reline@0.6.3.rbi create mode 100644 sorbet/rbi/gems/require-hooks@0.2.2.rbi create mode 100644 sorbet/rbi/gems/rexml@3.4.4.rbi create mode 100644 sorbet/rbi/gems/rubocop-ast@1.49.0.rbi create mode 100644 sorbet/rbi/gems/rubocop-minitest@0.38.2.rbi create mode 100644 sorbet/rbi/gems/rubocop-rake@0.7.1.rbi create mode 100644 sorbet/rbi/gems/rubocop-shopify@2.18.0.rbi create mode 100644 sorbet/rbi/gems/rubocop@1.84.2.rbi create mode 100644 sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi create mode 100644 sorbet/rbi/gems/spoom@1.7.11.rbi create mode 100644 sorbet/rbi/gems/stringio@3.2.0.rbi create mode 100644 sorbet/rbi/gems/tapioca@0.17.10.rbi create mode 100644 sorbet/rbi/gems/thor@1.5.0.rbi create mode 100644 sorbet/rbi/gems/tsort@0.2.0.rbi create mode 100644 sorbet/rbi/gems/unicode-display_width@3.2.0.rbi create mode 100644 sorbet/rbi/gems/unicode-emoji@4.2.0.rbi create mode 100644 sorbet/rbi/gems/yard-sorbet@0.9.0.rbi create mode 100644 sorbet/rbi/gems/yard@0.9.38.rbi create mode 100644 sorbet/rbi/todo.rbi create mode 100644 sorbet/tapioca/config.yml create mode 100644 sorbet/tapioca/require.rb diff --git a/bin/tapioca b/bin/tapioca new file mode 100755 index 0000000..82de9af --- /dev/null +++ b/bin/tapioca @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'tapioca' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("tapioca", "tapioca") diff --git a/sorbet/config b/sorbet/config new file mode 100644 index 0000000..983d2f1 --- /dev/null +++ b/sorbet/config @@ -0,0 +1,4 @@ +--dir +. +--ignore=tmp/ +--ignore=vendor/ diff --git a/sorbet/rbi/annotations/.gitattributes b/sorbet/rbi/annotations/.gitattributes new file mode 100644 index 0000000..d2eacd2 --- /dev/null +++ b/sorbet/rbi/annotations/.gitattributes @@ -0,0 +1 @@ +**/*.rbi linguist-vendored=true diff --git a/sorbet/rbi/annotations/minitest.rbi b/sorbet/rbi/annotations/minitest.rbi new file mode 100644 index 0000000..a7059f0 --- /dev/null +++ b/sorbet/rbi/annotations/minitest.rbi @@ -0,0 +1,120 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This file was pulled from a central RBI files repository. +# Please run `bin/tapioca annotations` to update it. + +module Minitest::Assertions + sig { params(test: T.anything, msg: T.anything).returns(TrueClass) } + def assert(test, msg = nil); end + + sig { params(obj: T.anything, msg: T.anything).returns(TrueClass) } + def assert_empty(obj, msg = nil); end + + sig { params(exp: T.anything, act: T.anything, msg: T.anything).returns(TrueClass) } + def assert_equal(exp, act, msg = nil); end + + sig { params(exp: T.anything, act: T.anything, delta: Numeric, msg: T.anything).returns(TrueClass) } + def assert_in_delta(exp, act, delta = T.unsafe(nil), msg = nil); end + + sig { params(a: T.anything, b: T.anything, epsilon: Numeric, msg: T.anything).returns(TrueClass) } + def assert_in_epsilon(a, b, epsilon = T.unsafe(nil), msg = nil); end + + sig { params(collection: T.anything, obj: T.anything, msg: T.anything).returns(TrueClass) } + def assert_includes(collection, obj, msg = nil); end + + sig { params(cls: T.anything, obj: T.anything, msg: T.anything).returns(TrueClass) } + def assert_instance_of(cls, obj, msg = nil); end + + sig { params(cls: T.anything, obj: T.anything, msg: T.anything).returns(TrueClass) } + def assert_kind_of(cls, obj, msg = nil); end + + sig { params(matcher: T.any(String, Regexp), obj: T.anything, msg: T.anything).returns(MatchData) } + def assert_match(matcher, obj, msg = nil); end + + sig { params(obj: T.anything, msg: T.anything).returns(TrueClass) } + def assert_nil(obj, msg = nil); end + + sig { params(o1: T.anything, op: T.any(Symbol, String), o2: T.anything, msg: T.anything).returns(TrueClass) } + def assert_operator(o1, op, o2 = T.unsafe(nil), msg = nil); end + + sig { params(stdout: T.nilable(T.any(String, Regexp)), stderr: T.nilable(T.any(String, Regexp)), block: T.proc.void).returns(T::Boolean) } + def assert_output(stdout = nil, stderr = nil, &block); end + + sig { params(path: T.any(String, Pathname), msg: T.anything).returns(TrueClass) } + def assert_path_exists(path, msg = nil); end + + sig { params(block: T.proc.void).returns(TrueClass) } + def assert_pattern(&block); end + + sig { params(o1: T.anything, op: T.any(String, Symbol), msg: T.anything).returns(TrueClass) } + def assert_predicate(o1, op, msg = nil); end + + sig { params(exp: NilClass, block: T.proc.void).returns(StandardError) } + sig { type_parameters(:T).params(exp: T.any(T::Class[T.type_parameter(:T)], Regexp, String), block: T.proc.void).returns(T.type_parameter(:T)) } + def assert_raises(*exp, &block); end + + sig { params(obj: T.anything, meth: T.any(String, Symbol), msg: T.anything, include_all: T::Boolean).returns(TrueClass) } + def assert_respond_to(obj, meth, msg = nil, include_all: false); end + + sig { params(exp: T.anything, act: T.anything, msg: T.anything).returns(TrueClass) } + def assert_same(exp, act, msg = nil); end + + # @version < 6.0.0 + sig { params(send_ary: T::Array[T.anything], m: T.anything).returns(T::Boolean) } + def assert_send(send_ary, m = nil); end + + sig { params(block: T.proc.void).returns(T::Boolean) } + def assert_silent(&block); end + + sig { params(sym: Symbol, msg: T.anything, block: T.proc.void).returns(T.anything) } + def assert_throws(sym, msg = nil, &block); end + + sig { params(test: T.anything, msg: T.anything).returns(TrueClass) } + def refute(test, msg = nil); end + + sig { params(obj: T.anything, msg: T.anything).returns(TrueClass) } + def refute_empty(obj, msg = nil); end + + sig { params(exp: T.anything, act: T.anything, msg: T.anything).returns(TrueClass) } + def refute_equal(exp, act, msg = nil); end + + sig { params(exp: T.anything, act: T.anything, delta: Numeric, msg: T.anything).returns(TrueClass) } + def refute_in_delta(exp, act, delta = T.unsafe(nil), msg = nil); end + + sig { params(a: T.anything, b: T.anything, epsilon: Numeric, msg: T.anything).returns(TrueClass) } + def refute_in_epsilon(a, b, epsilon = T.unsafe(nil), msg = nil); end + + sig { params(collection: T.anything, obj: T.anything, msg: T.anything).returns(TrueClass) } + def refute_includes(collection, obj, msg = nil); end + + sig { params(cls: T.anything, obj: T.anything, msg: T.anything).returns(TrueClass) } + def refute_instance_of(cls, obj, msg = nil); end + + sig { params(cls: T.anything, obj: T.anything, msg: T.anything).returns(TrueClass) } + def refute_kind_of(cls, obj, msg = nil); end + + sig { params(matcher: T.any(String, Regexp), obj: T.anything, msg: T.anything).returns(TrueClass) } + def refute_match(matcher, obj, msg = nil); end + + sig { params(obj: T.anything, msg: T.anything).returns(TrueClass) } + def refute_nil(obj, msg = nil); end + + sig { params(block: T.proc.void).returns(TrueClass) } + def refute_pattern(&block); end + + sig { params(o1: T.anything, op: T.any(Symbol, String), o2: T.anything, msg: T.anything).returns(TrueClass) } + def refute_operator(o1, op, o2 = T.unsafe(nil), msg = nil); end + + sig { params(path: T.any(String, Pathname), msg: T.anything).returns(TrueClass) } + def refute_path_exists(path, msg = nil); end + + sig { params(o1: T.anything, op: T.any(String, Symbol), msg: T.anything).returns(TrueClass) } + def refute_predicate(o1, op, msg = nil); end + + sig { params(obj: T.anything, meth: T.any(String, Symbol), msg: T.anything, include_all: T::Boolean).returns(TrueClass) } + def refute_respond_to(obj, meth, msg = nil, include_all: false); end + + sig { params(exp: T.anything, act: T.anything, msg: T.anything).returns(TrueClass) } + def refute_same(exp, act, msg = nil); end +end diff --git a/sorbet/rbi/annotations/rainbow.rbi b/sorbet/rbi/annotations/rainbow.rbi new file mode 100644 index 0000000..0d2cb4e --- /dev/null +++ b/sorbet/rbi/annotations/rainbow.rbi @@ -0,0 +1,269 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This file was pulled from a central RBI files repository. +# Please run `bin/tapioca annotations` to update it. + +module Rainbow + # @shim: https://github.com/sickill/rainbow/blob/master/lib/rainbow.rb#L10-L12 + sig { returns(T::Boolean) } + attr_accessor :enabled + + class Color + sig { returns(Symbol) } + attr_reader :ground + + sig { params(ground: Symbol, values: T.any([Integer], [Integer, Integer, Integer])).returns(Color) } + def self.build(ground, values); end + + sig { params(hex: String).returns([Integer, Integer, Integer]) } + def self.parse_hex_color(hex); end + + class Indexed < Rainbow::Color + sig { returns(Integer) } + attr_reader :num + + sig { params(ground: Symbol, num: Integer).void } + def initialize(ground, num); end + + sig { returns(T::Array[Integer]) } + def codes; end + end + + class Named < Rainbow::Color::Indexed + NAMES = T.let(nil, T::Hash[Symbol, Integer]) + + sig { params(ground: Symbol, name: Symbol).void } + def initialize(ground, name); end + + sig { returns(T::Array[Symbol]) } + def self.color_names; end + + sig { returns(String) } + def self.valid_names; end + end + + class RGB < Rainbow::Color::Indexed + sig { returns(Integer) } + attr_reader :r, :g, :b + + sig { params(ground: Symbol, values: Integer).void } + def initialize(ground, *values); end + + sig { returns(T::Array[Integer]) } + def codes; end + + sig { params(value: Numeric).returns(Integer) } + def self.to_ansi_domain(value); end + end + + class X11Named < Rainbow::Color::RGB + include Rainbow::X11ColorNames + + sig { params(ground: Symbol, name: Symbol).void } + def initialize(ground, name); end + + sig { returns(T::Array[Symbol]) } + def self.color_names; end + + sig { returns(String) } + def self.valid_names; end + end + end + + sig { returns(Wrapper) } + def self.global; end + + sig { returns(T::Boolean) } + def self.enabled; end + + sig { params(value: T::Boolean).returns(T::Boolean) } + def self.enabled=(value); end + + sig { params(string: String).returns(String) } + def self.uncolor(string); end + + class NullPresenter < String + sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) } + def color(*values); end + + sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) } + def foreground(*values); end + + sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) } + def fg(*values); end + + sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) } + def background(*values); end + + sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(NullPresenter) } + def bg(*values); end + + sig { returns(NullPresenter) } + def reset; end + + sig { returns(NullPresenter) } + def bright; end + + sig { returns(NullPresenter) } + def faint; end + + sig { returns(NullPresenter) } + def italic; end + + sig { returns(NullPresenter) } + def underline; end + + sig { returns(NullPresenter) } + def blink; end + + sig { returns(NullPresenter) } + def inverse; end + + sig { returns(NullPresenter) } + def hide; end + + sig { returns(NullPresenter) } + def cross_out; end + + sig { returns(NullPresenter) } + def black; end + + sig { returns(NullPresenter) } + def red; end + + sig { returns(NullPresenter) } + def green; end + + sig { returns(NullPresenter) } + def yellow; end + + sig { returns(NullPresenter) } + def blue; end + + sig { returns(NullPresenter) } + def magenta; end + + sig { returns(NullPresenter) } + def cyan; end + + sig { returns(NullPresenter) } + def white; end + + sig { returns(NullPresenter) } + def bold; end + + sig { returns(NullPresenter) } + def dark; end + + sig { returns(NullPresenter) } + def strike; end + end + + class Presenter < String + TERM_EFFECTS = T.let(nil, T::Hash[Symbol, Integer]) + + sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) } + def color(*values); end + + sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) } + def foreground(*values); end + + sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) } + def fg(*values); end + + sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) } + def background(*values); end + + sig { params(values: T.any([Integer], [Integer, Integer, Integer])).returns(Presenter) } + def bg(*values); end + + sig { returns(Presenter) } + def reset; end + + sig { returns(Presenter) } + def bright; end + + sig { returns(Presenter) } + def faint; end + + sig { returns(Presenter) } + def italic; end + + sig { returns(Presenter) } + def underline; end + + sig { returns(Presenter) } + def blink; end + + sig { returns(Presenter) } + def inverse; end + + sig { returns(Presenter) } + def hide; end + + sig { returns(Presenter) } + def cross_out; end + + sig { returns(Presenter) } + def black; end + + sig { returns(Presenter) } + def red; end + + sig { returns(Presenter) } + def green; end + + sig { returns(Presenter) } + def yellow; end + + sig { returns(Presenter) } + def blue; end + + sig { returns(Presenter) } + def magenta; end + + sig { returns(Presenter) } + def cyan; end + + sig { returns(Presenter) } + def white; end + + sig { returns(Presenter) } + def bold; end + + sig { returns(Presenter) } + def dark; end + + sig { returns(Presenter) } + def strike; end + end + + class StringUtils + sig { params(string: String, codes: T::Array[Integer]).returns(String) } + def self.wrap_with_sgr(string, codes); end + + sig { params(string: String).returns(String) } + def self.uncolor(string); end + end + + VERSION = T.let(nil, String) + + class Wrapper + sig { returns(T::Boolean) } + attr_accessor :enabled + + sig { params(enabled: T::Boolean).void } + def initialize(enabled = true); end + + sig { params(string: String).returns(T.any(Rainbow::Presenter, Rainbow::NullPresenter)) } + def wrap(string); end + end + + module X11ColorNames + NAMES = T.let(nil, T::Hash[Symbol, [Integer, Integer, Integer]]) + end +end + +sig { params(string: String).returns(Rainbow::Presenter) } +def Rainbow(string); end diff --git a/sorbet/rbi/gems/.gitattributes b/sorbet/rbi/gems/.gitattributes new file mode 100644 index 0000000..d9bb82a --- /dev/null +++ b/sorbet/rbi/gems/.gitattributes @@ -0,0 +1 @@ +**/*.rbi linguist-generated=true diff --git a/sorbet/rbi/gems/ast@2.4.3.rbi b/sorbet/rbi/gems/ast@2.4.3.rbi new file mode 100644 index 0000000..c05e587 --- /dev/null +++ b/sorbet/rbi/gems/ast@2.4.3.rbi @@ -0,0 +1,586 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `ast` gem. +# Please instead update this file by running `bin/tapioca gem ast`. + + +# {AST} is a library for manipulating abstract syntax trees. +# +# It embraces immutability; each AST node is inherently frozen at +# creation, and updating a child node requires recreating that node +# and its every parent, recursively. +# This is a design choice. It does create some pressure on +# garbage collector, but completely eliminates all concurrency +# and aliasing problems. +# +# See also {AST::Node}, {AST::Processor::Mixin} and {AST::Sexp} for +# additional recommendations and design patterns. +# +# source://ast//lib/ast.rb#13 +module AST; end + +# Node is an immutable class, instances of which represent abstract +# syntax tree nodes. It combines semantic information (i.e. anything +# that affects the algorithmic properties of a program) with +# meta-information (line numbers or compiler intermediates). +# +# Notes on inheritance +# ==================== +# +# The distinction between semantics and metadata is important. Complete +# semantic information should be contained within just the {#type} and +# {#children} of a Node instance; in other words, if an AST was to be +# stripped of all meta-information, it should remain a valid AST which +# could be successfully processed to yield a result with the same +# algorithmic properties. +# +# Thus, Node should never be inherited in order to define methods which +# affect or return semantic information, such as getters for `class_name`, +# `superclass` and `body` in the case of a hypothetical `ClassNode`. The +# correct solution is to use a generic Node with a {#type} of `:class` +# and three children. See also {Processor} for tips on working with such +# ASTs. +# +# On the other hand, Node can and should be inherited to define +# application-specific metadata (see also {#initialize}) or customize the +# printing format. It is expected that an application would have one or two +# such classes and use them across the entire codebase. +# +# The rationale for this pattern is extensibility and maintainability. +# Unlike static ones, dynamic languages do not require the presence of a +# predefined, rigid structure, nor does it improve dispatch efficiency, +# and while such a structure can certainly be defined, it does not add +# any value but incurs a maintaining cost. +# For example, extending the AST even with a transformation-local +# temporary node type requires making globally visible changes to +# the codebase. +# +# source://ast//lib/ast/node.rb#40 +class AST::Node + # Constructs a new instance of Node. + # + # The arguments `type` and `children` are converted with `to_sym` and + # `to_a` respectively. Additionally, the result of converting `children` + # is frozen. While mutating the arguments is generally considered harmful, + # the most common case is to pass an array literal to the constructor. If + # your code does not expect the argument to be frozen, use `#dup`. + # + # The `properties` hash is passed to {#assign_properties}. + # + # @return [Node] a new instance of Node + # + # source://ast//lib/ast/node.rb#72 + def initialize(type, children = T.unsafe(nil), properties = T.unsafe(nil)); end + + # Concatenates `array` with `children` and returns the resulting node. + # + # @return [AST::Node] + # + # source://ast//lib/ast/node.rb#172 + def +(array); end + + # Appends `element` to `children` and returns the resulting node. + # + # @return [AST::Node] + # + # source://ast//lib/ast/node.rb#181 + def <<(element); end + + # Compares `self` to `other`, possibly converting with `to_ast`. Only + # `type` and `children` are compared; metadata is deliberately ignored. + # + # @return [Boolean] + # + # source://ast//lib/ast/node.rb#153 + def ==(other); end + + # Appends `element` to `children` and returns the resulting node. + # + # @return [AST::Node] + # + # source://ast//lib/ast/node.rb#177 + def append(element); end + + # Returns the children of this node. + # The returned value is frozen. + # The to_a alias is useful for decomposing nodes concisely. + # For example: + # + # node = s(:gasgn, :$foo, s(:integer, 1)) + # var_name, value = *node + # p var_name # => :$foo + # p value # => (integer 1) + # + # @return [Array] + # + # source://ast//lib/ast/node.rb#56 + def children; end + + # Nodes are already frozen, so there is no harm in returning the + # current node as opposed to initializing from scratch and freezing + # another one. + # + # @return self + # + # source://ast//lib/ast/node.rb#118 + def clone; end + + # Concatenates `array` with `children` and returns the resulting node. + # + # @return [AST::Node] + # + # source://ast//lib/ast/node.rb#168 + def concat(array); end + + # Enables matching for Node, where type is the first element + # and the children are remaining items. + # + # @return [Array] + # + # source://ast//lib/ast/node.rb#253 + def deconstruct; end + + # Nodes are already frozen, so there is no harm in returning the + # current node as opposed to initializing from scratch and freezing + # another one. + # + # @return self + # + # source://ast//lib/ast/node.rb#115 + def dup; end + + # Test if other object is equal to + # + # @param other [Object] + # @return [Boolean] + # + # source://ast//lib/ast/node.rb#85 + def eql?(other); end + + # Returns the precomputed hash value for this node + # + # @return [Integer] + # + # source://ast//lib/ast/node.rb#61 + def hash; end + + # Converts `self` to a s-expression ruby string. + # The code return will recreate the node, using the sexp module s() + # + # @param indent [Integer] Base indentation level. + # @return [String] + # + # source://ast//lib/ast/node.rb#211 + def inspect(indent = T.unsafe(nil)); end + + # Returns the children of this node. + # The returned value is frozen. + # The to_a alias is useful for decomposing nodes concisely. + # For example: + # + # node = s(:gasgn, :$foo, s(:integer, 1)) + # var_name, value = *node + # p var_name # => :$foo + # p value # => (integer 1) + # + # @return [Array] + # + # source://ast//lib/ast/node.rb#57 + def to_a; end + + # @return [AST::Node] self + # + # source://ast//lib/ast/node.rb#229 + def to_ast; end + + # Converts `self` to a pretty-printed s-expression. + # + # @param indent [Integer] Base indentation level. + # @return [String] + # + # source://ast//lib/ast/node.rb#204 + def to_s(indent = T.unsafe(nil)); end + + # Converts `self` to a pretty-printed s-expression. + # + # @param indent [Integer] Base indentation level. + # @return [String] + # + # source://ast//lib/ast/node.rb#187 + def to_sexp(indent = T.unsafe(nil)); end + + # Converts `self` to an Array where the first element is the type as a Symbol, + # and subsequent elements are the same representation of its children. + # + # @return [Array] + # + # source://ast//lib/ast/node.rb#237 + def to_sexp_array; end + + # Returns the type of this node. + # + # @return [Symbol] + # + # source://ast//lib/ast/node.rb#43 + def type; end + + # Returns a new instance of Node where non-nil arguments replace the + # corresponding fields of `self`. + # + # For example, `Node.new(:foo, [ 1, 2 ]).updated(:bar)` would yield + # `(bar 1 2)`, and `Node.new(:foo, [ 1, 2 ]).updated(nil, [])` would + # yield `(foo)`. + # + # If the resulting node would be identical to `self`, does nothing. + # + # @param children [Array, nil] + # @param properties [Hash, nil] + # @param type [Symbol, nil] + # @return [AST::Node] + # + # source://ast//lib/ast/node.rb#133 + def updated(type = T.unsafe(nil), children = T.unsafe(nil), properties = T.unsafe(nil)); end + + protected + + # By default, each entry in the `properties` hash is assigned to + # an instance variable in this instance of Node. A subclass should define + # attribute readers for such variables. The values passed in the hash + # are not frozen or whitelisted; such behavior can also be implemented + # by subclassing Node and overriding this method. + # + # @return [nil] + # + # source://ast//lib/ast/node.rb#98 + def assign_properties(properties); end + + # Returns `@type` with all underscores replaced by dashes. This allows + # to write symbol literals without quotes in Ruby sources and yet have + # nicely looking s-expressions. + # + # @return [String] + # + # source://ast//lib/ast/node.rb#264 + def fancy_type; end + + private + + # source://ast//lib/ast/node.rb#107 + def original_dup; end +end + +# This class includes {AST::Processor::Mixin}; however, it is +# deprecated, since the module defines all of the behaviors that +# the processor includes. Any new libraries should use +# {AST::Processor::Mixin} instead of subclassing this. +# +# @deprecated Use {AST::Processor::Mixin} instead. +# +# source://ast//lib/ast/processor.rb#8 +class AST::Processor + include ::AST::Processor::Mixin +end + +# The processor module is a module which helps transforming one +# AST into another. In a nutshell, the {#process} method accepts +# a {Node} and dispatches it to a handler corresponding to its +# type, and returns a (possibly) updated variant of the node. +# +# The processor module has a set of associated design patterns. +# They are best explained with a concrete example. Let's define a +# simple arithmetic language and an AST format for it: +# +# Terminals (AST nodes which do not have other AST nodes inside): +# +# * `(integer )`, +# +# Nonterminals (AST nodes with other nodes as children): +# +# * `(add )`, +# * `(multiply )`, +# * `(divide )`, +# * `(negate )`, +# * `(store )`: stores value of `` +# into a variable named ``, +# * `(load )`: loads value of a variable named +# ``, +# * `(each ...)`: computes each of the ``s and +# prints the result. +# +# All AST nodes have the same Ruby class, and therefore they don't +# know how to traverse themselves. (A solution which dynamically +# checks the type of children is possible, but is slow and +# error-prone.) So, a class including the module which knows how +# to traverse the entire tree should be defined. Such classes +# have a handler for each nonterminal node which recursively +# processes children nodes: +# +# require 'ast' +# +# class ArithmeticsProcessor +# include AST::Processor::Mixin +# # This method traverses any binary operators such as (add) +# # or (multiply). +# def process_binary_op(node) +# # Children aren't decomposed automatically; it is +# # suggested to use Ruby multiple assignment expansion, +# # as it is very convenient here. +# left_expr, right_expr = *node +# +# # AST::Node#updated won't change node type if nil is +# # passed as a first argument, which allows to reuse the +# # same handler for multiple node types using `alias' +# # (below). +# node.updated(nil, [ +# process(left_expr), +# process(right_expr) +# ]) +# end +# alias_method :on_add, :process_binary_op +# alias_method :on_multiply, :process_binary_op +# alias_method :on_divide, :process_binary_op +# +# def on_negate(node) +# # It is also possible to use #process_all for more +# # compact code if every child is a Node. +# node.updated(nil, process_all(node)) +# end +# +# def on_store(node) +# expr, variable_name = *node +# +# # Note that variable_name is not a Node and thus isn't +# # passed to #process. +# node.updated(nil, [ +# process(expr), +# variable_name +# ]) +# end +# +# # (load) is effectively a terminal node, and so it does +# # not need an explicit handler, as the following is the +# # default behavior. Essentially, for any nodes that don't +# # have a defined handler, the node remains unchanged. +# def on_load(node) +# nil +# end +# +# def on_each(node) +# node.updated(nil, process_all(node)) +# end +# end +# +# Let's test our ArithmeticsProcessor: +# +# include AST::Sexp +# expr = s(:add, s(:integer, 2), s(:integer, 2)) +# +# p ArithmeticsProcessor.new.process(expr) == expr # => true +# +# As expected, it does not change anything at all. This isn't +# actually very useful, so let's now define a Calculator, which +# will compute the expression values: +# +# # This Processor folds nonterminal nodes and returns an +# # (integer) terminal node. +# class ArithmeticsCalculator < ArithmeticsProcessor +# def compute_op(node) +# # First, node children are processed and then unpacked +# # to local variables. +# nodes = process_all(node) +# +# if nodes.all? { |node| node.type == :integer } +# # If each of those nodes represents a literal, we can +# # fold this node! +# values = nodes.map { |node| node.children.first } +# AST::Node.new(:integer, [ +# yield(values) +# ]) +# else +# # Otherwise, we can just leave the current node in the +# # tree and only update it with processed children +# # nodes, which can be partially folded. +# node.updated(nil, nodes) +# end +# end +# +# def on_add(node) +# compute_op(node) { |left, right| left + right } +# end +# +# def on_multiply(node) +# compute_op(node) { |left, right| left * right } +# end +# end +# +# Let's check: +# +# p ArithmeticsCalculator.new.process(expr) # => (integer 4) +# +# Excellent, the calculator works! Now, a careful reader could +# notice that the ArithmeticsCalculator does not know how to +# divide numbers. What if we pass an expression with division to +# it? +# +# expr_with_division = \ +# s(:add, +# s(:integer, 1), +# s(:divide, +# s(:add, s(:integer, 8), s(:integer, 4)), +# s(:integer, 3))) # 1 + (8 + 4) / 3 +# +# folded_expr_with_division = ArithmeticsCalculator.new.process(expr_with_division) +# p folded_expr_with_division +# # => (add +# # (integer 1) +# # (divide +# # (integer 12) +# # (integer 3))) +# +# As you can see, the expression was folded _partially_: the inner +# `(add)` node which could be computed was folded to +# `(integer 12)`, the `(divide)` node is left as-is because there +# is no computing handler for it, and the root `(add)` node was +# also left as it is because some of its children were not +# literals. +# +# Note that this partial folding is only possible because the +# _data_ format, i.e. the format in which the computed values of +# the nodes are represented, is the same as the AST itself. +# +# Let's extend our ArithmeticsCalculator class further. +# +# class ArithmeticsCalculator +# def on_divide(node) +# compute_op(node) { |left, right| left / right } +# end +# +# def on_negate(node) +# # Note how #compute_op works regardless of the operator +# # arity. +# compute_op(node) { |value| -value } +# end +# end +# +# Now, let's apply our renewed ArithmeticsCalculator to a partial +# result of previous evaluation: +# +# p ArithmeticsCalculator.new.process(expr_with_division) # => (integer 5) +# +# Five! Excellent. This is also pretty much how CRuby 1.8 executed +# its programs. +# +# Now, let's do some automated bug searching. Division by zero is +# an error, right? So if we could detect that someone has divided +# by zero before the program is even run, that could save some +# debugging time. +# +# class DivisionByZeroVerifier < ArithmeticsProcessor +# class VerificationFailure < Exception; end +# +# def on_divide(node) +# # You need to process the children to handle nested divisions +# # such as: +# # (divide +# # (integer 1) +# # (divide (integer 1) (integer 0)) +# left, right = process_all(node) +# +# if right.type == :integer && +# right.children.first == 0 +# raise VerificationFailure, "Ouch! This code divides by zero." +# end +# end +# +# def divides_by_zero?(ast) +# process(ast) +# false +# rescue VerificationFailure +# true +# end +# end +# +# nice_expr = \ +# s(:divide, +# s(:add, s(:integer, 10), s(:integer, 2)), +# s(:integer, 4)) +# +# p DivisionByZeroVerifier.new.divides_by_zero?(nice_expr) +# # => false. Good. +# +# bad_expr = \ +# s(:add, s(:integer, 10), +# s(:divide, s(:integer, 1), s(:integer, 0))) +# +# p DivisionByZeroVerifier.new.divides_by_zero?(bad_expr) +# # => true. WHOOPS. DO NOT RUN THIS. +# +# Of course, this won't detect more complex cases... unless you +# use some partial evaluation before! The possibilites are +# endless. Have fun. +# +# source://ast//lib/ast/processor/mixin.rb#240 +module AST::Processor::Mixin + # Default handler. Does nothing. + # + # @param node [AST::Node] + # @return [AST::Node, nil] + # + # source://ast//lib/ast/processor/mixin.rb#284 + def handler_missing(node); end + + # Dispatches `node`. If a node has type `:foo`, then a handler + # named `on_foo` is invoked with one argument, the `node`; if + # there isn't such a handler, {#handler_missing} is invoked + # with the same argument. + # + # If the handler returns `nil`, `node` is returned; otherwise, + # the return value of the handler is passed along. + # + # @param node [AST::Node, nil] + # @return [AST::Node, nil] + # + # source://ast//lib/ast/processor/mixin.rb#251 + def process(node); end + + # {#process}es each node from `nodes` and returns an array of + # results. + # + # @param nodes [Array] + # @return [Array] + # + # source://ast//lib/ast/processor/mixin.rb#274 + def process_all(nodes); end +end + +# This simple module is very useful in the cases where one needs +# to define deeply nested ASTs from Ruby code, for example, in +# tests. It should be used like this: +# +# describe YourLanguage do +# include ::AST::Sexp +# +# it "should correctly parse expressions" do +# YourLanguage.parse("1 + 2 * 3").should == +# s(:add, +# s(:integer, 1), +# s(:multiply, +# s(:integer, 2), +# s(:integer, 3))) +# end +# end +# +# This way the amount of boilerplate code is greatly reduced. +# +# source://ast//lib/ast/sexp.rb#20 +module AST::Sexp + # Creates a {Node} with type `type` and children `children`. + # Note that the resulting node is of the type AST::Node and not a + # subclass. + # This would not pose a problem with comparisons, as {Node#==} + # ignores metadata. + # + # source://ast//lib/ast/sexp.rb#26 + def s(type, *children); end +end diff --git a/sorbet/rbi/gems/benchmark@0.5.0.rbi b/sorbet/rbi/gems/benchmark@0.5.0.rbi new file mode 100644 index 0000000..8531eef --- /dev/null +++ b/sorbet/rbi/gems/benchmark@0.5.0.rbi @@ -0,0 +1,637 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `benchmark` gem. +# Please instead update this file by running `bin/tapioca gem benchmark`. + + +# The Benchmark module provides methods to measure and report the time +# used to execute Ruby code. +# +# * Measure the time to construct the string given by the expression +# "a"*1_000_000_000: +# +# require 'benchmark' +# +# puts Benchmark.measure { "a"*1_000_000_000 } +# +# On my machine (OSX 10.8.3 on i5 1.7 GHz) this generates: +# +# 0.350000 0.400000 0.750000 ( 0.835234) +# +# This report shows the user CPU time, system CPU time, the total time +# (sum of user CPU time, system CPU time, children's user CPU time, +# and children's system CPU time), and the elapsed real time. The unit +# of time is seconds. +# +# * Do some experiments sequentially using the #bm method: +# +# require 'benchmark' +# +# n = 5000000 +# Benchmark.bm do |x| +# x.report { for i in 1..n; a = "1"; end } +# x.report { n.times do ; a = "1"; end } +# x.report { 1.upto(n) do ; a = "1"; end } +# end +# +# The result: +# +# user system total real +# 1.010000 0.000000 1.010000 ( 1.014479) +# 1.000000 0.000000 1.000000 ( 0.998261) +# 0.980000 0.000000 0.980000 ( 0.981335) +# +# * Continuing the previous example, put a label in each report: +# +# require 'benchmark' +# +# n = 5000000 +# Benchmark.bm(7) do |x| +# x.report("for:") { for i in 1..n; a = "1"; end } +# x.report("times:") { n.times do ; a = "1"; end } +# x.report("upto:") { 1.upto(n) do ; a = "1"; end } +# end +# +# The result: +# +# user system total real +# for: 1.010000 0.000000 1.010000 ( 1.015688) +# times: 1.000000 0.000000 1.000000 ( 1.003611) +# upto: 1.030000 0.000000 1.030000 ( 1.028098) +# +# * The times for some benchmarks depend on the order in which items +# are run. These differences are due to the cost of memory +# allocation and garbage collection. To avoid these discrepancies, +# the #bmbm method is provided. For example, to compare ways to +# sort an array of floats: +# +# require 'benchmark' +# +# array = (1..1000000).map { rand } +# +# Benchmark.bmbm do |x| +# x.report("sort!") { array.dup.sort! } +# x.report("sort") { array.dup.sort } +# end +# +# The result: +# +# Rehearsal ----------------------------------------- +# sort! 1.490000 0.010000 1.500000 ( 1.490520) +# sort 1.460000 0.000000 1.460000 ( 1.463025) +# -------------------------------- total: 2.960000sec +# +# user system total real +# sort! 1.460000 0.000000 1.460000 ( 1.460465) +# sort 1.450000 0.010000 1.460000 ( 1.448327) +# +# * Report statistics of sequential experiments with unique labels, +# using the #benchmark method: +# +# require 'benchmark' +# include Benchmark # we need the CAPTION and FORMAT constants +# +# n = 5000000 +# Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x| +# tf = x.report("for:") { for i in 1..n; a = "1"; end } +# tt = x.report("times:") { n.times do ; a = "1"; end } +# tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end } +# [tf+tt+tu, (tf+tt+tu)/3] +# end +# +# The result: +# +# user system total real +# for: 0.950000 0.000000 0.950000 ( 0.952039) +# times: 0.980000 0.000000 0.980000 ( 0.984938) +# upto: 0.950000 0.000000 0.950000 ( 0.946787) +# >total: 2.880000 0.000000 2.880000 ( 2.883764) +# >avg: 0.960000 0.000000 0.960000 ( 0.961255) +# +# source://benchmark//lib/benchmark.rb#123 +module Benchmark + private + + # Invokes the block with a Benchmark::Report object, which + # may be used to collect and report on the results of individual + # benchmark tests. Reserves +label_width+ leading spaces for + # labels on each line. Prints +caption+ at the top of the + # report, and uses +format+ to format each line. + # (Note: +caption+ must contain a terminating newline character, + # see the default Benchmark::Tms::CAPTION for an example.) + # + # Returns an array of Benchmark::Tms objects. + # + # If the block returns an array of + # Benchmark::Tms objects, these will be used to format + # additional lines of output. If +labels+ parameter are + # given, these are used to label these extra lines. + # + # _Note_: Other methods provide a simpler interface to this one, and are + # suitable for nearly all benchmarking requirements. See the examples in + # Benchmark, and the #bm and #bmbm methods. + # + # Example: + # + # require 'benchmark' + # include Benchmark # we need the CAPTION and FORMAT constants + # + # n = 5000000 + # Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x| + # tf = x.report("for:") { for i in 1..n; a = "1"; end } + # tt = x.report("times:") { n.times do ; a = "1"; end } + # tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end } + # [tf+tt+tu, (tf+tt+tu)/3] + # end + # + # Generates: + # + # user system total real + # for: 0.970000 0.000000 0.970000 ( 0.970493) + # times: 0.990000 0.000000 0.990000 ( 0.989542) + # upto: 0.970000 0.000000 0.970000 ( 0.972854) + # >total: 2.930000 0.000000 2.930000 ( 2.932889) + # >avg: 0.976667 0.000000 0.976667 ( 0.977630) + # + # source://benchmark//lib/benchmark.rb#171 + def benchmark(caption = T.unsafe(nil), label_width = T.unsafe(nil), format = T.unsafe(nil), *labels); end + + # A simple interface to the #benchmark method, #bm generates sequential + # reports with labels. +label_width+ and +labels+ parameters have the same + # meaning as for #benchmark. + # + # require 'benchmark' + # + # n = 5000000 + # Benchmark.bm(7) do |x| + # x.report("for:") { for i in 1..n; a = "1"; end } + # x.report("times:") { n.times do ; a = "1"; end } + # x.report("upto:") { 1.upto(n) do ; a = "1"; end } + # end + # + # Generates: + # + # user system total real + # for: 0.960000 0.000000 0.960000 ( 0.957966) + # times: 0.960000 0.000000 0.960000 ( 0.960423) + # upto: 0.950000 0.000000 0.950000 ( 0.954864) + # + # source://benchmark//lib/benchmark.rb#216 + def bm(label_width = T.unsafe(nil), *labels, &blk); end + + # Sometimes benchmark results are skewed because code executed + # earlier encounters different garbage collection overheads than + # that run later. #bmbm attempts to minimize this effect by running + # the tests twice, the first time as a rehearsal in order to get the + # runtime environment stable, the second time for + # real. GC.start is executed before the start of each of + # the real timings; the cost of this is not included in the + # timings. In reality, though, there's only so much that #bmbm can + # do, and the results are not guaranteed to be isolated from garbage + # collection and other effects. + # + # Because #bmbm takes two passes through the tests, it can + # calculate the required label width. + # + # require 'benchmark' + # + # array = (1..1000000).map { rand } + # + # Benchmark.bmbm do |x| + # x.report("sort!") { array.dup.sort! } + # x.report("sort") { array.dup.sort } + # end + # + # Generates: + # + # Rehearsal ----------------------------------------- + # sort! 1.440000 0.010000 1.450000 ( 1.446833) + # sort 1.440000 0.000000 1.440000 ( 1.448257) + # -------------------------------- total: 2.890000sec + # + # user system total real + # sort! 1.460000 0.000000 1.460000 ( 1.458065) + # sort 1.450000 0.000000 1.450000 ( 1.455963) + # + # #bmbm yields a Benchmark::Job object and returns an array of + # Benchmark::Tms objects. + # + # source://benchmark//lib/benchmark.rb#258 + def bmbm(width = T.unsafe(nil)); end + + # Returns the time used to execute the given block as a + # Benchmark::Tms object. Takes +label+ option. + # + # require 'benchmark' + # + # n = 1000000 + # + # time = Benchmark.measure do + # n.times { a = "1" } + # end + # puts time + # + # Generates: + # + # 0.220000 0.000000 0.220000 ( 0.227313) + # + # source://benchmark//lib/benchmark.rb#303 + def measure(label = T.unsafe(nil)); end + + # Returns the elapsed real time used to execute the given block. + # The unit of time is milliseconds. + # + # Benchmark.ms { "a" * 1_000_000_000 } + # #=> 509.8029999935534 + # + # source://benchmark//lib/benchmark.rb#335 + def ms; end + + # Returns the elapsed real time used to execute the given block. + # The unit of time is seconds. + # + # Benchmark.realtime { "a" * 1_000_000_000 } + # #=> 0.5098029999935534 + # + # source://benchmark//lib/benchmark.rb#322 + def realtime; end + + class << self + # Invokes the block with a Benchmark::Report object, which + # may be used to collect and report on the results of individual + # benchmark tests. Reserves +label_width+ leading spaces for + # labels on each line. Prints +caption+ at the top of the + # report, and uses +format+ to format each line. + # (Note: +caption+ must contain a terminating newline character, + # see the default Benchmark::Tms::CAPTION for an example.) + # + # Returns an array of Benchmark::Tms objects. + # + # If the block returns an array of + # Benchmark::Tms objects, these will be used to format + # additional lines of output. If +labels+ parameter are + # given, these are used to label these extra lines. + # + # _Note_: Other methods provide a simpler interface to this one, and are + # suitable for nearly all benchmarking requirements. See the examples in + # Benchmark, and the #bm and #bmbm methods. + # + # Example: + # + # require 'benchmark' + # include Benchmark # we need the CAPTION and FORMAT constants + # + # n = 5000000 + # Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x| + # tf = x.report("for:") { for i in 1..n; a = "1"; end } + # tt = x.report("times:") { n.times do ; a = "1"; end } + # tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end } + # [tf+tt+tu, (tf+tt+tu)/3] + # end + # + # Generates: + # + # user system total real + # for: 0.970000 0.000000 0.970000 ( 0.970493) + # times: 0.990000 0.000000 0.990000 ( 0.989542) + # upto: 0.970000 0.000000 0.970000 ( 0.972854) + # >total: 2.930000 0.000000 2.930000 ( 2.932889) + # >avg: 0.976667 0.000000 0.976667 ( 0.977630) + # + # source://benchmark//lib/benchmark.rb#341 + def benchmark(caption = T.unsafe(nil), label_width = T.unsafe(nil), format = T.unsafe(nil), *labels); end + + # A simple interface to the #benchmark method, #bm generates sequential + # reports with labels. +label_width+ and +labels+ parameters have the same + # meaning as for #benchmark. + # + # require 'benchmark' + # + # n = 5000000 + # Benchmark.bm(7) do |x| + # x.report("for:") { for i in 1..n; a = "1"; end } + # x.report("times:") { n.times do ; a = "1"; end } + # x.report("upto:") { 1.upto(n) do ; a = "1"; end } + # end + # + # Generates: + # + # user system total real + # for: 0.960000 0.000000 0.960000 ( 0.957966) + # times: 0.960000 0.000000 0.960000 ( 0.960423) + # upto: 0.950000 0.000000 0.950000 ( 0.954864) + # + # source://benchmark//lib/benchmark.rb#341 + def bm(label_width = T.unsafe(nil), *labels, &blk); end + + # Sometimes benchmark results are skewed because code executed + # earlier encounters different garbage collection overheads than + # that run later. #bmbm attempts to minimize this effect by running + # the tests twice, the first time as a rehearsal in order to get the + # runtime environment stable, the second time for + # real. GC.start is executed before the start of each of + # the real timings; the cost of this is not included in the + # timings. In reality, though, there's only so much that #bmbm can + # do, and the results are not guaranteed to be isolated from garbage + # collection and other effects. + # + # Because #bmbm takes two passes through the tests, it can + # calculate the required label width. + # + # require 'benchmark' + # + # array = (1..1000000).map { rand } + # + # Benchmark.bmbm do |x| + # x.report("sort!") { array.dup.sort! } + # x.report("sort") { array.dup.sort } + # end + # + # Generates: + # + # Rehearsal ----------------------------------------- + # sort! 1.440000 0.010000 1.450000 ( 1.446833) + # sort 1.440000 0.000000 1.440000 ( 1.448257) + # -------------------------------- total: 2.890000sec + # + # user system total real + # sort! 1.460000 0.000000 1.460000 ( 1.458065) + # sort 1.450000 0.000000 1.450000 ( 1.455963) + # + # #bmbm yields a Benchmark::Job object and returns an array of + # Benchmark::Tms objects. + # + # source://benchmark//lib/benchmark.rb#341 + def bmbm(width = T.unsafe(nil)); end + + # Returns the time used to execute the given block as a + # Benchmark::Tms object. Takes +label+ option. + # + # require 'benchmark' + # + # n = 1000000 + # + # time = Benchmark.measure do + # n.times { a = "1" } + # end + # puts time + # + # Generates: + # + # 0.220000 0.000000 0.220000 ( 0.227313) + # + # source://benchmark//lib/benchmark.rb#341 + def measure(label = T.unsafe(nil)); end + + # Returns the elapsed real time used to execute the given block. + # The unit of time is milliseconds. + # + # Benchmark.ms { "a" * 1_000_000_000 } + # #=> 509.8029999935534 + # + # source://benchmark//lib/benchmark.rb#341 + def ms; end + + # Returns the elapsed real time used to execute the given block. + # The unit of time is seconds. + # + # Benchmark.realtime { "a" * 1_000_000_000 } + # #=> 0.5098029999935534 + # + # source://benchmark//lib/benchmark.rb#341 + def realtime; end + end +end + +# A Job is a sequence of labelled blocks to be processed by the +# Benchmark.bmbm method. It is of little direct interest to the user. +# +# source://benchmark//lib/benchmark.rb#347 +class Benchmark::Job + # Returns an initialized Job instance. + # Usually, one doesn't call this method directly, as new + # Job objects are created by the #bmbm method. + # +width+ is a initial value for the label offset used in formatting; + # the #bmbm method passes its +width+ argument to this constructor. + # + # @return [Job] a new instance of Job + # + # source://benchmark//lib/benchmark.rb#355 + def initialize(width); end + + # Registers the given label and block pair in the job list. + # + # @raise [ArgumentError] + # + # source://benchmark//lib/benchmark.rb#363 + def item(label = T.unsafe(nil), &blk); end + + # An array of 2-element arrays, consisting of label and block pairs. + # + # source://benchmark//lib/benchmark.rb#375 + def list; end + + # Registers the given label and block pair in the job list. + # + # @raise [ArgumentError] + # + # source://benchmark//lib/benchmark.rb#372 + def report(label = T.unsafe(nil), &blk); end + + # Length of the widest label in the #list. + # + # source://benchmark//lib/benchmark.rb#378 + def width; end +end + +# This class is used by the Benchmark.benchmark and Benchmark.bm methods. +# It is of little direct interest to the user. +# +# source://benchmark//lib/benchmark.rb#385 +class Benchmark::Report + # Returns an initialized Report instance. + # Usually, one doesn't call this method directly, as new + # Report objects are created by the #benchmark and #bm methods. + # +width+ and +format+ are the label offset and + # format string used by Tms#format. + # + # @return [Report] a new instance of Report + # + # source://benchmark//lib/benchmark.rb#393 + def initialize(width = T.unsafe(nil), format = T.unsafe(nil)); end + + # An array of Benchmark::Tms objects representing each item. + # + # source://benchmark//lib/benchmark.rb#412 + def format; end + + # Prints the +label+ and measured time for the block, + # formatted by +format+. See Tms#format for the + # formatting rules. + # + # source://benchmark//lib/benchmark.rb#402 + def item(label = T.unsafe(nil), *format, &blk); end + + # An array of Benchmark::Tms objects representing each item. + # + # source://benchmark//lib/benchmark.rb#412 + def list; end + + # Prints the +label+ and measured time for the block, + # formatted by +format+. See Tms#format for the + # formatting rules. + # + # source://benchmark//lib/benchmark.rb#409 + def report(label = T.unsafe(nil), *format, &blk); end + + # An array of Benchmark::Tms objects representing each item. + # + # source://benchmark//lib/benchmark.rb#412 + def width; end +end + +# A data object, representing the times associated with a benchmark +# measurement. +# +# source://benchmark//lib/benchmark.rb#421 +class Benchmark::Tms + # Returns an initialized Tms object which has + # +utime+ as the user CPU time, +stime+ as the system CPU time, + # +cutime+ as the children's user CPU time, +cstime+ as the children's + # system CPU time, +real+ as the elapsed real time and +label+ as the label. + # + # @return [Tms] a new instance of Tms + # + # source://benchmark//lib/benchmark.rb#456 + def initialize(utime = T.unsafe(nil), stime = T.unsafe(nil), cutime = T.unsafe(nil), cstime = T.unsafe(nil), real = T.unsafe(nil), label = T.unsafe(nil)); end + + # Returns a new Tms object obtained by memberwise multiplication + # of the individual times for this Tms object by +x+. + # + # source://benchmark//lib/benchmark.rb#504 + def *(x); end + + # Returns a new Tms object obtained by memberwise summation + # of the individual times for this Tms object with those of the +other+ + # Tms object. + # This method and #/() are useful for taking statistics. + # + # source://benchmark//lib/benchmark.rb#491 + def +(other); end + + # Returns a new Tms object obtained by memberwise subtraction + # of the individual times for the +other+ Tms object from those of this + # Tms object. + # + # source://benchmark//lib/benchmark.rb#498 + def -(other); end + + # Returns a new Tms object obtained by memberwise division + # of the individual times for this Tms object by +x+. + # This method and #+() are useful for taking statistics. + # + # source://benchmark//lib/benchmark.rb#511 + def /(x); end + + # Returns a new Tms object whose times are the sum of the times for this + # Tms object, plus the time required to execute the code block (+blk+). + # + # source://benchmark//lib/benchmark.rb#465 + def add(&blk); end + + # An in-place version of #add. + # Changes the times of this Tms object by making it the sum of the times + # for this Tms object, plus the time required to execute + # the code block (+blk+). + # + # source://benchmark//lib/benchmark.rb#475 + def add!(&blk); end + + # System CPU time of children + # + # source://benchmark//lib/benchmark.rb#439 + def cstime; end + + # User CPU time of children + # + # source://benchmark//lib/benchmark.rb#436 + def cutime; end + + # Returns the contents of this Tms object as + # a formatted string, according to a +format+ string + # like that passed to Kernel.format. In addition, #format + # accepts the following extensions: + # + # %u:: Replaced by the user CPU time, as reported by Tms#utime. + # %y:: Replaced by the system CPU time, as reported by Tms#stime (Mnemonic: y of "s*y*stem") + # %U:: Replaced by the children's user CPU time, as reported by Tms#cutime + # %Y:: Replaced by the children's system CPU time, as reported by Tms#cstime + # %t:: Replaced by the total CPU time, as reported by Tms#total + # %r:: Replaced by the elapsed real time, as reported by Tms#real + # %n:: Replaced by the label string, as reported by Tms#label (Mnemonic: n of "*n*ame") + # + # If +format+ is not given, FORMAT is used as default value, detailing the + # user, system, total and real elapsed time. + # + # source://benchmark//lib/benchmark.rb#530 + def format(format = T.unsafe(nil), *args); end + + # Label + # + # source://benchmark//lib/benchmark.rb#448 + def label; end + + # Elapsed real time + # + # source://benchmark//lib/benchmark.rb#442 + def real; end + + # System CPU time + # + # source://benchmark//lib/benchmark.rb#433 + def stime; end + + # Returns a new 6-element array, consisting of the + # label, user CPU time, system CPU time, children's + # user CPU time, children's system CPU time and elapsed + # real time. + # + # source://benchmark//lib/benchmark.rb#555 + def to_a; end + + # Returns a hash containing the same data as `to_a`. + # + # source://benchmark//lib/benchmark.rb#562 + def to_h; end + + # Same as #format. + # + # source://benchmark//lib/benchmark.rb#545 + def to_s; end + + # Total time, that is +utime+ + +stime+ + +cutime+ + +cstime+ + # + # source://benchmark//lib/benchmark.rb#445 + def total; end + + # User CPU time + # + # source://benchmark//lib/benchmark.rb#430 + def utime; end + + protected + + # Returns a new Tms object obtained by memberwise operation +op+ + # of the individual times for this Tms object with those of the other + # Tms object (+x+). + # + # +op+ can be a mathematical operation such as +, -, + # *, / + # + # source://benchmark//lib/benchmark.rb#583 + def memberwise(op, x); end +end + +# source://benchmark//lib/benchmark.rb#125 +Benchmark::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/date@3.5.1.rbi b/sorbet/rbi/gems/date@3.5.1.rbi new file mode 100644 index 0000000..36681e8 --- /dev/null +++ b/sorbet/rbi/gems/date@3.5.1.rbi @@ -0,0 +1,403 @@ +# typed: false + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `date` gem. +# Please instead update this file by running `bin/tapioca gem date`. + + +# source://date//lib/date.rb#6 +class Date + include ::Comparable + + # source://date//lib/date.rb#4 + def initialize(*_arg0); end + + # source://date//lib/date.rb#4 + def +(_arg0); end + + # source://date//lib/date.rb#4 + def -(_arg0); end + + # source://date//lib/date.rb#4 + def <<(_arg0); end + + # source://date//lib/date.rb#4 + def <=>(_arg0); end + + # source://date//lib/date.rb#4 + def ===(_arg0); end + + # source://date//lib/date.rb#4 + def >>(_arg0); end + + # source://date//lib/date.rb#4 + def ajd; end + + # source://date//lib/date.rb#4 + def amjd; end + + # source://date//lib/date.rb#4 + def asctime; end + + # source://date//lib/date.rb#4 + def ctime; end + + # source://date//lib/date.rb#4 + def cwday; end + + # source://date//lib/date.rb#4 + def cweek; end + + # source://date//lib/date.rb#4 + def cwyear; end + + # source://date//lib/date.rb#4 + def day; end + + # source://date//lib/date.rb#4 + def day_fraction; end + + # source://date//lib/date.rb#4 + def deconstruct_keys(_arg0); end + + # source://date//lib/date.rb#4 + def downto(_arg0); end + + # source://date//lib/date.rb#4 + def england; end + + # source://date//lib/date.rb#4 + def eql?(_arg0); end + + # source://date//lib/date.rb#4 + def friday?; end + + # source://date//lib/date.rb#4 + def gregorian; end + + # source://date//lib/date.rb#4 + def gregorian?; end + + # source://date//lib/date.rb#4 + def hash; end + + # source://date//lib/date.rb#4 + def httpdate; end + + # call-seq: + # infinite? -> false + # + # Returns +false+ + # + # @return [Boolean] + # + # source://date//lib/date.rb#13 + def infinite?; end + + # source://date//lib/date.rb#4 + def inspect; end + + # source://date//lib/date.rb#4 + def iso8601; end + + # source://date//lib/date.rb#4 + def italy; end + + # source://date//lib/date.rb#4 + def jd; end + + # source://date//lib/date.rb#4 + def jisx0301; end + + # source://date//lib/date.rb#4 + def julian; end + + # source://date//lib/date.rb#4 + def julian?; end + + # source://date//lib/date.rb#4 + def ld; end + + # source://date//lib/date.rb#4 + def leap?; end + + # source://date//lib/date.rb#4 + def marshal_dump; end + + # source://date//lib/date.rb#4 + def marshal_load(_arg0); end + + # source://date//lib/date.rb#4 + def mday; end + + # source://date//lib/date.rb#4 + def mjd; end + + # source://date//lib/date.rb#4 + def mon; end + + # source://date//lib/date.rb#4 + def monday?; end + + # source://date//lib/date.rb#4 + def month; end + + # source://date//lib/date.rb#4 + def new_start(*_arg0); end + + # source://date//lib/date.rb#4 + def next; end + + # source://date//lib/date.rb#4 + def next_day(*_arg0); end + + # source://date//lib/date.rb#4 + def next_month(*_arg0); end + + # source://date//lib/date.rb#4 + def next_year(*_arg0); end + + # source://date//lib/date.rb#4 + def prev_day(*_arg0); end + + # source://date//lib/date.rb#4 + def prev_month(*_arg0); end + + # source://date//lib/date.rb#4 + def prev_year(*_arg0); end + + # source://date//lib/date.rb#4 + def rfc2822; end + + # source://date//lib/date.rb#4 + def rfc3339; end + + # source://date//lib/date.rb#4 + def rfc822; end + + # source://date//lib/date.rb#4 + def saturday?; end + + # source://date//lib/date.rb#4 + def start; end + + # source://date//lib/date.rb#4 + def step(*_arg0); end + + # source://date//lib/date.rb#4 + def strftime(*_arg0); end + + # source://date//lib/date.rb#4 + def succ; end + + # source://date//lib/date.rb#4 + def sunday?; end + + # source://date//lib/date.rb#4 + def thursday?; end + + # source://date//lib/date.rb#4 + def to_date; end + + # source://date//lib/date.rb#4 + def to_datetime; end + + # source://date//lib/date.rb#4 + def to_s; end + + # source://date//lib/date.rb#4 + def to_time; end + + # source://date//lib/date.rb#4 + def tuesday?; end + + # source://date//lib/date.rb#4 + def upto(_arg0); end + + # source://date//lib/date.rb#4 + def wday; end + + # source://date//lib/date.rb#4 + def wednesday?; end + + # source://date//lib/date.rb#4 + def xmlschema; end + + # source://date//lib/date.rb#4 + def yday; end + + # source://date//lib/date.rb#4 + def year; end + + private + + # source://date//lib/date.rb#4 + def hour; end + + # source://date//lib/date.rb#4 + def initialize_copy(_arg0); end + + # source://date//lib/date.rb#4 + def min; end + + # source://date//lib/date.rb#4 + def minute; end + + # source://date//lib/date.rb#4 + def sec; end + + # source://date//lib/date.rb#4 + def second; end + + class << self + # source://date//lib/date.rb#4 + def _httpdate(*_arg0); end + + # source://date//lib/date.rb#4 + def _iso8601(*_arg0); end + + # source://date//lib/date.rb#4 + def _jisx0301(*_arg0); end + + # source://date//lib/date.rb#4 + def _load(_arg0); end + + # source://date//lib/date.rb#4 + def _parse(*_arg0); end + + # source://date//lib/date.rb#4 + def _rfc2822(*_arg0); end + + # source://date//lib/date.rb#4 + def _rfc3339(*_arg0); end + + # source://date//lib/date.rb#4 + def _rfc822(*_arg0); end + + # source://date//lib/date.rb#4 + def _strptime(*_arg0); end + + # source://date//lib/date.rb#4 + def _xmlschema(*_arg0); end + + # source://date//lib/date.rb#4 + def civil(*_arg0); end + + # source://date//lib/date.rb#4 + def commercial(*_arg0); end + + # source://date//lib/date.rb#4 + def gregorian_leap?(_arg0); end + + # source://date//lib/date.rb#4 + def httpdate(*_arg0); end + + # source://date//lib/date.rb#4 + def iso8601(*_arg0); end + + # source://date//lib/date.rb#4 + def jd(*_arg0); end + + # source://date//lib/date.rb#4 + def jisx0301(*_arg0); end + + # source://date//lib/date.rb#4 + def julian_leap?(_arg0); end + + # source://date//lib/date.rb#4 + def leap?(_arg0); end + + # source://date//lib/date.rb#4 + def ordinal(*_arg0); end + + # source://date//lib/date.rb#4 + def parse(*_arg0); end + + # source://date//lib/date.rb#4 + def rfc2822(*_arg0); end + + # source://date//lib/date.rb#4 + def rfc3339(*_arg0); end + + # source://date//lib/date.rb#4 + def rfc822(*_arg0); end + + # source://date//lib/date.rb#4 + def strptime(*_arg0); end + + # source://date//lib/date.rb#4 + def today(*_arg0); end + + # source://date//lib/date.rb#4 + def valid_civil?(*_arg0); end + + # source://date//lib/date.rb#4 + def valid_commercial?(*_arg0); end + + # source://date//lib/date.rb#4 + def valid_date?(*_arg0); end + + # source://date//lib/date.rb#4 + def valid_jd?(*_arg0); end + + # source://date//lib/date.rb#4 + def valid_ordinal?(*_arg0); end + + # source://date//lib/date.rb#4 + def xmlschema(*_arg0); end + end +end + +# source://date//lib/date.rb#17 +class Date::Infinity < ::Numeric + # @return [Infinity] a new instance of Infinity + # + # source://date//lib/date.rb#19 + def initialize(d = T.unsafe(nil)); end + + # source://date//lib/date.rb#33 + def +@; end + + # source://date//lib/date.rb#32 + def -@; end + + # source://date//lib/date.rb#35 + def <=>(other); end + + # source://date//lib/date.rb#30 + def abs; end + + # source://date//lib/date.rb#51 + def coerce(other); end + + # @return [Boolean] + # + # source://date//lib/date.rb#26 + def finite?; end + + # @return [Boolean] + # + # source://date//lib/date.rb#27 + def infinite?; end + + # @return [Boolean] + # + # source://date//lib/date.rb#28 + def nan?; end + + # source://date//lib/date.rb#59 + def to_f; end + + # @return [Boolean] + # + # source://date//lib/date.rb#25 + def zero?; end + + protected + + # source://date//lib/date.rb#21 + def d; end +end + +# source://date//lib/date.rb#7 +Date::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/erb@6.0.1.rbi b/sorbet/rbi/gems/erb@6.0.1.rbi new file mode 100644 index 0000000..cfe5487 --- /dev/null +++ b/sorbet/rbi/gems/erb@6.0.1.rbi @@ -0,0 +1,816 @@ +# typed: false + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `erb` gem. +# Please instead update this file by running `bin/tapioca gem erb`. + + +# source://erb//lib/erb/version.rb#2 +class ERB + # :markup: markdown + # + # :call-seq: + # ERB.new(template, trim_mode: nil, eoutvar: '_erbout') + # + # Returns a new \ERB object containing the given string +template+. + # + # For details about `template`, its embedded tags, and generated results, see ERB. + # + # **Keyword Argument `trim_mode`** + # + # You can use keyword argument `trim_mode: '%'` + # to enable the [shorthand format][shorthand format] for execution tags. + # + # This value allows [blank line control][blank line control]: + # + # - `'-'`: Omit each blank line ending with `'%>'`. + # + # Other values allow [newline control][newline control]: + # + # - `'>'`: Omit newline for each line ending with `'%>'`. + # - `'<>'`: Omit newline for each line starting with `'<%'` and ending with `'%>'`. + # + # You can also [combine trim modes][combine trim modes]. + # + # **Keyword Argument `eoutvar`** + # + # The string value of keyword argument `eoutvar` specifies the name of the variable + # that method #result uses to construct its result string; + # see #src. + # + # This is useful when you need to run multiple \ERB templates through the same binding + # and/or when you want to control where output ends up. + # + # It's good practice to choose a variable name that begins with an underscore: `'_'`. + # + # [blank line control]: rdoc-ref:ERB@Suppressing+Unwanted+Blank+Lines + # [combine trim modes]: rdoc-ref:ERB@Combining+Trim+Modes + # [newline control]: rdoc-ref:ERB@Suppressing+Unwanted+Newlines + # [shorthand format]: rdoc-ref:ERB@Shorthand+Format+for+Execution+Tags + # + # @return [ERB] a new instance of ERB + # + # source://erb//lib/erb.rb#832 + def initialize(str, trim_mode: T.unsafe(nil), eoutvar: T.unsafe(nil)); end + + # :markup: markdown + # + # :call-seq: + # def_class(super_class = Object, method_name = 'result') -> new_class + # + # Returns a new nameless class whose superclass is `super_class`, + # and which has instance method `method_name`. + # + # Create a template from HTML that has embedded expression tags that use `@arg1` and `@arg2`: + # + # ``` + # html = <