diff --git a/.bundle/config b/.bundle/config deleted file mode 100644 index 7915bd4..0000000 --- a/.bundle/config +++ /dev/null @@ -1,2 +0,0 @@ ---- -BUNDLE_PATH: "/home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle" diff --git a/.gitignore b/.gitignore index 163ea08..3e2cc29 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ Gemfile.lock pkg coverage -.DS_Store \ No newline at end of file +.DS_Store +.bundle/ +vendor/bundle/ \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 4794252..920db89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### 0.5.1 (Next) +* [#29](https://github.com/dblock/ruby-link-checker/pull/29): Removed accidentally tracked Bundler artifacts, ignored local Bundler configuration and installed gems, and restricted gem packaging to tracked files - [@dblock](https://github.com/dblock), [@Copilot](https://github.com/Copilot). * [#28](https://github.com/dblock/ruby-link-checker/pull/28): Updated ruby-gem-release to 0.3.0 and removed the unsupported dry-run release input and instructions - [@dblock](https://github.com/dblock), [@Copilot](https://github.com/Copilot). * Your contribution here. diff --git a/ruby-link-checker.gemspec b/ruby-link-checker.gemspec index 4a574b6..da09473 100644 --- a/ruby-link-checker.gemspec +++ b/ruby-link-checker.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.required_rubygems_version = '>= 1.3.6' s.required_ruby_version = '>= 3.3' - s.files = Dir['**/*'] + s.files = IO.popen(%w[git ls-files -z], &:read).split("\0") s.require_paths = ['lib'] s.homepage = 'http://github.com/dblock/ruby-link-checker' s.licenses = ['MIT'] diff --git a/vendor/bundle/ruby/3.3.0/bin/danger b/vendor/bundle/ruby/3.3.0/bin/danger deleted file mode 100755 index 799b4b0..0000000 --- a/vendor/bundle/ruby/3.3.0/bin/danger +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by RubyGems. -# -# The application 'danger' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'rubygems' - -Gem.use_gemdeps - -version = ">= 0.a" - -str = ARGV.first -if str - str = str.b[/\A_(.*)_\z/, 1] - if str and Gem::Version.correct?(str) - version = str - ARGV.shift - end -end - -if Gem.respond_to?(:activate_bin_path) -load Gem.activate_bin_path('danger', 'danger', version) -else -gem "danger", version -load Gem.bin_path("danger", "danger", version) -end diff --git a/vendor/bundle/ruby/3.3.0/bin/htmldiff b/vendor/bundle/ruby/3.3.0/bin/htmldiff deleted file mode 100755 index a91f4b6..0000000 --- a/vendor/bundle/ruby/3.3.0/bin/htmldiff +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by RubyGems. -# -# The application 'diff-lcs' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'rubygems' - -Gem.use_gemdeps - -version = ">= 0.a" - -str = ARGV.first -if str - str = str.b[/\A_(.*)_\z/, 1] - if str and Gem::Version.correct?(str) - version = str - ARGV.shift - end -end - -if Gem.respond_to?(:activate_bin_path) -load Gem.activate_bin_path('diff-lcs', 'htmldiff', version) -else -gem "diff-lcs", version -load Gem.bin_path("diff-lcs", "htmldiff", version) -end diff --git a/vendor/bundle/ruby/3.3.0/bin/kramdown b/vendor/bundle/ruby/3.3.0/bin/kramdown deleted file mode 100755 index 80d0907..0000000 --- a/vendor/bundle/ruby/3.3.0/bin/kramdown +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by RubyGems. -# -# The application 'kramdown' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'rubygems' - -Gem.use_gemdeps - -version = ">= 0.a" - -str = ARGV.first -if str - str = str.b[/\A_(.*)_\z/, 1] - if str and Gem::Version.correct?(str) - version = str - ARGV.shift - end -end - -if Gem.respond_to?(:activate_bin_path) -load Gem.activate_bin_path('kramdown', 'kramdown', version) -else -gem "kramdown", version -load Gem.bin_path("kramdown", "kramdown", version) -end diff --git a/vendor/bundle/ruby/3.3.0/bin/ldiff b/vendor/bundle/ruby/3.3.0/bin/ldiff deleted file mode 100755 index b317920..0000000 --- a/vendor/bundle/ruby/3.3.0/bin/ldiff +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by RubyGems. -# -# The application 'diff-lcs' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'rubygems' - -Gem.use_gemdeps - -version = ">= 0.a" - -str = ARGV.first -if str - str = str.b[/\A_(.*)_\z/, 1] - if str and Gem::Version.correct?(str) - version = str - ARGV.shift - end -end - -if Gem.respond_to?(:activate_bin_path) -load Gem.activate_bin_path('diff-lcs', 'ldiff', version) -else -gem "diff-lcs", version -load Gem.bin_path("diff-lcs", "ldiff", version) -end diff --git a/vendor/bundle/ruby/3.3.0/bin/minitest b/vendor/bundle/ruby/3.3.0/bin/minitest deleted file mode 100755 index ea1f8f7..0000000 --- a/vendor/bundle/ruby/3.3.0/bin/minitest +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by RubyGems. -# -# The application 'minitest' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'rubygems' - -Gem.use_gemdeps - -version = ">= 0.a" - -str = ARGV.first -if str - str = str.b[/\A_(.*)_\z/, 1] - if str and Gem::Version.correct?(str) - version = str - ARGV.shift - end -end - -if Gem.respond_to?(:activate_bin_path) -load Gem.activate_bin_path('minitest', 'minitest', version) -else -gem "minitest", version -load Gem.bin_path("minitest", "minitest", version) -end diff --git a/vendor/bundle/ruby/3.3.0/bin/racc b/vendor/bundle/ruby/3.3.0/bin/racc deleted file mode 100755 index 9041ab6..0000000 --- a/vendor/bundle/ruby/3.3.0/bin/racc +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by RubyGems. -# -# The application 'racc' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'rubygems' - -Gem.use_gemdeps - -version = ">= 0.a" - -str = ARGV.first -if str - str = str.b[/\A_(.*)_\z/, 1] - if str and Gem::Version.correct?(str) - version = str - ARGV.shift - end -end - -if Gem.respond_to?(:activate_bin_path) -load Gem.activate_bin_path('racc', 'racc', version) -else -gem "racc", version -load Gem.bin_path("racc", "racc", version) -end diff --git a/vendor/bundle/ruby/3.3.0/bin/rake b/vendor/bundle/ruby/3.3.0/bin/rake deleted file mode 100755 index 3a26cbd..0000000 --- a/vendor/bundle/ruby/3.3.0/bin/rake +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by RubyGems. -# -# The application 'rake' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'rubygems' - -Gem.use_gemdeps - -version = ">= 0.a" - -str = ARGV.first -if str - str = str.b[/\A_(.*)_\z/, 1] - if str and Gem::Version.correct?(str) - version = str - ARGV.shift - end -end - -if Gem.respond_to?(:activate_bin_path) -load Gem.activate_bin_path('rake', 'rake', version) -else -gem "rake", version -load Gem.bin_path("rake", "rake", version) -end diff --git a/vendor/bundle/ruby/3.3.0/bin/rspec b/vendor/bundle/ruby/3.3.0/bin/rspec deleted file mode 100755 index d2cafd0..0000000 --- a/vendor/bundle/ruby/3.3.0/bin/rspec +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by RubyGems. -# -# The application 'rspec-core' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'rubygems' - -Gem.use_gemdeps - -version = ">= 0.a" - -str = ARGV.first -if str - str = str.b[/\A_(.*)_\z/, 1] - if str and Gem::Version.correct?(str) - version = str - ARGV.shift - end -end - -if Gem.respond_to?(:activate_bin_path) -load Gem.activate_bin_path('rspec-core', 'rspec', version) -else -gem "rspec-core", version -load Gem.bin_path("rspec-core", "rspec", version) -end diff --git a/vendor/bundle/ruby/3.3.0/bin/rubocop b/vendor/bundle/ruby/3.3.0/bin/rubocop deleted file mode 100755 index 9115ca0..0000000 --- a/vendor/bundle/ruby/3.3.0/bin/rubocop +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by RubyGems. -# -# The application 'rubocop' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'rubygems' - -Gem.use_gemdeps - -version = ">= 0.a" - -str = ARGV.first -if str - str = str.b[/\A_(.*)_\z/, 1] - if str and Gem::Version.correct?(str) - version = str - ARGV.shift - end -end - -if Gem.respond_to?(:activate_bin_path) -load Gem.activate_bin_path('rubocop', 'rubocop', version) -else -gem "rubocop", version -load Gem.bin_path("rubocop", "rubocop", version) -end diff --git a/vendor/bundle/ruby/3.3.0/bin/ruby-parse b/vendor/bundle/ruby/3.3.0/bin/ruby-parse deleted file mode 100755 index 4cbe6e8..0000000 --- a/vendor/bundle/ruby/3.3.0/bin/ruby-parse +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by RubyGems. -# -# The application 'parser' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'rubygems' - -Gem.use_gemdeps - -version = ">= 0.a" - -str = ARGV.first -if str - str = str.b[/\A_(.*)_\z/, 1] - if str and Gem::Version.correct?(str) - version = str - ARGV.shift - end -end - -if Gem.respond_to?(:activate_bin_path) -load Gem.activate_bin_path('parser', 'ruby-parse', version) -else -gem "parser", version -load Gem.bin_path("parser", "ruby-parse", version) -end diff --git a/vendor/bundle/ruby/3.3.0/bin/ruby-rewrite b/vendor/bundle/ruby/3.3.0/bin/ruby-rewrite deleted file mode 100755 index 00c71af..0000000 --- a/vendor/bundle/ruby/3.3.0/bin/ruby-rewrite +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by RubyGems. -# -# The application 'parser' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'rubygems' - -Gem.use_gemdeps - -version = ">= 0.a" - -str = ARGV.first -if str - str = str.b[/\A_(.*)_\z/, 1] - if str and Gem::Version.correct?(str) - version = str - ARGV.shift - end -end - -if Gem.respond_to?(:activate_bin_path) -load Gem.activate_bin_path('parser', 'ruby-rewrite', version) -else -gem "parser", version -load Gem.bin_path("parser", "ruby-rewrite", version) -end diff --git a/vendor/bundle/ruby/3.3.0/bin/simplecov b/vendor/bundle/ruby/3.3.0/bin/simplecov deleted file mode 100755 index aee794d..0000000 --- a/vendor/bundle/ruby/3.3.0/bin/simplecov +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby -# -# This file was generated by RubyGems. -# -# The application 'simplecov' is installed as part of a gem, and -# this file is here to facilitate running it. -# - -require 'rubygems' - -Gem.use_gemdeps - -version = ">= 0.a" - -str = ARGV.first -if str - str = str.b[/\A_(.*)_\z/, 1] - if str and Gem::Version.correct?(str) - version = str - ARGV.shift - end -end - -if Gem.respond_to?(:activate_bin_path) -load Gem.activate_bin_path('simplecov', 'simplecov', version) -else -gem "simplecov", version -load Gem.bin_path("simplecov", "simplecov", version) -end diff --git a/vendor/bundle/ruby/3.3.0/cache/activesupport-8.1.4.1.gem b/vendor/bundle/ruby/3.3.0/cache/activesupport-8.1.4.1.gem deleted file mode 100644 index 829ac6e..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/activesupport-8.1.4.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/addressable-2.9.2.gem b/vendor/bundle/ruby/3.3.0/cache/addressable-2.9.2.gem deleted file mode 100644 index d5a5853..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/addressable-2.9.2.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/ast-2.4.3.gem b/vendor/bundle/ruby/3.3.0/cache/ast-2.4.3.gem deleted file mode 100644 index 1f5e5c2..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/ast-2.4.3.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/async-2.46.0.gem b/vendor/bundle/ruby/3.3.0/cache/async-2.46.0.gem deleted file mode 100644 index 8427e17..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/async-2.46.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/async-http-0.105.0.gem b/vendor/bundle/ruby/3.3.0/cache/async-http-0.105.0.gem deleted file mode 100644 index c326ea7..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/async-http-0.105.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/async-pool-0.12.0.gem b/vendor/bundle/ruby/3.3.0/cache/async-pool-0.12.0.gem deleted file mode 100644 index a3a1d89..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/async-pool-0.12.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/base64-0.3.0.gem b/vendor/bundle/ruby/3.3.0/cache/base64-0.3.0.gem deleted file mode 100644 index 12f53f1..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/base64-0.3.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/bigdecimal-4.1.3.gem b/vendor/bundle/ruby/3.3.0/cache/bigdecimal-4.1.3.gem deleted file mode 100644 index ae6a4b4..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/bigdecimal-4.1.3.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/claide-1.1.0.gem b/vendor/bundle/ruby/3.3.0/cache/claide-1.1.0.gem deleted file mode 100644 index 6b0fb2d..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/claide-1.1.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/claide-plugins-0.9.2.gem b/vendor/bundle/ruby/3.3.0/cache/claide-plugins-0.9.2.gem deleted file mode 100644 index 30dfcb2..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/claide-plugins-0.9.2.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/colored2-3.1.2.gem b/vendor/bundle/ruby/3.3.0/cache/colored2-3.1.2.gem deleted file mode 100644 index 9757ae3..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/colored2-3.1.2.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/commonmarker-2.10.1-x86_64-linux.gem b/vendor/bundle/ruby/3.3.0/cache/commonmarker-2.10.1-x86_64-linux.gem deleted file mode 100644 index 82ac13e..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/commonmarker-2.10.1-x86_64-linux.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/concurrent-ruby-1.3.8.gem b/vendor/bundle/ruby/3.3.0/cache/concurrent-ruby-1.3.8.gem deleted file mode 100644 index faca14c..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/concurrent-ruby-1.3.8.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/connection_pool-3.0.2.gem b/vendor/bundle/ruby/3.3.0/cache/connection_pool-3.0.2.gem deleted file mode 100644 index 119b294..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/connection_pool-3.0.2.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/console-1.38.0.gem b/vendor/bundle/ruby/3.3.0/cache/console-1.38.0.gem deleted file mode 100644 index a24e778..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/console-1.38.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/cork-0.3.0.gem b/vendor/bundle/ruby/3.3.0/cache/cork-0.3.0.gem deleted file mode 100644 index 0cbcde1..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/cork-0.3.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/crack-1.0.1.gem b/vendor/bundle/ruby/3.3.0/cache/crack-1.0.1.gem deleted file mode 100644 index 49807f7..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/crack-1.0.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/danger-9.6.1.gem b/vendor/bundle/ruby/3.3.0/cache/danger-9.6.1.gem deleted file mode 100644 index 296943d..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/danger-9.6.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/danger-changelog-0.8.0.gem b/vendor/bundle/ruby/3.3.0/cache/danger-changelog-0.8.0.gem deleted file mode 100644 index 0d94127..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/danger-changelog-0.8.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/danger-plugin-api-1.0.0.gem b/vendor/bundle/ruby/3.3.0/cache/danger-plugin-api-1.0.0.gem deleted file mode 100644 index 306c92c..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/danger-plugin-api-1.0.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/danger-pr-comment-0.2.0.gem b/vendor/bundle/ruby/3.3.0/cache/danger-pr-comment-0.2.0.gem deleted file mode 100644 index a4c4973..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/danger-pr-comment-0.2.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/danger-toc-0.2.0.gem b/vendor/bundle/ruby/3.3.0/cache/danger-toc-0.2.0.gem deleted file mode 100644 index 9ab979b..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/danger-toc-0.2.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/diff-lcs-1.6.2.gem b/vendor/bundle/ruby/3.3.0/cache/diff-lcs-1.6.2.gem deleted file mode 100644 index 21c4c77..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/diff-lcs-1.6.2.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/drb-2.2.3.gem b/vendor/bundle/ruby/3.3.0/cache/drb-2.2.3.gem deleted file mode 100644 index 0c78b28..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/drb-2.2.3.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/ethon-0.19.1.gem b/vendor/bundle/ruby/3.3.0/cache/ethon-0.19.1.gem deleted file mode 100644 index 3d01432..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/ethon-0.19.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/faraday-2.15.1.gem b/vendor/bundle/ruby/3.3.0/cache/faraday-2.15.1.gem deleted file mode 100644 index 4b32cf8..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/faraday-2.15.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/faraday-http-cache-2.8.0.gem b/vendor/bundle/ruby/3.3.0/cache/faraday-http-cache-2.8.0.gem deleted file mode 100644 index f07ec5a..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/faraday-http-cache-2.8.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/faraday-net_http-3.5.0.gem b/vendor/bundle/ruby/3.3.0/cache/faraday-net_http-3.5.0.gem deleted file mode 100644 index d5d683d..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/faraday-net_http-3.5.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/ffi-1.17.4-x86_64-linux-gnu.gem b/vendor/bundle/ruby/3.3.0/cache/ffi-1.17.4-x86_64-linux-gnu.gem deleted file mode 100644 index 09ed5a3..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/ffi-1.17.4-x86_64-linux-gnu.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/fiber-annotation-0.2.0.gem b/vendor/bundle/ruby/3.3.0/cache/fiber-annotation-0.2.0.gem deleted file mode 100644 index d93eda3..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/fiber-annotation-0.2.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/fiber-local-1.1.0.gem b/vendor/bundle/ruby/3.3.0/cache/fiber-local-1.1.0.gem deleted file mode 100644 index 1206855..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/fiber-local-1.1.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/fiber-storage-1.0.1.gem b/vendor/bundle/ruby/3.3.0/cache/fiber-storage-1.0.1.gem deleted file mode 100644 index 15da383..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/fiber-storage-1.0.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/git-5.7.1.gem b/vendor/bundle/ruby/3.3.0/cache/git-5.7.1.gem deleted file mode 100644 index 2a99b06..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/git-5.7.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/hashdiff-1.2.1.gem b/vendor/bundle/ruby/3.3.0/cache/hashdiff-1.2.1.gem deleted file mode 100644 index 250f505..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/hashdiff-1.2.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/i18n-1.15.2.gem b/vendor/bundle/ruby/3.3.0/cache/i18n-1.15.2.gem deleted file mode 100644 index c02051c..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/i18n-1.15.2.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/io-endpoint-0.19.0.gem b/vendor/bundle/ruby/3.3.0/cache/io-endpoint-0.19.0.gem deleted file mode 100644 index 23f6a4b..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/io-endpoint-0.19.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/io-event-1.22.3.gem b/vendor/bundle/ruby/3.3.0/cache/io-event-1.22.3.gem deleted file mode 100644 index e67ef49..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/io-event-1.22.3.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/io-stream-0.14.0.gem b/vendor/bundle/ruby/3.3.0/cache/io-stream-0.14.0.gem deleted file mode 100644 index feff52b..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/io-stream-0.14.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/json-3.1.0.gem b/vendor/bundle/ruby/3.3.0/cache/json-3.1.0.gem deleted file mode 100644 index e2e7b48..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/json-3.1.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/kramdown-2.5.2.gem b/vendor/bundle/ruby/3.3.0/cache/kramdown-2.5.2.gem deleted file mode 100644 index 072acc3..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/kramdown-2.5.2.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/kramdown-parser-gfm-1.1.0.gem b/vendor/bundle/ruby/3.3.0/cache/kramdown-parser-gfm-1.1.0.gem deleted file mode 100644 index f087be5..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/kramdown-parser-gfm-1.1.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/language_server-protocol-3.17.0.6.gem b/vendor/bundle/ruby/3.3.0/cache/language_server-protocol-3.17.0.6.gem deleted file mode 100644 index d380955..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/language_server-protocol-3.17.0.6.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/lint_roller-1.1.0.gem b/vendor/bundle/ruby/3.3.0/cache/lint_roller-1.1.0.gem deleted file mode 100644 index 0f874b6..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/lint_roller-1.1.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/logger-1.7.0.gem b/vendor/bundle/ruby/3.3.0/cache/logger-1.7.0.gem deleted file mode 100644 index 061f1cc..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/logger-1.7.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/minitest-6.1.0.gem b/vendor/bundle/ruby/3.3.0/cache/minitest-6.1.0.gem deleted file mode 100644 index d24348c..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/minitest-6.1.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/nap-1.2.0.gem b/vendor/bundle/ruby/3.3.0/cache/nap-1.2.0.gem deleted file mode 100644 index c798c89..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/nap-1.2.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/net-http-0.10.0.gem b/vendor/bundle/ruby/3.3.0/cache/net-http-0.10.0.gem deleted file mode 100644 index d61bcab..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/net-http-0.10.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/net-protocol-0.4.0.gem b/vendor/bundle/ruby/3.3.0/cache/net-protocol-0.4.0.gem deleted file mode 100644 index 5a4a579..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/net-protocol-0.4.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/octokit-10.0.0.gem b/vendor/bundle/ruby/3.3.0/cache/octokit-10.0.0.gem deleted file mode 100644 index 05b18b9..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/octokit-10.0.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/open4-1.3.4.gem b/vendor/bundle/ruby/3.3.0/cache/open4-1.3.4.gem deleted file mode 100644 index 34dc1fb..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/open4-1.3.4.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/openssl-4.0.2.gem b/vendor/bundle/ruby/3.3.0/cache/openssl-4.0.2.gem deleted file mode 100644 index a44683b..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/openssl-4.0.2.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/parallel-2.3.0.gem b/vendor/bundle/ruby/3.3.0/cache/parallel-2.3.0.gem deleted file mode 100644 index ba3d380..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/parallel-2.3.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/parser-3.3.13.0.gem b/vendor/bundle/ruby/3.3.0/cache/parser-3.3.13.0.gem deleted file mode 100644 index 76253f4..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/parser-3.3.13.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/prism-1.9.0.gem b/vendor/bundle/ruby/3.3.0/cache/prism-1.9.0.gem deleted file mode 100644 index 45fb871..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/prism-1.9.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/process_executer-4.1.1.gem b/vendor/bundle/ruby/3.3.0/cache/process_executer-4.1.1.gem deleted file mode 100644 index f10abe2..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/process_executer-4.1.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/protocol-hpack-1.5.1.gem b/vendor/bundle/ruby/3.3.0/cache/protocol-hpack-1.5.1.gem deleted file mode 100644 index 1965635..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/protocol-hpack-1.5.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/protocol-http-0.72.1.gem b/vendor/bundle/ruby/3.3.0/cache/protocol-http-0.72.1.gem deleted file mode 100644 index 63c1434..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/protocol-http-0.72.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/protocol-http1-0.41.1.gem b/vendor/bundle/ruby/3.3.0/cache/protocol-http1-0.41.1.gem deleted file mode 100644 index f7676f8..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/protocol-http1-0.41.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/protocol-http2-0.29.2.gem b/vendor/bundle/ruby/3.3.0/cache/protocol-http2-0.29.2.gem deleted file mode 100644 index 9f0fc69..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/protocol-http2-0.29.2.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/protocol-url-0.19.0.gem b/vendor/bundle/ruby/3.3.0/cache/protocol-url-0.19.0.gem deleted file mode 100644 index 15282d5..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/protocol-url-0.19.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/pstore-0.3.0.gem b/vendor/bundle/ruby/3.3.0/cache/pstore-0.3.0.gem deleted file mode 100644 index efb5285..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/pstore-0.3.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/public_suffix-7.0.5.gem b/vendor/bundle/ruby/3.3.0/cache/public_suffix-7.0.5.gem deleted file mode 100644 index 43aa67e..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/public_suffix-7.0.5.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/racc-1.8.1.gem b/vendor/bundle/ruby/3.3.0/cache/racc-1.8.1.gem deleted file mode 100644 index ad9e6bb..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/racc-1.8.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/rainbow-3.1.1.gem b/vendor/bundle/ruby/3.3.0/cache/rainbow-3.1.1.gem deleted file mode 100644 index 863181a..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/rainbow-3.1.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/rake-13.4.2.gem b/vendor/bundle/ruby/3.3.0/cache/rake-13.4.2.gem deleted file mode 100644 index e8781c6..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/rake-13.4.2.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/rchardet-1.10.2.gem b/vendor/bundle/ruby/3.3.0/cache/rchardet-1.10.2.gem deleted file mode 100644 index 4839910..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/rchardet-1.10.2.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/regexp_parser-2.13.1.gem b/vendor/bundle/ruby/3.3.0/cache/regexp_parser-2.13.1.gem deleted file mode 100644 index 3d72095..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/regexp_parser-2.13.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/rexml-3.4.4.gem b/vendor/bundle/ruby/3.3.0/cache/rexml-3.4.4.gem deleted file mode 100644 index 46cc01a..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/rexml-3.4.4.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/rspec-3.13.2.gem b/vendor/bundle/ruby/3.3.0/cache/rspec-3.13.2.gem deleted file mode 100644 index 4b00e2a..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/rspec-3.13.2.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/rspec-core-3.13.7.gem b/vendor/bundle/ruby/3.3.0/cache/rspec-core-3.13.7.gem deleted file mode 100644 index ad25a15..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/rspec-core-3.13.7.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/rspec-expectations-3.13.6.gem b/vendor/bundle/ruby/3.3.0/cache/rspec-expectations-3.13.6.gem deleted file mode 100644 index 923cb8c..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/rspec-expectations-3.13.6.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/rspec-mocks-3.13.9.gem b/vendor/bundle/ruby/3.3.0/cache/rspec-mocks-3.13.9.gem deleted file mode 100644 index 37273ff..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/rspec-mocks-3.13.9.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/rspec-support-3.13.8.gem b/vendor/bundle/ruby/3.3.0/cache/rspec-support-3.13.8.gem deleted file mode 100644 index 284ebf0..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/rspec-support-3.13.8.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/rubocop-1.92.2.gem b/vendor/bundle/ruby/3.3.0/cache/rubocop-1.92.2.gem deleted file mode 100644 index e77f6dc..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/rubocop-1.92.2.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/rubocop-ast-1.50.0.gem b/vendor/bundle/ruby/3.3.0/cache/rubocop-ast-1.50.0.gem deleted file mode 100644 index 049db4b..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/rubocop-ast-1.50.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/rubocop-rake-0.7.1.gem b/vendor/bundle/ruby/3.3.0/cache/rubocop-rake-0.7.1.gem deleted file mode 100644 index 9fb1689..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/rubocop-rake-0.7.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/rubocop-rspec-3.10.2.gem b/vendor/bundle/ruby/3.3.0/cache/rubocop-rspec-3.10.2.gem deleted file mode 100644 index 29e35a4..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/rubocop-rspec-3.10.2.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/ruby-gem-release-0.2.1.gem b/vendor/bundle/ruby/3.3.0/cache/ruby-gem-release-0.2.1.gem deleted file mode 100644 index 707566a..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/ruby-gem-release-0.2.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/ruby-progressbar-1.13.0.gem b/vendor/bundle/ruby/3.3.0/cache/ruby-progressbar-1.13.0.gem deleted file mode 100644 index c50b94b..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/ruby-progressbar-1.13.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/sawyer-0.9.3.gem b/vendor/bundle/ruby/3.3.0/cache/sawyer-0.9.3.gem deleted file mode 100644 index 1a6b0db..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/sawyer-0.9.3.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/securerandom-0.4.1.gem b/vendor/bundle/ruby/3.3.0/cache/securerandom-0.4.1.gem deleted file mode 100644 index 05072ca..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/securerandom-0.4.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/simplecov-1.3.2.gem b/vendor/bundle/ruby/3.3.0/cache/simplecov-1.3.2.gem deleted file mode 100644 index aa4cdbe..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/simplecov-1.3.2.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/terminal-table-4.0.0.gem b/vendor/bundle/ruby/3.3.0/cache/terminal-table-4.0.0.gem deleted file mode 100644 index 3b5aa8c..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/terminal-table-4.0.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/timeout-0.6.1.gem b/vendor/bundle/ruby/3.3.0/cache/timeout-0.6.1.gem deleted file mode 100644 index a27f729..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/timeout-0.6.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/track_open_instances-0.1.15.gem b/vendor/bundle/ruby/3.3.0/cache/track_open_instances-0.1.15.gem deleted file mode 100644 index 5768fa2..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/track_open_instances-0.1.15.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/typhoeus-1.7.1.gem b/vendor/bundle/ruby/3.3.0/cache/typhoeus-1.7.1.gem deleted file mode 100644 index 6f5e1f2..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/typhoeus-1.7.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/tzinfo-2.0.6.gem b/vendor/bundle/ruby/3.3.0/cache/tzinfo-2.0.6.gem deleted file mode 100644 index 2c16da8..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/tzinfo-2.0.6.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/unicode-display_width-3.3.0.gem b/vendor/bundle/ruby/3.3.0/cache/unicode-display_width-3.3.0.gem deleted file mode 100644 index 4012ba7..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/unicode-display_width-3.3.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/unicode-emoji-4.3.0.gem b/vendor/bundle/ruby/3.3.0/cache/unicode-emoji-4.3.0.gem deleted file mode 100644 index 2fe23f4..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/unicode-emoji-4.3.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/uri-1.1.2.gem b/vendor/bundle/ruby/3.3.0/cache/uri-1.1.2.gem deleted file mode 100644 index 184a741..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/uri-1.1.2.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/vcr-6.4.1.gem b/vendor/bundle/ruby/3.3.0/cache/vcr-6.4.1.gem deleted file mode 100644 index f60ba20..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/vcr-6.4.1.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/cache/webmock-3.34.0.gem b/vendor/bundle/ruby/3.3.0/cache/webmock-3.34.0.gem deleted file mode 100644 index bdb0f91..0000000 Binary files a/vendor/bundle/ruby/3.3.0/cache/webmock-3.34.0.gem and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/bigdecimal-4.1.3/bigdecimal.so b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/bigdecimal-4.1.3/bigdecimal.so deleted file mode 100755 index df5f4ae..0000000 Binary files a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/bigdecimal-4.1.3/bigdecimal.so and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/bigdecimal-4.1.3/gem.build_complete b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/bigdecimal-4.1.3/gem.build_complete deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/bigdecimal-4.1.3/gem_make.out b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/bigdecimal-4.1.3/gem_make.out deleted file mode 100644 index 48c1e1e..0000000 --- a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/bigdecimal-4.1.3/gem_make.out +++ /dev/null @@ -1,39 +0,0 @@ -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal -/opt/hostedtoolcache/Ruby/3.3.13/x64/bin/ruby extconf.rb -checking for __builtin_clz()... yes -checking for __builtin_clzl()... yes -checking for __builtin_clzll()... yes -checking for float.h... yes -checking for math.h... yes -checking for stdbool.h... yes -checking for stdlib.h... yes -checking for x86intrin.h... yes -checking for _lzcnt_u32() in x86intrin.h... no -checking for _lzcnt_u64() in x86intrin.h... no -checking for intrin.h... no -checking for ruby/atomic.h... yes -checking for ruby/internal/has/builtin.h... yes -checking for ruby/internal/static_assert.h... yes -checking for rb_complex_real() in ruby.h... yes -checking for rb_complex_imag() in ruby.h... yes -checking for rb_opts_exception_p() in ruby.h... yes -checking for rb_category_warn() in ruby.h... yes -checking for RB_WARN_CATEGORY_DEPRECATED in ruby.h... yes -checking for RUBY_TYPED_EMBEDDABLE in ruby.h... yes -creating Makefile - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-jmaku0 sitelibdir\=./.gem.20261107-2444-jmaku0 clean - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-jmaku0 sitelibdir\=./.gem.20261107-2444-jmaku0 -compiling bigdecimal.c -compiling missing.c -linking shared-object bigdecimal.so - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-jmaku0 sitelibdir\=./.gem.20261107-2444-jmaku0 install -/usr/bin/install -c -m 0755 bigdecimal.so ./.gem.20261107-2444-jmaku0 - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-jmaku0 sitelibdir\=./.gem.20261107-2444-jmaku0 clean diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/bigdecimal-4.1.3/mkmf.log b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/bigdecimal-4.1.3/mkmf.log deleted file mode 100644 index a837765..0000000 --- a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/bigdecimal-4.1.3/mkmf.log +++ /dev/null @@ -1,450 +0,0 @@ -have_builtin_func: checking for __builtin_clz()... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: int main(int argc, char **argv) -4: { -5: return !!argv[argc]; -6: } -/* end */ - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: int foo; -4: int main() { __builtin_clz(0); return 0; } -/* end */ - --------------------- - -have_builtin_func: checking for __builtin_clzl()... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: int foo; -4: int main() { __builtin_clzl(0); return 0; } -/* end */ - --------------------- - -have_builtin_func: checking for __builtin_clzll()... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: int foo; -4: int main() { __builtin_clzll(0); return 0; } -/* end */ - --------------------- - -have_header: checking for float.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_header: checking for math.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_header: checking for stdbool.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_header: checking for stdlib.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_header: checking for x86intrin.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_func: checking for _lzcnt_u32() in x86intrin.h... -------------------- no - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -/usr/bin/x86_64-linux-gnu-ld.bfd: /tmp/ccDOon2s.o: in function `t': -/home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/conftest.c:16:(.text+0x7): undefined reference to `_lzcnt_u32' -collect2: error: ld returned 1 exit status -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: int t(void) { void ((*volatile p)()); p = (void ((*)()))_lzcnt_u32; return !p; } -/* end */ - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -conftest.c:16:13: error: conflicting types for ‘_lzcnt_u32’; have ‘void(void)’ - 16 | extern void _lzcnt_u32(); - | ^~~~~~~~~~ -In file included from /usr/lib/gcc/x86_64-linux-gnu/15/include/x86gprintrin.h:61, - from /usr/lib/gcc/x86_64-linux-gnu/15/include/x86intrin.h:27, - from conftest.c:3: -/usr/lib/gcc/x86_64-linux-gnu/15/include/lzcntintrin.h:51:1: note: previous definition of ‘_lzcnt_u32’ with type ‘unsigned int(unsigned int)’ - 51 | _lzcnt_u32 (unsigned int __X) - | ^~~~~~~~~~ -cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: extern void _lzcnt_u32(); -17: int t(void) { _lzcnt_u32(); return 0; } -/* end */ - --------------------- - -have_func: checking for _lzcnt_u64() in x86intrin.h... -------------------- no - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -/usr/bin/x86_64-linux-gnu-ld.bfd: /tmp/ccBLVLzc.o: in function `t': -/home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/conftest.c:16:(.text+0x7): undefined reference to `_lzcnt_u64' -collect2: error: ld returned 1 exit status -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: int t(void) { void ((*volatile p)()); p = (void ((*)()))_lzcnt_u64; return !p; } -/* end */ - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -conftest.c:16:13: error: conflicting types for ‘_lzcnt_u64’; have ‘void(void)’ - 16 | extern void _lzcnt_u64(); - | ^~~~~~~~~~ -In file included from /usr/lib/gcc/x86_64-linux-gnu/15/include/x86gprintrin.h:61, - from /usr/lib/gcc/x86_64-linux-gnu/15/include/x86intrin.h:27, - from conftest.c:3: -/usr/lib/gcc/x86_64-linux-gnu/15/include/lzcntintrin.h:64:1: note: previous definition of ‘_lzcnt_u64’ with type ‘long long unsigned int(long long unsigned int)’ - 64 | _lzcnt_u64 (unsigned long long __X) - | ^~~~~~~~~~ -cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: extern void _lzcnt_u64(); -17: int t(void) { _lzcnt_u64(); return 0; } -/* end */ - --------------------- - -have_header: checking for intrin.h... -------------------- no - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -conftest.c:3:10: fatal error: intrin.h: No such file or directory - 3 | #include - | ^~~~~~~~~~ -compilation terminated. -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_header: checking for ruby/atomic.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_header: checking for ruby/internal/has/builtin.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_header: checking for ruby/internal/static_assert.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_func: checking for rb_complex_real() in ruby.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_complex_real; return !p; } -/* end */ - --------------------- - -have_func: checking for rb_complex_imag() in ruby.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_complex_imag; return !p; } -/* end */ - --------------------- - -have_func: checking for rb_opts_exception_p() in ruby.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -conftest.c: In function ‘t’: -conftest.c:16:57: error: ‘rb_opts_exception_p’ undeclared (first use in this function); did you mean ‘rb_make_exception’? - 16 | int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_opts_exception_p; return !p; } - | ^~~~~~~~~~~~~~~~~~~ - | rb_make_exception -conftest.c:16:57: note: each undeclared identifier is reported only once for each function it appears in -At top level: -cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_opts_exception_p; return !p; } -/* end */ - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: extern void rb_opts_exception_p(); -17: int t(void) { rb_opts_exception_p(); return 0; } -/* end */ - --------------------- - -have_func: checking for rb_category_warn() in ruby.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_category_warn; return !p; } -/* end */ - --------------------- - -have_const: checking for RB_WARN_CATEGORY_DEPRECATED in ruby.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -4: -5: /*top*/ -6: typedef int conftest_type; -7: conftest_type conftestval = (int)RB_WARN_CATEGORY_DEPRECATED; -/* end */ - --------------------- - -have_const: checking for RUBY_TYPED_EMBEDDABLE in ruby.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -4: -5: /*top*/ -6: typedef int conftest_type; -7: conftest_type conftestval = (int)RUBY_TYPED_EMBEDDABLE; -/* end */ - --------------------- - diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/io-event-1.22.3/IO_Event.so b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/io-event-1.22.3/IO_Event.so deleted file mode 100755 index 62461d7..0000000 Binary files a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/io-event-1.22.3/IO_Event.so and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/io-event-1.22.3/gem.build_complete b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/io-event-1.22.3/gem.build_complete deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/io-event-1.22.3/gem_make.out b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/io-event-1.22.3/gem_make.out deleted file mode 100644 index b4add67..0000000 --- a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/io-event-1.22.3/gem_make.out +++ /dev/null @@ -1,45 +0,0 @@ -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/io-event-1.22.3/ext -/opt/hostedtoolcache/Ruby/3.3.13/x64/bin/ruby extconf.rb -checking for whether -Wall is accepted as CFLAGS... yes -checking for whether -Wno-unknown-pragmas is accepted as CFLAGS... yes -checking for whether -std=c99 is accepted as CFLAGS... yes -checking for rb_ext_ractor_safe()... yes -checking for &rb_fiber_transfer()... yes -checking for ruby/io/buffer.h... yes -checking for linux/futex.h... yes -checking for sys/syscall.h... yes -checking for -luring... no -checking for sys/epoll.h... yes -checking for sys/event.h... no -checking for sys/wait.h... yes -checking for sys/eventfd.h... yes -checking for rb_io_descriptor()... yes -checking for rb_process_status_for()... no -checking for &rb_process_status_wait()... yes -checking for rb_fiber_current()... yes -checking for &rb_fiber_raise()... yes -checking for epoll_pwait2(0, 0, 0, 0, 0) in sys/epoll.h... yes -checking for rb_fiber_scheduler_blocking_operation_extract()... no -creating extconf.h -creating Makefile - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/io-event-1.22.3/ext -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-2zz7bv sitelibdir\=./.gem.20261107-2444-2zz7bv clean - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/io-event-1.22.3/ext -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-2zz7bv sitelibdir\=./.gem.20261107-2444-2zz7bv -compiling ./io/event/event.c -compiling ./io/event/time.c -compiling ./io/event/fiber.c -compiling ./io/event/selector/selector.c -compiling ./io/event/futex.c -compiling ./io/event/selector/epoll.c -compiling ./io/event/interrupt.c -linking shared-object IO_Event.so - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/io-event-1.22.3/ext -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-2zz7bv sitelibdir\=./.gem.20261107-2444-2zz7bv install -/usr/bin/install -c -m 0755 IO_Event.so ./.gem.20261107-2444-2zz7bv - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/io-event-1.22.3/ext -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-2zz7bv sitelibdir\=./.gem.20261107-2444-2zz7bv clean diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/io-event-1.22.3/mkmf.log b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/io-event-1.22.3/mkmf.log deleted file mode 100644 index 9a758d3..0000000 --- a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/io-event-1.22.3/mkmf.log +++ /dev/null @@ -1,506 +0,0 @@ -append_cflags: checking for whether -Wall is accepted as CFLAGS... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: int main(int argc, char **argv) -4: { -5: return !!argv[argc]; -6: } -/* end */ - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Werror -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: int main(int argc, char **argv) -4: { -5: return !!argv[argc]; -6: } -/* end */ - --------------------- - -append_cflags: checking for whether -Wno-unknown-pragmas is accepted as CFLAGS... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -Werror -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: int main(int argc, char **argv) -4: { -5: return !!argv[argc]; -6: } -/* end */ - --------------------- - -append_cflags: checking for whether -std=c99 is accepted as CFLAGS... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 -Werror -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: int main(int argc, char **argv) -4: { -5: return !!argv[argc]; -6: } -/* end */ - --------------------- - -have_func: checking for rb_ext_ractor_safe()... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: /*top*/ - 4: extern int t(void); - 5: int main(int argc, char **argv) - 6: { - 7: if (argc > 1000000) { - 8: int (* volatile tp)(void)=(int (*)(void))&t; - 9: printf("%d", (*tp)()); -10: } -11: -12: return !!argv[argc]; -13: } -14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_ext_ractor_safe; return !p; } -/* end */ - --------------------- - -have_func: checking for &rb_fiber_transfer()... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: /*top*/ - 4: extern int t(void); - 5: int main(int argc, char **argv) - 6: { - 7: if (argc > 1000000) { - 8: int (* volatile tp)(void)=(int (*)(void))&t; - 9: printf("%d", (*tp)()); -10: } -11: -12: return !!argv[argc]; -13: } -14: int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_fiber_transfer; return !p; } -/* end */ - --------------------- - -have_header: checking for ruby/io/buffer.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_header: checking for linux/futex.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_header: checking for sys/syscall.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_library: checking for -luring... -------------------- no - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -luring -lm -lpthread -lc" -/usr/bin/x86_64-linux-gnu-ld.bfd: cannot find -luring: No such file or directory -collect2: error: ld returned 1 exit status -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: /*top*/ - 4: extern int t(void); - 5: int main(int argc, char **argv) - 6: { - 7: if (argc > 1000000) { - 8: int (* volatile tp)(void)=(int (*)(void))&t; - 9: printf("%d", (*tp)()); -10: } -11: -12: return !!argv[argc]; -13: } -14: -15: int t(void) { ; return 0; } -/* end */ - --------------------- - -have_header: checking for sys/epoll.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_header: checking for sys/event.h... -------------------- no - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 -c conftest.c" -conftest.c:3:10: fatal error: sys/event.h: No such file or directory - 3 | #include - | ^~~~~~~~~~~~~ -compilation terminated. -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_header: checking for sys/wait.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_header: checking for sys/eventfd.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_func: checking for rb_io_descriptor()... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -conftest.c: In function ‘t’: -conftest.c:14:57: error: ‘rb_io_descriptor’ undeclared (first use in this function) - 14 | int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_io_descriptor; return !p; } - | ^~~~~~~~~~~~~~~~ -conftest.c:14:57: note: each undeclared identifier is reported only once for each function it appears in -At top level: -cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: /*top*/ - 4: extern int t(void); - 5: int main(int argc, char **argv) - 6: { - 7: if (argc > 1000000) { - 8: int (* volatile tp)(void)=(int (*)(void))&t; - 9: printf("%d", (*tp)()); -10: } -11: -12: return !!argv[argc]; -13: } -14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_io_descriptor; return !p; } -/* end */ - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: /*top*/ - 4: extern int t(void); - 5: int main(int argc, char **argv) - 6: { - 7: if (argc > 1000000) { - 8: int (* volatile tp)(void)=(int (*)(void))&t; - 9: printf("%d", (*tp)()); -10: } -11: -12: return !!argv[argc]; -13: } -14: extern void rb_io_descriptor(); -15: int t(void) { rb_io_descriptor(); return 0; } -/* end */ - --------------------- - -have_func: checking for rb_process_status_for()... -------------------- no - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -conftest.c: In function ‘t’: -conftest.c:14:57: error: ‘rb_process_status_for’ undeclared (first use in this function); did you mean ‘rb_process_status_wait’? - 14 | int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_process_status_for; return !p; } - | ^~~~~~~~~~~~~~~~~~~~~ - | rb_process_status_wait -conftest.c:14:57: note: each undeclared identifier is reported only once for each function it appears in -At top level: -cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: /*top*/ - 4: extern int t(void); - 5: int main(int argc, char **argv) - 6: { - 7: if (argc > 1000000) { - 8: int (* volatile tp)(void)=(int (*)(void))&t; - 9: printf("%d", (*tp)()); -10: } -11: -12: return !!argv[argc]; -13: } -14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_process_status_for; return !p; } -/* end */ - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -/usr/bin/x86_64-linux-gnu-ld.bfd: /tmp/ccep6NRA.o: in function `t': -/home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/io-event-1.22.3/ext/conftest.c:15:(.text+0xb): undefined reference to `rb_process_status_for' -collect2: error: ld returned 1 exit status -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: /*top*/ - 4: extern int t(void); - 5: int main(int argc, char **argv) - 6: { - 7: if (argc > 1000000) { - 8: int (* volatile tp)(void)=(int (*)(void))&t; - 9: printf("%d", (*tp)()); -10: } -11: -12: return !!argv[argc]; -13: } -14: extern void rb_process_status_for(); -15: int t(void) { rb_process_status_for(); return 0; } -/* end */ - --------------------- - -have_func: checking for &rb_process_status_wait()... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: /*top*/ - 4: extern int t(void); - 5: int main(int argc, char **argv) - 6: { - 7: if (argc > 1000000) { - 8: int (* volatile tp)(void)=(int (*)(void))&t; - 9: printf("%d", (*tp)()); -10: } -11: -12: return !!argv[argc]; -13: } -14: int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_process_status_wait; return !p; } -/* end */ - --------------------- - -have_func: checking for rb_fiber_current()... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: /*top*/ - 4: extern int t(void); - 5: int main(int argc, char **argv) - 6: { - 7: if (argc > 1000000) { - 8: int (* volatile tp)(void)=(int (*)(void))&t; - 9: printf("%d", (*tp)()); -10: } -11: -12: return !!argv[argc]; -13: } -14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_fiber_current; return !p; } -/* end */ - --------------------- - -have_func: checking for &rb_fiber_raise()... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: /*top*/ - 4: extern int t(void); - 5: int main(int argc, char **argv) - 6: { - 7: if (argc > 1000000) { - 8: int (* volatile tp)(void)=(int (*)(void))&t; - 9: printf("%d", (*tp)()); -10: } -11: -12: return !!argv[argc]; -13: } -14: int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_fiber_raise; return !p; } -/* end */ - --------------------- - -have_func: checking for epoll_pwait2(0, 0, 0, 0, 0) in sys/epoll.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -conftest.c: In function ‘t’: -conftest.c:17:15: warning: argument 2 null where non-null expected [-Wnonnull] - 17 | int t(void) { epoll_pwait2(0, 0, 0, 0, 0); return 0; } - | ^~~~~~~~~~~~ -In file included from conftest.c:3: -/usr/include/x86_64-linux-gnu/sys/epoll.h:158:12: note: in a call to function ‘epoll_pwait2’ declared ‘nonnull’ - 158 | extern int epoll_pwait2 (int __epfd, struct epoll_event *__events, - | ^~~~~~~~~~~~ -At top level: -cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { epoll_pwait2(0, 0, 0, 0, 0); return 0; } -/* end */ - --------------------- - -have_func: checking for rb_fiber_scheduler_blocking_operation_extract()... -------------------- no - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -conftest.c: In function ‘t’: -conftest.c:14:57: error: ‘rb_fiber_scheduler_blocking_operation_extract’ undeclared (first use in this function) - 14 | int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_fiber_scheduler_blocking_operation_extract; return !p; } - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -conftest.c:14:57: note: each undeclared identifier is reported only once for each function it appears in -At top level: -cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: /*top*/ - 4: extern int t(void); - 5: int main(int argc, char **argv) - 6: { - 7: if (argc > 1000000) { - 8: int (* volatile tp)(void)=(int (*)(void))&t; - 9: printf("%d", (*tp)()); -10: } -11: -12: return !!argv[argc]; -13: } -14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_fiber_scheduler_blocking_operation_extract; return !p; } -/* end */ - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -/usr/bin/x86_64-linux-gnu-ld.bfd: /tmp/ccKWbllq.o: in function `t': -/home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/io-event-1.22.3/ext/conftest.c:15:(.text+0xb): undefined reference to `rb_fiber_scheduler_blocking_operation_extract' -collect2: error: ld returned 1 exit status -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: /*top*/ - 4: extern int t(void); - 5: int main(int argc, char **argv) - 6: { - 7: if (argc > 1000000) { - 8: int (* volatile tp)(void)=(int (*)(void))&t; - 9: printf("%d", (*tp)()); -10: } -11: -12: return !!argv[argc]; -13: } -14: extern void rb_fiber_scheduler_blocking_operation_extract(); -15: int t(void) { rb_fiber_scheduler_blocking_operation_extract(); return 0; } -/* end */ - --------------------- - -extconf.h is: -/* begin */ - 1: #ifndef EXTCONF_H - 2: #define EXTCONF_H - 3: #define HAVE_RB_EXT_RACTOR_SAFE 1 - 4: #define HAVE__RB_FIBER_TRANSFER 1 - 5: #define HAVE_RUBY_IO_BUFFER_H 1 - 6: #define HAVE_LINUX_FUTEX_H 1 - 7: #define HAVE_SYS_SYSCALL_H 1 - 8: #define HAVE_SYS_EPOLL_H 1 - 9: #define HAVE_SYS_WAIT_H 1 -10: #define HAVE_SYS_EVENTFD_H 1 -11: #define HAVE_RB_IO_DESCRIPTOR 1 -12: #define HAVE__RB_PROCESS_STATUS_WAIT 1 -13: #define HAVE_RB_FIBER_CURRENT 1 -14: #define HAVE__RB_FIBER_RAISE 1 -15: #define HAVE_EPOLL_PWAIT2 1 -16: #endif -/* end */ - diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/json-3.1.0/gem.build_complete b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/json-3.1.0/gem.build_complete deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/json-3.1.0/gem_make.out b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/json-3.1.0/gem_make.out deleted file mode 100644 index 4ab3b43..0000000 --- a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/json-3.1.0/gem_make.out +++ /dev/null @@ -1,31 +0,0 @@ -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/json-3.1.0/ext/json/ext/parser -/opt/hostedtoolcache/Ruby/3.3.13/x64/bin/ruby extconf.rb -checking for rb_enc_interned_str() in ruby/encoding.h... yes -checking for rb_str_to_interned_str() in ruby.h... yes -checking for rb_hash_new_capa() in ruby.h... yes -checking for rb_hash_bulk_insert() in ruby.h... yes -checking for ruby_xfree_sized() in ruby.h... no -checking for x86intrin.h... yes -checking for _lzcnt_u64() in x86intrin.h... no -checking for intrin.h... no -checking for RUBY_TYPED_EMBEDDABLE in ruby.h... yes -checking for whether -std=c99 is accepted as CFLAGS... yes -checking for whether -mno-outline is accepted as CFLAGS... no -checking for x86intrin.h... yes -checking for cpuid.h... yes -creating Makefile - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/json-3.1.0/ext/json/ext/parser -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-mh1we4 sitelibdir\=./.gem.20261107-2444-mh1we4 clean - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/json-3.1.0/ext/json/ext/parser -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-mh1we4 sitelibdir\=./.gem.20261107-2444-mh1we4 -compiling parser.c -linking shared-object json/ext/parser.so - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/json-3.1.0/ext/json/ext/parser -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-mh1we4 sitelibdir\=./.gem.20261107-2444-mh1we4 install -/usr/bin/install -c -m 0755 parser.so ./.gem.20261107-2444-mh1we4/json/ext - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/json-3.1.0/ext/json/ext/parser -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-mh1we4 sitelibdir\=./.gem.20261107-2444-mh1we4 clean diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/json-3.1.0/json/ext/generator.so b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/json-3.1.0/json/ext/generator.so deleted file mode 100755 index 134e732..0000000 Binary files a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/json-3.1.0/json/ext/generator.so and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/json-3.1.0/json/ext/parser.so b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/json-3.1.0/json/ext/parser.so deleted file mode 100755 index 1b30bf4..0000000 Binary files a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/json-3.1.0/json/ext/parser.so and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/json-3.1.0/mkmf.log b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/json-3.1.0/mkmf.log deleted file mode 100644 index 62322eb..0000000 --- a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/json-3.1.0/mkmf.log +++ /dev/null @@ -1,347 +0,0 @@ -have_func: checking for rb_enc_interned_str() in ruby/encoding.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: int main(int argc, char **argv) -4: { -5: return !!argv[argc]; -6: } -/* end */ - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_enc_interned_str; return !p; } -/* end */ - --------------------- - -have_func: checking for rb_str_to_interned_str() in ruby.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_str_to_interned_str; return !p; } -/* end */ - --------------------- - -have_func: checking for rb_hash_new_capa() in ruby.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_hash_new_capa; return !p; } -/* end */ - --------------------- - -have_func: checking for rb_hash_bulk_insert() in ruby.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_hash_bulk_insert; return !p; } -/* end */ - --------------------- - -have_func: checking for ruby_xfree_sized() in ruby.h... -------------------- no - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -conftest.c: In function ‘t’: -conftest.c:16:57: error: ‘ruby_xfree_sized’ undeclared (first use in this function); did you mean ‘rb_file_size’? - 16 | int t(void) { void ((*volatile p)()); p = (void ((*)()))ruby_xfree_sized; return !p; } - | ^~~~~~~~~~~~~~~~ - | rb_file_size -conftest.c:16:57: note: each undeclared identifier is reported only once for each function it appears in -At top level: -cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: int t(void) { void ((*volatile p)()); p = (void ((*)()))ruby_xfree_sized; return !p; } -/* end */ - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -/usr/bin/x86_64-linux-gnu-ld.bfd: /tmp/ccuPaEGL.o: in function `t': -/home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/json-3.1.0/ext/json/ext/parser/conftest.c:17:(.text+0x9): undefined reference to `ruby_xfree_sized' -collect2: error: ld returned 1 exit status -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: extern void ruby_xfree_sized(); -17: int t(void) { ruby_xfree_sized(); return 0; } -/* end */ - --------------------- - -have_header: checking for x86intrin.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_func: checking for _lzcnt_u64() in x86intrin.h... -------------------- no - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -/usr/bin/x86_64-linux-gnu-ld.bfd: /tmp/ccIqIvpq.o: in function `t': -/home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/json-3.1.0/ext/json/ext/parser/conftest.c:16:(.text+0x7): undefined reference to `_lzcnt_u64' -collect2: error: ld returned 1 exit status -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: int t(void) { void ((*volatile p)()); p = (void ((*)()))_lzcnt_u64; return !p; } -/* end */ - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -conftest.c:16:13: error: conflicting types for ‘_lzcnt_u64’; have ‘void(void)’ - 16 | extern void _lzcnt_u64(); - | ^~~~~~~~~~ -In file included from /usr/lib/gcc/x86_64-linux-gnu/15/include/x86gprintrin.h:61, - from /usr/lib/gcc/x86_64-linux-gnu/15/include/x86intrin.h:27, - from conftest.c:3: -/usr/lib/gcc/x86_64-linux-gnu/15/include/lzcntintrin.h:64:1: note: previous definition of ‘_lzcnt_u64’ with type ‘long long unsigned int(long long unsigned int)’ - 64 | _lzcnt_u64 (unsigned long long __X) - | ^~~~~~~~~~ -cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: extern void _lzcnt_u64(); -17: int t(void) { _lzcnt_u64(); return 0; } -/* end */ - --------------------- - -have_header: checking for intrin.h... -------------------- no - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -conftest.c:3:10: fatal error: intrin.h: No such file or directory - 3 | #include - | ^~~~~~~~~~ -compilation terminated. -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_const: checking for RUBY_TYPED_EMBEDDABLE in ruby.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -4: -5: /*top*/ -6: typedef int conftest_type; -7: conftest_type conftestval = (int)RUBY_TYPED_EMBEDDABLE; -/* end */ - --------------------- - -append_cflags: checking for whether -std=c99 is accepted as CFLAGS... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -std=c99 -Werror -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: int main(int argc, char **argv) -4: { -5: return !!argv[argc]; -6: } -/* end */ - --------------------- - -append_cflags: checking for whether -mno-outline is accepted as CFLAGS... -------------------- no - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -std=c99 -mno-outline -Werror -c conftest.c" -gcc: error: unrecognized command-line option ‘-mno-outline’ -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: int main(int argc, char **argv) -4: { -5: return !!argv[argc]; -6: } -/* end */ - --------------------- - -have_header: checking for x86intrin.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -std=c99 -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -std=c99 -Werror=implicit-function-declaration -c conftest.c" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: int main(int argc, char **argv) { - 6: __m128i test = _mm_set1_epi8(32); - 7: if (__builtin_cpu_supports("sse2")) { printf("OK"); } - 8: if (argc > 100000) printf("%p", &test); - 9: return 0; -10: } -/* end */ - -have_header: checking for cpuid.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -std=c99 -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/openssl-4.0.2/gem.build_complete b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/openssl-4.0.2/gem.build_complete deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/openssl-4.0.2/gem_make.out b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/openssl-4.0.2/gem_make.out deleted file mode 100644 index 885328d..0000000 --- a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/openssl-4.0.2/gem_make.out +++ /dev/null @@ -1,78 +0,0 @@ -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/openssl-4.0.2/ext/openssl -/opt/hostedtoolcache/Ruby/3.3.13/x64/bin/ruby extconf.rb -checking for rb_call_super_kw(0, NULL, 0) in ruby.h... yes -checking for rb_io_descriptor() in ruby/io.h... yes -checking for rb_io_maybe_wait(0, Qnil, Qnil, Qnil) in ruby/io.h... yes -checking for rb_io_timeout() in ruby/io.h... yes -checking for t_open() in -lnsl... no -checking for socket() in -lsocket... no -checking for pkg-config for openssl... [" ", "", "-lssl -lcrypto"] -checking for openssl/ssl.h... yes -checking for LIBRESSL_VERSION_NUMBER in openssl/opensslv.h... no -checking for OpenSSL version >= 1.1.1... yes -checking for RAND_egd() in openssl/rand.h... no -checking for SSL_CTX_set1_sigalgs_list(NULL, NULL) in openssl/ssl.h... yes -checking for SSL_CTX_set1_client_sigalgs_list(NULL, NULL) in openssl/ssl.h... yes -checking for EVP_PBE_scrypt("", 0, (unsigned char *)"", 0, 0, 0, 0, 0, NULL, 0) in openssl/evp.h... yes -checking for EVP_PKEY_check(NULL) in openssl/evp.h... yes -checking for SSL_CTX_set0_tmp_dh_pkey(NULL, NULL) in openssl/ssl.h... yes -checking for ERR_get_error_all(NULL, NULL, NULL, NULL, NULL) in openssl/err.h... yes -checking for SSL_CTX_load_verify_file(NULL, "") in openssl/ssl.h... yes -checking for BN_check_prime(NULL, NULL, NULL) in openssl/bn.h... yes -checking for EVP_MD_CTX_get0_md(NULL) in openssl/evp.h... yes -checking for EVP_MD_CTX_get_pkey_ctx(NULL) in openssl/evp.h... yes -checking for EVP_PKEY_eq(NULL, NULL) in openssl/evp.h... yes -checking for EVP_PKEY_dup(NULL) in openssl/evp.h... yes -checking for SSL_get0_group_name(NULL) in openssl/ssl.h... yes -checking for TS_VERIFY_CTX_set0_certs(NULL, NULL) in openssl/ts.h... yes -checking for SSL_get0_peer_signature_name(NULL, NULL) in openssl/ssl.h... yes -checking for ASN1_BIT_STRING_set1(NULL, NULL, 0, 0) in openssl/asn1.h... no -creating extconf.h -creating Makefile - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/openssl-4.0.2/ext/openssl -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-tkzdot sitelibdir\=./.gem.20261107-2444-tkzdot clean - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/openssl-4.0.2/ext/openssl -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-tkzdot sitelibdir\=./.gem.20261107-2444-tkzdot -compiling ossl.c -compiling ossl_asn1.c -compiling ossl_bio.c -compiling ossl_bn.c -compiling ossl_cipher.c -compiling ossl_config.c -compiling ossl_digest.c -compiling ossl_engine.c -compiling ossl_hmac.c -compiling ossl_kdf.c -compiling ossl_ns_spki.c -compiling ossl_ocsp.c -compiling ossl_pkcs12.c -compiling ossl_pkcs7.c -compiling ossl_pkey.c -compiling ossl_pkey_dh.c -compiling ossl_pkey_dsa.c -compiling ossl_pkey_ec.c -compiling ossl_pkey_rsa.c -compiling ossl_provider.c -compiling ossl_rand.c -compiling ossl_ssl.c -compiling ossl_ssl_session.c -compiling ossl_ts.c -compiling ossl_x509.c -compiling ossl_x509attr.c -compiling ossl_x509cert.c -compiling ossl_x509crl.c -compiling ossl_x509ext.c -compiling ossl_x509name.c -compiling ossl_x509req.c -compiling ossl_x509revoked.c -compiling ossl_x509store.c -linking shared-object openssl.so - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/openssl-4.0.2/ext/openssl -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-tkzdot sitelibdir\=./.gem.20261107-2444-tkzdot install -/usr/bin/install -c -m 0755 openssl.so ./.gem.20261107-2444-tkzdot - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/openssl-4.0.2/ext/openssl -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-tkzdot sitelibdir\=./.gem.20261107-2444-tkzdot clean diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/openssl-4.0.2/mkmf.log b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/openssl-4.0.2/mkmf.log deleted file mode 100644 index 3668ee3..0000000 --- a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/openssl-4.0.2/mkmf.log +++ /dev/null @@ -1,838 +0,0 @@ -=== OpenSSL for Ruby configurator === -have_func: checking for rb_call_super_kw(0, NULL, 0) in ruby.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: int main(int argc, char **argv) -4: { -5: return !!argv[argc]; -6: } -/* end */ - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { rb_call_super_kw(0, NULL, 0); return 0; } -/* end */ - --------------------- - -have_func: checking for rb_io_descriptor() in ruby/io.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_io_descriptor; return !p; } -/* end */ - --------------------- - -have_func: checking for rb_io_maybe_wait(0, Qnil, Qnil, Qnil) in ruby/io.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { rb_io_maybe_wait(0, Qnil, Qnil, Qnil); return 0; } -/* end */ - --------------------- - -have_func: checking for rb_io_timeout() in ruby/io.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_io_timeout; return !p; } -/* end */ - --------------------- - -=== Checking for system dependent stuff... === -have_library: checking for t_open() in -lnsl... -------------------- no - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lnsl -lm -lpthread -lc" -conftest.c: In function ‘t’: -conftest.c:14:57: error: ‘t_open’ undeclared (first use in this function); did you mean ‘popen’? - 14 | int t(void) { void ((*volatile p)()); p = (void ((*)()))t_open; return !p; } - | ^~~~~~ - | popen -conftest.c:14:57: note: each undeclared identifier is reported only once for each function it appears in -At top level: -cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: /*top*/ - 4: extern int t(void); - 5: int main(int argc, char **argv) - 6: { - 7: if (argc > 1000000) { - 8: int (* volatile tp)(void)=(int (*)(void))&t; - 9: printf("%d", (*tp)()); -10: } -11: -12: return !!argv[argc]; -13: } -14: int t(void) { void ((*volatile p)()); p = (void ((*)()))t_open; return !p; } -/* end */ - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lnsl -lm -lpthread -lc" -/usr/bin/x86_64-linux-gnu-ld.bfd: cannot find -lnsl: No such file or directory -collect2: error: ld returned 1 exit status -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: /*top*/ - 4: extern int t(void); - 5: int main(int argc, char **argv) - 6: { - 7: if (argc > 1000000) { - 8: int (* volatile tp)(void)=(int (*)(void))&t; - 9: printf("%d", (*tp)()); -10: } -11: -12: return !!argv[argc]; -13: } -14: extern void t_open(); -15: int t(void) { t_open(); return 0; } -/* end */ - --------------------- - -have_library: checking for socket() in -lsocket... -------------------- no - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lsocket -lm -lpthread -lc" -conftest.c: In function ‘t’: -conftest.c:14:57: error: ‘socket’ undeclared (first use in this function) - 14 | int t(void) { void ((*volatile p)()); p = (void ((*)()))socket; return !p; } - | ^~~~~~ -conftest.c:14:57: note: each undeclared identifier is reported only once for each function it appears in -At top level: -cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: /*top*/ - 4: extern int t(void); - 5: int main(int argc, char **argv) - 6: { - 7: if (argc > 1000000) { - 8: int (* volatile tp)(void)=(int (*)(void))&t; - 9: printf("%d", (*tp)()); -10: } -11: -12: return !!argv[argc]; -13: } -14: int t(void) { void ((*volatile p)()); p = (void ((*)()))socket; return !p; } -/* end */ - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lsocket -lm -lpthread -lc" -/usr/bin/x86_64-linux-gnu-ld.bfd: cannot find -lsocket: No such file or directory -collect2: error: ld returned 1 exit status -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: /*top*/ - 4: extern int t(void); - 5: int main(int argc, char **argv) - 6: { - 7: if (argc > 1000000) { - 8: int (* volatile tp)(void)=(int (*)(void))&t; - 9: printf("%d", (*tp)()); -10: } -11: -12: return !!argv[argc]; -13: } -14: extern void socket(); -15: int t(void) { socket(); return 0; } -/* end */ - --------------------- - -=== Checking for required stuff... === -pkg_config: checking for pkg-config for openssl... -------------------- [" ", "", "-lssl -lcrypto"] - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib pkg-config --exists openssl -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib pkg-config --libs openssl | -=> "-lssl -lcrypto\n" -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lssl -lcrypto -lm -lpthread -lc" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: int main(int argc, char **argv) -4: { -5: return !!argv[argc]; -6: } -/* end */ - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib pkg-config --cflags-only-I openssl | -=> "\n" -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib pkg-config --cflags-only-other openssl | -=> "\n" -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib pkg-config --libs-only-l openssl | -=> "-lssl -lcrypto\n" -package configuration for openssl -incflags: -cflags: -ldflags: -libs: -lssl -lcrypto - --------------------- - -have_header: checking for openssl/ssl.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -have_macro: checking for LIBRESSL_VERSION_NUMBER in openssl/opensslv.h... -------------------- no - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -conftest.c:6:3: error: #error - 6 | # error - | ^~~~~ -conftest.c:7:1: error: expected identifier or ‘(’ before ‘|’ token - 7 | |:/ === LIBRESSL_VERSION_NUMBER undefined === /:| - | ^ -cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -4: /*top*/ -5: #ifndef LIBRESSL_VERSION_NUMBER -6: # error -7: |:/ === LIBRESSL_VERSION_NUMBER undefined === /:| -8: #endif -/* end */ - --------------------- - -checking for OpenSSL version >= 1.1.1... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -4: -5: /*top*/ -6: int conftest_const[(OPENSSL_VERSION_NUMBER >= 0x10101000L) ? 1 : -1]; -/* end */ - --------------------- - -=== Checking for OpenSSL features... === -have_func: checking for RAND_egd() in openssl/rand.h... -------------------- no - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lssl -lcrypto -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lssl -lcrypto -lm -lpthread -lc" -conftest.c: In function ‘t’: -conftest.c:17:15: error: implicit declaration of function ‘RAND_egd’; did you mean ‘RAND_add’? [-Wimplicit-function-declaration] - 17 | int t(void) { RAND_egd(); return 0; } - | ^~~~~~~~ - | RAND_add -At top level: -cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { RAND_egd(); return 0; } -/* end */ - --------------------- - -have_func: checking for SSL_CTX_set1_sigalgs_list(NULL, NULL) in openssl/ssl.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lssl -lcrypto -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lssl -lcrypto -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { SSL_CTX_set1_sigalgs_list(NULL, NULL); return 0; } -/* end */ - --------------------- - -have_func: checking for SSL_CTX_set1_client_sigalgs_list(NULL, NULL) in openssl/ssl.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lssl -lcrypto -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lssl -lcrypto -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { SSL_CTX_set1_client_sigalgs_list(NULL, NULL); return 0; } -/* end */ - --------------------- - -have_func: checking for EVP_PBE_scrypt("", 0, (unsigned char *)"", 0, 0, 0, 0, 0, NULL, 0) in openssl/evp.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lssl -lcrypto -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lssl -lcrypto -lm -lpthread -lc" -conftest.c: In function ‘t’: -conftest.c:17:40: warning: ‘s1’ may be used uninitialized [-Wmaybe-uninitialized] - 17 | int t(void) { char s1[1024], s2[1024]; EVP_PBE_scrypt(s1, 0, (unsigned char *)s2, 0, 0, 0, 0, 0, NULL, 0); return 0; } - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -In file included from conftest.c:3: -/usr/include/openssl/evp.h:1545:5: note: by argument 1 of type ‘const char *’ to ‘EVP_PBE_scrypt’ declared here - 1545 | int EVP_PBE_scrypt(const char *pass, size_t passlen, - | ^~~~~~~~~~~~~~ -conftest.c:17:20: note: ‘s1’ declared here - 17 | int t(void) { char s1[1024], s2[1024]; EVP_PBE_scrypt(s1, 0, (unsigned char *)s2, 0, 0, 0, 0, 0, NULL, 0); return 0; } - | ^~ -conftest.c:17:40: warning: ‘s2’ may be used uninitialized [-Wmaybe-uninitialized] - 17 | int t(void) { char s1[1024], s2[1024]; EVP_PBE_scrypt(s1, 0, (unsigned char *)s2, 0, 0, 0, 0, 0, NULL, 0); return 0; } - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/usr/include/openssl/evp.h:1545:5: note: by argument 3 of type ‘const unsigned char *’ to ‘EVP_PBE_scrypt’ declared here - 1545 | int EVP_PBE_scrypt(const char *pass, size_t passlen, - | ^~~~~~~~~~~~~~ -conftest.c:17:30: note: ‘s2’ declared here - 17 | int t(void) { char s1[1024], s2[1024]; EVP_PBE_scrypt(s1, 0, (unsigned char *)s2, 0, 0, 0, 0, 0, NULL, 0); return 0; } - | ^~ -At top level: -cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { char s1[1024], s2[1024]; EVP_PBE_scrypt(s1, 0, (unsigned char *)s2, 0, 0, 0, 0, 0, NULL, 0); return 0; } -/* end */ - --------------------- - -have_func: checking for EVP_PKEY_check(NULL) in openssl/evp.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lssl -lcrypto -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lssl -lcrypto -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { EVP_PKEY_check(NULL); return 0; } -/* end */ - --------------------- - -have_func: checking for SSL_CTX_set0_tmp_dh_pkey(NULL, NULL) in openssl/ssl.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lssl -lcrypto -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lssl -lcrypto -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { SSL_CTX_set0_tmp_dh_pkey(NULL, NULL); return 0; } -/* end */ - --------------------- - -have_func: checking for ERR_get_error_all(NULL, NULL, NULL, NULL, NULL) in openssl/err.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lssl -lcrypto -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lssl -lcrypto -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { ERR_get_error_all(NULL, NULL, NULL, NULL, NULL); return 0; } -/* end */ - --------------------- - -have_func: checking for SSL_CTX_load_verify_file(NULL, "") in openssl/ssl.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lssl -lcrypto -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lssl -lcrypto -lm -lpthread -lc" -conftest.c: In function ‘t’: -conftest.c:17:30: warning: ‘s1’ may be used uninitialized [-Wmaybe-uninitialized] - 17 | int t(void) { char s1[1024]; SSL_CTX_load_verify_file(NULL, s1); return 0; } - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -In file included from conftest.c:3: -/usr/include/openssl/ssl.h:2185:12: note: by argument 2 of type ‘const char *’ to ‘SSL_CTX_load_verify_file’ declared here - 2185 | __owur int SSL_CTX_load_verify_file(SSL_CTX *ctx, const char *CAfile); - | ^~~~~~~~~~~~~~~~~~~~~~~~ -conftest.c:17:20: note: ‘s1’ declared here - 17 | int t(void) { char s1[1024]; SSL_CTX_load_verify_file(NULL, s1); return 0; } - | ^~ -At top level: -cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { char s1[1024]; SSL_CTX_load_verify_file(NULL, s1); return 0; } -/* end */ - --------------------- - -have_func: checking for BN_check_prime(NULL, NULL, NULL) in openssl/bn.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lssl -lcrypto -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lssl -lcrypto -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { BN_check_prime(NULL, NULL, NULL); return 0; } -/* end */ - --------------------- - -have_func: checking for EVP_MD_CTX_get0_md(NULL) in openssl/evp.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lssl -lcrypto -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lssl -lcrypto -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { EVP_MD_CTX_get0_md(NULL); return 0; } -/* end */ - --------------------- - -have_func: checking for EVP_MD_CTX_get_pkey_ctx(NULL) in openssl/evp.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lssl -lcrypto -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lssl -lcrypto -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { EVP_MD_CTX_get_pkey_ctx(NULL); return 0; } -/* end */ - --------------------- - -have_func: checking for EVP_PKEY_eq(NULL, NULL) in openssl/evp.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lssl -lcrypto -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lssl -lcrypto -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { EVP_PKEY_eq(NULL, NULL); return 0; } -/* end */ - --------------------- - -have_func: checking for EVP_PKEY_dup(NULL) in openssl/evp.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lssl -lcrypto -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lssl -lcrypto -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { EVP_PKEY_dup(NULL); return 0; } -/* end */ - --------------------- - -have_func: checking for SSL_get0_group_name(NULL) in openssl/ssl.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lssl -lcrypto -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lssl -lcrypto -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { SSL_get0_group_name(NULL); return 0; } -/* end */ - --------------------- - -have_func: checking for TS_VERIFY_CTX_set0_certs(NULL, NULL) in openssl/ts.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lssl -lcrypto -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lssl -lcrypto -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { TS_VERIFY_CTX_set0_certs(NULL, NULL); return 0; } -/* end */ - --------------------- - -have_func: checking for SSL_get0_peer_signature_name(NULL, NULL) in openssl/ssl.h... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lssl -lcrypto -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lssl -lcrypto -lm -lpthread -lc" -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { SSL_get0_peer_signature_name(NULL, NULL); return 0; } -/* end */ - --------------------- - -have_func: checking for ASN1_BIT_STRING_set1(NULL, NULL, 0, 0) in openssl/asn1.h... -------------------- no - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -lssl -lcrypto -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lssl -lcrypto -lm -lpthread -lc" -conftest.c: In function ‘t’: -conftest.c:17:15: error: implicit declaration of function ‘ASN1_BIT_STRING_set1’; did you mean ‘ASN1_BIT_STRING_set’? [-Wimplicit-function-declaration] - 17 | int t(void) { ASN1_BIT_STRING_set1(NULL, NULL, 0, 0); return 0; } - | ^~~~~~~~~~~~~~~~~~~~ - | ASN1_BIT_STRING_set -At top level: -cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics -checked program was: -/* begin */ - 1: #include "ruby.h" - 2: - 3: #include - 4: - 5: /*top*/ - 6: extern int t(void); - 7: int main(int argc, char **argv) - 8: { - 9: if (argc > 1000000) { -10: int (* volatile tp)(void)=(int (*)(void))&t; -11: printf("%d", (*tp)()); -12: } -13: -14: return !!argv[argc]; -15: } -16: -17: int t(void) { ASN1_BIT_STRING_set1(NULL, NULL, 0, 0); return 0; } -/* end */ - --------------------- - -=== Checking done. === -extconf.h is: -/* begin */ - 1: #ifndef EXTCONF_H - 2: #define EXTCONF_H - 3: #define OPENSSL_SUPPRESS_DEPRECATED 1 - 4: #define HAVE_RB_CALL_SUPER_KW 1 - 5: #define HAVE_RB_IO_DESCRIPTOR 1 - 6: #define HAVE_RB_IO_MAYBE_WAIT 1 - 7: #define HAVE_RB_IO_TIMEOUT 1 - 8: #define HAVE_OPENSSL_SSL_H 1 - 9: #define HAVE_SSL_CTX_SET1_SIGALGS_LIST 1 -10: #define HAVE_SSL_CTX_SET1_CLIENT_SIGALGS_LIST 1 -11: #define HAVE_EVP_PBE_SCRYPT 1 -12: #define HAVE_EVP_PKEY_CHECK 1 -13: #define HAVE_SSL_CTX_SET0_TMP_DH_PKEY 1 -14: #define HAVE_ERR_GET_ERROR_ALL 1 -15: #define HAVE_SSL_CTX_LOAD_VERIFY_FILE 1 -16: #define HAVE_BN_CHECK_PRIME 1 -17: #define HAVE_EVP_MD_CTX_GET0_MD 1 -18: #define HAVE_EVP_MD_CTX_GET_PKEY_CTX 1 -19: #define HAVE_EVP_PKEY_EQ 1 -20: #define HAVE_EVP_PKEY_DUP 1 -21: #define HAVE_SSL_GET0_GROUP_NAME 1 -22: #define HAVE_TS_VERIFY_CTX_SET0_CERTS 1 -23: #define HAVE_SSL_GET0_PEER_SIGNATURE_NAME 1 -24: #endif -/* end */ - -Done. diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/openssl-4.0.2/openssl.so b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/openssl-4.0.2/openssl.so deleted file mode 100755 index 7b03e12..0000000 Binary files a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/openssl-4.0.2/openssl.so and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/prism-1.9.0/gem.build_complete b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/prism-1.9.0/gem.build_complete deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/prism-1.9.0/gem_make.out b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/prism-1.9.0/gem_make.out deleted file mode 100644 index 4980152..0000000 --- a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/prism-1.9.0/gem_make.out +++ /dev/null @@ -1,52 +0,0 @@ -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/prism-1.9.0/ext/prism -/opt/hostedtoolcache/Ruby/3.3.13/x64/bin/ruby extconf.rb -checking for prism.h in /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/prism-1.9.0/include... yes -checking for prism/extension.h in /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/prism-1.9.0/ext... yes -checking for whether -fvisibility=hidden is accepted as CFLAGS... yes -creating Makefile - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/prism-1.9.0/ext/prism -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-kabi6m sitelibdir\=./.gem.20261107-2444-kabi6m clean - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/prism-1.9.0/ext/prism -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-kabi6m sitelibdir\=./.gem.20261107-2444-kabi6m -compiling api_node.c -compiling api_pack.c -compiling extension.c -compiling ./../../src/diagnostic.c -compiling ./../../src/encoding.c -compiling ./../../src/node.c -compiling ./../../src/options.c -compiling ./../../src/pack.c -compiling ./../../src/prettyprint.c -compiling ./../../src/prism.c -compiling ./../../src/regexp.c -compiling ./../../src/serialize.c -compiling ./../../src/static_literals.c -compiling ./../../src/token_type.c -compiling ./../../src/util/pm_buffer.c -compiling ./../../src/util/pm_char.c -compiling ./../../src/util/pm_constant_pool.c -compiling ./../../src/util/pm_integer.c -compiling ./../../src/util/pm_list.c -compiling ./../../src/util/pm_memchr.c -./../../src/util/pm_memchr.c: In function ‘pm_memchr’: -./../../src/util/pm_memchr.c:31:16: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] - 31 | return memchr(memory, character, number); - | ^~~~~~ -At top level: -cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics -cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics -compiling ./../../src/util/pm_newline_list.c -compiling ./../../src/util/pm_string.c -compiling ./../../src/util/pm_strncasecmp.c -compiling ./../../src/util/pm_strpbrk.c -linking shared-object prism/prism.so - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/prism-1.9.0/ext/prism -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-kabi6m sitelibdir\=./.gem.20261107-2444-kabi6m install -/usr/bin/install -c -m 0755 prism.so ./.gem.20261107-2444-kabi6m/prism - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/prism-1.9.0/ext/prism -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-kabi6m sitelibdir\=./.gem.20261107-2444-kabi6m clean diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/prism-1.9.0/mkmf.log b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/prism-1.9.0/mkmf.log deleted file mode 100644 index 91f587e..0000000 --- a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/prism-1.9.0/mkmf.log +++ /dev/null @@ -1,74 +0,0 @@ -find_header: checking for prism.h in /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/prism-1.9.0/include... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -o conftest -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC conftest.c -L. -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -Wl,-rpath,/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -L/opt/hostedtoolcache/Ruby/3.3.13/x64/lib -lruby -lm -lpthread -lc" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: int main(int argc, char **argv) -4: { -5: return !!argv[argc]; -6: } -/* end */ - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -conftest.c:3:10: fatal error: prism.h: No such file or directory - 3 | #include - | ^~~~~~~~~ -compilation terminated. -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -I/home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/prism-1.9.0/include -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -find_header: checking for prism/extension.h in /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/prism-1.9.0/ext... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -I/home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/prism-1.9.0/include -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -c conftest.c" -conftest.c:3:10: fatal error: prism/extension.h: No such file or directory - 3 | #include - | ^~~~~~~~~~~~~~~~~~~ -compilation terminated. -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -I/home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/prism-1.9.0/include -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -I/home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/prism-1.9.0/ext -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: #include -/* end */ - --------------------- - -append_cflags: checking for whether -fvisibility=hidden is accepted as CFLAGS... -------------------- yes - -LD_LIBRARY_PATH=.:/opt/hostedtoolcache/Ruby/3.3.13/x64/lib "gcc -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/ruby/backward -I/opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -I. -I/home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/prism-1.9.0/include -I/home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/prism-1.9.0/ext -DENABLE_PATH_CHECK=0 -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -fPIC -fvisibility=hidden -Werror -c conftest.c" -checked program was: -/* begin */ -1: #include "ruby.h" -2: -3: int main(int argc, char **argv) -4: { -5: return !!argv[argc]; -6: } -/* end */ - --------------------- - diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/prism-1.9.0/prism/prism.so b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/prism-1.9.0/prism/prism.so deleted file mode 100755 index ab13c51..0000000 Binary files a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/prism-1.9.0/prism/prism.so and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/racc-1.8.1/gem.build_complete b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/racc-1.8.1/gem.build_complete deleted file mode 100644 index e69de29..0000000 diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/racc-1.8.1/gem_make.out b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/racc-1.8.1/gem_make.out deleted file mode 100644 index 4ced802..0000000 --- a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/racc-1.8.1/gem_make.out +++ /dev/null @@ -1,18 +0,0 @@ -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/racc-1.8.1/ext/racc/cparse -/opt/hostedtoolcache/Ruby/3.3.13/x64/bin/ruby extconf.rb -creating Makefile - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/racc-1.8.1/ext/racc/cparse -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-92j57b sitelibdir\=./.gem.20261107-2444-92j57b clean - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/racc-1.8.1/ext/racc/cparse -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-92j57b sitelibdir\=./.gem.20261107-2444-92j57b -compiling cparse.c -linking shared-object racc/cparse.so - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/racc-1.8.1/ext/racc/cparse -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-92j57b sitelibdir\=./.gem.20261107-2444-92j57b install -/usr/bin/install -c -m 0755 cparse.so ./.gem.20261107-2444-92j57b/racc - -current directory: /home/runner/work/ruby-link-checker/ruby-link-checker/vendor/bundle/ruby/3.3.0/gems/racc-1.8.1/ext/racc/cparse -make DESTDIR\= sitearchdir\=./.gem.20261107-2444-92j57b sitelibdir\=./.gem.20261107-2444-92j57b clean diff --git a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/racc-1.8.1/racc/cparse.so b/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/racc-1.8.1/racc/cparse.so deleted file mode 100755 index 358b449..0000000 Binary files a/vendor/bundle/ruby/3.3.0/extensions/x86_64-linux/3.3.0/racc-1.8.1/racc/cparse.so and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/CHANGELOG.md b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/CHANGELOG.md deleted file mode 100644 index 41d0ad2..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/CHANGELOG.md +++ /dev/null @@ -1,803 +0,0 @@ -## Rails 8.1.4.1 (November 03, 2026) ## - -* `ActiveSupport::MessagePack` no longer deserializes an unsafe - `ActiveSupport::SafeBuffer` as `html_safe`. - - A `SafeBuffer` that was no longer `html_safe?`, for example after an - in-place `gsub!`, was deserialized as an `html_safe` `SafeBuffer`. It is now - serialized with an unsafe marker and deserialized as a `String`. Earlier - versions of Rails cannot read an unsafe buffer serialized this way. - - [GHSA-2w9f-fxwj-w2qf] - - *Jean Boussier* - -* `ActiveSupport::Inflector#safe_constantize` matches the constant name in a - `LoadError` message as a literal string instead of building a `Regexp` - from it. - - The name's segments were interpolated unescaped into the pattern, so input - that reaches `safe_constantize`, such as the channel identifier in an Action - Cable subscribe command, chose the source passed to the regexp compiler. - - [GHSA-8474-xrp6-wh69] - - *Jeremy Daer* - -## Rails 8.1.4 (September 24, 2026) ## - -* Fix the debug error page rendering for `SyntaxError`s with multi-line messages. - - *Marco Roth* - -* Make `ActiveSupport::JSON.decode` compatible with the upcoming `json` 3.0 gem. - - *Earlopain* - -* Fix `number_to_human_size` crashing for sizes above a terabyte by supporting - petabyte, exabyte, and zettabyte storage units. - - *Kenta Ishizaki* - -* Fix `Range#sole` raising `NoMethodError` when the enumerable core extension - isn't already loaded. - - *Kenta Ishizaki* - -* Fix `ActiveSupport::Cache::FileStore` raising `NameError` for `FileUtils` - when `fileutils` isn't already loaded. - - *Kenta Ishizaki* - -* Fix `Enumerable#in_order_of` with `filter: true` dropping `nil` elements - explicitly named in the series. - - *Kenta Ishizaki* - -* Keep `HashWithIndifferentAccess#filter` returning a `HashWithIndifferentAccess` - instead of a plain `Hash`. - - *Kenta Ishizaki* - -* Fix `number_to_human` and `number_to_human_size` crashing when `:precision` is `nil`. - - *Kenta Ishizaki* - -* Fix `ActiveSupport::InheritableOptions#to_h` to recursively flatten nested - `InheritableOptions` parents. - - *Andrew Novoselac* - -* Fix `ActiveSupport::StructuredEventSubscriber.debug_only` leaking debug-only - methods across subscriber subclasses. - - *Kenta Ishizaki* - -* Fix `ActiveSupport::Inflector#transliterate` mutating the caller's string. - - *Kenta Ishizaki* - -* Fix `Hash.from_xml` raising `Date::Error` on `type="date"` values surrounded - by whitespace. - - *Kenta Ishizaki* - -* Fix `Time#advance` and `DateTime#advance` mutating the options hash passed - by the caller. - - *Kenta Ishizaki* - -* Fix `ActiveSupport::Cache::MemoryStore#cleanup` raising `NoMethodError` when - used with a non-`DupCoder` serializer. - - *Kenta Ishizaki* - -* Fix `String#truncate` with `:separator` misbehaving when the `:omission` is - longer than the target length. - - *Kenta Ishizaki* - -* Fix `ActiveSupport::Cache::Store#delete_multi` mutating the names array passed - by the caller. - - *Kenta Ishizaki* - -* Fix `number_to_currency` crashing on a negative number when `:precision` is `nil`. - - *Kenta Ishizaki* - -* Fix `TimeZone#strptime` with `%s` dropping the sub-second fraction of the timestamp. - - *Kenta Ishizaki* - -* Fix `HashWithIndifferentAccess.new` dropping a falsy (`false` or `0`) default - value from the source hash. - - *Kenta Ishizaki* - -* Fix `Range#include?` and `Range#===` raising on exclusive non-integer sub-ranges. - - *Kenta Ishizaki* - -* Fix `number_to_delimited` corrupting numbers that begin with a `+` or `-` sign. - - *Kenta Ishizaki* - -* Fix `ActiveSupport::InheritableOptions#==` raising `NoMethodError` when compared - with a non-Hash object. - - *Kenta Ishizaki* - -* Fix `Enumerable#in_order_of` with `filter: false` dropping elements whose keyed - value is `nil`. - - *Hammad Khan* - -* Stop the DRb service when shutting down parallel test workers, preventing it - from lingering after the test run. - - *Shuta Mugikura* - -* Preserve the encoding of `ActiveSupport::SafeBuffer` values round-tripped through - `ActiveSupport::MessagePack`. - - *Rafael Mendonça França* - -* Fix `number_to_phone` without an area code stripping a leading delimiter when the - number itself coincidentally starts with the delimiter string. - - *Tahsin Hasan* - -* Update `ActiveSupport::TimeZone` mappings to use the current IANA identifiers - `Europe/Kyiv` (was `Europe/Kiev`) and `Asia/Yangon` (was `Asia/Rangoon`). - - *tsymbalenkovlad* - -* Use the faster string-based delimiter logic by default in `number_to_delimited`, - instead of the regular expression fallback. - - *Shinichi Maeshima* - -* Preserve the requested key order in `ActiveSupport::Cache::Store#fetch_multi` - when a local cache is active. - - Previously, if some keys were served from the local cache and others from the - underlying store, `fetch_multi` returned the local cache hits first instead of - following the order of the requested keys. - - *Mueez Afzal* - -* Fix `String#parameterize` raising `TypeError` when `separator` is `nil`. - - `parameterize` already treats a `nil` separator the same as an empty one when - squeezing and trimming separators, but raised `TypeError` before reaching that - point. A `nil` separator now behaves like `""`, removing the unwanted characters. - - ```ruby - "Donald E. Knuth".parameterize(separator: nil) # => "donaldeknuth" - ``` - - *Hammad Khan* - -* Add `RedisClient::Error` to `ActiveSupport::Cache::RedisCacheStore`'s failsafe rescue list. - - The redis-rb gem normally translates `RedisClient::*` errors into `Redis::*` errors but in - some rare cases, such as when using sentinels, `RedisClient::*` errors may slip through. - - *David Arrunategui* - -* Fix `ActiveSupport::Duration#in_minutes`, `#in_hours`, `#in_days`, - `#in_weeks`, `#in_months`, and `#in_years` truncating sub-second precision. - - These methods divided the duration's integer second count (`in_seconds`, - aliased to `to_i`) instead of its exact value, so any fractional second was - silently dropped before the conversion. - - ```ruby - # Before - 90.5.seconds.in_minutes # => 1.5 - - # After - 90.5.seconds.in_minutes # => 1.5083333333333333 - ``` - - *Kenta Ishizaki* - -* Fix JSON encoding of non-String Hash keys. - - The old encoder would simply call `to_s` on them, the newer encoder - would incorrectly call `as_json` instead. - - In the case of `Time`, `DateTime` and `TimeWithZone` this would result - in different serialization of time keys: `"2009-01-01T12:30:00.000Z"` (arguably better) - instead of `"2009-01-01 12:30:00 UTC"` (how it used to be). - - *Kenta Ishizaki* - -* Fix `number_to_phone` dropping only the first character of a - multi-character `:delimiter` when no area code is present. - - The leading delimiter produced by an empty first capture group was - stripped with `slice!(0, 1)`, which assumed a single-character - delimiter. Multi-character (and multibyte) delimiters now work: - - number_to_phone(5551234, delimiter: " - ") # => "555 - 1234" - # was "- 555 - 1234" - - *Kenta Ishizaki* - -* Fix `titleize` inflector to consider Unicode characters - - ```ruby - "ćasim đipa".titleize # => "Ćasim Đipa" - ``` - - *Eldin Guzin* - - -## Rails 8.1.3.1 (July 29, 2026) ## - -* No changes. - - -## Rails 8.1.3 (March 24, 2026) ## - -* Fix `JSONGemCoderEncoder` to correctly serialize custom object hash keys. - - When hash keys are custom objects whose `as_json` returns a Hash, - the encoder now calls `to_s` on the original key object instead of - on the `as_json` result. - - Before: - hash = {CustomKey.new(123) => "value"} - hash.to_json # => {"{:id=>123}":"value"} - - After: - hash.to_json # => {"custom_123":"value"} - - *Dan Sharp* - -* Fix inflections to better handle overlapping acronyms. - - ```ruby - ActiveSupport::Inflector.inflections(:en) do |inflect| - inflect.acronym "USD" - inflect.acronym "USDC" - end - - "USDC".underscore # => "usdc" - ``` - - *Said Kaldybaev* - -* Silence Dalli 4.0+ warning when using `ActiveSupport::Cache::MemCacheStore`. - - *zzak* - - -## Rails 8.1.2.1 (March 23, 2026) ## - -* Reject scientific notation in NumberConverter - - [CVE-2026-33176] - - *Jean Boussier* - -* Fix `SafeBuffer#%` to preserve unsafe status - - [CVE-2026-33170] - - *Jean Boussier* - -* Improve performance of NumberToDelimitedConverter - - [CVE-2026-33169] - - *Jean Boussier* - - -## Rails 8.1.2 (January 08, 2026) ## - -* Make `delegate` and `delegate_missing_to` work in BasicObject subclasses. - - *Rafael Mendonça França* - -* Fix Inflectors when using a locale that fallbacks to `:en`. - - *Said Kaldybaev* - -* Fix `ActiveSupport::TimeWithZone#as_json` to consistently return UTF-8 strings. - - Previously the returned string would sometime be encoded in US-ASCII, which in - some cases may be problematic. - - Now the method consistently always return UTF-8 strings. - - *Jean Boussier* - -* Fix `TimeWithZone#xmlschema` when wrapping a `DateTime` instance in local time. - - Previously it would return an invalid time. - - *Dmytro Rymar* - -* Implement LocalCache strategy on `ActiveSupport::Cache::MemoryStore`. The memory store - needs to respond to the same interface as other cache stores (e.g. `ActiveSupport::NullStore`). - - *Mikey Gough* - -* Fix `ActiveSupport::Inflector.humanize` with international characters. - - ```ruby - ActiveSupport::Inflector.humanize("áÉÍÓÚ") # => "Áéíóú" - ActiveSupport::Inflector.humanize("аБВГДЕ") # => "Абвгде" - ``` - - *Jose Luis Duran* - - -## Rails 8.1.1 (October 28, 2025) ## - -* No changes. - - -## Rails 8.1.0 (October 22, 2025) ## - -* Remove deprecated passing a Time object to `Time#since`. - - *Rafael Mendonça França* - -* Remove deprecated `Benchmark.ms` method. It is now defined in the `benchmark` gem. - - *Rafael Mendonça França* - -* Remove deprecated addition for `Time` instances with `ActiveSupport::TimeWithZone`. - - *Rafael Mendonça França* - -* Remove deprecated support for `to_time` to preserve the system local time. It will now always preserve the receiver - timezone. - - *Rafael Mendonça França* - -* Deprecate `config.active_support.to_time_preserves_timezone`. - - *Rafael Mendonça França* - -* Standardize event name formatting in `assert_event_reported` error messages. - - The event name in failure messages now uses `.inspect` (e.g., `name: "user.created"`) - to match `assert_events_reported` and provide type clarity between strings and symbols. - This only affects tests that assert on the failure message format itself. - - *George Ma* - -* Fix `Enumerable#sole` to return the full tuple instead of just the first element of the tuple. - - *Olivier Bellone* - -* Fix parallel tests hanging when worker processes die abruptly. - - Previously, if a worker process was killed (e.g., OOM killed, `kill -9`) during parallel - test execution, the test suite would hang forever waiting for the dead worker. - - *Joshua Young* - -* Add `config.active_support.escape_js_separators_in_json`. - - Introduce a new framework default to skip escaping LINE SEPARATOR (U+2028) and PARAGRAPH SEPARATOR (U+2029) in JSON. - - Historically these characters were not valid inside JavaScript literal strings but that changed in ECMAScript 2019. - As such it's no longer a concern in modern browsers: https://caniuse.com/mdn-javascript_builtins_json_json_superset. - - *Étienne Barrié*, *Jean Boussier* - -* Fix `NameError` when `class_attribute` is defined on instance singleton classes. - - Previously, calling `class_attribute` on an instance's singleton class would raise - a `NameError` when accessing the attribute through the instance. - - ```ruby - object = MyClass.new - object.singleton_class.class_attribute :foo, default: "bar" - object.foo # previously raised NameError, now returns "bar" - ``` - - *Joshua Young* - -* Introduce `ActiveSupport::Testing::EventReporterAssertions#with_debug_event_reporting` - to enable event reporter debug mode in tests. - - The previous way to enable debug mode is by using `#with_debug` on the - event reporter itself, which is too verbose. This new helper will help - clear up any confusion on how to test debug events. - - *Gannon McGibbon* - -* Add `ActiveSupport::StructuredEventSubscriber` for consuming notifications and - emitting structured event logs. Events may be emitted with the `#emit_event` - or `#emit_debug_event` methods. - - ```ruby - class MyStructuredEventSubscriber < ActiveSupport::StructuredEventSubscriber - def notification(event) - emit_event("my.notification", data: 1) - end - end - ``` - - *Adrianna Chang* - -* `ActiveSupport::FileUpdateChecker` does not depend on `Time.now` to prevent unecessary reloads with time travel test helpers - - *Jan Grodowski* - -* Add `ActiveSupport::Cache::Store#namespace=` and `#namespace`. - - Can be used as an alternative to `Store#clear` in some situations such as parallel - testing. - - *Nick Schwaderer* - -* Create `parallel_worker_id` helper for running parallel tests. This allows users to - know which worker they are currently running in. - - *Nick Schwaderer* - -* Make the cache of `ActiveSupport::Cache::Strategy::LocalCache::Middleware` updatable. - - If the cache client at `Rails.cache` of a booted application changes, the corresponding - mounted middleware needs to update in order for request-local caches to be setup properly. - Otherwise, redundant cache operations will erroneously hit the datastore. - - *Gannon McGibbon* - -* Add `assert_events_reported` test helper for `ActiveSupport::EventReporter`. - - This new assertion allows testing multiple events in a single block, regardless of order: - - ```ruby - assert_events_reported([ - { name: "user.created", payload: { id: 123 } }, - { name: "email.sent", payload: { to: "user@example.com" } } - ]) do - create_user_and_send_welcome_email - end - ``` - - *George Ma* - -* Add `ActiveSupport::TimeZone#standard_name` method. - - ``` ruby - zone = ActiveSupport::TimeZone['Hawaii'] - # Old way - ActiveSupport::TimeZone::MAPPING[zone.name] - # New way - zone.standard_name # => 'Pacific/Honolulu' - ``` - - *Bogdan Gusiev* - -* Add Structured Event Reporter, accessible via `Rails.event`. - - The Event Reporter provides a unified interface for producing structured events in Rails - applications: - - ```ruby - Rails.event.notify("user.signup", user_id: 123, email: "user@example.com") - ``` - - It supports adding tags to events: - - ```ruby - Rails.event.tagged("graphql") do - # Event includes tags: { graphql: true } - Rails.event.notify("user.signup", user_id: 123, email: "user@example.com") - end - ``` - - As well as context: - ```ruby - # All events will contain context: {request_id: "abc123", shop_id: 456} - Rails.event.set_context(request_id: "abc123", shop_id: 456) - ``` - - Events are emitted to subscribers. Applications register subscribers to - control how events are serialized and emitted. Subscribers must implement - an `#emit` method, which receives the event hash: - - ```ruby - class LogSubscriber - def emit(event) - payload = event[:payload].map { |key, value| "#{key}=#{value}" }.join(" ") - source_location = event[:source_location] - log = "[#{event[:name]}] #{payload} at #{source_location[:filepath]}:#{source_location[:lineno]}" - Rails.logger.info(log) - end - end - ``` - - *Adrianna Chang* - -* Make `ActiveSupport::Logger` `#freeze`-friendly. - - *Joshua Young* - -* Make `ActiveSupport::Gzip.compress` deterministic based on input. - - `ActiveSupport::Gzip.compress` used to include a timestamp in the output, - causing consecutive calls with the same input data to have different output - if called during different seconds. It now always sets the timestamp to `0` - so that the output is identical for any given input. - - *Rob Brackett* - -* Given an array of `Thread::Backtrace::Location` objects, the new method - `ActiveSupport::BacktraceCleaner#clean_locations` returns an array with the - clean ones: - - ```ruby - clean_locations = backtrace_cleaner.clean_locations(caller_locations) - ``` - - Filters and silencers receive strings as usual. However, the `path` - attributes of the locations in the returned array are the original, - unfiltered ones, since locations are immutable. - - *Xavier Noria* - -* Improve `CurrentAttributes` and `ExecutionContext` state managment in test cases. - - Previously these two global state would be entirely cleared out whenever calling - into code that is wrapped by the Rails executor, typically Action Controller or - Active Job helpers: - - ```ruby - test "#index works" do - CurrentUser.id = 42 - get :index - CurrentUser.id == nil - end - ``` - - Now re-entering the executor properly save and restore that state. - - *Jean Boussier* - -* The new method `ActiveSupport::BacktraceCleaner#first_clean_location` - returns the first clean location of the caller's call stack, or `nil`. - Locations are `Thread::Backtrace::Location` objects. Useful when you want to - report the application-level location where something happened as an object. - - *Xavier Noria* - -* FileUpdateChecker and EventedFileUpdateChecker ignore changes in Gem.path now. - - *Ermolaev Andrey*, *zzak* - -* The new method `ActiveSupport::BacktraceCleaner#first_clean_frame` returns - the first clean frame of the caller's backtrace, or `nil`. Useful when you - want to report the application-level frame where something happened as a - string. - - *Xavier Noria* - -* Always clear `CurrentAttributes` instances. - - Previously `CurrentAttributes` instance would be reset at the end of requests. - Meaning its attributes would be re-initialized. - - This is problematic because it assume these objects don't hold any state - other than their declared attribute, which isn't always the case, and - can lead to state leak across request. - - Now `CurrentAttributes` instances are abandoned at the end of a request, - and a new instance is created at the start of the next request. - - *Jean Boussier*, *Janko Marohnić* - -* Add public API for `before_fork_hook` in parallel testing. - - Introduces a public API for calling the before fork hooks implemented by parallel testing. - - ```ruby - parallelize_before_fork do - # perform an action before test processes are forked - end - ``` - - *Eileen M. Uchitelle* - -* Implement ability to skip creating parallel testing databases. - - With parallel testing, Rails will create a database per process. If this isn't - desirable or you would like to implement databases handling on your own, you can - now turn off this default behavior. - - To skip creating a database per process, you can change it via the - `parallelize` method: - - ```ruby - parallelize(workers: 10, parallelize_databases: false) - ``` - - or via the application configuration: - - ```ruby - config.active_support.parallelize_databases = false - ``` - - *Eileen M. Uchitelle* - -* Allow to configure maximum cache key sizes - - When the key exceeds the configured limit (250 bytes by default), it will be truncated and - the digest of the rest of the key appended to it. - - Note that previously `ActiveSupport::Cache::RedisCacheStore` allowed up to 1kb cache keys before - truncation, which is now reduced to 250 bytes. - - ```ruby - config.cache_store = :redis_cache_store, { max_key_size: 64 } - ``` - - *fatkodima* - -* Use `UNLINK` command instead of `DEL` in `ActiveSupport::Cache::RedisCacheStore` for non-blocking deletion. - - *Aron Roh* - -* Add `Cache#read_counter` and `Cache#write_counter` - - ```ruby - Rails.cache.write_counter("foo", 1) - Rails.cache.read_counter("foo") # => 1 - Rails.cache.increment("foo") - Rails.cache.read_counter("foo") # => 2 - ``` - - *Alex Ghiculescu* - -* Introduce ActiveSupport::Testing::ErrorReporterAssertions#capture_error_reports - - Captures all reported errors from within the block that match the given - error class. - - ```ruby - reports = capture_error_reports(IOError) do - Rails.error.report(IOError.new("Oops")) - Rails.error.report(IOError.new("Oh no")) - Rails.error.report(StandardError.new) - end - - assert_equal 2, reports.size - assert_equal "Oops", reports.first.error.message - assert_equal "Oh no", reports.last.error.message - ``` - - *Andrew Novoselac* - -* Introduce ActiveSupport::ErrorReporter#add_middleware - - When reporting an error, the error context middleware will be called with the reported error - and base execution context. The stack may mutate the context hash. The mutated context will - then be passed to error subscribers. Middleware receives the same parameters as `ErrorReporter#report`. - - *Andrew Novoselac*, *Sam Schmidt* - -* Change execution wrapping to report all exceptions, including `Exception`. - - If a more serious error like `SystemStackError` or `NoMemoryError` happens, - the error reporter should be able to report these kinds of exceptions. - - *Gannon McGibbon* - -* `ActiveSupport::Testing::Parallelization.before_fork_hook` allows declaration of callbacks that - are invoked immediately before forking test workers. - - *Mike Dalessio* - -* Allow the `#freeze_time` testing helper to accept a date or time argument. - - ```ruby - Time.current # => Sun, 09 Jul 2024 15:34:49 EST -05:00 - freeze_time Time.current + 1.day - sleep 1 - Time.current # => Mon, 10 Jul 2024 15:34:49 EST -05:00 - ``` - - *Joshua Young* - -* `ActiveSupport::JSON` now accepts options - - It is now possible to pass options to `ActiveSupport::JSON`: - ```ruby - ActiveSupport::JSON.decode('{"key": "value"}', symbolize_names: true) # => { key: "value" } - ``` - - *matthaigh27* - -* `ActiveSupport::Testing::NotificationAssertions`'s `assert_notification` now matches against payload subsets by default. - - Previously the following assertion would fail due to excess key vals in the notification payload. Now with payload subset matching, it will pass. - - ```ruby - assert_notification("post.submitted", title: "Cool Post") do - ActiveSupport::Notifications.instrument("post.submitted", title: "Cool Post", body: "Cool Body") - end - ``` - - Additionally, you can now persist a matched notification for more customized assertions. - - ```ruby - notification = assert_notification("post.submitted", title: "Cool Post") do - ActiveSupport::Notifications.instrument("post.submitted", title: "Cool Post", body: Body.new("Cool Body")) - end - - assert_instance_of(Body, notification.payload[:body]) - ``` - - *Nicholas La Roux* - -* Deprecate `String#mb_chars` and `ActiveSupport::Multibyte::Chars`. - - These APIs are a relic of the Ruby 1.8 days when Ruby strings weren't encoding - aware. There is no legitimate reasons to need these APIs today. - - *Jean Boussier* - -* Deprecate `ActiveSupport::Configurable` - - *Sean Doyle* - -* `nil.to_query("key")` now returns `key`. - - Previously it would return `key=`, preventing round tripping with `Rack::Utils.parse_nested_query`. - - *Erol Fornoles* - -* Avoid wrapping redis in a `ConnectionPool` when using `ActiveSupport::Cache::RedisCacheStore` if the `:redis` - option is already a `ConnectionPool`. - - *Joshua Young* - -* Alter `ERB::Util.tokenize` to return :PLAIN token with full input string when string doesn't contain ERB tags. - - *Martin Emde* - -* Fix a bug in `ERB::Util.tokenize` that causes incorrect tokenization when ERB tags are preceded by multibyte characters. - - *Martin Emde* - -* Add `ActiveSupport::Testing::NotificationAssertions` module to help with testing `ActiveSupport::Notifications`. - - *Nicholas La Roux*, *Yishu See*, *Sean Doyle* - -* `ActiveSupport::CurrentAttributes#attributes` now will return a new hash object on each call. - - Previously, the same hash object was returned each time that method was called. - - *fatkodima* - -* `ActiveSupport::JSON.encode` supports CIDR notation. - - Previously: - - ```ruby - ActiveSupport::JSON.encode(IPAddr.new("172.16.0.0/24")) # => "\"172.16.0.0\"" - ``` - - After this change: - - ```ruby - ActiveSupport::JSON.encode(IPAddr.new("172.16.0.0/24")) # => "\"172.16.0.0/24\"" - ``` - - *Taketo Takashima* - -* Make `ActiveSupport::FileUpdateChecker` faster when checking many file-extensions. - - *Jonathan del Strother* - -Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/activesupport/CHANGELOG.md) for previous changes. diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/MIT-LICENSE b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/MIT-LICENSE deleted file mode 100644 index f12cfa7..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/MIT-LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) David Heinemeier Hansson - -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/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/README.rdoc b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/README.rdoc deleted file mode 100644 index b8de6af..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/README.rdoc +++ /dev/null @@ -1,40 +0,0 @@ -= Active Support -- Utility classes and Ruby extensions from \Rails - -Active Support is a collection of utility classes and standard library -extensions that were found useful for the \Rails framework. These additions -reside in this package so they can be loaded as needed in Ruby projects -outside of \Rails. - -You can read more about the extensions in the {Active Support Core Extensions}[https://guides.rubyonrails.org/active_support_core_extensions.html] guide. - -== Download and installation - -The latest version of Active Support can be installed with RubyGems: - - $ gem install activesupport - -Source code can be downloaded as part of the \Rails project on GitHub: - -* https://github.com/rails/rails/tree/main/activesupport - - -== License - -Active Support is released under the MIT license: - -* https://opensource.org/licenses/MIT - - -== Support - -API documentation is at: - -* https://api.rubyonrails.org - -Bug reports for the Ruby on \Rails project can be filed here: - -* https://github.com/rails/rails/issues - -Feature requests should be discussed on the rubyonrails-core forum here: - -* https://discuss.rubyonrails.org/c/rubyonrails-core diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support.rb deleted file mode 100644 index 978a5cb..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support.rb +++ /dev/null @@ -1,148 +0,0 @@ -# frozen_string_literal: true - -#-- -# Copyright (c) David Heinemeier Hansson -# -# 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. -#++ - -require "securerandom" -require "active_support/dependencies/autoload" -require "active_support/version" -require "active_support/deprecator" -require "active_support/logger" -require "active_support/broadcast_logger" -require "active_support/lazy_load_hooks" -require "active_support/core_ext/date_and_time/compatibility" - -# :include: ../README.rdoc -module ActiveSupport - extend ActiveSupport::Autoload - - autoload :Concern - autoload :CodeGenerator - autoload :ActionableError - autoload :Configurable - autoload :ConfigurationFile - autoload :ContinuousIntegration - autoload :CurrentAttributes - autoload :Dependencies - autoload :DescendantsTracker - autoload :Editor - autoload :ExecutionWrapper - autoload :Executor - autoload :ErrorReporter - autoload :EventReporter - autoload :FileUpdateChecker - autoload :EventedFileUpdateChecker - autoload :ForkTracker - autoload :LogSubscriber - autoload :StructuredEventSubscriber - autoload :IsolatedExecutionState - autoload :Notifications - autoload :Reloader - autoload :SecureCompareRotator - - eager_autoload do - autoload :BacktraceCleaner - autoload :Benchmark - autoload :Benchmarkable - autoload :Cache - autoload :Callbacks - autoload :ClassAttribute - autoload :Deprecation - autoload :Delegation - autoload :Digest - autoload :ExecutionContext - autoload :Gzip - autoload :Inflector - autoload :JSON - autoload :KeyGenerator - autoload :MessageEncryptor - autoload :MessageEncryptors - autoload :MessageVerifier - autoload :MessageVerifiers - autoload :Multibyte - autoload :NumberHelper - autoload :OptionMerger - autoload :OrderedHash - autoload :OrderedOptions - autoload :StringInquirer - autoload :EnvironmentInquirer - autoload :TaggedLogging - autoload :XmlMini - autoload :ArrayInquirer - end - - autoload :Rescuable - autoload :SafeBuffer, "active_support/core_ext/string/output_safety" - autoload :TestCase - - def self.eager_load! - super - - NumberHelper.eager_load! - end - - cattr_accessor :test_order # :nodoc: - cattr_accessor :test_parallelization_threshold, default: 50 # :nodoc: - cattr_accessor :parallelize_test_databases, default: true # :nodoc: - - @error_reporter = ActiveSupport::ErrorReporter.new - singleton_class.attr_accessor :error_reporter # :nodoc: - - @event_reporter = ActiveSupport::EventReporter.new - singleton_class.attr_accessor :event_reporter # :nodoc: - - cattr_accessor :filter_parameters, default: [] # :nodoc: - - def self.cache_format_version - Cache.format_version - end - - def self.cache_format_version=(value) - Cache.format_version = value - end - - def self.to_time_preserves_timezone - ActiveSupport.deprecator.warn( - "`config.active_support.to_time_preserves_timezone` is deprecated and will be removed in Rails 8.2" - ) - @to_time_preserves_timezone - end - - def self.to_time_preserves_timezone=(value) - ActiveSupport.deprecator.warn( - "`config.active_support.to_time_preserves_timezone` is deprecated and will be removed in Rails 8.2" - ) - - @to_time_preserves_timezone = value - end - - def self.utc_to_local_returns_utc_offset_times - DateAndTime::Compatibility.utc_to_local_returns_utc_offset_times - end - - def self.utc_to_local_returns_utc_offset_times=(value) - DateAndTime::Compatibility.utc_to_local_returns_utc_offset_times = value - end -end - -autoload :I18n, "active_support/i18n" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/actionable_error.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/actionable_error.rb deleted file mode 100644 index 8c05e56..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/actionable_error.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # = Actionable Errors - # - # Actionable errors lets you define actions to resolve an error. - # - # To make an error actionable, include the +ActiveSupport::ActionableError+ - # module and invoke the +action+ class macro to define the action. An action - # needs a name and a block to execute. - module ActionableError - extend Concern - - class NonActionable < StandardError; end - - included do - class_attribute :_actions, default: {} - end - - def self.actions(error) # :nodoc: - case error - when ActionableError, -> it { Class === it && it < ActionableError } - error._actions - else - {} - end - end - - def self.dispatch(error, name) # :nodoc: - actions(error).fetch(name).call - rescue KeyError - raise NonActionable, "Cannot find action \"#{name}\"" - end - - module ClassMethods - # Defines an action that can resolve the error. - # - # class PendingMigrationError < MigrationError - # include ActiveSupport::ActionableError - # - # action "Run pending migrations" do - # ActiveRecord::Tasks::DatabaseTasks.migrate - # end - # end - def action(name, &block) - _actions[name] = block - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/all.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/all.rb deleted file mode 100644 index 4adf446..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/all.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -require "active_support" -require "active_support/time" -require "active_support/core_ext" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/array_inquirer.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/array_inquirer.rb deleted file mode 100644 index 6fb6208..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/array_inquirer.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # = \Array Inquirer - # - # Wrapping an array in an +ArrayInquirer+ gives a friendlier way to check - # its string-like contents: - # - # variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet]) - # - # variants.phone? # => true - # variants.tablet? # => true - # variants.desktop? # => false - class ArrayInquirer < Array - # Passes each element of +candidates+ collection to ArrayInquirer collection. - # The method returns true if any element from the ArrayInquirer collection - # is equal to the stringified or symbolized form of any element in the +candidates+ collection. - # - # If +candidates+ collection is not given, method returns true. - # - # variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet]) - # - # variants.any? # => true - # variants.any?(:phone, :tablet) # => true - # variants.any?('phone', 'desktop') # => true - # variants.any?(:desktop, :watch) # => false - def any?(*candidates) - if candidates.none? - super - else - candidates.any? do |candidate| - include?(candidate.to_sym) || include?(candidate.to_s) - end - end - end - - private - def respond_to_missing?(name, include_private = false) - name.end_with?("?") || super - end - - def method_missing(name, ...) - if name.end_with?("?") - any?(name[0..-2]) - else - super - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/backtrace_cleaner.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/backtrace_cleaner.rb deleted file mode 100644 index a478529..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/backtrace_cleaner.rb +++ /dev/null @@ -1,234 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # = Backtrace Cleaner - # - # Backtraces often include many lines that are not relevant for the context - # under review. This makes it hard to find the signal amongst the backtrace - # noise, and adds debugging time. With a BacktraceCleaner, filters and - # silencers are used to remove the noisy lines, so that only the most relevant - # lines remain. - # - # Filters are used to modify lines of data, while silencers are used to remove - # lines entirely. The typical filter use case is to remove lengthy path - # information from the start of each line, and view file paths relevant to the - # app directory instead of the file system root. The typical silencer use case - # is to exclude the output of a noisy library from the backtrace, so that you - # can focus on the rest. - # - # bc = ActiveSupport::BacktraceCleaner.new - # root = "#{Rails.root}/" - # bc.add_filter { |line| line.delete_prefix(root) } # strip the Rails.root prefix - # bc.add_silencer { |line| /puma|rubygems/.match?(line) } # skip any lines from puma or rubygems - # bc.clean(exception.backtrace) # perform the cleanup - # - # To reconfigure an existing BacktraceCleaner (like the default one in \Rails) - # and show as much data as possible, you can always call - # BacktraceCleaner#remove_silencers!, which will restore the - # backtrace to a pristine state. If you need to reconfigure an existing - # BacktraceCleaner so that it does not filter or modify the paths of any lines - # of the backtrace, you can call BacktraceCleaner#remove_filters! - # These two methods will give you a completely untouched backtrace. - # - # Inspired by the Quiet Backtrace gem by thoughtbot. - class BacktraceCleaner - def initialize - @filters, @silencers = [], [] - add_core_silencer - add_gem_filter - add_gem_silencer - add_stdlib_silencer - end - - # Returns the backtrace after all filters and silencers have been run - # against it. Filters run first, then silencers. - def clean(backtrace, kind = :silent) - filtered = filter_backtrace(backtrace) - - case kind - when :silent - silence(filtered) - when :noise - noise(filtered) - else - filtered - end - end - alias :filter :clean - - # Given an array of Thread::Backtrace::Location objects, returns an array - # with the clean ones: - # - # clean_locations = backtrace_cleaner.clean_locations(caller_locations) - # - # Filters and silencers receive strings as usual. However, the +path+ - # attributes of the locations in the returned array are the original, - # unfiltered ones, since locations are immutable. - def clean_locations(locations, kind = :silent) - locations.select { |location| clean_frame(location, kind) } - end - - # Returns the frame with all filters applied. - # returns +nil+ if the frame was silenced. - def clean_frame(frame, kind = :silent) - frame = frame.to_s - @filters.each do |f| - frame = f.call(frame.to_s) - end - - case kind - when :silent - frame unless @silencers.any? { |s| s.call(frame) } - when :noise - frame if @silencers.any? { |s| s.call(frame) } - else - frame - end - end - - # Thread.each_caller_location does not accept a start in Ruby < 3.4. - if Thread.method(:each_caller_location).arity == 0 - # Returns the first clean frame of the caller's backtrace, or +nil+. - # - # Frames are strings. - def first_clean_frame(kind = :silent) - caller_location_skipped = false - - Thread.each_caller_location do |location| - unless caller_location_skipped - caller_location_skipped = true - next - end - - frame = clean_frame(location, kind) - return frame if frame - end - end - - # Returns the first clean location of the caller's call stack, or +nil+. - # - # Locations are Thread::Backtrace::Location objects. Since they are - # immutable, their +path+ attributes are the original ones, but filters - # are applied internally so silencers can still rely on them. - def first_clean_location(kind = :silent) - caller_location_skipped = false - - Thread.each_caller_location do |location| - unless caller_location_skipped - caller_location_skipped = true - next - end - - return location if clean_frame(location, kind) - end - end - else - # Returns the first clean frame of the caller's backtrace, or +nil+. - # - # Frames are strings. - def first_clean_frame(kind = :silent) - Thread.each_caller_location(2) do |location| - frame = clean_frame(location, kind) - return frame if frame - end - end - - # Returns the first clean location of the caller's call stack, or +nil+. - # - # Locations are Thread::Backtrace::Location objects. Since they are - # immutable, their +path+ attributes are the original ones, but filters - # are applied internally so silencers can still rely on them. - def first_clean_location(kind = :silent) - Thread.each_caller_location(2) do |location| - return location if clean_frame(location, kind) - end - end - end - - # Adds a filter from the block provided. Each line in the backtrace will be - # mapped against this filter. - # - # # Will turn "/my/rails/root/app/models/person.rb" into "app/models/person.rb" - # root = "#{Rails.root}/" - # backtrace_cleaner.add_filter { |line| line.delete_prefix(root) } - def add_filter(&block) - @filters << block - end - - # Adds a silencer from the block provided. If the silencer returns +true+ - # for a given line, it will be excluded from the clean backtrace. - # - # # Will reject all lines that include the word "puma", like "/gems/puma/server.rb" or "/app/my_puma_server/rb" - # backtrace_cleaner.add_silencer { |line| /puma/.match?(line) } - def add_silencer(&block) - @silencers << block - end - - # Removes all silencers, but leaves in the filters. Useful if your - # context of debugging suddenly expands as you suspect a bug in one of - # the libraries you use. - def remove_silencers! - @silencers = [] - end - - # Removes all filters, but leaves in the silencers. Useful if you suddenly - # need to see entire filepaths in the backtrace that you had already - # filtered out. - def remove_filters! - @filters = [] - end - - private - FORMATTED_GEMS_PATTERN = /\A[^\/]+ \([\w.]+\) / - - def initialize_copy(_other) - @filters = @filters.dup - @silencers = @silencers.dup - end - - def add_gem_filter - gems_paths = (Gem.path | [Gem.default_dir]).map { |p| Regexp.escape(p) } - return if gems_paths.empty? - - gems_regexp = %r{\A(#{gems_paths.join('|')})/(bundler/)?gems/([^/]+)-([\w.]+)/(.*)} - gems_result = '\3 (\4) \5' - add_filter { |line| line.sub(gems_regexp, gems_result) } - end - - def add_core_silencer - add_silencer { |line| line.include?(" 0.10007 - # - # ActiveSupport::Benchmark.realtime(:float_millisecond) { sleep 0.1 } - # # => 100.07 - # - # `unit` can be any of the values accepted by Ruby's `Process.clock_gettime`. - def self.realtime(unit = :float_second, &block) - time_start = Process.clock_gettime(Process::CLOCK_MONOTONIC, unit) - yield - Process.clock_gettime(Process::CLOCK_MONOTONIC, unit) - time_start - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/benchmarkable.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/benchmarkable.rb deleted file mode 100644 index 8697e7c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/benchmarkable.rb +++ /dev/null @@ -1,53 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/hash/keys" - -module ActiveSupport - # = \Benchmarkable - module Benchmarkable - # Allows you to measure the execution time of a block in a template and - # records the result to the log. Wrap this block around expensive operations - # or possible bottlenecks to get a time reading for the operation. For - # example, let's say you thought your file processing method was taking too - # long; you could wrap it in a benchmark block. - # - # <% benchmark 'Process data files' do %> - # <%= expensive_files_operation %> - # <% end %> - # - # That would add something like "Process data files (345.2ms)" to the log, - # which you can then use to compare timings when optimizing your code. - # - # You may give an optional logger level (:debug, :info, - # :warn, :error) as the :level option. The - # default logger level value is :info. - # - # <% benchmark 'Low-level files', level: :debug do %> - # <%= lowlevel_files_operation %> - # <% end %> - # - # Finally, you can pass true as the third argument to silence all log - # activity (other than the timing information) from inside the block. This - # is great for boiling down a noisy block to just a single statement that - # produces one log line: - # - # <% benchmark 'Process data files', level: :info, silence: true do %> - # <%= expensive_and_chatty_files_operation %> - # <% end %> - def benchmark(message = "Benchmarking", options = {}, &block) - if logger - options.assert_valid_keys(:level, :silence) - options[:level] ||= :info - - result = nil - ms = ActiveSupport::Benchmark.realtime(:float_millisecond) do - result = options[:silence] ? logger.silence(&block) : yield - end - logger.public_send(options[:level], "%s (%.1fms)" % [ message, ms ]) - result - else - yield - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/broadcast_logger.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/broadcast_logger.rb deleted file mode 100644 index 057b42a..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/broadcast_logger.rb +++ /dev/null @@ -1,238 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # = Active Support Broadcast Logger - # - # The Broadcast logger is a logger used to write messages to multiple IO. It is commonly used - # in development to display messages on STDOUT and also write them to a file (development.log). - # With the Broadcast logger, you can broadcast your logs to a unlimited number of sinks. - # - # The BroadcastLogger acts as a standard logger and all methods you are used to are available. - # However, all the methods on this logger will propagate and be delegated to the other loggers - # that are part of the broadcast. - # - # Broadcasting your logs. - # - # stdout_logger = Logger.new(STDOUT) - # file_logger = Logger.new("development.log") - # broadcast = BroadcastLogger.new(stdout_logger, file_logger) - # - # broadcast.info("Hello world!") # Writes the log to STDOUT and the development.log file. - # - # Add a logger to the broadcast. - # - # stdout_logger = Logger.new(STDOUT) - # broadcast = BroadcastLogger.new(stdout_logger) - # file_logger = Logger.new("development.log") - # broadcast.broadcast_to(file_logger) - # - # broadcast.info("Hello world!") # Writes the log to STDOUT and the development.log file. - # - # Modifying the log level for all broadcasted loggers. - # - # stdout_logger = Logger.new(STDOUT) - # file_logger = Logger.new("development.log") - # broadcast = BroadcastLogger.new(stdout_logger, file_logger) - # - # broadcast.level = Logger::FATAL # Modify the log level for the whole broadcast. - # - # Stop broadcasting log to a sink. - # - # stdout_logger = Logger.new(STDOUT) - # file_logger = Logger.new("development.log") - # broadcast = BroadcastLogger.new(stdout_logger, file_logger) - # broadcast.info("Hello world!") # Writes the log to STDOUT and the development.log file. - # - # broadcast.stop_broadcasting_to(file_logger) - # broadcast.info("Hello world!") # Writes the log *only* to STDOUT. - # - # At least one sink has to be part of the broadcast. Otherwise, your logs will not - # be written anywhere. For instance: - # - # broadcast = BroadcastLogger.new - # broadcast.info("Hello world") # The log message will appear nowhere. - # - # If you are adding a custom logger with custom methods to the broadcast, - # the `BroadcastLogger` will proxy them and return the raw value, or an array - # of raw values, depending on how many loggers in the broadcasts responded to - # the method: - # - # class MyLogger < ::Logger - # def loggable? - # true - # end - # end - # - # logger = BroadcastLogger.new - # logger.loggable? # => A NoMethodError exception is raised because no loggers in the broadcasts could respond. - # - # logger.broadcast_to(MyLogger.new(STDOUT)) - # logger.loggable? # => true - # logger.broadcast_to(MyLogger.new(STDOUT)) - # puts logger.broadcasts # => [MyLogger, MyLogger] - # logger.loggable? # [true, true] - class BroadcastLogger - include ActiveSupport::LoggerSilence - - # Returns all the logger that are part of this broadcast. - attr_reader :broadcasts - attr_accessor :progname - - def initialize(*loggers) - @broadcasts = [] - @progname = "Broadcast" - - broadcast_to(*loggers) - end - - # Add logger(s) to the broadcast. - # - # broadcast_logger = ActiveSupport::BroadcastLogger.new - # broadcast_logger.broadcast_to(Logger.new(STDOUT), Logger.new(STDERR)) - def broadcast_to(*loggers) - @broadcasts.concat(loggers) - end - - # Remove a logger from the broadcast. When a logger is removed, messages sent to - # the broadcast will no longer be written to its sink. - # - # sink = Logger.new(STDOUT) - # broadcast_logger = ActiveSupport::BroadcastLogger.new - # - # broadcast_logger.stop_broadcasting_to(sink) - def stop_broadcasting_to(logger) - @broadcasts.delete(logger) - end - - def local_level=(level) - @broadcasts.each do |logger| - logger.local_level = level if logger.respond_to?(:local_level=) - end - end - - def local_level - loggers = @broadcasts.select { |logger| logger.respond_to?(:local_level) } - - loggers.map do |logger| - logger.local_level - end.first - end - - LOGGER_METHODS = %w[ - << log add debug info warn error fatal unknown - level= sev_threshold= close - formatter formatter= - ] # :nodoc: - LOGGER_METHODS.each do |method| - class_eval <<-RUBY, __FILE__, __LINE__ + 1 - def #{method}(...) - dispatch(:#{method}, ...) - end - RUBY - end - - # Returns the lowest level of all the loggers in the broadcast. - def level - @broadcasts.map(&:level).min - end - - # True if the log level allows entries with severity +Logger::DEBUG+ to be written - # to at least one broadcast. False otherwise. - def debug? - @broadcasts.any? { |logger| logger.debug? } - end - - # Sets the log level to +Logger::DEBUG+ for the whole broadcast. - def debug! - dispatch(:debug!) - end - - # True if the log level allows entries with severity +Logger::INFO+ to be written - # to at least one broadcast. False otherwise. - def info? - @broadcasts.any? { |logger| logger.info? } - end - - # Sets the log level to +Logger::INFO+ for the whole broadcast. - def info! - dispatch(:info!) - end - - # True if the log level allows entries with severity +Logger::WARN+ to be written - # to at least one broadcast. False otherwise. - def warn? - @broadcasts.any? { |logger| logger.warn? } - end - - # Sets the log level to +Logger::WARN+ for the whole broadcast. - def warn! - dispatch(:warn!) - end - - # True if the log level allows entries with severity +Logger::ERROR+ to be written - # to at least one broadcast. False otherwise. - def error? - @broadcasts.any? { |logger| logger.error? } - end - - # Sets the log level to +Logger::ERROR+ for the whole broadcast. - def error! - dispatch(:error!) - end - - # True if the log level allows entries with severity +Logger::FATAL+ to be written - # to at least one broadcast. False otherwise. - def fatal? - @broadcasts.any? { |logger| logger.fatal? } - end - - # Sets the log level to +Logger::FATAL+ for the whole broadcast. - def fatal! - dispatch(:fatal!) - end - - def initialize_copy(other) - @broadcasts = [] - @progname = other.progname.dup - - broadcast_to(*other.broadcasts.map(&:dup)) - end - - private - def dispatch(method, *args, **kwargs, &block) - if block_given? - # Maintain semantics that the first logger yields the block - # as normal, but subsequent loggers won't re-execute the block. - # Instead, the initial result is immediately returned. - called, result = false, nil - block = proc { |*args, **kwargs| - if called then result - else - called = true - result = yield(*args, **kwargs) - end - } - end - - @broadcasts.map { |logger| - logger.send(method, *args, **kwargs, &block) - }.first - end - - def method_missing(name, ...) - loggers = @broadcasts.select { |logger| logger.respond_to?(name) } - - if loggers.none? - super - elsif loggers.one? - loggers.first.send(name, ...) - else - loggers.map { |logger| logger.send(name, ...) } - end - end - - def respond_to_missing?(method, include_all) - @broadcasts.any? { |logger| logger.respond_to?(method, include_all) } - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/builder.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/builder.rb deleted file mode 100644 index cd49ec6..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/builder.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -begin - require "builder" -rescue LoadError => e - warn "You don't have builder installed in your application. Please add it to your Gemfile and run bundle install" - raise e -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache.rb deleted file mode 100644 index 4676f6e..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache.rb +++ /dev/null @@ -1,1170 +0,0 @@ -# frozen_string_literal: true - -require "zlib" -require "active_support/core_ext/array/extract_options" -require "active_support/core_ext/enumerable" -require "active_support/core_ext/module/attribute_accessors" -require "active_support/core_ext/numeric/bytes" -require "active_support/core_ext/object/to_param" -require "active_support/core_ext/object/try" -require "active_support/core_ext/string/inflections" -require_relative "cache/coder" -require_relative "cache/entry" -require_relative "cache/serializer_with_fallback" - -module ActiveSupport - # See ActiveSupport::Cache::Store for documentation. - module Cache - autoload :FileStore, "active_support/cache/file_store" - autoload :MemoryStore, "active_support/cache/memory_store" - autoload :MemCacheStore, "active_support/cache/mem_cache_store" - autoload :NullStore, "active_support/cache/null_store" - autoload :RedisCacheStore, "active_support/cache/redis_cache_store" - - # These options mean something to all cache implementations. Individual cache - # implementations may support additional options. - UNIVERSAL_OPTIONS = [ - :coder, - :compress, - :compress_threshold, - :compressor, - :expire_in, - :expired_in, - :expires_in, - :namespace, - :race_condition_ttl, - :serializer, - :skip_nil, - :raw, - :max_key_size, - ] - - # Mapping of canonical option names to aliases that a store will recognize. - OPTION_ALIASES = { - expires_in: [:expire_in, :expired_in] - }.freeze - - DEFAULT_COMPRESS_LIMIT = 1.kilobyte - - # Raised by coders when the cache entry can't be deserialized. - # This error is treated as a cache miss. - DeserializationError = Class.new(StandardError) - - module Strategy - autoload :LocalCache, "active_support/cache/strategy/local_cache" - end - - @format_version = 7.0 - - class << self - attr_accessor :format_version - - # Creates a new Store object according to the given options. - # - # If no arguments are passed to this method, then a new - # ActiveSupport::Cache::MemoryStore object will be returned. - # - # If you pass a Symbol as the first argument, then a corresponding cache - # store class under the ActiveSupport::Cache namespace will be created. - # For example: - # - # ActiveSupport::Cache.lookup_store(:memory_store) - # # => returns a new ActiveSupport::Cache::MemoryStore object - # - # ActiveSupport::Cache.lookup_store(:mem_cache_store) - # # => returns a new ActiveSupport::Cache::MemCacheStore object - # - # Any additional arguments will be passed to the corresponding cache store - # class's constructor: - # - # ActiveSupport::Cache.lookup_store(:file_store, '/tmp/cache') - # # => same as: ActiveSupport::Cache::FileStore.new('/tmp/cache') - # - # If the first argument is not a Symbol, then it will simply be returned: - # - # ActiveSupport::Cache.lookup_store(MyOwnCacheStore.new) - # # => returns MyOwnCacheStore.new - def lookup_store(store = nil, *parameters) - case store - when Symbol - options = parameters.extract_options! - retrieve_store_class(store).new(*parameters, **options) - when Array - lookup_store(*store) - when nil - ActiveSupport::Cache::MemoryStore.new - else - store - end - end - - # Expands out the +key+ argument into a key that can be used for the - # cache store. Optionally accepts a namespace, and all keys will be - # scoped within that namespace. - # - # If the +key+ argument provided is an array, or responds to +to_a+, then - # each of elements in the array will be turned into parameters/keys and - # concatenated into a single key. For example: - # - # ActiveSupport::Cache.expand_cache_key([:foo, :bar]) # => "foo/bar" - # ActiveSupport::Cache.expand_cache_key([:foo, :bar], "namespace") # => "namespace/foo/bar" - # - # The +key+ argument can also respond to +cache_key+ or +to_param+. - def expand_cache_key(key, namespace = nil) - expanded_cache_key = namespace ? +"#{namespace}/" : +"" - - if prefix = ENV["RAILS_CACHE_ID"] || ENV["RAILS_APP_VERSION"] - expanded_cache_key << "#{prefix}/" - end - - expanded_cache_key << retrieve_cache_key(key) - expanded_cache_key - end - - private - def retrieve_cache_key(key) - case - when key.respond_to?(:cache_key_with_version) then key.cache_key_with_version - when key.respond_to?(:cache_key) then key.cache_key - when key.is_a?(Array) then key.map { |element| retrieve_cache_key(element) }.to_param - when key.respond_to?(:to_a) then retrieve_cache_key(key.to_a) - else key.to_param - end.to_s - end - - # Obtains the specified cache store class, given the name of the +store+. - # Raises an error when the store class cannot be found. - def retrieve_store_class(store) - # require_relative cannot be used here because the class might be - # provided by another gem, like redis-activesupport for example. - require "active_support/cache/#{store}" - rescue LoadError => e - raise "Could not find cache store adapter for #{store} (#{e})" - else - ActiveSupport::Cache.const_get(store.to_s.camelize) - end - end - - # = Active Support \Cache \Store - # - # An abstract cache store class. There are multiple cache store - # implementations, each having its own additional features. See the classes - # under the ActiveSupport::Cache module, e.g. - # ActiveSupport::Cache::MemCacheStore. MemCacheStore is currently the most - # popular cache store for large production websites. - # - # Some implementations may not support all methods beyond the basic cache - # methods of #fetch, #write, #read, #exist?, and #delete. - # - # +ActiveSupport::Cache::Store+ can store any Ruby object that is supported - # by its +coder+'s +dump+ and +load+ methods. - # - # cache = ActiveSupport::Cache::MemoryStore.new - # - # cache.read('city') # => nil - # cache.write('city', "Duckburgh") # => true - # cache.read('city') # => "Duckburgh" - # - # cache.write('not serializable', Proc.new {}) # => TypeError - # - # Keys are always translated into Strings and are case sensitive. When an - # object is specified as a key and has a +cache_key+ method defined, this - # method will be called to define the key. Otherwise, the +to_param+ - # method will be called. Hashes and Arrays can also be used as keys. The - # elements will be delimited by slashes, and the elements within a Hash - # will be sorted by key so they are consistent. - # - # cache.read('city') == cache.read(:city) # => true - # - # Nil values can be cached. - # - # If your cache is on a shared infrastructure, you can define a namespace - # for your cache entries. If a namespace is defined, it will be prefixed on - # to every key. The namespace can be either a static value or a Proc. If it - # is a Proc, it will be invoked when each key is evaluated so that you can - # use application logic to invalidate keys. - # - # cache.namespace = -> { @last_mod_time } # Set the namespace to a variable - # @last_mod_time = Time.now # Invalidate the entire cache by changing namespace - # - class Store - # Default +ConnectionPool+ options - DEFAULT_POOL_OPTIONS = { size: 5, timeout: 5 }.freeze - - # Keys are truncated with the Active Support digest if they exceed the limit. - MAX_KEY_SIZE = 250 - - cattr_accessor :logger, instance_writer: true - cattr_accessor :raise_on_invalid_cache_expiration_time, default: false - - attr_reader :silence, :options - alias :silence? :silence - - class << self - private - def retrieve_pool_options(options) - if options.key?(:pool) - pool_options = options.delete(:pool) - else - pool_options = true - end - - case pool_options - when false, nil - return false - when true - pool_options = DEFAULT_POOL_OPTIONS - when Hash - pool_options[:size] = Integer(pool_options[:size]) if pool_options.key?(:size) - pool_options[:timeout] = Float(pool_options[:timeout]) if pool_options.key?(:timeout) - pool_options = DEFAULT_POOL_OPTIONS.merge(pool_options) - else - raise TypeError, "Invalid :pool argument, expected Hash, got: #{pool_options.inspect}" - end - - pool_options unless pool_options.empty? - end - end - - # Creates a new cache. - # - # ==== Options - # - # [+:namespace+] - # Sets the namespace for the cache. This option is especially useful if - # your application shares a cache with other applications. - # - # [+:serializer+] - # The serializer for cached values. Must respond to +dump+ and +load+. - # - # The default serializer depends on the cache format version (set via - # +config.active_support.cache_format_version+ when using Rails). The - # default serializer for each format version includes a fallback - # mechanism to deserialize values from any format version. This behavior - # makes it easy to migrate between format versions without invalidating - # the entire cache. - # - # You can also specify serializer: :message_pack to use a - # preconfigured serializer based on ActiveSupport::MessagePack. The - # +:message_pack+ serializer includes the same deserialization fallback - # mechanism, allowing easy migration from (or to) the default - # serializer. The +:message_pack+ serializer may improve performance, - # but it requires the +msgpack+ gem. - # - # [+:compressor+] - # The compressor for serialized cache values. Must respond to +deflate+ - # and +inflate+. - # - # The default compressor is +Zlib+. To define a new custom compressor - # that also decompresses old cache entries, you can check compressed - # values for Zlib's "\x78" signature: - # - # module MyCompressor - # def self.deflate(dumped) - # # compression logic... (make sure result does not start with "\x78"!) - # end - # - # def self.inflate(compressed) - # if compressed.start_with?("\x78") - # Zlib.inflate(compressed) - # else - # # decompression logic... - # end - # end - # end - # - # ActiveSupport::Cache.lookup_store(:redis_cache_store, compressor: MyCompressor) - # - # [+:coder+] - # The coder for serializing and (optionally) compressing cache entries. - # Must respond to +dump+ and +load+. - # - # The default coder composes the serializer and compressor, and includes - # some performance optimizations. If you only need to override the - # serializer or compressor, you should specify the +:serializer+ or - # +:compressor+ options instead. - # - # If the store can handle cache entries directly, you may also specify - # coder: nil to omit the serializer, compressor, and coder. For - # example, if you are using ActiveSupport::Cache::MemoryStore and can - # guarantee that cache values will not be mutated, you can specify - # coder: nil to avoid the overhead of safeguarding against - # mutation. - # - # The +:coder+ option is mutually exclusive with the +:serializer+ and - # +:compressor+ options. Specifying them together will raise an - # +ArgumentError+. - # - # Any other specified options are treated as default options for the - # relevant cache operations, such as #read, #write, and #fetch. - def initialize(options = nil) - @options = options ? validate_options(normalize_options(options)) : {} - - @options[:compress] = true unless @options.key?(:compress) - @options[:compress_threshold] ||= DEFAULT_COMPRESS_LIMIT - - @max_key_size = @options.delete(:max_key_size) - @max_key_size = MAX_KEY_SIZE if @max_key_size.nil? # allow 'false' as a value - - @coder = @options.delete(:coder) do - legacy_serializer = Cache.format_version < 7.1 && !@options[:serializer] - serializer = @options.delete(:serializer) || default_serializer - serializer = Cache::SerializerWithFallback[serializer] if serializer.is_a?(Symbol) - compressor = @options.delete(:compressor) { Zlib } - - Cache::Coder.new(serializer, compressor, legacy_serializer: legacy_serializer) - end - - @coder ||= Cache::SerializerWithFallback[:passthrough] - - @coder_supports_compression = @coder.respond_to?(:dump_compressed) - end - - # Silences the logger. - def silence! - @silence = true - self - end - - # Silences the logger within a block. - def mute - previous_silence, @silence = @silence, true - yield - ensure - @silence = previous_silence - end - - # Fetches data from the cache, using the given key. If there is data in - # the cache with the given key, then that data is returned. - # - # If there is no such data in the cache (a cache miss), then +nil+ will be - # returned. However, if a block has been passed, that block will be passed - # the key and executed in the event of a cache miss. The return value of the - # block will be written to the cache under the given cache key, and that - # return value will be returned. - # - # cache.write('today', 'Monday') - # cache.fetch('today') # => "Monday" - # - # cache.fetch('city') # => nil - # cache.fetch('city') do - # 'Duckburgh' - # end - # cache.fetch('city') # => "Duckburgh" - # - # ==== Options - # - # Internally, +fetch+ calls +read_entry+, and calls +write_entry+ on a - # cache miss. Thus, +fetch+ supports the same options as #read and #write. - # Additionally, +fetch+ supports the following options: - # - # * force: true - Forces a cache "miss," meaning we treat the - # cache value as missing even if it's present. Passing a block is - # required when +force+ is true so this always results in a cache write. - # - # cache.write('today', 'Monday') - # cache.fetch('today', force: true) { 'Tuesday' } # => 'Tuesday' - # cache.fetch('today', force: true) # => ArgumentError - # - # The +:force+ option is useful when you're calling some other method to - # ask whether you should force a cache write. Otherwise, it's clearer to - # just call +write+. - # - # * skip_nil: true - Prevents caching a nil result: - # - # cache.fetch('foo') { nil } - # cache.fetch('bar', skip_nil: true) { nil } - # cache.exist?('foo') # => true - # cache.exist?('bar') # => false - # - # * +:race_condition_ttl+ - Specifies the number of seconds during which - # an expired value can be reused while a new value is being generated. - # This can be used to prevent race conditions when cache entries expire, - # by preventing multiple processes from simultaneously regenerating the - # same entry (also known as the dog pile effect). - # - # When a process encounters a cache entry that has expired less than - # +:race_condition_ttl+ seconds ago, it will bump the expiration time by - # +:race_condition_ttl+ seconds before generating a new value. During - # this extended time window, while the process generates a new value, - # other processes will continue to use the old value. After the first - # process writes the new value, other processes will then use it. - # - # If the first process errors out while generating a new value, another - # process can try to generate a new value after the extended time window - # has elapsed. - # - # # Set all values to expire after one second. - # cache = ActiveSupport::Cache::MemoryStore.new(expires_in: 1) - # - # cache.write("foo", "original value") - # val_1 = nil - # val_2 = nil - # p cache.read("foo") # => "original value" - # - # sleep 1 # wait until the cache expires - # - # t1 = Thread.new do - # # fetch does the following: - # # 1. gets an recent expired entry - # # 2. extends the expiry by 2 seconds (race_condition_ttl) - # # 3. regenerates the new value - # val_1 = cache.fetch("foo", race_condition_ttl: 2) do - # sleep 1 - # "new value 1" - # end - # end - # - # # Wait until t1 extends the expiry of the entry - # # but before generating the new value - # sleep 0.1 - # - # val_2 = cache.fetch("foo", race_condition_ttl: 2) do - # # This block won't be executed because t1 extended the expiry - # "new value 2" - # end - # - # t1.join - # - # p val_1 # => "new value 1" - # p val_2 # => "original value" - # p cache.fetch("foo") # => "new value 1" - # - # # The entry requires 3 seconds to expire (expires_in + race_condition_ttl) - # # We have waited 2 seconds already (sleep(1) + t1.join) thus we need to wait 1 - # # more second to see the entry expire. - # sleep 1 - # - # p cache.fetch("foo") # => nil - # - # ==== Dynamic Options - # - # In some cases it may be necessary to dynamically compute options based - # on the cached value. To support this, an ActiveSupport::Cache::WriteOptions - # instance is passed as the second argument to the block. For example: - # - # cache.fetch("authentication-token:#{user.id}") do |key, options| - # token = authenticate_to_service - # options.expires_at = token.expires_at - # token - # end - # - def fetch(name, options = nil, &block) - if block_given? - options = merged_options(options) - key = normalize_key(name, options) - - entry = nil - unless options[:force] - instrument(:read, key, options) do |payload| - cached_entry = read_entry(key, **options, event: payload) - entry = handle_expired_entry(cached_entry, key, options) - if entry - if entry.mismatched?(normalize_version(name, options)) - entry = nil - else - begin - entry.value - rescue DeserializationError - entry = nil - end - end - end - payload[:super_operation] = :fetch if payload - payload[:hit] = !!entry if payload - end - end - - if entry - get_entry_value(entry, name, options) - else - save_block_result_to_cache(name, key, options, &block) - end - elsif options && options[:force] - raise ArgumentError, "Missing block: Calling `Cache#fetch` with `force: true` requires a block." - else - read(name, options) - end - end - - # Reads data from the cache, using the given key. If there is data in - # the cache with the given key, then that data is returned. Otherwise, - # +nil+ is returned. - # - # Note, if data was written with the :expires_in or - # :version options, both of these conditions are applied before - # the data is returned. - # - # ==== Options - # - # * +:namespace+ - Replace the store namespace for this call. - # * +:version+ - Specifies a version for the cache entry. If the cached - # version does not match the requested version, the read will be treated - # as a cache miss. This feature is used to support recyclable cache keys. - # - # Other options will be handled by the specific cache store implementation. - def read(name, options = nil) - options = merged_options(options) - key = normalize_key(name, options) - version = normalize_version(name, options) - - instrument(:read, key, options) do |payload| - entry = read_entry(key, **options, event: payload) - - if entry - if entry.expired? - delete_entry(key, **options) - payload[:hit] = false if payload - nil - elsif entry.mismatched?(version) - payload[:hit] = false if payload - nil - else - payload[:hit] = true if payload - begin - entry.value - rescue DeserializationError - payload[:hit] = false - nil - end - end - else - payload[:hit] = false if payload - nil - end - end - end - - # Reads multiple values at once from the cache. Options can be passed - # in the last argument. - # - # Some cache implementation may optimize this method. - # - # Returns a hash mapping the names provided to the values found. - def read_multi(*names) - return {} if names.empty? - - options = names.extract_options! - options = merged_options(options) - keys = names.map { |name| normalize_key(name, options) } - - instrument_multi :read_multi, keys, options do |payload| - read_multi_entries(names, **options, event: payload).tap do |results| - payload[:hits] = results.keys.map { |name| normalize_key(name, options) } - end - end - end - - # Cache Storage API to write multiple values at once. - def write_multi(hash, options = nil) - return hash if hash.empty? - - options = merged_options(options) - normalized_hash = hash.transform_keys { |key| normalize_key(key, options) } - - instrument_multi :write_multi, normalized_hash, options do |payload| - entries = hash.each_with_object({}) do |(name, value), memo| - memo[normalize_key(name, options)] = Entry.new(value, **options, version: normalize_version(name, options)) - end - - write_multi_entries entries, **options - end - end - - # Fetches data from the cache, using the given keys. If there is data in - # the cache with the given keys, then that data is returned. Otherwise, - # the supplied block is called for each key for which there was no data, - # and the result will be written to the cache and returned. - # Therefore, you need to pass a block that returns the data to be written - # to the cache. If you do not want to write the cache when the cache is - # not found, use #read_multi. - # - # Returns a hash with the data for each of the names. For example: - # - # cache.write("bim", "bam") - # cache.fetch_multi("bim", "unknown_key") do |key| - # "Fallback value for key: #{key}" - # end - # # => { "bim" => "bam", - # # "unknown_key" => "Fallback value for key: unknown_key" } - # - # You may also specify additional options via the +options+ argument. See #fetch for details. - # Other options are passed to the underlying cache implementation. For example: - # - # cache.fetch_multi("fizz", expires_in: 5.seconds) do |key| - # "buzz" - # end - # # => {"fizz"=>"buzz"} - # cache.read("fizz") - # # => "buzz" - # sleep(6) - # cache.read("fizz") - # # => nil - def fetch_multi(*names) - raise ArgumentError, "Missing block: `Cache#fetch_multi` requires a block." unless block_given? - return {} if names.empty? - - options = names.extract_options! - options = merged_options(options) - keys = names.map { |name| normalize_key(name, options) } - writes = {} - ordered = instrument_multi :read_multi, keys, options do |payload| - if options[:force] - reads = {} - else - reads = read_multi_entries(names, **options) - end - - ordered = names.index_with do |name| - reads.fetch(name) { writes[name] = yield(name) } - end - writes.compact! if options[:skip_nil] - - payload[:hits] = reads.keys.map { |name| normalize_key(name, options) } - payload[:super_operation] = :fetch_multi - - ordered - end - - write_multi(writes, options) - - ordered - end - - # Writes the value to the cache with the key. The value must be supported - # by the +coder+'s +dump+ and +load+ methods. - # - # Returns +true+ if the write succeeded, +nil+ if there was an error talking - # to the cache backend, or +false+ if the write failed for another reason. - # - # By default, cache entries larger than 1kB are compressed. Compression - # allows more data to be stored in the same memory footprint, leading to - # fewer cache evictions and higher hit rates. - # - # ==== Options - # - # * compress: false - Disables compression of the cache entry. - # - # * +:compress_threshold+ - The compression threshold, specified in bytes. - # \Cache entries larger than this threshold will be compressed. Defaults - # to +1.kilobyte+. - # - # * +:expires_in+ - Sets a relative expiration time for the cache entry, - # specified in seconds. +:expire_in+ and +:expired_in+ are aliases for - # +:expires_in+. - # - # cache = ActiveSupport::Cache::MemoryStore.new(expires_in: 5.minutes) - # cache.write(key, value, expires_in: 1.minute) # Set a lower value for one entry - # - # * +:expires_at+ - Sets an absolute expiration time for the cache entry. - # - # cache = ActiveSupport::Cache::MemoryStore.new - # cache.write(key, value, expires_at: Time.now.at_end_of_hour) - # - # * +:version+ - Specifies a version for the cache entry. When reading - # from the cache, if the cached version does not match the requested - # version, the read will be treated as a cache miss. This feature is - # used to support recyclable cache keys. - # - # * +:unless_exist+ - Prevents overwriting an existing cache entry. - # - # Other options will be handled by the specific cache store implementation. - def write(name, value, options = nil) - options = merged_options(options) - key = normalize_key(name, options) - - instrument(:write, key, options) do - entry = Entry.new(value, **options, version: normalize_version(name, options)) - write_entry(key, entry, **options) - end - end - - # Deletes an entry in the cache. Returns +true+ if an entry is deleted - # and +false+ otherwise. - # - # Options are passed to the underlying cache implementation. - def delete(name, options = nil) - options = merged_options(options) - key = normalize_key(name, options) - - instrument(:delete, key, options) do - delete_entry(key, **options) - end - end - - # Deletes multiple entries in the cache. Returns the number of deleted - # entries. - # - # Options are passed to the underlying cache implementation. - def delete_multi(names, options = nil) - return 0 if names.empty? - - options = merged_options(options) - names = names.map { |key| normalize_key(key, options) } - - instrument_multi(:delete_multi, names, options) do - delete_multi_entries(names, **options) - end - end - - # Returns +true+ if the cache contains an entry for the given key. - # - # Options are passed to the underlying cache implementation. - def exist?(name, options = nil) - options = merged_options(options) - key = normalize_key(name, options) - - instrument(:exist?, key) do |payload| - entry = read_entry(key, **options, event: payload) - (entry && !entry.expired? && !entry.mismatched?(normalize_version(name, options))) || false - end - end - - def new_entry(value, options = nil) # :nodoc: - Entry.new(value, **merged_options(options)) - end - - # Deletes all entries with keys matching the pattern. - # - # Options are passed to the underlying cache implementation. - # - # Some implementations may not support this method. - def delete_matched(matcher, options = nil) - raise NotImplementedError.new("#{self.class.name} does not support delete_matched") - end - - # Increments an integer value in the cache. - # - # Options are passed to the underlying cache implementation. - # - # Some implementations may not support this method. - def increment(name, amount = 1, options = nil) - raise NotImplementedError.new("#{self.class.name} does not support increment") - end - - # Decrements an integer value in the cache. - # - # Options are passed to the underlying cache implementation. - # - # Some implementations may not support this method. - def decrement(name, amount = 1, options = nil) - raise NotImplementedError.new("#{self.class.name} does not support decrement") - end - - # Reads a counter that was set by #increment / #decrement. - # - # cache.write_counter("foo", 1) - # cache.read_counter("foo") # => 1 - # cache.increment("foo") - # cache.read_counter("foo") # => 2 - # - # Options are passed to the underlying cache implementation. - def read_counter(name, **options) - options = merged_options(options).merge(raw: true) - read(name, **options)&.to_i - end - - # Writes a counter that can then be modified by #increment / #decrement. - # - # cache.write_counter("foo", 1) - # cache.read_counter("foo") # => 1 - # cache.increment("foo") - # cache.read_counter("foo") # => 2 - # - # Options are passed to the underlying cache implementation. - def write_counter(name, value, **options) - options = merged_options(options).merge(raw: true) - write(name, value.to_i, **options) - end - - # Cleans up the cache by removing expired entries. - # - # Options are passed to the underlying cache implementation. - # - # Some implementations may not support this method. - def cleanup(options = nil) - raise NotImplementedError.new("#{self.class.name} does not support cleanup") - end - - # Clears the entire cache. Be careful with this method since it could - # affect other processes if shared cache is being used. - # - # The options hash is passed to the underlying cache implementation. - # - # Some implementations may not support this method. - def clear(options = nil) - raise NotImplementedError.new("#{self.class.name} does not support clear") - end - - # Get the current namespace - def namespace - @options[:namespace] - end - - # Set the current namespace. Note, this will be ignored if custom - # options are passed to cache wills with a namespace key. - def namespace=(namespace) - @options[:namespace] = namespace - end - - private - def default_serializer - case Cache.format_version - when 7.0 - Cache::SerializerWithFallback[:marshal_7_0] - when 7.1 - Cache::SerializerWithFallback[:marshal_7_1] - else - raise ArgumentError, "Unrecognized ActiveSupport::Cache.format_version: #{Cache.format_version.inspect}" - end - end - - # Adds the namespace defined in the options to a pattern designed to - # match keys. Implementations that support delete_matched should call - # this method to translate a pattern that matches names into one that - # matches namespaced keys. - def key_matcher(pattern, options) # :doc: - prefix = options[:namespace].is_a?(Proc) ? options[:namespace].call : options[:namespace] - if prefix - source = pattern.source - if source.start_with?("^") - source = source[1, source.length] - else - source = ".*#{source[0, source.length]}" - end - Regexp.new("^#{Regexp.escape(prefix)}:#{source}", pattern.options) - else - pattern - end - end - - # Reads an entry from the cache implementation. Subclasses must implement - # this method. - def read_entry(key, **options) - raise NotImplementedError.new - end - - # Writes an entry to the cache implementation. Subclasses must implement - # this method. - def write_entry(key, entry, **options) - raise NotImplementedError.new - end - - def serialize_entry(entry, **options) - options = merged_options(options) - if @coder_supports_compression && options[:compress] - @coder.dump_compressed(entry, options[:compress_threshold]) - else - @coder.dump(entry) - end - end - - def deserialize_entry(payload, **) - payload.nil? ? nil : @coder.load(payload) - rescue DeserializationError - nil - end - - # Reads multiple entries from the cache implementation. Subclasses MAY - # implement this method. - def read_multi_entries(names, **options) - names.each_with_object({}) do |name, results| - key = normalize_key(name, options) - entry = read_entry(key, **options) - - next unless entry - - version = normalize_version(name, options) - - if entry.expired? - delete_entry(key, **options) - elsif !entry.mismatched?(version) - results[name] = entry.value - end - end - end - - # Writes multiple entries to the cache implementation. Subclasses MAY - # implement this method. - def write_multi_entries(hash, **options) - hash.each do |key, entry| - write_entry key, entry, **options - end - end - - # Deletes an entry from the cache implementation. Subclasses must - # implement this method. - def delete_entry(key, **options) - raise NotImplementedError.new - end - - # Deletes multiples entries in the cache implementation. Subclasses MAY - # implement this method. - def delete_multi_entries(entries, **options) - entries.count { |key| delete_entry(key, **options) } - end - - # Merges the default options with ones specific to a method call. - def merged_options(call_options) - if call_options - call_options = normalize_options(call_options) - if call_options.key?(:expires_in) && call_options.key?(:expires_at) - raise ArgumentError, "Either :expires_in or :expires_at can be supplied, but not both" - end - - expires_at = call_options.delete(:expires_at) - call_options[:expires_in] = (expires_at - Time.now) if expires_at - - if call_options[:expires_in].is_a?(Time) - expires_in = call_options[:expires_in] - raise ArgumentError.new("expires_in parameter should not be a Time. Did you mean to use expires_at? Got: #{expires_in}") - end - if call_options[:expires_in]&.negative? - expires_in = call_options.delete(:expires_in) - handle_invalid_expires_in("Cache expiration time is invalid, cannot be negative: #{expires_in}") - end - - if options.empty? - call_options - else - options.merge(call_options) - end - else - options - end - end - - def handle_invalid_expires_in(message) - error = ArgumentError.new(message) - if ActiveSupport::Cache::Store.raise_on_invalid_cache_expiration_time - raise error - else - ActiveSupport.error_reporter&.report(error, handled: true, severity: :warning) - logger.error("#{error.class}: #{error.message}") if logger - end - end - - # Normalize aliased options to their canonical form - def normalize_options(options) - options = options.dup - OPTION_ALIASES.each do |canonical_name, aliases| - alias_key = aliases.detect { |key| options.key?(key) } - options[canonical_name] ||= options[alias_key] if alias_key - options.except!(*aliases) - end - - options - end - - def validate_options(options) - if options.key?(:coder) && options[:serializer] - raise ArgumentError, "Cannot specify :serializer and :coder options together" - end - - if options.key?(:coder) && options[:compressor] - raise ArgumentError, "Cannot specify :compressor and :coder options together" - end - - if Cache.format_version < 7.1 && !options[:serializer] && options[:compressor] - raise ArgumentError, "Cannot specify :compressor option when using" \ - " default serializer and cache format version is < 7.1" - end - - options - end - - # Expands, namespaces and truncates the cache key. - # Raises an exception when the key is +nil+ or an empty string. - # May be overridden by cache stores to do additional normalization. - def normalize_key(key, options = nil) - key = expand_and_namespace_key(key, options) - truncate_key(key) - end - - def expand_and_namespace_key(key, options = nil) - str_key = expanded_key(key) - raise(ArgumentError, "key cannot be blank") if !str_key || str_key.empty? - - namespace_key str_key, options - end - - def truncate_key(key) - if key && @max_key_size && key.bytesize > @max_key_size - suffix = ":hash:#{ActiveSupport::Digest.hexdigest(key)}" - truncate_at = @max_key_size - suffix.bytesize - key = key.byteslice(0, truncate_at) - key.scrub!("") - "#{key}#{suffix}" - else - key - end - end - - # Prefix the key with a namespace string: - # - # namespace_key 'foo', namespace: 'cache' - # # => 'cache:foo' - # - # With a namespace block: - # - # namespace_key 'foo', namespace: -> { 'cache' } - # # => 'cache:foo' - def namespace_key(key, call_options = nil) - namespace = if call_options&.key?(:namespace) - call_options[:namespace] - else - options[:namespace] - end - - if namespace.respond_to?(:call) - namespace = namespace.call - end - - if key && key.encoding != Encoding::UTF_8 - key = key.dup.force_encoding(Encoding::UTF_8) - end - - if namespace - "#{namespace}:#{key}" - else - key - end - end - - # Expands key to be a consistent string value. Invokes +cache_key+ if - # object responds to +cache_key+. Otherwise, +to_param+ method will be - # called. If the key is a Hash, then keys will be sorted alphabetically. - def expanded_key(key) - return key.cache_key.to_s if key.respond_to?(:cache_key) - - case key - when Array - if key.size > 1 - key.collect { |element| expanded_key(element) } - else - expanded_key(key.first) - end - when Hash - key.collect { |k, v| "#{k}=#{v}" }.sort! - else - key - end.to_param - end - - def normalize_version(key, options = nil) - (options && options[:version].try(:to_param)) || expanded_version(key) - end - - def expanded_version(key) - case - when key.respond_to?(:cache_version) then key.cache_version.to_param - when key.is_a?(Array) then key.map { |element| expanded_version(element) }.tap(&:compact!).to_param - when key.respond_to?(:to_a) then expanded_version(key.to_a) - end - end - - def instrument(operation, key, options = nil, &block) - _instrument(operation, key: key, options: options, &block) - end - - def instrument_multi(operation, keys, options = nil, &block) - _instrument(operation, multi: true, key: keys, options: options, &block) - end - - def _instrument(operation, multi: false, options: nil, **payload, &block) - if logger && logger.debug? && !silence? - debug_key = - if multi - ": #{payload[:key].size} key(s) specified" - elsif payload[:key] - ": #{payload[:key]}" - end - - debug_options = " (#{options.inspect})" unless options.blank? - - logger.debug "Cache #{operation}#{debug_key}#{debug_options}" - end - - payload[:store] = self.class.name - payload.merge!(options) if options.is_a?(Hash) - ActiveSupport::Notifications.instrument("cache_#{operation}.active_support", payload) do - block&.call(payload) - end - end - - def handle_expired_entry(entry, key, options) - if entry && entry.expired? - race_ttl = options[:race_condition_ttl].to_i - if (race_ttl > 0) && (Time.now.to_f - entry.expires_at <= race_ttl) - # When an entry has a positive :race_condition_ttl defined, put the stale entry back into the cache - # for a brief period while the entry is being recalculated. - entry.expires_at = Time.now.to_f + race_ttl - write_entry(key, entry, **options, expires_in: race_ttl * 2) - else - delete_entry(key, **options) - end - entry = nil - end - entry - end - - def get_entry_value(entry, name, options) - instrument(:fetch_hit, name, options) - entry.value - end - - def save_block_result_to_cache(name, key, options) - options = options.dup - - result = instrument(:generate, key, options) do - yield(name, WriteOptions.new(options)) - end - - write(name, result, options) unless result.nil? && options[:skip_nil] - result - end - end - - # Enables the dynamic configuration of Cache entry options while ensuring - # that conflicting options are not both set. When a block is given to - # ActiveSupport::Cache::Store#fetch, the second argument will be an - # instance of +WriteOptions+. - class WriteOptions - def initialize(options) # :nodoc: - @options = options - end - - def version - @options[:version] - end - - def version=(version) - @options[:version] = version - end - - def expires_in - @options[:expires_in] - end - - # Sets the Cache entry's +expires_in+ value. If an +expires_at+ option was - # previously set, this will unset it since +expires_in+ and +expires_at+ - # cannot both be set. - def expires_in=(expires_in) - @options.delete(:expires_at) - @options[:expires_in] = expires_in - end - - def expires_at - @options[:expires_at] - end - - # Sets the Cache entry's +expires_at+ value. If an +expires_in+ option was - # previously set, this will unset it since +expires_at+ and +expires_in+ - # cannot both be set. - def expires_at=(expires_at) - @options.delete(:expires_in) - @options[:expires_at] = expires_at - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/coder.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/coder.rb deleted file mode 100644 index b21d07d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/coder.rb +++ /dev/null @@ -1,153 +0,0 @@ -# frozen_string_literal: true - -require_relative "entry" - -module ActiveSupport - module Cache - class Coder # :nodoc: - def initialize(serializer, compressor, legacy_serializer: false) - @serializer = serializer - @compressor = compressor - @legacy_serializer = legacy_serializer - end - - def dump(entry) - return @serializer.dump(entry) if @legacy_serializer - - dump_compressed(entry, Float::INFINITY) - end - - def dump_compressed(entry, threshold) - return @serializer.dump_compressed(entry, threshold) if @legacy_serializer - - # If value is a string with a supported encoding, use it as the payload - # instead of passing it through the serializer. - if type = type_for_string(entry.value) - payload = entry.value.b - else - type = OBJECT_DUMP_TYPE - payload = @serializer.dump(entry.value) - end - - if compressed = try_compress(payload, threshold) - payload = compressed - type = type | COMPRESSED_FLAG - end - - expires_at = entry.expires_at || -1.0 - - version = dump_version(entry.version) if entry.version - version_length = version&.bytesize || -1 - - packed = SIGNATURE.b - packed << [type, expires_at, version_length].pack(PACKED_TEMPLATE) - packed << version if version - packed << payload - end - - def load(dumped) - return @serializer.load(dumped) if !signature?(dumped) - - type = dumped.unpack1(PACKED_TYPE_TEMPLATE) - expires_at = dumped.unpack1(PACKED_EXPIRES_AT_TEMPLATE) - version_length = dumped.unpack1(PACKED_VERSION_LENGTH_TEMPLATE) - - expires_at = nil if expires_at < 0 - version = load_version(dumped.byteslice(PACKED_VERSION_INDEX, version_length)) if version_length >= 0 - payload = dumped.byteslice((PACKED_VERSION_INDEX + [version_length, 0].max)..) - - compressor = @compressor if type & COMPRESSED_FLAG > 0 - serializer = STRING_DESERIALIZERS[type & ~COMPRESSED_FLAG] || @serializer - - LazyEntry.new(serializer, compressor, payload, version: version, expires_at: expires_at) - end - - private - SIGNATURE = "\x00\x11".b.freeze - - OBJECT_DUMP_TYPE = 0x01 - - STRING_ENCODINGS = { - 0x02 => Encoding::UTF_8, - 0x03 => Encoding::BINARY, - 0x04 => Encoding::US_ASCII, - } - - COMPRESSED_FLAG = 0x80 - - PACKED_TEMPLATE = "CEl<" - PACKED_TYPE_TEMPLATE = "@#{SIGNATURE.bytesize}C" - PACKED_EXPIRES_AT_TEMPLATE = "@#{[0].pack(PACKED_TYPE_TEMPLATE).bytesize}E" - PACKED_VERSION_LENGTH_TEMPLATE = "@#{[0].pack(PACKED_EXPIRES_AT_TEMPLATE).bytesize}l<" - PACKED_VERSION_INDEX = [0].pack(PACKED_VERSION_LENGTH_TEMPLATE).bytesize - - MARSHAL_SIGNATURE = "\x04\x08".b.freeze - - class StringDeserializer - def initialize(encoding) - @encoding = encoding - end - - def load(payload) - payload.force_encoding(@encoding) - end - end - - STRING_DESERIALIZERS = STRING_ENCODINGS.transform_values { |encoding| StringDeserializer.new(encoding) } - - class LazyEntry < Cache::Entry - def initialize(serializer, compressor, payload, **options) - super(payload, **options) - @serializer = serializer - @compressor = compressor - @resolved = false - end - - def value - if !@resolved - @value = @serializer.load(@compressor ? @compressor.inflate(@value) : @value) - @resolved = true - end - @value - end - - def mismatched?(version) - super.tap { |mismatched| value if !mismatched } - rescue Cache::DeserializationError - true - end - end - - def signature?(dumped) - dumped.is_a?(String) && dumped.start_with?(SIGNATURE) - end - - def type_for_string(value) - STRING_ENCODINGS.key(value.encoding) if value.instance_of?(String) - end - - def try_compress(string, threshold) - if @compressor && string.bytesize >= threshold - compressed = @compressor.deflate(string) - compressed if compressed.bytesize < string.bytesize - end - end - - def dump_version(version) - if version.encoding != Encoding::UTF_8 || version.start_with?(MARSHAL_SIGNATURE) - Marshal.dump(version) - else - version.b - end - end - - def load_version(dumped_version) - if dumped_version.start_with?(MARSHAL_SIGNATURE) - Marshal.load(dumped_version) - else - dumped_version.force_encoding(Encoding::UTF_8) - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/entry.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/entry.rb deleted file mode 100644 index 99318d8..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/entry.rb +++ /dev/null @@ -1,134 +0,0 @@ -# frozen_string_literal: true - -require "zlib" - -module ActiveSupport - module Cache - # This class is used to represent cache entries. Cache entries have a value, an optional - # expiration time, and an optional version. The expiration time is used to support the :race_condition_ttl option - # on the cache. The version is used to support the :version option on the cache for rejecting - # mismatches. - # - # Since cache entries in most instances will be serialized, the internals of this class are highly optimized - # using short instance variable names that are lazily defined. - class Entry # :nodoc: - class << self - def unpack(members) - new(members[0], expires_at: members[1], version: members[2]) - end - end - - attr_reader :version - - # Creates a new cache entry for the specified value. Options supported are - # +:compressed+, +:version+, +:expires_at+ and +:expires_in+. - def initialize(value, compressed: false, version: nil, expires_in: nil, expires_at: nil, **) - @value = value - @version = version - @created_at = 0.0 - @expires_in = expires_at&.to_f || expires_in && (expires_in.to_f + Time.now.to_f) - @compressed = true if compressed - end - - def value - compressed? ? uncompress(@value) : @value - end - - def mismatched?(version) - @version && version && @version != version - end - - # Checks if the entry is expired. The +expires_in+ parameter can override - # the value set when the entry was created. - def expired? - @expires_in && @created_at + @expires_in <= Time.now.to_f - end - - def expires_at - @expires_in ? @created_at + @expires_in : nil - end - - def expires_at=(value) - if value - @expires_in = value.to_f - @created_at - else - @expires_in = nil - end - end - - # Returns the size of the cached value. This could be less than - # value.bytesize if the data is compressed. - def bytesize - case value - when NilClass - 0 - when String - @value.bytesize - else - @s ||= Marshal.dump(@value).bytesize - end - end - - def compressed? # :nodoc: - defined?(@compressed) - end - - def compressed(compress_threshold) - return self if compressed? - - case @value - when nil, true, false, Numeric - uncompressed_size = 0 - when String - uncompressed_size = @value.bytesize - else - serialized = Marshal.dump(@value) - uncompressed_size = serialized.bytesize - end - - if uncompressed_size >= compress_threshold - serialized ||= Marshal.dump(@value) - compressed = Zlib::Deflate.deflate(serialized) - - if compressed.bytesize < uncompressed_size - return Entry.new(compressed, compressed: true, expires_at: expires_at, version: version) - end - end - self - end - - def local? - false - end - - # Duplicates the value in a class. This is used by cache implementations that don't natively - # serialize entries to protect against accidental cache modifications. - def dup_value! - if @value && !compressed? && !(@value.is_a?(Numeric) || @value == true || @value == false) - if @value.is_a?(String) - @value = @value.dup - else - @value = Marshal.load(Marshal.dump(@value)) - end - end - end - - def pack - members = [value, expires_at, version] - members.pop while !members.empty? && members.last.nil? - members - end - - private - def uncompress(value) - marshal_load(Zlib::Inflate.inflate(value)) - end - - def marshal_load(payload) - Marshal.load(payload) - rescue ArgumentError => error - raise Cache::DeserializationError, error.message - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/file_store.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/file_store.rb deleted file mode 100644 index 50d78ed..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/file_store.rb +++ /dev/null @@ -1,245 +0,0 @@ -# frozen_string_literal: true - -require "fileutils" -require "active_support/core_ext/file/atomic" -require "active_support/core_ext/string/conversions" -require "uri/common" - -module ActiveSupport - module Cache - # = \File \Cache \Store - # - # A cache store implementation which stores everything on the filesystem. - class FileStore < Store - attr_reader :cache_path - - DIR_FORMATTER = "%03X" - FILENAME_MAX_SIZE = 226 # max filename size on file system is 255, minus room for timestamp, pid, and random characters appended by Tempfile (used by atomic write) - FILEPATH_MAX_SIZE = 900 # max is 1024, plus some room - GITKEEP_FILES = [".gitkeep", ".keep"].freeze - - def initialize(cache_path, **options) - super(options) - @cache_path = cache_path.to_s - end - - # Advertise cache versioning support. - def self.supports_cache_versioning? - true - end - - # Deletes all items from the cache. In this case it deletes all the entries in the specified - # file store directory except for .keep or .gitkeep. Be careful which directory is specified in your - # config file when using +FileStore+ because everything in that directory will be deleted. - def clear(options = nil) - root_dirs = (Dir.children(cache_path) - GITKEEP_FILES) - FileUtils.rm_r(root_dirs.collect { |f| File.join(cache_path, f) }) - rescue Errno::ENOENT, Errno::ENOTEMPTY - end - - # Preemptively iterates through all stored keys and removes the ones which have expired. - def cleanup(options = nil) - options = merged_options(options) - search_dir(cache_path) do |fname| - entry = read_entry(fname, **options) - delete_entry(fname, **options) if entry && entry.expired? - end - end - - # Increment a cached integer value. Returns the updated value. - # - # If the key is unset, it starts from +0+: - # - # cache.increment("foo") # => 1 - # cache.increment("bar", 100) # => 100 - # - # To set a specific value, call #write: - # - # cache.write("baz", 5) - # cache.increment("baz") # => 6 - # - def increment(name, amount = 1, **options) - options = merged_options(options) - key = normalize_key(name, options) - - instrument(:increment, key, amount: amount) do - modify_value(name, amount, options) - end - end - - # Decrement a cached integer value. Returns the updated value. - # - # If the key is unset, it will be set to +-amount+. - # - # cache.decrement("foo") # => -1 - # - # To set a specific value, call #write: - # - # cache.write("baz", 5) - # cache.decrement("baz") # => 4 - # - def decrement(name, amount = 1, **options) - options = merged_options(options) - key = normalize_key(name, options) - - instrument(:decrement, key, amount: amount) do - modify_value(name, -amount, options) - end - end - - def delete_matched(matcher, options = nil) - options = merged_options(options) - matcher = key_matcher(matcher, options) - - instrument(:delete_matched, matcher.inspect) do - search_dir(cache_path) do |path| - key = file_path_key(path) - delete_entry(path, **options) if key.match(matcher) - end - end - end - - def inspect # :nodoc: - "#<#{self.class.name} cache_path=#{@cache_path}, options=#{@options.inspect}>" - end - - private - def read_entry(key, **options) - if payload = read_serialized_entry(key, **options) - entry = deserialize_entry(payload) - entry if entry.is_a?(Cache::Entry) - end - end - - def read_serialized_entry(key, **) - File.binread(key) if File.exist?(key) - rescue => error - logger.error("FileStoreError (#{error}): #{error.message}") if logger - nil - end - - def write_entry(key, entry, **options) - write_serialized_entry(key, serialize_entry(entry, **options), **options) - end - - def write_serialized_entry(key, payload, **options) - return false if options[:unless_exist] && File.exist?(key) - ensure_cache_path(File.dirname(key)) - File.atomic_write(key, cache_path) { |f| f.write(payload) } - true - end - - def delete_entry(key, **options) - if File.exist?(key) - begin - File.delete(key) - delete_empty_directories(File.dirname(key)) - true - rescue - # Just in case the error was caused by another process deleting the file first. - raise if File.exist?(key) - false - end - else - false - end - end - - # Lock a file for a block so only one process can modify it at a time. - def lock_file(file_name, &block) - if File.exist?(file_name) - File.open(file_name, "r+") do |f| - f.flock File::LOCK_EX - yield - ensure - f.flock File::LOCK_UN - end - else - yield - end - end - - # Translate a key into a file path. - def normalize_key(key, options) - key = super - fname = URI.encode_www_form_component(key) - - if fname.size > FILEPATH_MAX_SIZE - fname = ActiveSupport::Digest.hexdigest(key) - end - - hash = Zlib.adler32(fname) - hash, dir_1 = hash.divmod(0x1000) - dir_2 = hash.modulo(0x1000) - - # Make sure file name doesn't exceed file system limits. - if fname.length < FILENAME_MAX_SIZE - fname_paths = fname - else - fname_paths = [] - begin - fname_paths << fname[0, FILENAME_MAX_SIZE] - fname = fname[FILENAME_MAX_SIZE..-1] - end until fname.blank? - end - - File.join(cache_path, DIR_FORMATTER % dir_1, DIR_FORMATTER % dir_2, fname_paths) - end - - # Translate a file path into a key. - def file_path_key(path) - fname = path[cache_path.to_s.size..-1].split(File::SEPARATOR, 4).last.delete(File::SEPARATOR) - URI.decode_www_form_component(fname, Encoding::UTF_8) - end - - # Delete empty directories in the cache. - def delete_empty_directories(dir) - return if File.realpath(dir) == File.realpath(cache_path) - if Dir.children(dir).empty? - Dir.delete(dir) rescue nil - delete_empty_directories(File.dirname(dir)) - end - end - - # Make sure a file path's directories exist. - def ensure_cache_path(path) - FileUtils.makedirs(path) unless File.exist?(path) - end - - def search_dir(dir, &callback) - return if !File.exist?(dir) - Dir.each_child(dir) do |d| - name = File.join(dir, d) - if File.directory?(name) - search_dir(name, &callback) - else - callback.call name - end - end - end - - # Modifies the amount of an integer value that is stored in the cache. - # If the key is not found it is created and set to +amount+. - def modify_value(name, amount, options) - options = merged_options(options) - key = normalize_key(name, options) - version = normalize_version(name, options) - amount = Integer(amount) - - lock_file(key) do - entry = read_entry(key, **options) - - if !entry || entry.expired? || entry.mismatched?(version) - write(name, amount, options) - amount - else - num = entry.value.to_i + amount - entry = Entry.new(num, expires_at: entry.expires_at, version: entry.version) - write_entry(key, entry) - num - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/mem_cache_store.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/mem_cache_store.rb deleted file mode 100644 index 2f187f6..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/mem_cache_store.rb +++ /dev/null @@ -1,291 +0,0 @@ -# frozen_string_literal: true - -begin - require "dalli" -rescue LoadError => e - warn "You don't have dalli installed in your application. Please add it to your Gemfile and run bundle install" - raise e -end - -require "connection_pool" -require "delegate" -require "active_support/core_ext/enumerable" -require "active_support/core_ext/array/extract_options" -require "active_support/core_ext/numeric/time" - -module ActiveSupport - module Cache - # = Memcached \Cache \Store - # - # A cache store implementation which stores data in Memcached: - # https://memcached.org - # - # This is currently the most popular cache store for production websites. - # - # Special features: - # - Clustering and load balancing. One can specify multiple memcached servers, - # and +MemCacheStore+ will load balance between all available servers. If a - # server goes down, then +MemCacheStore+ will ignore it until it comes back up. - # - # +MemCacheStore+ implements the Strategy::LocalCache strategy which - # implements an in-memory cache inside of a block. - class MemCacheStore < Store - # These options represent behavior overridden by this implementation and should - # not be allowed to get down to the Dalli client - OVERRIDDEN_OPTIONS = UNIVERSAL_OPTIONS - - # Advertise cache versioning support. - def self.supports_cache_versioning? - true - end - - prepend Strategy::LocalCache - - ESCAPE_KEY_CHARS = /[\x00-\x20%\x7F-\xFF]/n - - # Creates a new Dalli::Client instance with specified addresses and options. - # If no addresses are provided, we give nil to Dalli::Client, so it uses its fallbacks: - # - ENV["MEMCACHE_SERVERS"] (if defined) - # - "127.0.0.1:11211" (otherwise) - # - # ActiveSupport::Cache::MemCacheStore.build_mem_cache - # # => # - # ActiveSupport::Cache::MemCacheStore.build_mem_cache('localhost:10290') - # # => # - def self.build_mem_cache(*addresses) # :nodoc: - addresses = addresses.flatten - options = addresses.extract_options! - addresses = nil if addresses.compact.empty? - pool_options = retrieve_pool_options(options) - - if pool_options - ConnectionPool.new(**pool_options) { Dalli::Client.new(addresses, options.merge(threadsafe: false)) } - else - Dalli::Client.new(addresses, options) - end - end - - # Creates a new +MemCacheStore+ object, with the given memcached server - # addresses. Each address is either a host name, or a host-with-port string - # in the form of "host_name:port". For example: - # - # ActiveSupport::Cache::MemCacheStore.new("localhost", "server-downstairs.localnetwork:8229") - # - # If no addresses are provided, but ENV['MEMCACHE_SERVERS'] is defined, it will be used instead. Otherwise, - # +MemCacheStore+ will connect to localhost:11211 (the default memcached port). - def initialize(*addresses) - addresses = addresses.flatten - options = addresses.extract_options! - if options.key?(:cache_nils) - options[:skip_nil] = !options.delete(:cache_nils) - end - options[:max_key_size] ||= MAX_KEY_SIZE - super(options) - - unless [String, Dalli::Client, NilClass].include?(addresses.first.class) - raise ArgumentError, "First argument must be an empty array, address, or array of addresses." - end - - @mem_cache_options = options.dup - # The value "compress: false" prevents duplicate compression within Dalli. - @mem_cache_options[:compress] = false - (OVERRIDDEN_OPTIONS - %i(compress)).each { |name| @mem_cache_options.delete(name) } - # Set the default serializer for Dalli to prevent warning about - # inheriting the default serializer. - @mem_cache_options[:serializer] = Marshal - @data = self.class.build_mem_cache(*(addresses + [@mem_cache_options])) - end - - def inspect - instance = @data || @mem_cache_options - "#<#{self.class} options=#{options.inspect} mem_cache=#{instance.inspect}>" - end - - ## - # :method: write - # :call-seq: write(name, value, options = nil) - # - # Behaves the same as ActiveSupport::Cache::Store#write, but supports - # additional options specific to memcached. - # - # ==== Additional Options - # - # * raw: true - Sends the value directly to the server as raw - # bytes. The value must be a string or number. You can use memcached - # direct operations like +increment+ and +decrement+ only on raw values. - - # Increment a cached integer value using the memcached incr atomic operator. - # Returns the updated value. - # - # If the key is unset or has expired, it will be set to +amount+: - # - # cache.increment("foo") # => 1 - # cache.increment("bar", 100) # => 100 - # - # To set a specific value, call #write passing raw: true: - # - # cache.write("baz", 5, raw: true) - # cache.increment("baz") # => 6 - # - # Incrementing a non-numeric value, or a value written without - # raw: true, will fail and return +nil+. - # - # To read the value later, call #read_counter: - # - # cache.increment("baz") # => 7 - # cache.read_counter("baz") # 7 - def increment(name, amount = 1, options = nil) - options = merged_options(options) - key = normalize_key(name, options) - - instrument(:increment, key, amount: amount) do - rescue_error_with nil do - @data.with { |c| c.incr(key, amount, options[:expires_in], amount) } - end - end - end - - # Decrement a cached integer value using the memcached decr atomic operator. - # Returns the updated value. - # - # If the key is unset or has expired, it will be set to 0. Memcached - # does not support negative counters. - # - # cache.decrement("foo") # => 0 - # - # To set a specific value, call #write passing raw: true: - # - # cache.write("baz", 5, raw: true) - # cache.decrement("baz") # => 4 - # - # Decrementing a non-numeric value, or a value written without - # raw: true, will fail and return +nil+. - # - # To read the value later, call #read_counter: - # - # cache.decrement("baz") # => 3 - # cache.read_counter("baz") # 3 - def decrement(name, amount = 1, options = nil) - options = merged_options(options) - key = normalize_key(name, options) - - instrument(:decrement, key, amount: amount) do - rescue_error_with nil do - @data.with { |c| c.decr(key, amount, options[:expires_in], 0) } - end - end - end - - # Clear the entire cache on all memcached servers. This method should - # be used with care when shared cache is being used. - def clear(options = nil) - rescue_error_with(nil) { @data.with { |c| c.flush_all } } - end - - # Get the statistics from the memcached servers. - def stats - @data.with { |c| c.stats } - end - - private - # Read an entry from the cache. - def read_entry(key, **options) - deserialize_entry(read_serialized_entry(key, **options), **options) - end - - def read_serialized_entry(key, **options) - rescue_error_with(nil) do - @data.with { |c| c.get(key, options) } - end - end - - # Write an entry to the cache. - def write_entry(key, entry, **options) - write_serialized_entry(key, serialize_entry(entry, **options), **options) - end - - def write_serialized_entry(key, payload, **options) - method = options[:unless_exist] ? :add : :set - expires_in = options[:expires_in].to_i - if options[:race_condition_ttl] && expires_in > 0 && !options[:raw] - # Set the memcache expire a few minutes in the future to support race condition ttls on read - expires_in += 5.minutes - end - rescue_error_with nil do - # Don't pass compress option to Dalli since we are already dealing with compression. - options.delete(:compress) - @data.with { |c| !!c.send(method, key, payload, expires_in, **options) } - end - end - - # Reads multiple entries from the cache implementation. - def read_multi_entries(names, **options) - keys_to_names = names.index_by { |name| normalize_key(name, options) } - - rescue_error_with({}) do - raw_values = @data.with { |c| c.get_multi(keys_to_names.keys) } - - values = {} - - raw_values.each do |key, value| - entry = deserialize_entry(value, raw: options[:raw]) - - unless entry.nil? || entry.expired? || entry.mismatched?(normalize_version(keys_to_names[key], options)) - begin - values[keys_to_names[key]] = entry.value - rescue DeserializationError - end - end - end - - values - end - end - - # Delete an entry from the cache. - def delete_entry(key, **options) - rescue_error_with(false) { @data.with { |c| c.delete(key) } } - end - - def serialize_entry(entry, raw: false, **options) - if raw - entry.value.to_s - else - super(entry, raw: raw, **options) - end - end - - # Memcache keys are binaries. So we need to force their encoding to binary - # before applying the regular expression to ensure we are escaping all - # characters properly. - def normalize_key(key, options) - key = expand_and_namespace_key(key, options) - if key - key = key.dup.force_encoding(Encoding::ASCII_8BIT) - key = key.gsub(ESCAPE_KEY_CHARS) { |match| "%#{match.getbyte(0).to_s(16).upcase}" } - end - truncate_key(key) - end - - def deserialize_entry(payload, raw: false, **) - if payload && raw - Entry.new(payload) - else - super(payload) - end - end - - def rescue_error_with(fallback) - yield - rescue Dalli::DalliError, ConnectionPool::Error, ConnectionPool::TimeoutError => error - logger.error("DalliError (#{error}): #{error.message}") if logger - ActiveSupport.error_reporter&.report( - error, - severity: :warning, - source: "mem_cache_store.active_support", - ) - fallback - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/memory_store.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/memory_store.rb deleted file mode 100644 index e06c7a0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/memory_store.rb +++ /dev/null @@ -1,264 +0,0 @@ -# frozen_string_literal: true - -require "monitor" - -module ActiveSupport - module Cache - # = Memory \Cache \Store - # - # A cache store implementation which stores everything into memory in the - # same process. If you're running multiple Ruby on \Rails server processes - # (which is the case if you're using Phusion Passenger or puma clustered mode), - # then this means that \Rails server process instances won't be able - # to share cache data with each other and this may not be the most - # appropriate cache in that scenario. - # - # This cache has a bounded size specified by the +:size+ options to the - # initializer (default is 32Mb). When the cache exceeds the allotted size, - # a cleanup will occur which tries to prune the cache down to three quarters - # of the maximum size by removing the least recently used entries. - # - # Unlike other Cache store implementations, +MemoryStore+ does not compress - # values by default. +MemoryStore+ does not benefit from compression as much - # as other Store implementations, as it does not send data over a network. - # However, when compression is enabled, it still pays the full cost of - # compression in terms of cpu use. - # - # +MemoryStore+ is thread-safe. - class MemoryStore < Store - prepend Strategy::LocalCache - - module DupCoder # :nodoc: - extend self - - def dump(entry) - if entry.value && entry.value != true && !entry.value.is_a?(Numeric) - Cache::Entry.new(dump_value(entry.value), expires_at: entry.expires_at, version: entry.version) - else - entry - end - end - - def dump_compressed(entry, threshold) - compressed_entry = entry.compressed(threshold) - compressed_entry.compressed? ? compressed_entry : dump(entry) - end - - def load(entry) - if !entry.compressed? && entry.value.is_a?(String) - Cache::Entry.new(load_value(entry.value), expires_at: entry.expires_at, version: entry.version) - else - entry - end - end - - private - MARSHAL_SIGNATURE = "\x04\x08".b.freeze - - def dump_value(value) - if value.is_a?(String) && !value.start_with?(MARSHAL_SIGNATURE) - value.dup - else - Marshal.dump(value) - end - end - - def load_value(string) - if string.start_with?(MARSHAL_SIGNATURE) - Marshal.load(string) - else - string.dup - end - end - end - - def initialize(options = nil) - options ||= {} - options[:coder] = DupCoder unless options.key?(:coder) || options.key?(:serializer) - # Disable compression by default. - options[:compress] ||= false - super(options) - @data = {} - @max_size = options[:size] || 32.megabytes - @max_prune_time = options[:max_prune_time] || 2 - @cache_size = 0 - @monitor = Monitor.new - @pruning = false - end - - # Advertise cache versioning support. - def self.supports_cache_versioning? - true - end - - # Delete all data stored in a given cache store. - def clear(options = nil) - synchronize do - @data.clear - @cache_size = 0 - end - end - - # Preemptively iterates through all stored keys and removes the ones which have expired. - def cleanup(options = nil) - options = merged_options(options) - _instrument(:cleanup, size: @data.size) do - keys = synchronize { @data.keys } - keys.each do |key| - entry = deserialize_entry(@data[key]) - delete_entry(key, **options) if entry && entry.expired? - end - end - end - - # To ensure entries fit within the specified memory prune the cache by removing the least - # recently accessed entries. - def prune(target_size, max_time = nil) - return if pruning? - @pruning = true - begin - start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) - cleanup - instrument(:prune, target_size, from: @cache_size) do - keys = synchronize { @data.keys } - keys.each do |key| - delete_entry(key, **options) - return if @cache_size <= target_size || (max_time && Process.clock_gettime(Process::CLOCK_MONOTONIC) - start_time > max_time) - end - end - ensure - @pruning = false - end - end - - # Returns true if the cache is currently being pruned. - def pruning? - @pruning - end - - # Increment a cached integer value. Returns the updated value. - # - # If the key is unset, it will be set to +amount+: - # - # cache.increment("foo") # => 1 - # cache.increment("bar", 100) # => 100 - # - # To set a specific value, call #write: - # - # cache.write("baz", 5) - # cache.increment("baz") # => 6 - # - def increment(name, amount = 1, **options) - instrument(:increment, name, amount: amount) do - modify_value(name, amount, **options) - end - end - - # Decrement a cached integer value. Returns the updated value. - # - # If the key is unset or has expired, it will be set to +-amount+. - # - # cache.decrement("foo") # => -1 - # - # To set a specific value, call #write: - # - # cache.write("baz", 5) - # cache.decrement("baz") # => 4 - # - def decrement(name, amount = 1, **options) - instrument(:decrement, name, amount: amount) do - modify_value(name, -amount, **options) - end - end - - # Deletes cache entries if the cache key matches a given pattern. - def delete_matched(matcher, options = nil) - options = merged_options(options) - matcher = key_matcher(matcher, options) - - instrument(:delete_matched, matcher.inspect) do - keys = synchronize { @data.keys } - keys.each do |key| - delete_entry(key, **options) if key.match(matcher) - end - end - end - - def inspect # :nodoc: - "#<#{self.class.name} entries=#{@data.size}, size=#{@cache_size}, options=#{@options.inspect}>" - end - - # Synchronize calls to the cache. This should be called wherever the underlying cache implementation - # is not thread safe. - def synchronize(&block) # :nodoc: - @monitor.synchronize(&block) - end - - private - PER_ENTRY_OVERHEAD = 240 - - def cached_size(key, payload) - key.to_s.bytesize + payload.bytesize + PER_ENTRY_OVERHEAD - end - - def read_entry(key, **options) - entry = nil - synchronize do - payload = @data.delete(key) - if payload - @data[key] = payload - entry = deserialize_entry(payload) - end - end - entry - end - - def write_entry(key, entry, **options) - payload = serialize_entry(entry, **options) - synchronize do - return false if options[:unless_exist] && exist?(key, namespace: nil) - - old_payload = @data[key] - if old_payload - @cache_size -= (old_payload.bytesize - payload.bytesize) - else - @cache_size += cached_size(key, payload) - end - @data[key] = payload - prune(@max_size * 0.75, @max_prune_time) if @cache_size > @max_size - true - end - end - - def delete_entry(key, **options) - synchronize do - payload = @data.delete(key) - @cache_size -= cached_size(key, payload) if payload - !!payload - end - end - - # Modifies the amount of an integer value that is stored in the cache. - # If the key is not found it is created and set to +amount+. - def modify_value(name, amount, **options) - options = merged_options(options) - key = normalize_key(name, options) - version = normalize_version(name, options) - - synchronize do - entry = read_entry(key, **options) - - if !entry || entry.expired? || entry.mismatched?(version) - write(name, Integer(amount), options) - amount - else - num = entry.value.to_i + amount - entry = Entry.new(num, expires_at: entry.expires_at, version: entry.version) - write_entry(key, entry) - num - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/null_store.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/null_store.rb deleted file mode 100644 index 7479a26..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/null_store.rb +++ /dev/null @@ -1,62 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module Cache - # = Null \Cache \Store - # - # A cache store implementation which doesn't actually store anything. Useful in - # development and test environments where you don't want caching turned on but - # need to go through the caching interface. - # - # This cache does implement the local cache strategy, so values will actually - # be cached inside blocks that utilize this strategy. See - # ActiveSupport::Cache::Strategy::LocalCache for more details. - class NullStore < Store - prepend Strategy::LocalCache - - # Advertise cache versioning support. - def self.supports_cache_versioning? - true - end - - def clear(options = nil) - end - - def cleanup(options = nil) - end - - def increment(name, amount = 1, **options) - end - - def decrement(name, amount = 1, **options) - end - - def delete_matched(matcher, options = nil) - end - - def inspect # :nodoc: - "#<#{self.class.name} options=#{@options.inspect}>" - end - - private - def read_entry(key, **s) - deserialize_entry(read_serialized_entry(key)) - end - - def read_serialized_entry(_key, **) - end - - def write_entry(key, entry, **) - write_serialized_entry(key, serialize_entry(entry)) - end - - def write_serialized_entry(_key, _payload, **) - true - end - - def delete_entry(key, **options) - false - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/redis_cache_store.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/redis_cache_store.rb deleted file mode 100644 index 798fa2a..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/redis_cache_store.rb +++ /dev/null @@ -1,506 +0,0 @@ -# frozen_string_literal: true - -begin - gem "redis", ">= 4.0.1" - require "redis" - require "redis/distributed" -rescue LoadError - warn "The Redis cache store requires the redis gem, version 4.0.1 or later. Please add it to your Gemfile: `gem \"redis\", \">= 4.0.1\"`" - raise -end - -require "connection_pool" -require "active_support/core_ext/array/wrap" -require "active_support/core_ext/hash/slice" -require "active_support/core_ext/numeric/time" -require "active_support/digest" - -module ActiveSupport - module Cache - # = Redis \Cache \Store - # - # Deployment note: Take care to use a dedicated Redis cache rather - # than pointing this at a persistent Redis server (for example, one used as - # an Active Job queue). Redis won't cope well with mixed usage patterns and it - # won't expire cache entries by default. - # - # Redis cache server setup guide: https://redis.io/topics/lru-cache - # - # * Supports vanilla Redis, hiredis, and +Redis::Distributed+. - # * Supports Memcached-like sharding across Redises with +Redis::Distributed+. - # * Fault tolerant. If the Redis server is unavailable, no exceptions are - # raised. Cache fetches are all misses and writes are dropped. - # * Local cache. Hot in-memory primary cache within block/middleware scope. - # * +read_multi+ and +write_multi+ support for Redis mget/mset. Use - # +Redis::Distributed+ 4.0.1+ for distributed mget support. - # * +delete_matched+ support for Redis KEYS globs. - class RedisCacheStore < Store - DEFAULT_REDIS_OPTIONS = { - connect_timeout: 1, - read_timeout: 1, - write_timeout: 1, - } - - DEFAULT_ERROR_HANDLER = -> (method:, returning:, exception:) do - if logger - logger.error { "RedisCacheStore: #{method} failed, returned #{returning.inspect}: #{exception.class}: #{exception.message}" } - end - ActiveSupport.error_reporter&.report( - exception, - severity: :warning, - source: "redis_cache_store.active_support", - ) - end - - # The maximum number of entries to receive per SCAN call. - SCAN_BATCH_SIZE = 1000 - private_constant :SCAN_BATCH_SIZE - - # Advertise cache versioning support. - def self.supports_cache_versioning? - true - end - - prepend Strategy::LocalCache - - class << self - # Factory method to create a new Redis instance. - # - # Handles four options: :redis block, :redis instance, single :url - # string, and multiple :url strings. - # - # Option Class Result - # :redis Proc -> options[:redis].call - # :redis Object -> options[:redis] - # :url String -> Redis.new(url: …) - # :url Array -> Redis::Distributed.new([{ url: … }, { url: … }, …]) - # - def build_redis(redis: nil, url: nil, **redis_options) # :nodoc: - urls = Array(url) - - if redis.is_a?(Proc) - redis.call - elsif redis - redis - elsif urls.size > 1 - build_redis_distributed_client(urls: urls, **redis_options) - elsif urls.empty? - build_redis_client(**redis_options) - else - build_redis_client(url: urls.first, **redis_options) - end - end - - private - def build_redis_distributed_client(urls:, **redis_options) - ::Redis::Distributed.new([], DEFAULT_REDIS_OPTIONS.merge(redis_options)).tap do |dist| - urls.each { |u| dist.add_node url: u } - end - end - - def build_redis_client(**redis_options) - ::Redis.new(DEFAULT_REDIS_OPTIONS.merge(redis_options)) - end - end - - attr_reader :redis - - # Creates a new Redis cache store. - # - # There are a few ways to provide the Redis client used by the cache: - # - # 1. The +:redis+ param can be: - # - A Redis instance. - # - A +ConnectionPool+ instance wrapping a Redis instance. - # - A block that returns a Redis instance. - # - # 2. The +:url+ param can be: - # - A string used to create a Redis instance. - # - An array of strings used to create a +Redis::Distributed+ instance. - # - # If the final Redis instance is not already a +ConnectionPool+, it will - # be wrapped in one using +ActiveSupport::Cache::Store::DEFAULT_POOL_OPTIONS+. - # These options can be overridden with the +:pool+ param, or the pool can be - # disabled with +:pool: false+. - # - # Option Class Result - # :redis Object -> options[:redis] - # :redis Proc -> options[:redis].call - # :url String -> Redis.new(url: …) - # :url Array -> Redis::Distributed.new([{ url: … }, { url: … }, …]) - # - # No namespace is set by default. Provide one if the Redis cache - # server is shared with other apps: namespace: 'myapp-cache'. - # - # Compression is enabled by default with a 1kB threshold, so cached - # values larger than 1kB are automatically compressed. Disable by - # passing compress: false or change the threshold by passing - # compress_threshold: 4.kilobytes. - # - # No expiry is set on cache entries by default. Redis is expected to - # be configured with an eviction policy that automatically deletes - # least-recently or -frequently used keys when it reaches max memory. - # See https://redis.io/topics/lru-cache for cache server setup. - # - # Race condition TTL is not set by default. This can be used to avoid - # "thundering herd" cache writes when hot cache entries are expired. - # See ActiveSupport::Cache::Store#fetch for more. - # - # Setting skip_nil: true will not cache nil results: - # - # cache.fetch('foo') { nil } - # cache.fetch('bar', skip_nil: true) { nil } - # cache.exist?('foo') # => true - # cache.exist?('bar') # => false - def initialize(error_handler: DEFAULT_ERROR_HANDLER, **redis_options) - universal_options = redis_options.extract!(*UNIVERSAL_OPTIONS) - redis = redis_options[:redis] - - already_pool = redis.instance_of?(::ConnectionPool) || - (redis.respond_to?(:wrapped_pool) && redis.wrapped_pool.instance_of?(::ConnectionPool)) - - if !already_pool && pool_options = self.class.send(:retrieve_pool_options, redis_options) - @redis = ::ConnectionPool.new(**pool_options) { self.class.build_redis(**redis_options) } - else - @redis = self.class.build_redis(**redis_options) - end - - @error_handler = error_handler - - super(universal_options) - end - - def inspect - "#<#{self.class} options=#{options.inspect} redis=#{redis.inspect}>" - end - - # Cache Store API implementation. - # - # Read multiple values at once. Returns a hash of requested keys -> - # fetched values. - def read_multi(*names) - return {} if names.empty? - - options = names.extract_options! - options = merged_options(options) - keys = names.map { |name| normalize_key(name, options) } - - instrument_multi(:read_multi, keys, options) do |payload| - read_multi_entries(names, **options).tap do |results| - payload[:hits] = results.keys.map { |name| normalize_key(name, options) } - end - end - end - - # Cache Store API implementation. - # - # Supports Redis KEYS glob patterns: - # - # h?llo matches hello, hallo and hxllo - # h*llo matches hllo and heeeello - # h[ae]llo matches hello and hallo, but not hillo - # h[^e]llo matches hallo, hbllo, ... but not hello - # h[a-b]llo matches hallo and hbllo - # - # Use \ to escape special characters if you want to match them verbatim. - # - # See https://redis.io/commands/KEYS for more. - # - # Failsafe: Raises errors. - def delete_matched(matcher, options = nil) - unless String === matcher - raise ArgumentError, "Only Redis glob strings are supported: #{matcher.inspect}" - end - pattern = namespace_key(matcher, options) - - instrument :delete_matched, pattern do - redis.then do |c| - cursor = "0" - # Fetch keys in batches using SCAN to avoid blocking the Redis server. - nodes = c.respond_to?(:nodes) ? c.nodes : [c] - - nodes.each do |node| - begin - cursor, keys = node.scan(cursor, match: pattern, count: SCAN_BATCH_SIZE) - node.unlink(*keys) unless keys.empty? - end until cursor == "0" - end - end - end - end - - # Increment a cached integer value using the Redis incrby atomic operator. - # Returns the updated value. - # - # If the key is unset or has expired, it will be set to +amount+: - # - # cache.increment("foo") # => 1 - # cache.increment("bar", 100) # => 100 - # - # To set a specific value, call #write passing raw: true: - # - # cache.write("baz", 5, raw: true) - # cache.increment("baz") # => 6 - # - # Incrementing a non-numeric value, or a value written without - # raw: true, will fail and return +nil+. - # - # To read the value later, call #read_counter: - # - # cache.increment("baz") # => 7 - # cache.read_counter("baz") # 7 - # - # Failsafe: Raises errors. - def increment(name, amount = 1, options = nil) - options = merged_options(options) - key = normalize_key(name, options) - - instrument :increment, key, amount: amount do - failsafe :increment do - change_counter(key, amount, options) - end - end - end - - # Decrement a cached integer value using the Redis decrby atomic operator. - # Returns the updated value. - # - # If the key is unset or has expired, it will be set to +-amount+: - # - # cache.decrement("foo") # => -1 - # - # To set a specific value, call #write passing raw: true: - # - # cache.write("baz", 5, raw: true) - # cache.decrement("baz") # => 4 - # - # Decrementing a non-numeric value, or a value written without - # raw: true, will fail and return +nil+. - # - # To read the value later, call #read_counter: - # - # cache.decrement("baz") # => 3 - # cache.read_counter("baz") # 3 - # - # Failsafe: Raises errors. - def decrement(name, amount = 1, options = nil) - options = merged_options(options) - key = normalize_key(name, options) - - instrument :decrement, key, amount: amount do - failsafe :decrement do - change_counter(key, -amount, options) - end - end - end - - # Cache Store API implementation. - # - # Removes expired entries. Handled natively by Redis least-recently-/ - # least-frequently-used expiry, so manual cleanup is not supported. - def cleanup(options = nil) - super - end - - # Clear the entire cache on all Redis servers. Safe to use on - # shared servers if the cache is namespaced. - # - # Failsafe: Raises errors. - def clear(options = nil) - failsafe :clear do - if namespace = merged_options(options)[:namespace] - delete_matched "*", namespace: namespace - else - redis.then { |c| c.flushdb } - end - end - end - - # Get info from redis servers. - def stats - redis.then { |c| c.info } - end - - private - def pipeline_entries(entries, &block) - redis.then { |c| - if c.is_a?(Redis::Distributed) - entries.group_by { |k, _v| c.node_for(k) }.each do |node, sub_entries| - node.pipelined { |pipe| yield(pipe, sub_entries) } - end - else - c.pipelined { |pipe| yield(pipe, entries) } - end - } - end - - # Store provider interface: - # Read an entry from the cache. - def read_entry(key, **options) - deserialize_entry(read_serialized_entry(key, **options), **options) - end - - def read_serialized_entry(key, raw: false, **options) - failsafe :read_entry do - redis.then { |c| c.get(key) } - end - end - - def read_multi_entries(names, **options) - options = merged_options(options) - return {} if names == [] - raw = options&.fetch(:raw, false) - - keys = names.map { |name| normalize_key(name, options) } - - values = failsafe(:read_multi_entries, returning: {}) do - redis.then { |c| c.mget(*keys) } - end - - names.zip(values).each_with_object({}) do |(name, value), results| - if value - entry = deserialize_entry(value, raw: raw) - unless entry.nil? || entry.expired? || entry.mismatched?(normalize_version(name, options)) - begin - results[name] = entry.value - rescue DeserializationError - end - end - end - end - end - - # Write an entry to the cache. - # - # Requires Redis 2.6.12+ for extended SET options. - def write_entry(key, entry, raw: false, **options) - write_serialized_entry(key, serialize_entry(entry, raw: raw, **options), raw: raw, **options) - end - - def write_serialized_entry(key, payload, raw: false, unless_exist: false, expires_in: nil, race_condition_ttl: nil, pipeline: nil, **options) - # If race condition TTL is in use, ensure that cache entries - # stick around a bit longer after they would have expired - # so we can purposefully serve stale entries. - if race_condition_ttl && expires_in && expires_in > 0 && !raw - expires_in += 5.minutes - end - - modifiers = {} - if unless_exist || expires_in - modifiers[:nx] = unless_exist - modifiers[:px] = (1000 * expires_in.to_f).ceil if expires_in - end - - if pipeline - pipeline.set(key, payload, **modifiers) - else - failsafe :write_entry, returning: nil do - redis.then { |c| !!c.set(key, payload, **modifiers) } - end - end - end - - # Delete an entry from the cache. - def delete_entry(key, **options) - failsafe :delete_entry, returning: false do - redis.then { |c| c.unlink(key) == 1 } - end - end - - # Deletes multiple entries in the cache. Returns the number of entries deleted. - def delete_multi_entries(entries, **_options) - return 0 if entries.empty? - - failsafe :delete_multi_entries, returning: 0 do - redis.then { |c| c.unlink(*entries) } - end - end - - # Nonstandard store provider API to write multiple values at once. - def write_multi_entries(entries, **options) - return if entries.empty? - - failsafe :write_multi_entries do - pipeline_entries(entries) do |pipeline, sharded_entries| - options = options.dup - options[:pipeline] = pipeline - sharded_entries.each do |key, entry| - write_entry key, entry, **options - end - end - end - end - - def deserialize_entry(payload, raw: false, **) - if raw && !payload.nil? - Entry.new(payload) - else - super(payload) - end - end - - def serialize_entry(entry, raw: false, **options) - if raw - entry.value.to_s - else - super(entry, raw: raw, **options) - end - end - - def serialize_entries(entries, **options) - entries.transform_values do |entry| - serialize_entry(entry, **options) - end - end - - def change_counter(key, amount, options) - redis.then do |c| - c = c.node_for(key) if c.is_a?(Redis::Distributed) - - expires_in = options[:expires_in] - - if expires_in - if supports_expire_nx? - count, _ = c.pipelined do |pipeline| - pipeline.incrby(key, amount) - pipeline.call(:expire, key, expires_in.to_i, "NX") - end - else - count, ttl = c.pipelined do |pipeline| - pipeline.incrby(key, amount) - pipeline.ttl(key) - end - c.expire(key, expires_in.to_i) if ttl < 0 - end - else - count = c.incrby(key, amount) - end - - count - end - end - - def supports_expire_nx? - return @supports_expire_nx if defined?(@supports_expire_nx) - - redis_versions = redis.then { |c| Array.wrap(c.info("server")).pluck("redis_version") } - @supports_expire_nx = redis_versions.all? { |v| Gem::Version.new(v) >= Gem::Version.new("7.0.0") } - end - - FAILSAFE_ERRORS = [ - ::Redis::BaseError, - ConnectionPool::Error, - ConnectionPool::TimeoutError, - (::RedisClient::Error if defined?(::RedisClient::Error)), - ].compact.freeze - private_constant :FAILSAFE_ERRORS - - def failsafe(method, returning: nil) - yield - rescue *FAILSAFE_ERRORS => error - @error_handler&.call(method: method, exception: error, returning: returning) - returning - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/serializer_with_fallback.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/serializer_with_fallback.rb deleted file mode 100644 index 9935849..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/serializer_with_fallback.rb +++ /dev/null @@ -1,152 +0,0 @@ -# frozen_string_literal: true - -require "zlib" -require "active_support/core_ext/kernel/reporting" - -module ActiveSupport - module Cache - module SerializerWithFallback # :nodoc: - def self.[](format) - if format.to_s.include?("message_pack") && !defined?(ActiveSupport::MessagePack) - require "active_support/message_pack" - end - - SERIALIZERS.fetch(format) - end - - def load(dumped) - if dumped.is_a?(String) - case - when MessagePackWithFallback.dumped?(dumped) - MessagePackWithFallback._load(dumped) - when Marshal71WithFallback.dumped?(dumped) - Marshal71WithFallback._load(dumped) - when Marshal70WithFallback.dumped?(dumped) - Marshal70WithFallback._load(dumped) - else - Cache::Store.logger&.warn("Unrecognized payload prefix #{dumped.byteslice(0).inspect}; deserializing as nil") - nil - end - elsif PassthroughWithFallback.dumped?(dumped) - PassthroughWithFallback._load(dumped) - else - Cache::Store.logger&.warn("Unrecognized payload class #{dumped.class}; deserializing as nil") - nil - end - end - - private - def marshal_load(payload) - Marshal.load(payload) - rescue ArgumentError => error - raise Cache::DeserializationError, error.message - end - - module PassthroughWithFallback - include SerializerWithFallback - extend self - - def dump(entry) - entry - end - - def dump_compressed(entry, threshold) - entry.compressed(threshold) - end - - def _load(entry) - entry - end - - def dumped?(dumped) - dumped.is_a?(Cache::Entry) - end - end - - module Marshal70WithFallback - include SerializerWithFallback - extend self - - MARK_UNCOMPRESSED = "\x00".b.freeze - MARK_COMPRESSED = "\x01".b.freeze - - def dump(entry) - MARK_UNCOMPRESSED + Marshal.dump(entry.pack) - end - - def dump_compressed(entry, threshold) - dumped = Marshal.dump(entry.pack) - - if dumped.bytesize >= threshold - compressed = Zlib::Deflate.deflate(dumped) - return MARK_COMPRESSED + compressed if compressed.bytesize < dumped.bytesize - end - - MARK_UNCOMPRESSED + dumped - end - - def _load(marked) - dumped = marked.byteslice(1..-1) - dumped = Zlib::Inflate.inflate(dumped) if marked.start_with?(MARK_COMPRESSED) - Cache::Entry.unpack(marshal_load(dumped)) - end - - def dumped?(dumped) - dumped.start_with?(MARK_UNCOMPRESSED, MARK_COMPRESSED) - end - end - - module Marshal71WithFallback - include SerializerWithFallback - extend self - - MARSHAL_SIGNATURE = "\x04\x08".b.freeze - - def dump(value) - Marshal.dump(value) - end - - def _load(dumped) - marshal_load(dumped) - end - - def dumped?(dumped) - dumped.start_with?(MARSHAL_SIGNATURE) - end - end - - module MessagePackWithFallback - include SerializerWithFallback - extend self - - def dump(value) - ActiveSupport::MessagePack::CacheSerializer.dump(value) - end - - def _load(dumped) - ActiveSupport::MessagePack::CacheSerializer.load(dumped) - end - - def dumped?(dumped) - available? && ActiveSupport::MessagePack.signature?(dumped) - end - - private - def available? - return @available if defined?(@available) - silence_warnings { require "active_support/message_pack" } - @available = true - rescue LoadError - @available = false - end - end - - SERIALIZERS = { - passthrough: PassthroughWithFallback, - marshal_7_0: Marshal70WithFallback, - marshal_7_1: Marshal71WithFallback, - message_pack: MessagePackWithFallback, - } - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/strategy/local_cache.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/strategy/local_cache.rb deleted file mode 100644 index 87fa172..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/strategy/local_cache.rb +++ /dev/null @@ -1,246 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/string/inflections" - -module ActiveSupport - module Cache - module Strategy - # = Local \Cache \Strategy - # - # Caches that implement LocalCache will be backed by an in-memory cache for the - # duration of a block. Repeated calls to the cache for the same key will hit the - # in-memory cache for faster access. - module LocalCache - autoload :Middleware, "active_support/cache/strategy/local_cache_middleware" - - # Class for storing and registering the local caches. - module LocalCacheRegistry # :nodoc: - extend self - - def cache_for(local_cache_key) - registry = ActiveSupport::IsolatedExecutionState[:active_support_local_cache_registry] ||= {} - registry[local_cache_key] - end - - def set_cache_for(local_cache_key, value) - registry = ActiveSupport::IsolatedExecutionState[:active_support_local_cache_registry] ||= {} - registry[local_cache_key] = value - end - end - - # = Local \Cache \Store - # - # Simple memory backed cache. This cache is not thread safe and is intended only - # for serving as a temporary memory cache for a single thread. - class LocalStore - def initialize - @data = {} - end - - def clear(options = nil) - @data.clear - end - - def read_entry(key) - @data[key] - end - - def read_multi_entries(keys) - @data.slice(*keys) - end - - def write_entry(key, entry) - @data[key] = entry - true - end - - def delete_entry(key) - !!@data.delete(key) - end - - def fetch_entry(key) # :nodoc: - @data.fetch(key) { @data[key] = yield } - end - end - - # Use a local cache for the duration of block. - def with_local_cache(&block) - use_temporary_local_cache(LocalStore.new, &block) - end - - # Set a new local cache. - def new_local_cache - LocalCacheRegistry.set_cache_for(local_cache_key, LocalStore.new) - end - - # Unset the current local cache. - def unset_local_cache - LocalCacheRegistry.set_cache_for(local_cache_key, nil) - end - - # The current local cache. - def local_cache - LocalCacheRegistry.cache_for(local_cache_key) - end - - # Middleware class can be inserted as a Rack handler to be local cache for the - # duration of request. - def middleware - @middleware ||= Middleware.new("ActiveSupport::Cache::Strategy::LocalCache", self) - end - - def clear(options = nil) # :nodoc: - return super unless cache = local_cache - cache.clear(options) - super - end - - def cleanup(options = nil) # :nodoc: - return super unless cache = local_cache - cache.clear(options) - super - end - - def delete_matched(matcher, options = nil) # :nodoc: - return super unless cache = local_cache - cache.clear(options) - super - end - - def increment(name, amount = 1, **options) # :nodoc: - return super unless local_cache - value = bypass_local_cache { super } - write_cache_value(name, value, raw: true, **options) - value - end - - def decrement(name, amount = 1, **options) # :nodoc: - return super unless local_cache - value = bypass_local_cache { super } - write_cache_value(name, value, raw: true, **options) - value - end - - def fetch_multi(*names, &block) # :nodoc: - return super if local_cache.nil? || names.empty? - - options = names.extract_options! - options = merged_options(options) - - keys_to_names = names.index_by { |name| normalize_key(name, options) } - - local_entries = local_cache.read_multi_entries(keys_to_names.keys) - results = local_entries.each_with_object({}) do |(key, value), result| - # If we recorded a miss in the local cache, `#fetch_multi` will forward - # that key to the real store, and the entry will be replaced - # local_cache.delete_entry(key) - next if value.nil? - - entry = deserialize_entry(value, **options) - - normalized_key = keys_to_names[key] - if entry.nil? - result[normalized_key] = nil - elsif entry.expired? || entry.mismatched?(normalize_version(normalized_key, options)) - local_cache.delete_entry(key) - else - result[normalized_key] = entry.value - end - end - - if results.size < names.size - results.merge!(super(*(names - results.keys), options, &block)) - end - - results.slice(*names) - end - - private - def read_serialized_entry(key, raw: false, **options) - if cache = local_cache - hit = true - entry = cache.fetch_entry(key) do - hit = false - super - end - options[:event][:store] = cache.class.name if hit && options[:event] - entry - else - super - end - end - - def read_multi_entries(names, **options) - return super unless local_cache - - keys_to_names = names.index_by { |name| normalize_key(name, options) } - - local_entries = local_cache.read_multi_entries(keys_to_names.keys) - - results = local_entries.each_with_object({}) do |(key, value), result| - next if value.nil? # recorded cache miss - - entry = deserialize_entry(value, **options) - - normalized_key = keys_to_names[key] - if entry.nil? - result[normalized_key] = nil - elsif entry.expired? || entry.mismatched?(normalize_version(normalized_key, options)) - local_cache.delete_entry(key) - else - result[normalized_key] = entry.value - end - end - - if results.size < names.size - results.merge!(super(names - results.keys, **options)) - end - - results - end - - def write_serialized_entry(key, payload, **) - if return_value = super - local_cache.write_entry(key, payload) if local_cache - else - local_cache.delete_entry(key) if local_cache - end - return_value - end - - def delete_entry(key, **) - local_cache.delete_entry(key) if local_cache - super - end - - def write_cache_value(name, value, **options) - name = normalize_key(name, options) - cache = local_cache - if value - cache.write_entry(name, serialize_entry(new_entry(value, **options), **options)) - else - cache.delete_entry(name) - end - end - - def local_cache_key - @local_cache_key ||= "#{self.class.name.underscore}_local_cache_#{object_id}".gsub(/[\/-]/, "_").to_sym - end - - def bypass_local_cache(&block) - use_temporary_local_cache(nil, &block) - end - - def use_temporary_local_cache(temporary_cache) - save_cache = LocalCacheRegistry.cache_for(local_cache_key) - begin - LocalCacheRegistry.set_cache_for(local_cache_key, temporary_cache) - yield - ensure - LocalCacheRegistry.set_cache_for(local_cache_key, save_cache) - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/strategy/local_cache_middleware.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/strategy/local_cache_middleware.rb deleted file mode 100644 index d547673..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/cache/strategy/local_cache_middleware.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -require "rack/body_proxy" -require "rack/utils" - -module ActiveSupport - module Cache - module Strategy - module LocalCache - #-- - # This class wraps up local storage for middlewares. Only the middleware method should - # construct them. - class Middleware # :nodoc: - attr_reader :name - attr_accessor :cache - - def initialize(name, cache) - @name = name - @cache = cache - @app = nil - end - - def new(app) - @app = app - self - end - - def call(env) - cache.new_local_cache - response = @app.call(env) - response[2] = ::Rack::BodyProxy.new(response[2]) do - cache.unset_local_cache - end - cleanup_on_body_close = true - response - rescue Rack::Utils::InvalidParameterError - [400, {}, []] - ensure - cache.unset_local_cache unless cleanup_on_body_close - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/callbacks.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/callbacks.rb deleted file mode 100644 index 9e27372..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/callbacks.rb +++ /dev/null @@ -1,960 +0,0 @@ -# frozen_string_literal: true - -require "active_support/concern" -require "active_support/descendants_tracker" -require "active_support/core_ext/array/extract_options" -require "active_support/core_ext/class/attribute" -require "active_support/core_ext/module/redefine_method" -require "active_support/core_ext/string/filters" -require "active_support/core_ext/object/blank" - -module ActiveSupport - # = Active Support \Callbacks - # - # \Callbacks are code hooks that are run at key points in an object's life cycle. - # The typical use case is to have a base class define a set of callbacks - # relevant to the other functionality it supplies, so that subclasses can - # install callbacks that enhance or modify the base functionality without - # needing to override or redefine methods of the base class. - # - # Mixing in this module allows you to define the events in the object's - # life cycle that will support callbacks (via ClassMethods#define_callbacks), - # set the instance methods, procs, or callback objects to be called (via - # ClassMethods#set_callback), and run the installed callbacks at the - # appropriate times (via +run_callbacks+). - # - # By default callbacks are halted by throwing +:abort+. - # See ClassMethods#define_callbacks for details. - # - # Three kinds of callbacks are supported: before callbacks, run before a - # certain event; after callbacks, run after the event; and around callbacks, - # blocks that surround the event, triggering it when they yield. Callback code - # can be contained in instance methods, procs or lambdas, or callback objects - # that respond to certain predetermined methods. See ClassMethods#set_callback - # for details. - # - # class Record - # include ActiveSupport::Callbacks - # define_callbacks :save - # - # def save - # run_callbacks :save do - # puts "- save" - # end - # end - # end - # - # class PersonRecord < Record - # set_callback :save, :before, :saving_message - # def saving_message - # puts "saving..." - # end - # - # set_callback :save, :after do |object| - # puts "saved" - # end - # end - # - # person = PersonRecord.new - # person.save - # - # Output: - # saving... - # - save - # saved - module Callbacks - extend Concern - - included do - extend ActiveSupport::DescendantsTracker - class_attribute :__callbacks, instance_writer: false, instance_predicate: false, default: {} - end - - CALLBACK_FILTER_TYPES = [:before, :after, :around].freeze - - # Runs the callbacks for the given event. - # - # Calls the before and around callbacks in the order they were set, yields - # the block (if given one), and then runs the after callbacks in reverse - # order. - # - # If the callback chain was halted, returns +false+. Otherwise returns the - # result of the block, +nil+ if no callbacks have been set, or +true+ - # if callbacks have been set but no block is given. - # - # run_callbacks :save do - # save - # end - # - #-- - # - # As this method is used in many places, and often wraps large portions of - # user code, it has an additional design goal of minimizing its impact on - # the visible call stack. An exception from inside a :before or :after - # callback can be as noisy as it likes -- but when control has passed - # smoothly through and into the supplied block, we want as little evidence - # as possible that we were here. - def run_callbacks(kind, type = nil) - callbacks = __callbacks[kind.to_sym] - - if callbacks.empty? - yield if block_given? - else - env = Filters::Environment.new(self, false, nil) - - next_sequence = callbacks.compile(type) - - # Common case: no 'around' callbacks defined - if next_sequence.final? - next_sequence.invoke_before(env) - env.value = !env.halted && (!block_given? || yield) - next_sequence.invoke_after(env) - env.value - else - invoke_sequence = Proc.new do - skipped = nil - - while true - current = next_sequence - current.invoke_before(env) - if current.final? - env.value = !env.halted && (!block_given? || yield) - elsif current.skip?(env) - (skipped ||= []) << current - next_sequence = next_sequence.nested - next - else - next_sequence = next_sequence.nested - begin - target, block, method, *arguments = current.expand_call_template(env, invoke_sequence) - target.send(method, *arguments, &block) - ensure - next_sequence = current - end - end - current.invoke_after(env) - skipped.pop.invoke_after(env) while skipped&.first - break env.value - end - end - - invoke_sequence.call - end - end - end - - private - # A hook invoked every time a before callback is halted. - # This can be overridden in ActiveSupport::Callbacks implementors in order - # to provide better debugging/logging. - def halted_callback_hook(filter, name) - end - - module Conditionals # :nodoc: all - class Value - def initialize(&block) - @block = block - end - def call(target, value); @block.call(value); end - end - end - - module Filters # :nodoc: all - Environment = Struct.new(:target, :halted, :value) - - class Before - def initialize(user_callback, user_conditions, chain_config, filter, name) - halted_lambda = chain_config[:terminator] - @user_callback, @user_conditions, @halted_lambda, @filter, @name = user_callback, user_conditions, halted_lambda, filter, name - freeze - end - attr_reader :user_callback, :user_conditions, :halted_lambda, :filter, :name - - def call(env) - target = env.target - value = env.value - halted = env.halted - - if !halted && user_conditions.all? { |c| c.call(target, value) } - result_lambda = -> { user_callback.call target, value } - env.halted = halted_lambda.call(target, result_lambda) - if env.halted - target.send :halted_callback_hook, filter, name - end - end - - env - end - - def apply(callback_sequence) - callback_sequence.before(self) - end - end - - class After - attr_reader :user_callback, :user_conditions, :halting - def initialize(user_callback, user_conditions, chain_config) - halting = chain_config[:skip_after_callbacks_if_terminated] - @user_callback, @user_conditions, @halting = user_callback, user_conditions, halting - freeze - end - - def call(env) - target = env.target - value = env.value - halted = env.halted - - if (!halted || !@halting) && user_conditions.all? { |c| c.call(target, value) } - user_callback.call target, value - end - - env - end - - def apply(callback_sequence) - callback_sequence.after(self) - end - end - - class Around - def initialize(user_callback, user_conditions) - @user_callback, @user_conditions = user_callback, user_conditions - freeze - end - - def apply(callback_sequence) - callback_sequence.around(@user_callback, @user_conditions) - end - end - end - - class Callback # :nodoc: - def self.build(chain, filter, kind, options) - if filter.is_a?(String) - raise ArgumentError, <<-MSG.squish - Passing string to define a callback is not supported. See the `.set_callback` - documentation to see supported values. - MSG - end - - new chain.name, filter, kind, options, chain.config - end - - attr_accessor :kind, :name - attr_reader :chain_config, :filter - - def initialize(name, filter, kind, options, chain_config) - @chain_config = chain_config - @name = name - @kind = kind - @filter = filter - @if = check_conditionals(options[:if]) - @unless = check_conditionals(options[:unless]) - - compiled - end - - def merge_conditional_options(chain, if_option:, unless_option:) - options = { - if: @if.dup, - unless: @unless.dup - } - - options[:if].concat Array(unless_option) - options[:unless].concat Array(if_option) - - self.class.build chain, @filter, @kind, options - end - - def matches?(_kind, _filter) - @kind == _kind && filter == _filter - end - - def duplicates?(other) - case @filter - when Symbol - matches?(other.kind, other.filter) - else - false - end - end - - def compiled - @compiled ||= - begin - user_conditions = conditions_lambdas - user_callback = CallTemplate.build(@filter, self) - - case kind - when :before - Filters::Before.new(user_callback.make_lambda, user_conditions, chain_config, @filter, name) - when :after - Filters::After.new(user_callback.make_lambda, user_conditions, chain_config) - when :around - Filters::Around.new(user_callback, user_conditions) - end - end - end - - # Wraps code with filter - def apply(callback_sequence) - compiled.apply(callback_sequence) - end - - def current_scopes - Array(chain_config[:scope]).map { |s| public_send(s) } - end - - private - EMPTY_ARRAY = [].freeze - private_constant :EMPTY_ARRAY - - def check_conditionals(conditionals) - return EMPTY_ARRAY if conditionals.blank? - - conditionals = Array(conditionals) - if conditionals.any?(String) - raise ArgumentError, <<-MSG.squish - Passing string to be evaluated in :if and :unless conditional - options is not supported. Pass a symbol for an instance method, - or a lambda, proc or block, instead. - MSG - end - - conditionals.freeze - end - - def conditions_lambdas - conditions = - @if.map { |c| CallTemplate.build(c, self).make_lambda } + - @unless.map { |c| CallTemplate.build(c, self).inverted_lambda } - conditions.empty? ? EMPTY_ARRAY : conditions - end - end - - # A future invocation of user-supplied code (either as a callback, - # or a condition filter). - module CallTemplate # :nodoc: all - class MethodCall - def initialize(method) - @method_name = method - end - - # Return the parts needed to make this call, with the given - # input values. - # - # Returns an array of the form: - # - # [target, block, method, *arguments] - # - # This array can be used as such: - # - # target.send(method, *arguments, &block) - # - # The actual invocation is left up to the caller to minimize - # call stack pollution. - def expand(target, value, block) - [target, block, @method_name] - end - - def make_lambda - lambda do |target, value, &block| - target.send(@method_name, &block) - end - end - - def inverted_lambda - lambda do |target, value, &block| - !target.send(@method_name, &block) - end - end - end - - class ObjectCall - def initialize(target, method) - @override_target = target - @method_name = method - end - - def expand(target, value, block) - [@override_target || target, block, @method_name, target] - end - - def make_lambda - lambda do |target, value, &block| - (@override_target || target).send(@method_name, target, &block) - end - end - - def inverted_lambda - lambda do |target, value, &block| - !(@override_target || target).send(@method_name, target, &block) - end - end - end - - class InstanceExec0 - def initialize(block) - @override_block = block - end - - def expand(target, value, block) - [target, @override_block, :instance_exec] - end - - def make_lambda - lambda do |target, value, &block| - target.instance_exec(&@override_block) - end - end - - def inverted_lambda - lambda do |target, value, &block| - !target.instance_exec(&@override_block) - end - end - end - - class InstanceExec1 - def initialize(block) - @override_block = block - end - - def expand(target, value, block) - [target, @override_block, :instance_exec, target] - end - - def make_lambda - lambda do |target, value, &block| - target.instance_exec(target, &@override_block) - end - end - - def inverted_lambda - lambda do |target, value, &block| - !target.instance_exec(target, &@override_block) - end - end - end - - class InstanceExec2 - def initialize(block) - @override_block = block - end - - def expand(target, value, block) - raise ArgumentError unless block - [target, @override_block || block, :instance_exec, target, block] - end - - def make_lambda - lambda do |target, value, &block| - raise ArgumentError unless block - target.instance_exec(target, block, &@override_block) - end - end - - def inverted_lambda - lambda do |target, value, &block| - raise ArgumentError unless block - !target.instance_exec(target, block, &@override_block) - end - end - end - - class ProcCall - def initialize(target) - @override_target = target - end - - def expand(target, value, block) - [@override_target || target, block, :call, target, value] - end - - def make_lambda - lambda do |target, value, &block| - (@override_target || target).call(target, value, &block) - end - end - - def inverted_lambda - lambda do |target, value, &block| - !(@override_target || target).call(target, value, &block) - end - end - end - - # Filters support: - # - # Symbols:: A method to call. - # Procs:: A proc to call with the object. - # Objects:: An object with a before_foo method on it to call. - # - # All of these objects are converted into a CallTemplate and handled - # the same after this point. - def self.build(filter, callback) - case filter - when Symbol - MethodCall.new(filter) - when Conditionals::Value - ProcCall.new(filter) - when ::Proc - case filter.arity - when 2 - InstanceExec2.new(filter) - when 1, -2 - InstanceExec1.new(filter) - else - InstanceExec0.new(filter) - end - else - ObjectCall.new(filter, callback.current_scopes.join("_").to_sym) - end - end - end - - # Execute before and after filters in a sequence instead of - # chaining them with nested lambda calls, see: - # https://github.com/rails/rails/issues/18011 - class CallbackSequence # :nodoc: - def initialize(nested = nil, call_template = nil, user_conditions = nil) - @nested = nested - @call_template = call_template - @user_conditions = user_conditions - - @before = nil - @after = nil - end - - def before(before) - @before ||= [] - @before.unshift(before) - self - end - - def after(after) - @after ||= [] - @after.push(after) - self - end - - def around(call_template, user_conditions) - CallbackSequence.new(self, call_template, user_conditions) - end - - def skip?(arg) - arg.halted || !@user_conditions.all? { |c| c.call(arg.target, arg.value) } - end - - attr_reader :nested - - def final? - !@call_template - end - - def expand_call_template(arg, block) - @call_template.expand(arg.target, arg.value, block) - end - - def invoke_before(arg) - @before&.each { |b| b.call(arg) } - end - - def invoke_after(arg) - @after&.each { |a| a.call(arg) } - end - end - - class CallbackChain # :nodoc: - include Enumerable - - attr_reader :name, :config - - def initialize(name, config) - @name = name - @config = { - scope: [:kind], - terminator: DEFAULT_TERMINATOR - }.merge!(config) - @chain = [] - @all_callbacks = nil - @single_callbacks = {} - @mutex = Mutex.new - end - - def each(&block); @chain.each(&block); end - def index(o); @chain.index(o); end - def empty?; @chain.empty?; end - - def insert(index, o) - @all_callbacks = nil - @single_callbacks.clear - @chain.insert(index, o) - end - - def delete(o) - @all_callbacks = nil - @single_callbacks.clear - @chain.delete(o) - end - - def clear - @all_callbacks = nil - @single_callbacks.clear - @chain.clear - self - end - - def initialize_copy(other) - @all_callbacks = nil - @single_callbacks = {} - @chain = other.chain.dup - @mutex = Mutex.new - end - - def compile(type) - if type.nil? - @all_callbacks || @mutex.synchronize do - final_sequence = CallbackSequence.new - @all_callbacks ||= @chain.reverse.inject(final_sequence) do |callback_sequence, callback| - callback.apply(callback_sequence) - end - end - else - @single_callbacks[type] || @mutex.synchronize do - final_sequence = CallbackSequence.new - @single_callbacks[type] ||= @chain.reverse.inject(final_sequence) do |callback_sequence, callback| - type == callback.kind ? callback.apply(callback_sequence) : callback_sequence - end - end - end - end - - def append(*callbacks) - callbacks.each { |c| append_one(c) } - end - - def prepend(*callbacks) - callbacks.each { |c| prepend_one(c) } - end - - protected - attr_reader :chain - - private - def append_one(callback) - @all_callbacks = nil - @single_callbacks.clear - remove_duplicates(callback) - @chain.push(callback) - end - - def prepend_one(callback) - @all_callbacks = nil - @single_callbacks.clear - remove_duplicates(callback) - @chain.unshift(callback) - end - - def remove_duplicates(callback) - @all_callbacks = nil - @single_callbacks.clear - @chain.delete_if { |c| callback.duplicates?(c) } - end - - class DefaultTerminator # :nodoc: - def call(target, result_lambda) - terminate = true - catch(:abort) do - result_lambda.call - terminate = false - end - terminate - end - end - DEFAULT_TERMINATOR = DefaultTerminator.new.freeze - end - - module ClassMethods - def normalize_callback_params(filters, block) # :nodoc: - type = CALLBACK_FILTER_TYPES.include?(filters.first) ? filters.shift : :before - options = filters.extract_options! - filters.unshift(block) if block - [type, filters, options.dup] - end - - # This is used internally to append, prepend and skip callbacks to the - # CallbackChain. - def __update_callbacks(name) # :nodoc: - self.descendants.prepend(self).reverse_each do |target| - chain = target.get_callbacks name - yield target, chain.dup - end - end - - # Install a callback for the given event. - # - # set_callback :save, :before, :before_method - # set_callback :save, :after, :after_method, if: :condition - # set_callback :save, :around, ->(r, block) { stuff; result = block.call; stuff } - # - # The second argument indicates whether the callback is to be run +:before+, - # +:after+, or +:around+ the event. If omitted, +:before+ is assumed. This - # means the first example above can also be written as: - # - # set_callback :save, :before_method - # - # The callback can be specified as a symbol naming an instance method; as a - # proc, lambda, or block; or as an object that responds to a certain method - # determined by the :scope argument to #define_callbacks. - # - # If a proc, lambda, or block is given, its body is evaluated in the context - # of the current object. It can also optionally accept the current object as - # an argument. - # - # Before and around callbacks are called in the order that they are set; - # after callbacks are called in the reverse order. - # - # Around callbacks can access the return value from the event, if it - # wasn't halted, from the +yield+ call. - # - # ===== Options - # - # * :if - A symbol or an array of symbols, each naming an instance - # method or a proc; the callback will be called only when they all return - # a true value. - # - # If a proc is given, its body is evaluated in the context of the - # current object. It can also optionally accept the current object as - # an argument. - # * :unless - A symbol or an array of symbols, each naming an - # instance method or a proc; the callback will be called only when they - # all return a false value. - # - # If a proc is given, its body is evaluated in the context of the - # current object. It can also optionally accept the current object as - # an argument. - # * :prepend - If +true+, the callback will be prepended to the - # existing chain rather than appended. - def set_callback(name, *filter_list, &block) - type, filters, options = normalize_callback_params(filter_list, block) - - self_chain = get_callbacks name - mapped = filters.map do |filter| - Callback.build(self_chain, filter, type, options) - end - - __update_callbacks(name) do |target, chain| - options[:prepend] ? chain.prepend(*mapped) : chain.append(*mapped) - target.set_callbacks name, chain - end - end - - # Skip a previously set callback. Like #set_callback, :if or - # :unless options may be passed in order to control when the - # callback is skipped. - # - # Note: this example uses +PersonRecord+ and +#saving_message+, which you - # can see defined here[rdoc-ref:ActiveSupport::Callbacks] - # - # class Writer < PersonRecord - # attr_accessor :age - # skip_callback :save, :before, :saving_message, if: -> { age > 18 } - # end - # - # When if option returns true, callback is skipped. - # - # writer = Writer.new - # writer.age = 20 - # writer.save - # - # Output: - # - save - # saved - # - # When if option returns false, callback is NOT skipped. - # - # young_writer = Writer.new - # young_writer.age = 17 - # young_writer.save - # - # Output: - # saving... - # - save - # saved - # - # An ArgumentError will be raised if the callback has not - # already been set (unless the :raise option is set to false). - def skip_callback(name, *filter_list, &block) - type, filters, options = normalize_callback_params(filter_list, block) - - options[:raise] = true unless options.key?(:raise) - - __update_callbacks(name) do |target, chain| - filters.each do |filter| - callback = chain.find { |c| c.matches?(type, filter) } - - if !callback && options[:raise] - raise ArgumentError, "#{type.to_s.capitalize} #{name} callback #{filter.inspect} has not been defined" - end - - if callback && (options.key?(:if) || options.key?(:unless)) - new_callback = callback.merge_conditional_options(chain, if_option: options[:if], unless_option: options[:unless]) - chain.insert(chain.index(callback), new_callback) - end - - chain.delete(callback) - end - target.set_callbacks name, chain - end - end - - # Remove all set callbacks for the given event. - def reset_callbacks(name) - callbacks = get_callbacks name - - self.descendants.each do |target| - chain = target.get_callbacks(name).dup - callbacks.each { |c| chain.delete(c) } - target.set_callbacks name, chain - end - - set_callbacks(name, callbacks.dup.clear) - end - - # Define sets of events in the object life cycle that support callbacks. - # - # define_callbacks :validate - # define_callbacks :initialize, :save, :destroy - # - # ===== Options - # - # * :terminator - Determines when a before filter will halt the - # callback chain, preventing following before and around callbacks from - # being called and the event from being triggered. - # This should be a lambda to be executed. - # The current object and the result lambda of the callback will be provided - # to the terminator lambda. - # - # define_callbacks :validate, terminator: ->(target, result_lambda) { result_lambda.call == false } - # - # In this example, if any before validate callbacks returns +false+, - # any successive before and around callback is not executed. - # - # The default terminator halts the chain when a callback throws +:abort+. - # - # * :skip_after_callbacks_if_terminated - Determines if after - # callbacks should be terminated by the :terminator option. By - # default after callbacks are executed no matter if callback chain was - # terminated or not. This option has no effect if :terminator - # option is set to +nil+. - # - # * :scope - Indicates which methods should be executed when an - # object is used as a callback. - # - # class Audit - # def before(caller) - # puts 'Audit: before is called' - # end - # - # def before_save(caller) - # puts 'Audit: before_save is called' - # end - # end - # - # class Account - # include ActiveSupport::Callbacks - # - # define_callbacks :save - # set_callback :save, :before, Audit.new - # - # def save - # run_callbacks :save do - # puts 'save in main' - # end - # end - # end - # - # In the above case whenever you save an account the method - # Audit#before will be called. On the other hand - # - # define_callbacks :save, scope: [:kind, :name] - # - # would trigger Audit#before_save instead. That's constructed - # by calling #{kind}_#{name} on the given instance. In this - # case "kind" is "before" and "name" is "save". In this context +:kind+ - # and +:name+ have special meanings: +:kind+ refers to the kind of - # callback (before/after/around) and +:name+ refers to the method on - # which callbacks are being defined. - # - # A declaration like - # - # define_callbacks :save, scope: [:name] - # - # would call Audit#save. - # - # ===== Notes - # - # +names+ passed to +define_callbacks+ must not end with - # !, ? or =. - # - # Calling +define_callbacks+ multiple times with the same +names+ will - # overwrite previous callbacks registered with #set_callback. - def define_callbacks(*names) - options = names.extract_options! - - names.each do |name| - name = name.to_sym - - module_eval <<-RUBY, __FILE__, __LINE__ + 1 - def _run_#{name}_callbacks - yield if block_given? - end - silence_redefinition_of_method(:_run_#{name}_callbacks) - - def _run_#{name}_callbacks!(&block) - run_callbacks #{name.inspect}, &block - end - - def self._#{name}_callbacks - get_callbacks(#{name.inspect}) - end - - def self._#{name}_callbacks=(value) - set_callbacks(#{name.inspect}, value) - end - - def _#{name}_callbacks - __callbacks[#{name.inspect}] - end - RUBY - - ([self] + self.descendants).each do |target| - target.set_callbacks name, CallbackChain.new(name, options) - end - end - end - - protected - def get_callbacks(name) # :nodoc: - __callbacks[name.to_sym] - end - - def set_callbacks(name, callbacks) # :nodoc: - # HACK: We're making assumption on how `class_attribute` is implemented - # to save constantly duping the callback hash. If this desync with class_attribute - # we'll lose the optimization, but won't cause an actual behavior bug. - unless singleton_class.private_method_defined?(:__class_attr__callbacks, false) - self.__callbacks = __callbacks.dup - end - name = name.to_sym - callbacks_was = self.__callbacks[name.to_sym] - if (callbacks_was.nil? || callbacks_was.empty?) && !callbacks.empty? - alias_method("_run_#{name}_callbacks", "_run_#{name}_callbacks!") - end - self.__callbacks[name.to_sym] = callbacks - self.__callbacks - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/class_attribute.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/class_attribute.rb deleted file mode 100644 index 8aac26e..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/class_attribute.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module ClassAttribute # :nodoc: - class << self - def redefine(owner, name, namespaced_name, value) - if owner.singleton_class? - if owner.attached_object.is_a?(Module) - redefine_method(owner, namespaced_name, private: true) { value } - else - redefine_method(owner, name) { value } - end - end - - redefine_method(owner.singleton_class, namespaced_name, private: true) { value } - - redefine_method(owner.singleton_class, "#{namespaced_name}=", private: true) do |new_value| - if owner.equal?(self) - value = new_value - else - ::ActiveSupport::ClassAttribute.redefine(self, name, namespaced_name, new_value) - end - end - end - - def redefine_method(owner, name, private: false, &block) - owner.silence_redefinition_of_method(name) - owner.define_method(name, &block) - owner.send(:private, name) if private - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/code_generator.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/code_generator.rb deleted file mode 100644 index 26eabb1..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/code_generator.rb +++ /dev/null @@ -1,79 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - class CodeGenerator # :nodoc: - class MethodSet - METHOD_CACHES = Hash.new { |h, k| h[k] = Module.new } - - def initialize(namespace) - @cache = METHOD_CACHES[namespace] - @sources = [] - @methods = {} - @canonical_methods = {} - end - - def define_cached_method(canonical_name, as: nil) - canonical_name = canonical_name.to_sym - as = (as || canonical_name).to_sym - - @methods.fetch(as) do - unless @cache.method_defined?(canonical_name) || @canonical_methods[canonical_name] - yield @sources - end - @canonical_methods[canonical_name] = true - @methods[as] = canonical_name - end - end - - def apply(owner, path, line) - unless @sources.empty? - @cache.module_eval("# frozen_string_literal: true\n" + @sources.join(";"), path, line) - end - @canonical_methods.clear - - @methods.each do |as, canonical_name| - owner.define_method(as, @cache.instance_method(canonical_name)) - end - end - end - - class << self - def batch(owner, path, line) - if owner.is_a?(CodeGenerator) - yield owner - else - instance = new(owner, path, line) - result = yield instance - instance.execute - result - end - end - end - - def initialize(owner, path, line) - @owner = owner - @path = path - @line = line - @namespaces = Hash.new { |h, k| h[k] = MethodSet.new(k) } - @sources = [] - end - - def class_eval - yield @sources - end - - def define_cached_method(canonical_name, namespace:, as: nil, &block) - @namespaces[namespace].define_cached_method(canonical_name, as: as, &block) - end - - def execute - @namespaces.each_value do |method_set| - method_set.apply(@owner, @path, @line - 1) - end - - unless @sources.empty? - @owner.class_eval("# frozen_string_literal: true\n" + @sources.join(";"), @path, @line - 1) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/concern.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/concern.rb deleted file mode 100644 index 7af9c75..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/concern.rb +++ /dev/null @@ -1,217 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # = Active Support \Concern - # - # A typical module looks like this: - # - # module M - # def self.included(base) - # base.extend ClassMethods - # base.class_eval do - # scope :disabled, -> { where(disabled: true) } - # end - # end - # - # module ClassMethods - # ... - # end - # end - # - # By using +ActiveSupport::Concern+ the above module could instead be - # written as: - # - # require "active_support/concern" - # - # module M - # extend ActiveSupport::Concern - # - # included do - # scope :disabled, -> { where(disabled: true) } - # end - # - # class_methods do - # ... - # end - # end - # - # Moreover, it gracefully handles module dependencies. Given a +Foo+ module - # and a +Bar+ module which depends on the former, we would typically write the - # following: - # - # module Foo - # def self.included(base) - # base.class_eval do - # def self.method_injected_by_foo - # ... - # end - # end - # end - # end - # - # module Bar - # def self.included(base) - # base.method_injected_by_foo - # end - # end - # - # class Host - # include Foo # We need to include this dependency for Bar - # include Bar # Bar is the module that Host really needs - # end - # - # But why should +Host+ care about +Bar+'s dependencies, namely +Foo+? We - # could try to hide these from +Host+ directly including +Foo+ in +Bar+: - # - # module Bar - # include Foo - # def self.included(base) - # base.method_injected_by_foo - # end - # end - # - # class Host - # include Bar - # end - # - # Unfortunately this won't work, since when +Foo+ is included, its base - # is the +Bar+ module, not the +Host+ class. With +ActiveSupport::Concern+, - # module dependencies are properly resolved: - # - # require "active_support/concern" - # - # module Foo - # extend ActiveSupport::Concern - # included do - # def self.method_injected_by_foo - # ... - # end - # end - # end - # - # module Bar - # extend ActiveSupport::Concern - # include Foo - # - # included do - # self.method_injected_by_foo - # end - # end - # - # class Host - # include Bar # It works, now Bar takes care of its dependencies - # end - # - # === Prepending concerns - # - # Just like include, concerns also support prepend with a corresponding - # prepended do callback. module ClassMethods or class_methods do are - # prepended as well. - # - # prepend is also used for any dependencies. - module Concern - class MultipleIncludedBlocks < StandardError # :nodoc: - def initialize - super "Cannot define multiple 'included' blocks for a Concern" - end - end - - class MultiplePrependBlocks < StandardError # :nodoc: - def initialize - super "Cannot define multiple 'prepended' blocks for a Concern" - end - end - - def self.extended(base) # :nodoc: - base.instance_variable_set(:@_dependencies, []) - end - - def append_features(base) # :nodoc: - if base.instance_variable_defined?(:@_dependencies) - base.instance_variable_get(:@_dependencies) << self - false - else - return false if base < self - @_dependencies.each { |dep| base.include(dep) } - super - base.extend const_get(:ClassMethods) if const_defined?(:ClassMethods) - base.class_eval(&@_included_block) if instance_variable_defined?(:@_included_block) - end - end - - def prepend_features(base) # :nodoc: - if base.instance_variable_defined?(:@_dependencies) - base.instance_variable_get(:@_dependencies).unshift self - false - else - return false if base < self - @_dependencies.each { |dep| base.prepend(dep) } - super - base.singleton_class.prepend const_get(:ClassMethods) if const_defined?(:ClassMethods) - base.class_eval(&@_prepended_block) if instance_variable_defined?(:@_prepended_block) - end - end - - # Evaluate given block in context of base class, - # so that you can write class macros here. - # When you define more than one +included+ block, it raises an exception. - def included(base = nil, &block) - if base.nil? - if instance_variable_defined?(:@_included_block) - if @_included_block.source_location != block.source_location - raise MultipleIncludedBlocks - end - else - @_included_block = block - end - else - super - end - end - - # Evaluate given block in context of base class, - # so that you can write class macros here. - # When you define more than one +prepended+ block, it raises an exception. - def prepended(base = nil, &block) - if base.nil? - if instance_variable_defined?(:@_prepended_block) - if @_prepended_block.source_location != block.source_location - raise MultiplePrependBlocks - end - else - @_prepended_block = block - end - else - super - end - end - - # Define class methods from given block. - # You can define private class methods as well. - # - # module Example - # extend ActiveSupport::Concern - # - # class_methods do - # def foo; puts 'foo'; end - # - # private - # def bar; puts 'bar'; end - # end - # end - # - # class Buzz - # include Example - # end - # - # Buzz.foo # => "foo" - # Buzz.bar # => private method 'bar' called for Buzz:Class(NoMethodError) - def class_methods(&class_methods_module_definition) - mod = const_defined?(:ClassMethods, false) ? - const_get(:ClassMethods) : - const_set(:ClassMethods, Module.new) - - mod.module_eval(&class_methods_module_definition) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb deleted file mode 100644 index 92b3132..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -require "monitor" - -module ActiveSupport - module Concurrency - # A monitor that will permit dependency loading while blocked waiting for - # the lock. - LoadInterlockAwareMonitor = ActiveSupport::Deprecation::DeprecatedConstantProxy.new( - "ActiveSupport::Concurrency::LoadInterlockAwareMonitor", - "::Monitor", - ActiveSupport.deprecator, - message: "ActiveSupport::Concurrency::LoadInterlockAwareMonitor is deprecated and will be " \ - "removed in Rails 9.0. Use Monitor directly instead, as the loading interlock is " \ - "no longer used." - ) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/concurrency/null_lock.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/concurrency/null_lock.rb deleted file mode 100644 index 3810158..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/concurrency/null_lock.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module Concurrency - module NullLock # :nodoc: - extend self - - def synchronize - yield - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/concurrency/share_lock.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/concurrency/share_lock.rb deleted file mode 100644 index 3bfb1ae..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/concurrency/share_lock.rb +++ /dev/null @@ -1,225 +0,0 @@ -# frozen_string_literal: true - -require "monitor" - -module ActiveSupport - module Concurrency - # A share/exclusive lock, otherwise known as a read/write lock. - # - # https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock - class ShareLock - include MonitorMixin - - # We track Thread objects, instead of just using counters, because - # we need exclusive locks to be reentrant, and we need to be able - # to upgrade share locks to exclusive. - - def raw_state # :nodoc: - synchronize do - threads = @sleeping.keys | @sharing.keys | @waiting.keys - threads |= [@exclusive_thread] if @exclusive_thread - - data = {} - - threads.each do |thread| - purpose, compatible = @waiting[thread] - - data[thread] = { - thread: thread, - sharing: @sharing[thread], - exclusive: @exclusive_thread == thread, - purpose: purpose, - compatible: compatible, - waiting: !!@waiting[thread], - sleeper: @sleeping[thread], - } - end - - # NB: Yields while holding our *internal* synchronize lock, - # which is supposed to be used only for a few instructions at - # a time. This allows the caller to inspect additional state - # without things changing out from underneath, but would have - # disastrous effects upon normal operation. Fortunately, this - # method is only intended to be called when things have - # already gone wrong. - yield data - end - end - - def initialize - super() - - @cv = new_cond - - @sharing = Hash.new(0) - @waiting = {} - @sleeping = {} - @exclusive_thread = nil - @exclusive_depth = 0 - end - - # Returns false if +no_wait+ is set and the lock is not - # immediately available. Otherwise, returns true after the lock - # has been acquired. - # - # +purpose+ and +compatible+ work together; while this thread is - # waiting for the exclusive lock, it will yield its share (if any) - # to any other attempt whose +purpose+ appears in this attempt's - # +compatible+ list. This allows a "loose" upgrade, which, being - # less strict, prevents some classes of deadlocks. - # - # For many resources, loose upgrades are sufficient: if a thread - # is awaiting a lock, it is not running any other code. With - # +purpose+ matching, it is possible to yield only to other - # threads whose activity will not interfere. - def start_exclusive(purpose: nil, compatible: [], no_wait: false) - synchronize do - unless @exclusive_thread == Thread.current - if busy_for_exclusive?(purpose) - return false if no_wait - - yield_shares(purpose: purpose, compatible: compatible, block_share: true) do - wait_for(:start_exclusive) { busy_for_exclusive?(purpose) } - end - end - @exclusive_thread = Thread.current - end - @exclusive_depth += 1 - - true - end - end - - # Relinquish the exclusive lock. Must only be called by the thread - # that called start_exclusive (and currently holds the lock). - def stop_exclusive(compatible: []) - synchronize do - raise "invalid unlock" if @exclusive_thread != Thread.current - - @exclusive_depth -= 1 - if @exclusive_depth == 0 - @exclusive_thread = nil - - if eligible_waiters?(compatible) - yield_shares(compatible: compatible, block_share: true) do - wait_for(:stop_exclusive) { @exclusive_thread || eligible_waiters?(compatible) } - end - end - @cv.broadcast - end - end - end - - def start_sharing - synchronize do - if @sharing[Thread.current] > 0 || @exclusive_thread == Thread.current - # We already hold a lock; nothing to wait for - elsif @waiting[Thread.current] - # We're nested inside a +yield_shares+ call: we'll resume as - # soon as there isn't an exclusive lock in our way - wait_for(:start_sharing) { @exclusive_thread } - else - # This is an initial / outermost share call: any outstanding - # requests for an exclusive lock get to go first - wait_for(:start_sharing) { busy_for_sharing?(false) } - end - @sharing[Thread.current] += 1 - end - end - - def stop_sharing - synchronize do - if @sharing[Thread.current] > 1 - @sharing[Thread.current] -= 1 - else - @sharing.delete Thread.current - @cv.broadcast - end - end - end - - # Execute the supplied block while holding the Exclusive lock. If - # +no_wait+ is set and the lock is not immediately available, - # returns +nil+ without yielding. Otherwise, returns the result of - # the block. - # - # See +start_exclusive+ for other options. - def exclusive(purpose: nil, compatible: [], after_compatible: [], no_wait: false) - if start_exclusive(purpose: purpose, compatible: compatible, no_wait: no_wait) - begin - yield - ensure - stop_exclusive(compatible: after_compatible) - end - end - end - - # Execute the supplied block while holding the Share lock. - def sharing - start_sharing - begin - yield - ensure - stop_sharing - end - end - - # Temporarily give up all held Share locks while executing the - # supplied block, allowing any +compatible+ exclusive lock request - # to proceed. - def yield_shares(purpose: nil, compatible: [], block_share: false) - loose_shares = previous_wait = nil - synchronize do - if loose_shares = @sharing.delete(Thread.current) - if previous_wait = @waiting[Thread.current] - purpose = nil unless purpose == previous_wait[0] - compatible &= previous_wait[1] - end - compatible |= [false] unless block_share - @waiting[Thread.current] = [purpose, compatible] - end - - @cv.broadcast - end - - begin - yield - ensure - synchronize do - wait_for(:yield_shares) { @exclusive_thread && @exclusive_thread != Thread.current } - - if previous_wait - @waiting[Thread.current] = previous_wait - else - @waiting.delete Thread.current - end - @sharing[Thread.current] = loose_shares if loose_shares - end - end - end - - private - # Must be called within synchronize - def busy_for_exclusive?(purpose) - busy_for_sharing?(purpose) || - @sharing.size > (@sharing[Thread.current] > 0 ? 1 : 0) - end - - def busy_for_sharing?(purpose) - (@exclusive_thread && @exclusive_thread != Thread.current) || - @waiting.any? { |t, (_, c)| t != Thread.current && !c.include?(purpose) } - end - - def eligible_waiters?(compatible) - @waiting.any? { |t, (p, _)| compatible.include?(p) && @waiting.all? { |t2, (_, c2)| t == t2 || c2.include?(p) } } - end - - def wait_for(method, &block) - @sleeping[Thread.current] = method - @cv.wait_while(&block) - ensure - @sleeping.delete Thread.current - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/concurrency/thread_monitor.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/concurrency/thread_monitor.rb deleted file mode 100644 index d28c889..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/concurrency/thread_monitor.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module Concurrency - class ThreadMonitor # :nodoc: - EXCEPTION_NEVER = { Exception => :never }.freeze - EXCEPTION_IMMEDIATE = { Exception => :immediate }.freeze - private_constant :EXCEPTION_NEVER, :EXCEPTION_IMMEDIATE - - def initialize - @owner = nil - @count = 0 - @mutex = Mutex.new - end - - def synchronize(&block) - Thread.handle_interrupt(EXCEPTION_NEVER) do - mon_enter - - begin - Thread.handle_interrupt(EXCEPTION_IMMEDIATE, &block) - ensure - mon_exit - end - end - end - - private - def mon_try_enter - if @owner != Thread.current - return false unless @mutex.try_lock - @owner = Thread.current - end - @count += 1 - end - - def mon_enter - @mutex.lock if @owner != Thread.current - @owner = Thread.current - @count += 1 - end - - def mon_exit - unless @owner == Thread.current - raise ThreadError, "current thread not owner" - end - - @count -= 1 - return unless @count == 0 - @owner = nil - @mutex.unlock - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/configurable.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/configurable.rb deleted file mode 100644 index d6b8a7c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/configurable.rb +++ /dev/null @@ -1,193 +0,0 @@ -# frozen_string_literal: true - -ActiveSupport.deprecator.warn <<~MSG - ActiveSupport::Configurable is deprecated without replacement, and will be removed in Rails 8.2. - - The previous behavior can be emulated with `attr_accessor`s, `class_attribute`s, or combinations of `class_attribute` and `InheritableOptions` depending on requirements. -MSG - -require "active_support/concern" -require "active_support/ordered_options" - -module ActiveSupport - # = Active Support \Configurable - # - # Configurable provides a config method to store and retrieve - # configuration options as an OrderedOptions. - module Configurable - extend ActiveSupport::Concern - - class Configuration < ActiveSupport::InheritableOptions - def compile_methods! - self.class.compile_methods!(keys) - end - - # Compiles reader methods so we don't have to go through method_missing. - def self.compile_methods!(keys) - keys.reject { |m| method_defined?(m) }.each do |key| - class_eval <<-RUBY, __FILE__, __LINE__ + 1 - def #{key}; _get(#{key.inspect}); end - RUBY - end - end - end - - module ClassMethods - # Reads and writes attributes from a configuration OrderedOptions. - # - # require "active_support/configurable" - # - # class User - # include ActiveSupport::Configurable - # end - # - # User.config.allowed_access = true - # User.config.level = 1 - # - # User.config.allowed_access # => true - # User.config.level # => 1 - def config - @_config ||= if respond_to?(:superclass) && superclass.respond_to?(:config) - superclass.config.inheritable_copy - else - # create a new "anonymous" class that will host the compiled reader methods - Class.new(Configuration).new - end - end - - # Configure values from within the passed block. - # - # require "active_support/configurable" - # - # class User - # include ActiveSupport::Configurable - # end - # - # User.config.allowed_access # => nil - # - # User.configure do |config| - # config.allowed_access = true - # end - # - # User.config.allowed_access # => true - def configure - yield config - end - - # Allows you to add shortcut so that you don't have to refer to attribute - # through config. Also look at the example for config to contrast. - # - # Defines both class and instance config accessors. - # - # class User - # include ActiveSupport::Configurable - # config_accessor :allowed_access - # end - # - # User.allowed_access # => nil - # User.allowed_access = false - # User.allowed_access # => false - # - # user = User.new - # user.allowed_access # => false - # user.allowed_access = true - # user.allowed_access # => true - # - # User.allowed_access # => false - # - # The attribute name must be a valid method name in Ruby. - # - # class User - # include ActiveSupport::Configurable - # config_accessor :"1_Badname" - # end - # # => NameError: invalid config attribute name - # - # To omit the instance writer method, pass instance_writer: false. - # To omit the instance reader method, pass instance_reader: false. - # - # class User - # include ActiveSupport::Configurable - # config_accessor :allowed_access, instance_reader: false, instance_writer: false - # end - # - # User.allowed_access = false - # User.allowed_access # => false - # - # User.new.allowed_access = true # => NoMethodError - # User.new.allowed_access # => NoMethodError - # - # Or pass instance_accessor: false, to omit both instance methods. - # - # class User - # include ActiveSupport::Configurable - # config_accessor :allowed_access, instance_accessor: false - # end - # - # User.allowed_access = false - # User.allowed_access # => false - # - # User.new.allowed_access = true # => NoMethodError - # User.new.allowed_access # => NoMethodError - # - # Also you can pass default or a block to set up the attribute with a default value. - # - # class User - # include ActiveSupport::Configurable - # config_accessor :allowed_access, default: false - # config_accessor :hair_colors do - # [:brown, :black, :blonde, :red] - # end - # end - # - # User.allowed_access # => false - # User.hair_colors # => [:brown, :black, :blonde, :red] - def config_accessor(*names, instance_reader: true, instance_writer: true, instance_accessor: true, default: nil) # :doc: - names.each do |name| - raise NameError.new("invalid config attribute name") unless /\A[_A-Za-z]\w*\z/.match?(name) - - reader, reader_line = "def #{name}; config.#{name}; end", __LINE__ - writer, writer_line = "def #{name}=(value); config.#{name} = value; end", __LINE__ - - singleton_class.class_eval reader, __FILE__, reader_line - singleton_class.class_eval writer, __FILE__, writer_line - - if instance_accessor - class_eval reader, __FILE__, reader_line if instance_reader - class_eval writer, __FILE__, writer_line if instance_writer - end - - send("#{name}=", block_given? ? yield : default) - end - end - private :config_accessor - - private - def inherited(subclass) - super - subclass.class_eval do - @_config = nil - end - end - end - - # Reads and writes attributes from a configuration OrderedOptions. - # - # require "active_support/configurable" - # - # class User - # include ActiveSupport::Configurable - # end - # - # user = User.new - # - # user.config.allowed_access = true - # user.config.level = 1 - # - # user.config.allowed_access # => true - # user.config.level # => 1 - def config - @_config ||= self.class.config.inheritable_copy - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/configuration_file.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/configuration_file.rb deleted file mode 100644 index 78cb1c6..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/configuration_file.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # Reads a YAML configuration file, evaluating any ERB, then - # parsing the resulting YAML. - # - # Warns in case of YAML confusing characters, like invisible - # non-breaking spaces. - class ConfigurationFile # :nodoc: - class FormatError < StandardError; end - - def initialize(content_path) - @content_path = content_path.to_s - @content = read content_path - end - - def self.parse(content_path, **options) - new(content_path).parse(**options) - end - - def parse(context: nil, **options) - source = @content.include?("<%") ? render(context) : @content - - if source == @content - if YAML.respond_to?(:unsafe_load) - YAML.unsafe_load_file(@content_path, **options) || {} - else - YAML.load_file(@content_path, **options) || {} - end - else - if YAML.respond_to?(:unsafe_load) - YAML.unsafe_load(source, **options) || {} - else - YAML.load(source, **options) || {} - end - end - rescue Psych::SyntaxError => error - raise "YAML syntax error occurred while parsing #{@content_path}. " \ - "Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \ - "Error: #{error.message}" - end - - private - def read(content_path) - require "yaml" unless defined?(YAML) - - File.read(content_path).tap do |content| - if content.include?("\u00A0") - warn "#{content_path} contains invisible non-breaking spaces, you may want to remove those" - end - end - end - - def render(context) - require "erb" unless defined?(ERB) - erb = ERB.new(@content).tap { |e| e.filename = @content_path } - context ? erb.result(context) : erb.result - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/continuous_integration.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/continuous_integration.rb deleted file mode 100644 index c88d3e1..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/continuous_integration.rb +++ /dev/null @@ -1,145 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # Provides a DSL for declaring a continuous integration workflow that can be run either locally or in the cloud. - # Each step is timed, reports success/error, and is aggregated into a collective report that reports total runtime, - # as well as whether the entire run was successful or not. - # - # Example: - # - # ActiveSupport::ContinuousIntegration.run do - # step "Setup", "bin/setup --skip-server" - # step "Style: Ruby", "bin/rubocop" - # step "Security: Gem audit", "bin/bundler-audit" - # step "Tests: Rails", "bin/rails test test:system" - # - # if success? - # step "Signoff: Ready for merge and deploy", "gh signoff" - # else - # failure "Skipping signoff; CI failed.", "Fix the issues and try again." - # end - # end - # - # Starting with Rails 8.1, a default `bin/ci` and `config/ci.rb` file are created to provide out-of-the-box CI. - class ContinuousIntegration - COLORS = { - banner: "\033[1;32m", # Green - title: "\033[1;35m", # Purple - subtitle: "\033[1;90m", # Medium Gray - error: "\033[1;31m", # Red - success: "\033[1;32m" # Green - } - - attr_reader :results - - # Perform a CI run. Execute each step, show their results and runtime, and exit with a non-zero status if there are any failures. - # - # Pass an optional title, subtitle, and a block that declares the steps to be executed. - # - # Sets the CI environment variable to "true" to allow for conditional behavior in the app, like enabling eager loading and disabling logging. - # - # Example: - # - # ActiveSupport::ContinuousIntegration.run do - # step "Setup", "bin/setup --skip-server" - # step "Style: Ruby", "bin/rubocop" - # step "Security: Gem audit", "bin/bundler-audit" - # step "Tests: Rails", "bin/rails test test:system" - # - # if success? - # step "Signoff: Ready for merge and deploy", "gh signoff" - # else - # failure "Skipping signoff; CI failed.", "Fix the issues and try again." - # end - # end - def self.run(title = "Continuous Integration", subtitle = "Running tests, style checks, and security audits", &block) - new.tap do |ci| - ENV["CI"] = "true" - ci.heading title, subtitle, padding: false - ci.report(title, &block) - abort unless ci.success? - end - end - - def initialize - @results = [] - end - - # Declare a step with a title and a command. The command can either be given as a single string or as multiple - # strings that will be passed to `system` as individual arguments (and therefore correctly escaped for paths etc). - # - # Examples: - # - # step "Setup", "bin/setup" - # step "Single test", "bin/rails", "test", "--name", "test_that_is_one" - def step(title, *command) - heading title, command.join(" "), type: :title - report(title) { results << system(*command) } - end - - # Returns true if all steps were successful. - def success? - results.all? - end - - # Display an error heading with the title and optional subtitle to reflect that the run failed. - def failure(title, subtitle = nil) - heading title, subtitle, type: :error - end - - # Display a colorized heading followed by an optional subtitle. - # - # Examples: - # - # heading "Smoke Testing", "End-to-end tests verifying key functionality", padding: false - # heading "Skipping video encoding tests", "Install FFmpeg to run these tests", type: :error - # - # See ActiveSupport::ContinuousIntegration::COLORS for a complete list of options. - def heading(heading, subtitle = nil, type: :banner, padding: true) - echo "#{padding ? "\n\n" : ""}#{heading}", type: type - echo "#{subtitle}#{padding ? "\n" : ""}", type: :subtitle if subtitle - end - - # Echo text to the terminal in the color corresponding to the type of the text. - # - # Examples: - # - # echo "This is going to be green!", type: :success - # echo "This is going to be red!", type: :error - # - # See ActiveSupport::ContinuousIntegration::COLORS for a complete list of options. - def echo(text, type:) - puts colorize(text, type) - end - - # :nodoc: - def report(title, &block) - Signal.trap("INT") { abort colorize(:error, "\n❌ #{title} interrupted") } - - ci = self.class.new - elapsed = timing { ci.instance_eval(&block) } - - if ci.success? - echo "\n✅ #{title} passed in #{elapsed}", type: :success - else - echo "\n❌ #{title} failed in #{elapsed}", type: :error - end - - results.concat ci.results - ensure - Signal.trap("INT", "-") - end - - private - def timing - started_at = Time.now.to_f - yield - min, sec = (Time.now.to_f - started_at).divmod(60) - "#{"#{min}m" if min > 0}%.2fs" % sec - end - - def colorize(text, type) - "#{COLORS.fetch(type)}#{text}\033[0m" - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext.rb deleted file mode 100644 index 3f5d081..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -Dir.glob(File.expand_path("core_ext/*.rb", __dir__)).sort.each do |path| - require path -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array.rb deleted file mode 100644 index 913c798..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -require_relative "array/wrap" -require_relative "array/access" -require_relative "array/conversions" -require_relative "array/extract" -require_relative "array/extract_options" -require_relative "array/grouping" -require_relative "array/inquiry" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/access.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/access.rb deleted file mode 100644 index 8f36669..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/access.rb +++ /dev/null @@ -1,100 +0,0 @@ -# frozen_string_literal: true - -class Array - # Returns the tail of the array from +position+. - # - # %w( a b c d ).from(0) # => ["a", "b", "c", "d"] - # %w( a b c d ).from(2) # => ["c", "d"] - # %w( a b c d ).from(10) # => [] - # %w().from(0) # => [] - # %w( a b c d ).from(-2) # => ["c", "d"] - # %w( a b c ).from(-10) # => [] - def from(position) - self[position, length] || [] - end - - # Returns the beginning of the array up to +position+. - # - # %w( a b c d ).to(0) # => ["a"] - # %w( a b c d ).to(2) # => ["a", "b", "c"] - # %w( a b c d ).to(10) # => ["a", "b", "c", "d"] - # %w().to(0) # => [] - # %w( a b c d ).to(-2) # => ["a", "b", "c"] - # %w( a b c ).to(-10) # => [] - def to(position) - if position >= 0 - take position + 1 - else - self[0..position] - end - end - - # Returns a new array that includes the passed elements. - # - # [ 1, 2, 3 ].including(4, 5) # => [ 1, 2, 3, 4, 5 ] - # [ [ 0, 1 ] ].including([ [ 1, 0 ] ]) # => [ [ 0, 1 ], [ 1, 0 ] ] - def including(*elements) - self + elements.flatten(1) - end - - # Returns a copy of the Array excluding the specified elements. - # - # ["David", "Rafael", "Aaron", "Todd"].excluding("Aaron", "Todd") # => ["David", "Rafael"] - # [ [ 0, 1 ], [ 1, 0 ] ].excluding([ [ 1, 0 ] ]) # => [ [ 0, 1 ] ] - # - # Note: This is an optimization of Enumerable#excluding that uses Array#- - # instead of Array#reject for performance reasons. - def excluding(*elements) - self - elements.flatten(1) - end - alias :without :excluding - - # Equal to self[1]. - # - # %w( a b c d e ).second # => "b" - def second - self[1] - end - - # Equal to self[2]. - # - # %w( a b c d e ).third # => "c" - def third - self[2] - end - - # Equal to self[3]. - # - # %w( a b c d e ).fourth # => "d" - def fourth - self[3] - end - - # Equal to self[4]. - # - # %w( a b c d e ).fifth # => "e" - def fifth - self[4] - end - - # Equal to self[41]. Also known as accessing "the reddit". - # - # (1..42).to_a.forty_two # => 42 - def forty_two - self[41] - end - - # Equal to self[-3]. - # - # %w( a b c d e ).third_to_last # => "c" - def third_to_last - self[-3] - end - - # Equal to self[-2]. - # - # %w( a b c d e ).second_to_last # => "d" - def second_to_last - self[-2] - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/conversions.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/conversions.rb deleted file mode 100644 index 125a67d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/conversions.rb +++ /dev/null @@ -1,213 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/hash/keys" -require "active_support/core_ext/string/inflections" -require "active_support/core_ext/object/to_param" -require "active_support/core_ext/object/to_query" - -class Array - # Converts the array to a comma-separated sentence where the last element is - # joined by the connector word. - # - # You can pass the following options to change the default behavior. If you - # pass an option key that doesn't exist in the list below, it will raise an - # ArgumentError. - # - # ==== Options - # - # * :words_connector - The sign or word used to join all but the last - # element in arrays with three or more elements (default: ", "). - # * :last_word_connector - The sign or word used to join the last element - # in arrays with three or more elements (default: ", and "). - # * :two_words_connector - The sign or word used to join the elements - # in arrays with two elements (default: " and "). - # * :locale - If +i18n+ is available, you can set a locale and use - # the connector options defined on the 'support.array' namespace in the - # corresponding dictionary file. - # - # ==== Examples - # - # [].to_sentence # => "" - # ['one'].to_sentence # => "one" - # ['one', 'two'].to_sentence # => "one and two" - # ['one', 'two', 'three'].to_sentence # => "one, two, and three" - # - # ['one', 'two'].to_sentence(passing: 'invalid option') - # # => ArgumentError: Unknown key: :passing. Valid keys are: :words_connector, :two_words_connector, :last_word_connector, :locale - # - # ['one', 'two'].to_sentence(two_words_connector: '-') - # # => "one-two" - # - # ['one', 'two', 'three'].to_sentence(words_connector: ' or ', last_word_connector: ' or at least ') - # # => "one or two or at least three" - # - # Using :locale option: - # - # # Given this locale dictionary: - # # - # # es: - # # support: - # # array: - # # words_connector: " o " - # # two_words_connector: " y " - # # last_word_connector: " o al menos " - # - # ['uno', 'dos'].to_sentence(locale: :es) - # # => "uno y dos" - # - # ['uno', 'dos', 'tres'].to_sentence(locale: :es) - # # => "uno o dos o al menos tres" - def to_sentence(options = {}) - options.assert_valid_keys(:words_connector, :two_words_connector, :last_word_connector, :locale) - - default_connectors = { - words_connector: ", ", - two_words_connector: " and ", - last_word_connector: ", and " - } - if options[:locale] != false && defined?(I18n) - i18n_connectors = I18n.translate(:'support.array', locale: options[:locale], default: {}) - default_connectors.merge!(i18n_connectors) - end - options = default_connectors.merge!(options) - - case length - when 0 - +"" - when 1 - +"#{self[0]}" - when 2 - +"#{self[0]}#{options[:two_words_connector]}#{self[1]}" - else - +"#{self[0...-1].join(options[:words_connector])}#{options[:last_word_connector]}#{self[-1]}" - end - end - - # Extends Array#to_s to convert a collection of elements into a - # comma separated id list if :db argument is given as the format. - # - # This method is aliased to to_formatted_s. - # - # Blog.all.to_fs(:db) # => "1,2,3" - # Blog.none.to_fs(:db) # => "null" - # [1,2].to_fs # => "[1, 2]" - def to_fs(format = :default) - case format - when :db - if empty? - "null" - else - collect(&:id).join(",") - end - else - to_s - end - end - alias_method :to_formatted_s, :to_fs - - # Returns a string that represents the array in XML by invoking +to_xml+ - # on each element. Active Record collections delegate their representation - # in XML to this method. - # - # All elements are expected to respond to +to_xml+, if any of them does - # not then an exception is raised. - # - # The root node reflects the class name of the first element in plural - # if all elements belong to the same type and that's not Hash: - # - # customer.projects.to_xml - # - # - # - # - # 20000.0 - # 1567 - # 2008-04-09 - # ... - # - # - # 57230.0 - # 1567 - # 2008-04-15 - # ... - # - # - # - # Otherwise the root element is "objects": - # - # [{ foo: 1, bar: 2}, { baz: 3}].to_xml - # - # - # - # - # 2 - # 1 - # - # - # 3 - # - # - # - # If the collection is empty the root element is "nil-classes" by default: - # - # [].to_xml - # - # - # - # - # To ensure a meaningful root element use the :root option: - # - # customer_with_no_projects.projects.to_xml(root: 'projects') - # - # - # - # - # By default name of the node for the children of root is root.singularize. - # You can change it with the :children option. - # - # The +options+ hash is passed downwards: - # - # Message.all.to_xml(skip_types: true) - # - # - # - # - # 2008-03-07T09:58:18+01:00 - # 1 - # 1 - # 2008-03-07T09:58:18+01:00 - # 1 - # - # - # - def to_xml(options = {}) - require "active_support/builder" unless defined?(Builder::XmlMarkup) - - options = options.dup - options[:indent] ||= 2 - options[:builder] ||= Builder::XmlMarkup.new(indent: options[:indent]) - options[:root] ||= \ - if first.class != Hash && all?(first.class) - underscored = ActiveSupport::Inflector.underscore(first.class.name) - ActiveSupport::Inflector.pluralize(underscored).tr("/", "_") - else - "objects" - end - - builder = options[:builder] - builder.instruct! unless options.delete(:skip_instruct) - - root = ActiveSupport::XmlMini.rename_key(options[:root].to_s, options) - children = options.delete(:children) || root.singularize - attributes = options[:skip_types] ? {} : { type: "array" } - - if empty? - builder.tag!(root, attributes) - else - builder.tag!(root, attributes) do - each { |value| ActiveSupport::XmlMini.to_tag(children, value, options) } - yield builder if block_given? - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/extract.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/extract.rb deleted file mode 100644 index cc5a8a3..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/extract.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class Array - # Removes and returns the elements for which the block returns a true value. - # If no block is given, an Enumerator is returned instead. - # - # numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - # odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9] - # numbers # => [0, 2, 4, 6, 8] - def extract! - return to_enum(:extract!) { size } unless block_given? - - extracted_elements = [] - - reject! do |element| - extracted_elements << element if yield(element) - end - - extracted_elements - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/extract_options.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/extract_options.rb deleted file mode 100644 index 8c7cb2e..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/extract_options.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class Hash - # By default, only instances of Hash itself are extractable. - # Subclasses of Hash may implement this method and return - # true to declare themselves as extractable. If a Hash - # is extractable, Array#extract_options! pops it from - # the Array when it is the last element of the Array. - def extractable_options? - instance_of?(Hash) - end -end - -class Array - # Extracts options from a set of arguments. Removes and returns the last - # element in the array if it's a hash, otherwise returns a blank hash. - # - # def options(*args) - # args.extract_options! - # end - # - # options(1, 2) # => {} - # options(1, 2, a: :b) # => {:a=>:b} - def extract_options! - if last.is_a?(Hash) && last.extractable_options? - pop - else - {} - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/grouping.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/grouping.rb deleted file mode 100644 index 36993e0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/grouping.rb +++ /dev/null @@ -1,109 +0,0 @@ -# frozen_string_literal: true - -class Array - # Splits or iterates over the array in groups of size +number+, - # padding any remaining slots with +fill_with+ unless it is +false+. - # - # %w(1 2 3 4 5 6 7 8 9 10).in_groups_of(3) {|group| p group} - # ["1", "2", "3"] - # ["4", "5", "6"] - # ["7", "8", "9"] - # ["10", nil, nil] - # - # %w(1 2 3 4 5).in_groups_of(2, ' ') {|group| p group} - # ["1", "2"] - # ["3", "4"] - # ["5", " "] - # - # %w(1 2 3 4 5).in_groups_of(2, false) {|group| p group} - # ["1", "2"] - # ["3", "4"] - # ["5"] - def in_groups_of(number, fill_with = nil, &block) - if number.to_i <= 0 - raise ArgumentError, - "Group size must be a positive integer, was #{number.inspect}" - end - - if fill_with == false - collection = self - else - # size % number gives how many extra we have; - # subtracting from number gives how many to add; - # modulo number ensures we don't add group of just fill. - padding = (number - size % number) % number - collection = dup.concat(Array.new(padding, fill_with)) - end - - if block_given? - collection.each_slice(number, &block) - else - collection.each_slice(number).to_a - end - end - - # Splits or iterates over the array in +number+ of groups, padding any - # remaining slots with +fill_with+ unless it is +false+. - # - # %w(1 2 3 4 5 6 7 8 9 10).in_groups(3) {|group| p group} - # ["1", "2", "3", "4"] - # ["5", "6", "7", nil] - # ["8", "9", "10", nil] - # - # %w(1 2 3 4 5 6 7 8 9 10).in_groups(3, ' ') {|group| p group} - # ["1", "2", "3", "4"] - # ["5", "6", "7", " "] - # ["8", "9", "10", " "] - # - # %w(1 2 3 4 5 6 7).in_groups(3, false) {|group| p group} - # ["1", "2", "3"] - # ["4", "5"] - # ["6", "7"] - def in_groups(number, fill_with = nil, &block) - # size.div number gives minor group size; - # size % number gives how many objects need extra accommodation; - # each group hold either division or division + 1 items. - division = size.div number - modulo = size % number - - # create a new array avoiding dup - groups = [] - start = 0 - - number.times do |index| - length = division + (modulo > 0 && modulo > index ? 1 : 0) - groups << last_group = slice(start, length) - last_group << fill_with if fill_with != false && - modulo > 0 && length == division - start += length - end - - if block_given? - groups.each(&block) - else - groups - end - end - - # Divides the array into one or more subarrays based on a delimiting +value+ - # or the result of an optional block. - # - # [1, 2, 3, 4, 5].split(3) # => [[1, 2], [4, 5]] - # (1..10).to_a.split { |i| i % 3 == 0 } # => [[1, 2], [4, 5], [7, 8], [10]] - def split(value = nil, &block) - arr = dup - result = [] - if block_given? - while (idx = arr.index(&block)) - result << arr.shift(idx) - arr.shift - end - else - while (idx = arr.index(value)) - result << arr.shift(idx) - arr.shift - end - end - result << arr - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/inquiry.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/inquiry.rb deleted file mode 100644 index 650b106..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/inquiry.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -require "active_support/array_inquirer" - -class Array - # Wraps the array in an ActiveSupport::ArrayInquirer object, which gives a - # friendlier way to check its string-like contents. - # - # pets = [:cat, :dog].inquiry - # - # pets.cat? # => true - # pets.ferret? # => false - # - # pets.any?(:cat, :ferret) # => true - # pets.any?(:ferret, :alligator) # => false - def inquiry - ActiveSupport::ArrayInquirer.new(self) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/wrap.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/wrap.rb deleted file mode 100644 index d62f97e..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/array/wrap.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -class Array - # Wraps its argument in an array unless it is already an array (or array-like). - # - # Specifically: - # - # * If the argument is +nil+ an empty array is returned. - # * Otherwise, if the argument responds to +to_ary+ it is invoked, and its result returned. - # * Otherwise, returns an array with the argument as its single element. - # - # Array.wrap(nil) # => [] - # Array.wrap([1, 2, 3]) # => [1, 2, 3] - # Array.wrap(0) # => [0] - # - # This method is similar in purpose to Kernel#Array, but there are some differences: - # - # * If the argument responds to +to_ary+ the method is invoked. Kernel#Array - # moves on to try +to_a+ if the returned value is +nil+, but Array.wrap returns - # an array with the argument as its single element right away. - # * If the returned value from +to_ary+ is neither +nil+ nor an +Array+ object, Kernel#Array - # raises an exception, while Array.wrap does not, it just returns the value. - # * It does not call +to_a+ on the argument, if the argument does not respond to +to_ary+ - # it returns an array with the argument as its single element. - # - # The last point is easily explained with some enumerables: - # - # Array(foo: :bar) # => [[:foo, :bar]] - # Array.wrap(foo: :bar) # => [{:foo=>:bar}] - # - # There's also a related idiom that uses the splat operator: - # - # [*object] - # - # which returns [] for +nil+, but calls to Array(object) otherwise. - # - # The differences with Kernel#Array explained above - # apply to the rest of objects. - def self.wrap(object) - if object.nil? - [] - elsif object.respond_to?(:to_ary) - object.to_ary || [object] - else - [object] - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/benchmark.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/benchmark.rb deleted file mode 100644 index 8e9b8f9..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/benchmark.rb +++ /dev/null @@ -1 +0,0 @@ -# frozen_string_literal: true diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/big_decimal.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/big_decimal.rb deleted file mode 100644 index 5568db6..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/big_decimal.rb +++ /dev/null @@ -1,3 +0,0 @@ -# frozen_string_literal: true - -require_relative "big_decimal/conversions" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/big_decimal/conversions.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/big_decimal/conversions.rb deleted file mode 100644 index 76ad584..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/big_decimal/conversions.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -require "bigdecimal" -require "bigdecimal/util" - -module ActiveSupport - module BigDecimalWithDefaultFormat # :nodoc: - def to_s(format = "F") - super(format) - end - end -end - -BigDecimal.prepend(ActiveSupport::BigDecimalWithDefaultFormat) diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/class.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/class.rb deleted file mode 100644 index 65e1d68..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/class.rb +++ /dev/null @@ -1,4 +0,0 @@ -# frozen_string_literal: true - -require_relative "class/attribute" -require_relative "class/subclasses" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/class/attribute.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/class/attribute.rb deleted file mode 100644 index e52bf99..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/class/attribute.rb +++ /dev/null @@ -1,137 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/module/redefine_method" -require "active_support/class_attribute" - -class Class - # Declare a class-level attribute whose value is inheritable by subclasses. - # Subclasses can change their own value and it will not impact parent class. - # - # ==== Options - # - # * :instance_reader - Sets the instance reader method (defaults to true). - # * :instance_writer - Sets the instance writer method (defaults to true). - # * :instance_accessor - Sets both instance methods (defaults to true). - # * :instance_predicate - Sets a predicate method (defaults to true). - # * :default - Sets a default value for the attribute (defaults to nil). - # - # ==== Examples - # - # class Base - # class_attribute :setting - # end - # - # class Subclass < Base - # end - # - # Base.setting = true - # Subclass.setting # => true - # Subclass.setting = false - # Subclass.setting # => false - # Base.setting # => true - # - # In the above case as long as Subclass does not assign a value to setting - # by performing Subclass.setting = _something_, Subclass.setting - # would read value assigned to parent class. Once Subclass assigns a value then - # the value assigned by Subclass would be returned. - # - # This matches normal Ruby method inheritance: think of writing an attribute - # on a subclass as overriding the reader method. However, you need to be aware - # when using +class_attribute+ with mutable structures as +Array+ or +Hash+. - # In such cases, you don't want to do changes in place. Instead use setters: - # - # Base.setting = [] - # Base.setting # => [] - # Subclass.setting # => [] - # - # # Appending in child changes both parent and child because it is the same object: - # Subclass.setting << :foo - # Base.setting # => [:foo] - # Subclass.setting # => [:foo] - # - # # Use setters to not propagate changes: - # Base.setting = [] - # Subclass.setting += [:foo] - # Base.setting # => [] - # Subclass.setting # => [:foo] - # - # For convenience, an instance predicate method is defined as well. - # To skip it, pass instance_predicate: false. - # - # Subclass.setting? # => false - # - # Instances may overwrite the class value in the same way: - # - # Base.setting = true - # object = Base.new - # object.setting # => true - # object.setting = false - # object.setting # => false - # Base.setting # => true - # - # To opt out of the instance reader method, pass instance_reader: false. - # - # object.setting # => NoMethodError - # object.setting? # => NoMethodError - # - # To opt out of the instance writer method, pass instance_writer: false. - # - # object.setting = false # => NoMethodError - # - # To opt out of both instance methods, pass instance_accessor: false. - # - # To set a default value for the attribute, pass default:, like so: - # - # class_attribute :settings, default: {} - def class_attribute(*attrs, instance_accessor: true, - instance_reader: instance_accessor, instance_writer: instance_accessor, instance_predicate: true, default: nil - ) - class_methods, methods = [], [] - attrs.each do |name| - unless name.is_a?(Symbol) || name.is_a?(String) - raise TypeError, "#{name.inspect} is not a symbol nor a string" - end - - name = name.to_sym - namespaced_name = :"__class_attr_#{name}" - ::ActiveSupport::ClassAttribute.redefine(self, name, namespaced_name, default) - - class_methods << "def #{name}; #{namespaced_name}; end" - class_methods << "def #{name}=(value); self.#{namespaced_name} = value; end" - - if singleton_class? - methods << <<~RUBY if instance_reader - silence_redefinition_of_method(:#{name}) - def #{name} - self.singleton_class.#{name} - end - RUBY - else - methods << <<~RUBY if instance_reader - silence_redefinition_of_method def #{name} - if defined?(@#{name}) - @#{name} - else - self.class.#{name} - end - end - RUBY - end - - methods << <<~RUBY if instance_writer - silence_redefinition_of_method(:#{name}=) - attr_writer :#{name} - RUBY - - if instance_predicate - class_methods << "silence_redefinition_of_method def #{name}?; !!self.#{name}; end" - if instance_reader - methods << "silence_redefinition_of_method def #{name}?; !!self.#{name}; end" - end - end - end - - location = caller_locations(1, 1).first - class_eval(["class << self", *class_methods, "end", *methods].join(";").tr("\n", ";"), location.path, location.lineno) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/class/attribute_accessors.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/class/attribute_accessors.rb deleted file mode 100644 index a77354e..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/class/attribute_accessors.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -# cattr_* became mattr_* aliases in 7dfbd91b0780fbd6a1dd9bfbc176e10894871d2d, -# but we keep this around for libraries that directly require it knowing they -# want cattr_*. No need to deprecate. -require "active_support/core_ext/module/attribute_accessors" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/class/subclasses.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/class/subclasses.rb deleted file mode 100644 index dd5b9e3..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/class/subclasses.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -require "active_support/descendants_tracker" - -class Class - # Returns an array with all classes that are < than its receiver. - # - # class C; end - # C.descendants # => [] - # - # class B < C; end - # C.descendants # => [B] - # - # class A < B; end - # C.descendants # => [B, A] - # - # class D < C; end - # C.descendants # => [B, A, D] - def descendants - subclasses.concat(subclasses.flat_map(&:descendants)) - end - - prepend ActiveSupport::DescendantsTracker::ReloadedClassesFiltering -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date.rb deleted file mode 100644 index 2a2ed54..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -require_relative "date/acts_like" -require_relative "date/blank" -require_relative "date/calculations" -require_relative "date/conversions" -require_relative "date/zones" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date/acts_like.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date/acts_like.rb deleted file mode 100644 index c8077f3..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date/acts_like.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/acts_like" - -class Date - # Duck-types as a Date-like class. See Object#acts_like?. - def acts_like_date? - true - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date/blank.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date/blank.rb deleted file mode 100644 index 4419f86..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date/blank.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -require "date" - -class Date # :nodoc: - # No Date is blank: - # - # Date.today.blank? # => false - # - # @return [false] - def blank? - false - end - - def present? - true - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date/calculations.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date/calculations.rb deleted file mode 100644 index 7dea469..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date/calculations.rb +++ /dev/null @@ -1,161 +0,0 @@ -# frozen_string_literal: true - -require "date" -require "active_support/duration" -require "active_support/core_ext/object/acts_like" -require "active_support/core_ext/date/zones" -require "active_support/core_ext/time/zones" -require "active_support/core_ext/date_and_time/calculations" - -class Date - include DateAndTime::Calculations - - class << self - attr_accessor :beginning_of_week_default - - # Returns the week start (e.g. +:monday+) for the current request, if this has been set (via Date.beginning_of_week=). - # If Date.beginning_of_week has not been set for the current request, returns the week start specified in config.beginning_of_week. - # If no +config.beginning_of_week+ was specified, returns +:monday+. - def beginning_of_week - ::ActiveSupport::IsolatedExecutionState[:beginning_of_week] || beginning_of_week_default || :monday - end - - # Sets Date.beginning_of_week to a week start (e.g. +:monday+) for current request/thread. - # - # This method accepts any of the following day symbols: - # +:monday+, +:tuesday+, +:wednesday+, +:thursday+, +:friday+, +:saturday+, +:sunday+ - def beginning_of_week=(week_start) - ::ActiveSupport::IsolatedExecutionState[:beginning_of_week] = find_beginning_of_week!(week_start) - end - - # Returns week start day symbol (e.g. +:monday+), or raises an +ArgumentError+ for invalid day symbol. - def find_beginning_of_week!(week_start) - raise ArgumentError, "Invalid beginning of week: #{week_start}" unless ::Date::DAYS_INTO_WEEK.key?(week_start) - week_start - end - - # Returns a new Date representing the date 1 day ago (i.e. yesterday's date). - def yesterday - ::Date.current.yesterday - end - - # Returns a new Date representing the date 1 day after today (i.e. tomorrow's date). - def tomorrow - ::Date.current.tomorrow - end - - # Returns Time.zone.today when Time.zone or config.time_zone are set, otherwise just returns Date.today. - def current - ::Time.zone ? ::Time.zone.today : ::Date.today - end - end - - # Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00) - # and then subtracts the specified number of seconds. - def ago(seconds) - in_time_zone.since(-seconds) - end - - # Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00) - # and then adds the specified number of seconds - def since(seconds) - in_time_zone.since(seconds) - end - alias :in :since - - # Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00) - def beginning_of_day - in_time_zone - end - alias :midnight :beginning_of_day - alias :at_midnight :beginning_of_day - alias :at_beginning_of_day :beginning_of_day - - # Converts Date to a Time (or DateTime if necessary) with the time portion set to the middle of the day (12:00) - def middle_of_day - in_time_zone.middle_of_day - end - alias :midday :middle_of_day - alias :noon :middle_of_day - alias :at_midday :middle_of_day - alias :at_noon :middle_of_day - alias :at_middle_of_day :middle_of_day - - # Converts Date to a Time (or DateTime if necessary) with the time portion set to the end of the day (23:59:59) - def end_of_day - in_time_zone.end_of_day - end - alias :at_end_of_day :end_of_day - - def plus_with_duration(other) # :nodoc: - if ActiveSupport::Duration === other - other.since(self) - else - plus_without_duration(other) - end - end - alias_method :plus_without_duration, :+ - alias_method :+, :plus_with_duration - - def minus_with_duration(other) # :nodoc: - if ActiveSupport::Duration === other - plus_with_duration(-other) - else - minus_without_duration(other) - end - end - alias_method :minus_without_duration, :- - alias_method :-, :minus_with_duration - - # Provides precise Date calculations for years, months, and days. The +options+ parameter takes a hash with - # any of these keys: :years, :months, :weeks, :days. - # - # The increments are applied in order of time units from largest to smallest. - # In other words, the date is incremented first by +:years+, then by - # +:months+, then by +:weeks+, then by +:days+. This order can affect the - # result around the end of a month. For example, incrementing first by months - # then by days: - # - # Date.new(2004, 9, 30).advance(months: 1, days: 1) - # # => Sun, 31 Oct 2004 - # - # Whereas incrementing first by days then by months yields a different result: - # - # Date.new(2004, 9, 30).advance(days: 1).advance(months: 1) - # # => Mon, 01 Nov 2004 - # - def advance(options) - d = self - - d = d >> options[:years] * 12 if options[:years] - d = d >> options[:months] if options[:months] - d = d + options[:weeks] * 7 if options[:weeks] - d = d + options[:days] if options[:days] - - d - end - - # Returns a new Date where one or more of the elements have been changed according to the +options+ parameter. - # The +options+ parameter is a hash with a combination of these keys: :year, :month, :day. - # - # Date.new(2007, 5, 12).change(day: 1) # => Date.new(2007, 5, 1) - # Date.new(2007, 5, 12).change(year: 2005, month: 1) # => Date.new(2005, 1, 12) - def change(options) - ::Date.new( - options.fetch(:year, year), - options.fetch(:month, month), - options.fetch(:day, day) - ) - end - - # Allow Date to be compared with Time by converting to DateTime and relying on the <=> from there. - def compare_with_coercion(other) - if other.is_a?(Time) - to_datetime <=> other - else - compare_without_coercion(other) - end - end - alias_method :compare_without_coercion, :<=> - alias_method :<=>, :compare_with_coercion -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date/conversions.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date/conversions.rb deleted file mode 100644 index 983a3bf..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date/conversions.rb +++ /dev/null @@ -1,98 +0,0 @@ -# frozen_string_literal: true - -require "date" -require "active_support/inflector/methods" -require "active_support/core_ext/date/zones" -require "active_support/core_ext/module/redefine_method" - -class Date - DATE_FORMATS = { - short: "%d %b", - long: "%B %d, %Y", - db: "%Y-%m-%d", - inspect: "%Y-%m-%d", - number: "%Y%m%d", - long_ordinal: lambda { |date| - day_format = ActiveSupport::Inflector.ordinalize(date.day) - date.strftime("%B #{day_format}, %Y") # => "April 25th, 2007" - }, - rfc822: "%d %b %Y", - rfc2822: "%d %b %Y", - iso8601: lambda { |date| date.iso8601 } - } - - # Convert to a formatted string. See DATE_FORMATS for predefined formats. - # - # This method is aliased to to_formatted_s. - # - # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007 - # - # date.to_fs(:db) # => "2007-11-10" - # date.to_formatted_s(:db) # => "2007-11-10" - # - # date.to_fs(:short) # => "10 Nov" - # date.to_fs(:number) # => "20071110" - # date.to_fs(:long) # => "November 10, 2007" - # date.to_fs(:long_ordinal) # => "November 10th, 2007" - # date.to_fs(:rfc822) # => "10 Nov 2007" - # date.to_fs(:rfc2822) # => "10 Nov 2007" - # date.to_fs(:iso8601) # => "2007-11-10" - # - # == Adding your own date formats to to_fs - # You can add your own formats to the Date::DATE_FORMATS hash. - # Use the format name as the hash key and either a strftime string - # or Proc instance that takes a date argument as the value. - # - # # config/initializers/date_formats.rb - # Date::DATE_FORMATS[:month_and_year] = '%B %Y' - # Date::DATE_FORMATS[:short_ordinal] = ->(date) { date.strftime("%B #{date.day.ordinalize}") } - def to_fs(format = :default) - if formatter = DATE_FORMATS[format] - if formatter.respond_to?(:call) - formatter.call(self).to_s - else - strftime(formatter) - end - else - to_s - end - end - alias_method :to_formatted_s, :to_fs - - # Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005" - def readable_inspect - strftime("%a, %d %b %Y") - end - alias_method :default_inspect, :inspect - alias_method :inspect, :readable_inspect - - silence_redefinition_of_method :to_time - - # Converts a Date instance to a Time, where the time is set to the beginning of the day. - # The timezone can be either +:local+ or +:utc+ (default +:local+). - # - # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007 - # - # date.to_time # => 2007-11-10 00:00:00 0800 - # date.to_time(:local) # => 2007-11-10 00:00:00 0800 - # - # date.to_time(:utc) # => 2007-11-10 00:00:00 UTC - # - # NOTE: The +:local+ timezone is Ruby's *process* timezone, i.e. ENV['TZ']. - # If the application's timezone is needed, then use +in_time_zone+ instead. - def to_time(form = :local) - raise ArgumentError, "Expected :local or :utc, got #{form.inspect}." unless [:local, :utc].include?(form) - ::Time.public_send(form, year, month, day) - end - - silence_redefinition_of_method :xmlschema - - # Returns a string which represents the time in used time zone as DateTime - # defined by XML Schema: - # - # date = Date.new(2015, 05, 23) # => Sat, 23 May 2015 - # date.xmlschema # => "2015-05-23T00:00:00+04:00" - def xmlschema - in_time_zone.xmlschema - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date/zones.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date/zones.rb deleted file mode 100644 index 2dcf97c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date/zones.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -require "date" -require "active_support/core_ext/date_and_time/zones" - -class Date - include DateAndTime::Zones -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_and_time/calculations.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_and_time/calculations.rb deleted file mode 100644 index e713cee..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_and_time/calculations.rb +++ /dev/null @@ -1,374 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/try" -require "active_support/core_ext/date_time/conversions" - -module DateAndTime - module Calculations - DAYS_INTO_WEEK = { - sunday: 0, - monday: 1, - tuesday: 2, - wednesday: 3, - thursday: 4, - friday: 5, - saturday: 6 - } - WEEKEND_DAYS = [ 6, 0 ] - - # Returns a new date/time representing yesterday. - def yesterday - advance(days: -1) - end - - # Returns a new date/time representing tomorrow. - def tomorrow - advance(days: 1) - end - - # Returns true if the date/time is today. - def today? - to_date == ::Date.current - end - - # Returns true if the date/time is tomorrow. - def tomorrow? - to_date == ::Date.current.tomorrow - end - alias :next_day? :tomorrow? - - # Returns true if the date/time is yesterday. - def yesterday? - to_date == ::Date.current.yesterday - end - alias :prev_day? :yesterday? - - # Returns true if the date/time is in the past. - def past? - self < self.class.current - end - - # Returns true if the date/time is in the future. - def future? - self > self.class.current - end - - # Returns true if the date/time falls on a Saturday or Sunday. - def on_weekend? - WEEKEND_DAYS.include?(wday) - end - - # Returns true if the date/time does not fall on a Saturday or Sunday. - def on_weekday? - !WEEKEND_DAYS.include?(wday) - end - - # Returns true if the date/time falls before date_or_time. - def before?(date_or_time) - self < date_or_time - end - - # Returns true if the date/time falls after date_or_time. - def after?(date_or_time) - self > date_or_time - end - - # Returns a new date/time the specified number of days ago. - def days_ago(days) - advance(days: -days) - end - - # Returns a new date/time the specified number of days in the future. - def days_since(days) - advance(days: days) - end - - # Returns a new date/time the specified number of weeks ago. - def weeks_ago(weeks) - advance(weeks: -weeks) - end - - # Returns a new date/time the specified number of weeks in the future. - def weeks_since(weeks) - advance(weeks: weeks) - end - - # Returns a new date/time the specified number of months ago. - def months_ago(months) - advance(months: -months) - end - - # Returns a new date/time the specified number of months in the future. - def months_since(months) - advance(months: months) - end - - # Returns a new date/time the specified number of years ago. - def years_ago(years) - advance(years: -years) - end - - # Returns a new date/time the specified number of years in the future. - def years_since(years) - advance(years: years) - end - - # Returns a new date/time at the start of the month. - # - # today = Date.today # => Thu, 18 Jun 2015 - # today.beginning_of_month # => Mon, 01 Jun 2015 - # - # +DateTime+ objects will have a time set to 0:00. - # - # now = DateTime.current # => Thu, 18 Jun 2015 15:23:13 +0000 - # now.beginning_of_month # => Mon, 01 Jun 2015 00:00:00 +0000 - def beginning_of_month - first_hour(change(day: 1)) - end - alias :at_beginning_of_month :beginning_of_month - - # Returns a new date/time at the start of the quarter. - # - # today = Date.today # => Fri, 10 Jul 2015 - # today.beginning_of_quarter # => Wed, 01 Jul 2015 - # - # +DateTime+ objects will have a time set to 0:00. - # - # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000 - # now.beginning_of_quarter # => Wed, 01 Jul 2015 00:00:00 +0000 - def beginning_of_quarter - first_quarter_month = month - (2 + month) % 3 - beginning_of_month.change(month: first_quarter_month) - end - alias :at_beginning_of_quarter :beginning_of_quarter - - # Returns a new date/time at the end of the quarter. - # - # today = Date.today # => Fri, 10 Jul 2015 - # today.end_of_quarter # => Wed, 30 Sep 2015 - # - # +DateTime+ objects will have a time set to 23:59:59. - # - # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000 - # now.end_of_quarter # => Wed, 30 Sep 2015 23:59:59 +0000 - def end_of_quarter - last_quarter_month = month + (12 - month) % 3 - beginning_of_month.change(month: last_quarter_month).end_of_month - end - alias :at_end_of_quarter :end_of_quarter - - # Returns the quarter for a date/time. - # - # Date.new(2010, 1, 31).quarter # => 1 - # Date.new(2010, 4, 12).quarter # => 2 - # Date.new(2010, 9, 15).quarter # => 3 - # Date.new(2010, 12, 25).quarter # => 4 - def quarter - (month / 3.0).ceil - end - - # Returns a new date/time at the beginning of the year. - # - # today = Date.today # => Fri, 10 Jul 2015 - # today.beginning_of_year # => Thu, 01 Jan 2015 - # - # +DateTime+ objects will have a time set to 0:00. - # - # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000 - # now.beginning_of_year # => Thu, 01 Jan 2015 00:00:00 +0000 - def beginning_of_year - change(month: 1).beginning_of_month - end - alias :at_beginning_of_year :beginning_of_year - - # Returns a new date/time representing the given day in the next week. - # - # today = Date.today # => Thu, 07 May 2015 - # today.next_week # => Mon, 11 May 2015 - # - # The +given_day_in_next_week+ defaults to the beginning of the week - # which is determined by +Date.beginning_of_week+ or +config.beginning_of_week+ - # when set. - # - # today = Date.today # => Thu, 07 May 2015 - # today.next_week(:friday) # => Fri, 15 May 2015 - # - # +DateTime+ objects have their time set to 0:00 unless +same_time+ is true. - # - # now = DateTime.current # => Thu, 07 May 2015 13:31:16 +0000 - # now.next_week # => Mon, 11 May 2015 00:00:00 +0000 - def next_week(given_day_in_next_week = Date.beginning_of_week, same_time: false) - result = first_hour(weeks_since(1).beginning_of_week.days_since(days_span(given_day_in_next_week))) - same_time ? copy_time_to(result) : result - end - - # Returns a new date/time representing the next weekday. - def next_weekday - if next_day.on_weekend? - next_week(:monday, same_time: true) - else - next_day - end - end - - # Short-hand for months_since(3). - def next_quarter - months_since(3) - end - - # Returns a new date/time representing the given day in the previous week. - # Week is assumed to start on +start_day+, default is - # +Date.beginning_of_week+ or +config.beginning_of_week+ when set. - # DateTime objects have their time set to 0:00 unless +same_time+ is true. - def prev_week(start_day = Date.beginning_of_week, same_time: false) - result = first_hour(weeks_ago(1).beginning_of_week.days_since(days_span(start_day))) - same_time ? copy_time_to(result) : result - end - alias_method :last_week, :prev_week - - # Returns a new date/time representing the previous weekday. - def prev_weekday - if prev_day.on_weekend? - copy_time_to(beginning_of_week(:friday)) - else - prev_day - end - end - alias_method :last_weekday, :prev_weekday - - # Short-hand for months_ago(1). - def last_month - months_ago(1) - end - - # Short-hand for months_ago(3). - def prev_quarter - months_ago(3) - end - alias_method :last_quarter, :prev_quarter - - # Short-hand for years_ago(1). - def last_year - years_ago(1) - end - - # Returns the number of days to the start of the week on the given day. - # Week is assumed to start on +start_day+, default is - # +Date.beginning_of_week+ or +config.beginning_of_week+ when set. - def days_to_week_start(start_day = Date.beginning_of_week) - start_day_number = DAYS_INTO_WEEK.fetch(start_day) - (wday - start_day_number) % 7 - end - - # Returns a new date/time representing the start of this week on the given day. - # Week is assumed to start on +start_day+, default is - # +Date.beginning_of_week+ or +config.beginning_of_week+ when set. - # +DateTime+ objects have their time set to 0:00. - def beginning_of_week(start_day = Date.beginning_of_week) - result = days_ago(days_to_week_start(start_day)) - acts_like?(:time) ? result.midnight : result - end - alias :at_beginning_of_week :beginning_of_week - - # Returns Monday of this week assuming that week starts on Monday. - # +DateTime+ objects have their time set to 0:00. - def monday - beginning_of_week(:monday) - end - - # Returns a new date/time representing the end of this week on the given day. - # Week is assumed to start on +start_day+, default is - # +Date.beginning_of_week+ or +config.beginning_of_week+ when set. - # DateTime objects have their time set to 23:59:59. - def end_of_week(start_day = Date.beginning_of_week) - last_hour(days_since(6 - days_to_week_start(start_day))) - end - alias :at_end_of_week :end_of_week - - # Returns Sunday of this week assuming that week starts on Monday. - # +DateTime+ objects have their time set to 23:59:59. - def sunday - end_of_week(:monday) - end - - # Returns a new date/time representing the end of the month. - # DateTime objects will have a time set to 23:59:59. - def end_of_month - last_day = ::Time.days_in_month(month, year) - last_hour(days_since(last_day - day)) - end - alias :at_end_of_month :end_of_month - - # Returns a new date/time representing the end of the year. - # DateTime objects will have a time set to 23:59:59. - def end_of_year - change(month: 12).end_of_month - end - alias :at_end_of_year :end_of_year - - # Returns a Range representing the whole day of the current date/time. - def all_day - beginning_of_day..end_of_day - end - - # Returns a Range representing the whole week of the current date/time. - # Week starts on start_day, default is Date.beginning_of_week or config.beginning_of_week when set. - def all_week(start_day = Date.beginning_of_week) - beginning_of_week(start_day)..end_of_week(start_day) - end - - # Returns a Range representing the whole month of the current date/time. - def all_month - beginning_of_month..end_of_month - end - - # Returns a Range representing the whole quarter of the current date/time. - def all_quarter - beginning_of_quarter..end_of_quarter - end - - # Returns a Range representing the whole year of the current date/time. - def all_year - beginning_of_year..end_of_year - end - - # Returns a new date/time representing the next occurrence of the specified day of week. - # - # today = Date.today # => Thu, 14 Dec 2017 - # today.next_occurring(:monday) # => Mon, 18 Dec 2017 - # today.next_occurring(:thursday) # => Thu, 21 Dec 2017 - def next_occurring(day_of_week) - from_now = DAYS_INTO_WEEK.fetch(day_of_week) - wday - from_now += 7 unless from_now > 0 - advance(days: from_now) - end - - # Returns a new date/time representing the previous occurrence of the specified day of week. - # - # today = Date.today # => Thu, 14 Dec 2017 - # today.prev_occurring(:monday) # => Mon, 11 Dec 2017 - # today.prev_occurring(:thursday) # => Thu, 07 Dec 2017 - def prev_occurring(day_of_week) - ago = wday - DAYS_INTO_WEEK.fetch(day_of_week) - ago += 7 unless ago > 0 - advance(days: -ago) - end - - private - def first_hour(date_or_time) - date_or_time.acts_like?(:time) ? date_or_time.beginning_of_day : date_or_time - end - - def last_hour(date_or_time) - date_or_time.acts_like?(:time) ? date_or_time.end_of_day : date_or_time - end - - def days_span(day) - (DAYS_INTO_WEEK.fetch(day) - DAYS_INTO_WEEK.fetch(Date.beginning_of_week)) % 7 - end - - def copy_time_to(other) - other.change(hour: hour, min: min, sec: sec, nsec: try(:nsec)) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_and_time/compatibility.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_and_time/compatibility.rb deleted file mode 100644 index 4a4ef5b..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_and_time/compatibility.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/module/attribute_accessors" -require "active_support/core_ext/module/redefine_method" - -module DateAndTime - module Compatibility - # Change the output of ActiveSupport::TimeZone.utc_to_local. - # - # When +true+, it returns local times with a UTC offset, with +false+ local - # times are returned as UTC. - # - # # Given this zone: - # zone = ActiveSupport::TimeZone["Eastern Time (US & Canada)"] - # - # # With `utc_to_local_returns_utc_offset_times = false`, local time is converted to UTC: - # zone.utc_to_local(Time.utc(2000, 1)) # => 1999-12-31 19:00:00 UTC - # - # # With `utc_to_local_returns_utc_offset_times = true`, local time is returned with UTC offset: - # zone.utc_to_local(Time.utc(2000, 1)) # => 1999-12-31 19:00:00 -0500 - mattr_accessor :utc_to_local_returns_utc_offset_times, instance_writer: false, default: false - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_and_time/zones.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_and_time/zones.rb deleted file mode 100644 index fb6a27c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_and_time/zones.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -module DateAndTime - module Zones - # Returns the simultaneous time in Time.zone if a zone is given or - # if Time.zone_default is set. Otherwise, it returns the current time. - # - # Time.zone = 'Hawaii' # => 'Hawaii' - # Time.utc(2000).in_time_zone # => Fri, 31 Dec 1999 14:00:00 HST -10:00 - # Date.new(2000).in_time_zone # => Sat, 01 Jan 2000 00:00:00 HST -10:00 - # - # This method is similar to Time#localtime, except that it uses Time.zone as the local zone - # instead of the operating system's time zone. - # - # You can also pass in a TimeZone instance or string that identifies a TimeZone as an argument, - # and the conversion will be based on that zone instead of Time.zone. - # - # Time.utc(2000).in_time_zone('Alaska') # => Fri, 31 Dec 1999 15:00:00 AKST -09:00 - # Date.new(2000).in_time_zone('Alaska') # => Sat, 01 Jan 2000 00:00:00 AKST -09:00 - def in_time_zone(zone = ::Time.zone) - time_zone = ::Time.find_zone! zone - time = acts_like?(:time) ? self : nil - - if time_zone - time_with_zone(time, time_zone) - else - time || to_time - end - end - - private - def time_with_zone(time, zone) - if time - ActiveSupport::TimeWithZone.new(time.utc? ? time : time.getutc, zone) - else - ActiveSupport::TimeWithZone.new(nil, zone, to_time(:utc)) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_time.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_time.rb deleted file mode 100644 index b3d6773..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_time.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -require_relative "date_time/acts_like" -require_relative "date_time/blank" -require_relative "date_time/calculations" -require_relative "date_time/compatibility" -require_relative "date_time/conversions" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_time/acts_like.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_time/acts_like.rb deleted file mode 100644 index 5dccdfe..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_time/acts_like.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -require "date" -require "active_support/core_ext/object/acts_like" - -class DateTime - # Duck-types as a Date-like class. See Object#acts_like?. - def acts_like_date? - true - end - - # Duck-types as a Time-like class. See Object#acts_like?. - def acts_like_time? - true - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_time/blank.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_time/blank.rb deleted file mode 100644 index 49290bf..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_time/blank.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -require "date" - -class DateTime # :nodoc: - # No DateTime is ever blank: - # - # DateTime.now.blank? # => false - # - # @return [false] - def blank? - false - end - - def present? - true - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_time/calculations.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_time/calculations.rb deleted file mode 100644 index 926507a..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_time/calculations.rb +++ /dev/null @@ -1,216 +0,0 @@ -# frozen_string_literal: true - -require "date" - -class DateTime - class << self - # Returns Time.zone.now.to_datetime when Time.zone or - # config.time_zone are set, otherwise returns - # Time.now.to_datetime. - def current - ::Time.zone ? ::Time.zone.now.to_datetime : ::Time.now.to_datetime - end - end - - # Returns the number of seconds since 00:00:00. - # - # DateTime.new(2012, 8, 29, 0, 0, 0).seconds_since_midnight # => 0 - # DateTime.new(2012, 8, 29, 12, 34, 56).seconds_since_midnight # => 45296 - # DateTime.new(2012, 8, 29, 23, 59, 59).seconds_since_midnight # => 86399 - def seconds_since_midnight - sec + (min * 60) + (hour * 3600) - end - - # Returns the number of seconds until 23:59:59. - # - # DateTime.new(2012, 8, 29, 0, 0, 0).seconds_until_end_of_day # => 86399 - # DateTime.new(2012, 8, 29, 12, 34, 56).seconds_until_end_of_day # => 41103 - # DateTime.new(2012, 8, 29, 23, 59, 59).seconds_until_end_of_day # => 0 - def seconds_until_end_of_day - end_of_day.to_i - to_i - end - - # Returns the fraction of a second as a +Rational+ - # - # DateTime.new(2012, 8, 29, 0, 0, 0.5).subsec # => (1/2) - def subsec - sec_fraction - end - - # Returns a new DateTime where one or more of the elements have been changed - # according to the +options+ parameter. The time options (:hour, - # :min, :sec) reset cascadingly, so if only the hour is - # passed, then minute and sec is set to 0. If the hour and minute is passed, - # then sec is set to 0. The +options+ parameter takes a hash with any of these - # keys: :year, :month, :day, :hour, - # :min, :sec, :offset, :start. - # - # DateTime.new(2012, 8, 29, 22, 35, 0).change(day: 1) # => DateTime.new(2012, 8, 1, 22, 35, 0) - # DateTime.new(2012, 8, 29, 22, 35, 0).change(year: 1981, day: 1) # => DateTime.new(1981, 8, 1, 22, 35, 0) - # DateTime.new(2012, 8, 29, 22, 35, 0).change(year: 1981, hour: 0) # => DateTime.new(1981, 8, 29, 0, 0, 0) - def change(options) - if new_nsec = options[:nsec] - raise ArgumentError, "Can't change both :nsec and :usec at the same time: #{options.inspect}" if options[:usec] - new_fraction = Rational(new_nsec, 1000000000) - else - new_usec = options.fetch(:usec, (options[:hour] || options[:min] || options[:sec]) ? 0 : Rational(nsec, 1000)) - new_fraction = Rational(new_usec, 1000000) - end - - raise ArgumentError, "argument out of range" if new_fraction >= 1 - - ::DateTime.civil( - options.fetch(:year, year), - options.fetch(:month, month), - options.fetch(:day, day), - options.fetch(:hour, hour), - options.fetch(:min, options[:hour] ? 0 : min), - options.fetch(:sec, (options[:hour] || options[:min]) ? 0 : sec) + new_fraction, - options.fetch(:offset, offset), - options.fetch(:start, start) - ) - end - - # Uses Date to provide precise Time calculations for years, months, and days. - # The +options+ parameter takes a hash with any of these keys: :years, - # :months, :weeks, :days, :hours, - # :minutes, :seconds. - # - # Just like Date#advance, increments are applied in order of time units from - # largest to smallest. This order can affect the result around the end of a - # month. - def advance(options) - options = options.dup - unless options[:weeks].nil? - options[:weeks], partial_weeks = options[:weeks].divmod(1) - options[:days] = options.fetch(:days, 0) + 7 * partial_weeks - end - - unless options[:days].nil? - options[:days], partial_days = options[:days].divmod(1) - options[:hours] = options.fetch(:hours, 0) + 24 * partial_days - end - - d = to_date.advance(options) - datetime_advanced_by_date = change(year: d.year, month: d.month, day: d.day) - seconds_to_advance = \ - options.fetch(:seconds, 0) + - options.fetch(:minutes, 0) * 60 + - options.fetch(:hours, 0) * 3600 - - if seconds_to_advance.zero? - datetime_advanced_by_date - else - datetime_advanced_by_date.since(seconds_to_advance) - end - end - - # Returns a new DateTime representing the time a number of seconds ago. - # Do not use this method in combination with x.months, use months_ago instead! - def ago(seconds) - since(-seconds) - end - - # Returns a new DateTime representing the time a number of seconds since the - # instance time. Do not use this method in combination with x.months, use - # months_since instead! - def since(seconds) - self + Rational(seconds, 86400) - end - alias :in :since - - # Returns a new DateTime representing the start of the day (0:00). - def beginning_of_day - change(hour: 0) - end - alias :midnight :beginning_of_day - alias :at_midnight :beginning_of_day - alias :at_beginning_of_day :beginning_of_day - - # Returns a new DateTime representing the middle of the day (12:00) - def middle_of_day - change(hour: 12) - end - alias :midday :middle_of_day - alias :noon :middle_of_day - alias :at_midday :middle_of_day - alias :at_noon :middle_of_day - alias :at_middle_of_day :middle_of_day - - # Returns a new DateTime representing the end of the day (23:59:59). - def end_of_day - change(hour: 23, min: 59, sec: 59, usec: Rational(999999999, 1000)) - end - alias :at_end_of_day :end_of_day - - # Returns a new DateTime representing the start of the hour (hh:00:00). - def beginning_of_hour - change(min: 0) - end - alias :at_beginning_of_hour :beginning_of_hour - - # Returns a new DateTime representing the end of the hour (hh:59:59). - def end_of_hour - change(min: 59, sec: 59, usec: Rational(999999999, 1000)) - end - alias :at_end_of_hour :end_of_hour - - # Returns a new DateTime representing the start of the minute (hh:mm:00). - def beginning_of_minute - change(sec: 0) - end - alias :at_beginning_of_minute :beginning_of_minute - - # Returns a new DateTime representing the end of the minute (hh:mm:59). - def end_of_minute - change(sec: 59, usec: Rational(999999999, 1000)) - end - alias :at_end_of_minute :end_of_minute - - # Returns a Time instance of the simultaneous time in the system timezone. - def localtime(utc_offset = nil) - utc = new_offset(0) - - Time.utc( - utc.year, utc.month, utc.day, - utc.hour, utc.min, utc.sec + utc.sec_fraction - ).getlocal(utc_offset) - end - alias_method :getlocal, :localtime - - # Returns a Time instance of the simultaneous time in the UTC timezone. - # - # DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)) # => Mon, 21 Feb 2005 10:11:12 -0600 - # DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc # => Mon, 21 Feb 2005 16:11:12 UTC - def utc - utc = new_offset(0) - - Time.utc( - utc.year, utc.month, utc.day, - utc.hour, utc.min, utc.sec + utc.sec_fraction - ) - end - alias_method :getgm, :utc - alias_method :getutc, :utc - alias_method :gmtime, :utc - - # Returns +true+ if offset == 0. - def utc? - offset == 0 - end - - # Returns the offset value in seconds. - def utc_offset - (offset * 86400).to_i - end - - # Layers additional behavior on DateTime#<=> so that Time and - # ActiveSupport::TimeWithZone instances can be compared with a DateTime. - def <=>(other) - if other.respond_to? :to_datetime - super other.to_datetime rescue nil - else - super - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_time/compatibility.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_time/compatibility.rb deleted file mode 100644 index 3b8d82b..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_time/compatibility.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/date_and_time/compatibility" -require "active_support/core_ext/module/redefine_method" - -class DateTime - include DateAndTime::Compatibility - - silence_redefinition_of_method :to_time - - # Return an instance of +Time+ with the same UTC offset - # as +self+. - def to_time - getlocal(utc_offset) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_time/conversions.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_time/conversions.rb deleted file mode 100644 index 0aed6f9..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/date_time/conversions.rb +++ /dev/null @@ -1,108 +0,0 @@ -# frozen_string_literal: true - -require "date" -require "active_support/inflector/methods" -require "active_support/core_ext/time/conversions" -require "active_support/core_ext/date_time/calculations" -require "active_support/values/time_zone" - -class DateTime - # Convert to a formatted string. See Time::DATE_FORMATS for predefined formats. - # - # This method is aliased to to_formatted_s. - # - # ==== Examples - # - # datetime = DateTime.civil(2007, 12, 4, 0, 0, 0, 0) # => Tue, 04 Dec 2007 00:00:00 +0000 - # - # datetime.to_fs(:db) # => "2007-12-04 00:00:00" - # datetime.to_formatted_s(:db) # => "2007-12-04 00:00:00" - # datetime.to_fs(:number) # => "20071204000000" - # datetime.to_fs(:short) # => "04 Dec 00:00" - # datetime.to_fs(:long) # => "December 04, 2007 00:00" - # datetime.to_fs(:long_ordinal) # => "December 4th, 2007 00:00" - # datetime.to_fs(:rfc822) # => "Tue, 04 Dec 2007 00:00:00 +0000" - # datetime.to_fs(:iso8601) # => "2007-12-04T00:00:00+00:00" - # - # ==== Adding your own datetime formats to +to_fs+ - # - # DateTime formats are shared with Time. You can add your own to the - # Time::DATE_FORMATS hash. Use the format name as the hash key and - # either a strftime string or Proc instance that takes a time or - # datetime argument as the value. - # - # # config/initializers/time_formats.rb - # Time::DATE_FORMATS[:month_and_year] = '%B %Y' - # Time::DATE_FORMATS[:short_ordinal] = lambda { |time| time.strftime("%B #{time.day.ordinalize}") } - def to_fs(format = :default) - if formatter = ::Time::DATE_FORMATS[format] - formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter) - else - to_s - end - end - alias_method :to_formatted_s, :to_fs - - - # Returns a formatted string of the offset from UTC, or an alternative - # string if the time zone is already UTC. - # - # datetime = DateTime.civil(2000, 1, 1, 0, 0, 0, Rational(-6, 24)) - # datetime.formatted_offset # => "-06:00" - # datetime.formatted_offset(false) # => "-0600" - def formatted_offset(colon = true, alternate_utc_string = nil) - utc? && alternate_utc_string || ActiveSupport::TimeZone.seconds_to_utc_offset(utc_offset, colon) - end - - # Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005 14:30:00 +0000". - def readable_inspect - to_fs(:rfc822) - end - alias_method :default_inspect, :inspect - alias_method :inspect, :readable_inspect - - # Returns DateTime with local offset for given year if format is local else - # offset is zero. - # - # DateTime.civil_from_format :local, 2012 - # # => Sun, 01 Jan 2012 00:00:00 +0300 - # DateTime.civil_from_format :local, 2012, 12, 17 - # # => Mon, 17 Dec 2012 00:00:00 +0000 - def self.civil_from_format(utc_or_local, year, month = 1, day = 1, hour = 0, min = 0, sec = 0) - if utc_or_local.to_sym == :local - offset = ::Time.local(year, month, day).utc_offset.to_r / 86400 - else - offset = 0 - end - civil(year, month, day, hour, min, sec, offset) - end - - # Converts +self+ to a floating-point number of seconds, including fractional microseconds, since the Unix epoch. - def to_f - seconds_since_unix_epoch.to_f + sec_fraction - end - - # Converts +self+ to an integer number of seconds since the Unix epoch. - def to_i - seconds_since_unix_epoch.to_i - end - - # Returns the fraction of a second as microseconds - def usec - (sec_fraction * 1_000_000).to_i - end - - # Returns the fraction of a second as nanoseconds - def nsec - (sec_fraction * 1_000_000_000).to_i - end - - private - def offset_in_seconds - (offset * 86400).to_i - end - - def seconds_since_unix_epoch - (jd - 2440588) * 86400 - offset_in_seconds + seconds_since_midnight - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/digest.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/digest.rb deleted file mode 100644 index 3f1d38e..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/digest.rb +++ /dev/null @@ -1,3 +0,0 @@ -# frozen_string_literal: true - -require_relative "digest/uuid" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/digest/uuid.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/digest/uuid.rb deleted file mode 100644 index 0f06a97..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/digest/uuid.rb +++ /dev/null @@ -1,76 +0,0 @@ -# frozen_string_literal: true - -require "securerandom" -require "openssl" - -module Digest - module UUID - DNS_NAMESPACE = "k\xA7\xB8\x10\x9D\xAD\x11\xD1\x80\xB4\x00\xC0O\xD40\xC8" # :nodoc: - URL_NAMESPACE = "k\xA7\xB8\x11\x9D\xAD\x11\xD1\x80\xB4\x00\xC0O\xD40\xC8" # :nodoc: - OID_NAMESPACE = "k\xA7\xB8\x12\x9D\xAD\x11\xD1\x80\xB4\x00\xC0O\xD40\xC8" # :nodoc: - X500_NAMESPACE = "k\xA7\xB8\x14\x9D\xAD\x11\xD1\x80\xB4\x00\xC0O\xD40\xC8" # :nodoc: - - # Generates a v5 non-random UUID (Universally Unique IDentifier). - # - # Using OpenSSL::Digest::MD5 generates version 3 UUIDs; OpenSSL::Digest::SHA1 generates version 5 UUIDs. - # uuid_from_hash always generates the same UUID for a given name and namespace combination. - # - # See RFC 4122 for details of UUID at: https://www.ietf.org/rfc/rfc4122.txt - def self.uuid_from_hash(hash_class, namespace, name) - if hash_class == Digest::MD5 || hash_class == OpenSSL::Digest::MD5 - version = 3 - elsif hash_class == Digest::SHA1 || hash_class == OpenSSL::Digest::SHA1 - version = 5 - else - raise ArgumentError, "Expected OpenSSL::Digest::SHA1 or OpenSSL::Digest::MD5, got #{hash_class.name}." - end - - uuid_namespace = pack_uuid_namespace(namespace) - - hash = hash_class.new - hash.update(uuid_namespace) - hash.update(name) - - ary = hash.digest.unpack("NnnnnN") - ary[2] = (ary[2] & 0x0FFF) | (version << 12) - ary[3] = (ary[3] & 0x3FFF) | 0x8000 - - "%08x-%04x-%04x-%04x-%04x%08x" % ary - end - - # Convenience method for uuid_from_hash using OpenSSL::Digest::MD5. - def self.uuid_v3(uuid_namespace, name) - uuid_from_hash(OpenSSL::Digest::MD5, uuid_namespace, name) - end - - # Convenience method for uuid_from_hash using OpenSSL::Digest::SHA1. - def self.uuid_v5(uuid_namespace, name) - uuid_from_hash(OpenSSL::Digest::SHA1, uuid_namespace, name) - end - - # Convenience method for SecureRandom.uuid. - def self.uuid_v4 - SecureRandom.uuid - end - - # Returns the nil UUID. This is a special form of UUID that is specified to - # have all 128 bits set to zero. - def self.nil_uuid - "00000000-0000-0000-0000-000000000000" - end - - def self.pack_uuid_namespace(namespace) - if [DNS_NAMESPACE, OID_NAMESPACE, URL_NAMESPACE, X500_NAMESPACE].include?(namespace) - namespace - else - match_data = namespace.match(/\A(\h{8})-(\h{4})-(\h{4})-(\h{4})-(\h{4})(\h{8})\z/) - - raise ArgumentError, "Only UUIDs are valid namespace identifiers" unless match_data.present? - - match_data.captures.map { |s| s.to_i(16) }.pack("NnnnnN") - end - end - - private_class_method :pack_uuid_namespace - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/enumerable.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/enumerable.rb deleted file mode 100644 index 99e499f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/enumerable.rb +++ /dev/null @@ -1,279 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module EnumerableCoreExt # :nodoc: - module Constants - private - def const_missing(name) - if name == :SoleItemExpectedError - ::ActiveSupport::EnumerableCoreExt::SoleItemExpectedError - else - super - end - end - end - end -end - -module Enumerable - # Error generated by +sole+ when called on an enumerable that doesn't have - # exactly one item. - class SoleItemExpectedError < StandardError; end - - # HACK: For performance reasons, Enumerable shouldn't have any constants of its own. - # So we move SoleItemExpectedError into ActiveSupport::EnumerableCoreExt. - ActiveSupport::EnumerableCoreExt::SoleItemExpectedError = remove_const(:SoleItemExpectedError) - singleton_class.prepend(ActiveSupport::EnumerableCoreExt::Constants) - - # Calculates the minimum from the extracted elements. - # - # payments = [Payment.new(5), Payment.new(15), Payment.new(10)] - # payments.minimum(:price) # => 5 - def minimum(key) - map(&key).min - end - - # Calculates the maximum from the extracted elements. - # - # payments = [Payment.new(5), Payment.new(15), Payment.new(10)] - # payments.maximum(:price) # => 15 - def maximum(key) - map(&key).max - end - - # Convert an enumerable to a hash, using the block result as the key and the - # element as the value. - # - # people.index_by(&:login) - # # => { "nextangle" => , "chade-" => , ...} - # - # people.index_by { |person| "#{person.first_name} #{person.last_name}" } - # # => { "Chade- Fowlersburg-e" => , "David Heinemeier Hansson" => , ...} - def index_by - if block_given? - result = {} - each { |elem| result[yield(elem)] = elem } - result - else - to_enum(:index_by) { size if respond_to?(:size) } - end - end - - # Convert an enumerable to a hash, using the element as the key and the block - # result as the value. - # - # post = Post.new(title: "hey there", body: "what's up?") - # - # %i( title body ).index_with { |attr_name| post.public_send(attr_name) } - # # => { title: "hey there", body: "what's up?" } - # - # If an argument is passed instead of a block, it will be used as the value - # for all elements: - # - # %i( created_at updated_at ).index_with(Time.now) - # # => { created_at: 2020-03-09 22:31:47, updated_at: 2020-03-09 22:31:47 } - def index_with(default = (no_default = true)) - if block_given? - result = {} - each { |elem| result[elem] = yield(elem) } - result - elsif no_default - to_enum(:index_with) { size if respond_to?(:size) } - else - result = {} - each { |elem| result[elem] = default } - result - end - end - - # Returns +true+ if the enumerable has more than 1 element. Functionally - # equivalent to enum.to_a.size > 1. Can be called with a block too, - # much like any?, so people.many? { |p| p.age > 26 } returns +true+ - # if more than one person is over 26. - def many? - cnt = 0 - if block_given? - any? do |*args| - cnt += 1 if yield(*args) - cnt > 1 - end - else - any? { (cnt += 1) > 1 } - end - end - - # Returns a new array that includes the passed elements. - # - # [ 1, 2, 3 ].including(4, 5) - # # => [ 1, 2, 3, 4, 5 ] - # - # ["David", "Rafael"].including %w[ Aaron Todd ] - # # => ["David", "Rafael", "Aaron", "Todd"] - def including(*elements) - to_a.including(*elements) - end - - # The negative of the Enumerable#include?. Returns +true+ if the - # collection does not include the object. - def exclude?(object) - !include?(object) - end - - # Returns a copy of the enumerable excluding the specified elements. - # - # ["David", "Rafael", "Aaron", "Todd"].excluding "Aaron", "Todd" - # # => ["David", "Rafael"] - # - # ["David", "Rafael", "Aaron", "Todd"].excluding %w[ Aaron Todd ] - # # => ["David", "Rafael"] - # - # {foo: 1, bar: 2, baz: 3}.excluding :bar - # # => {foo: 1, baz: 3} - def excluding(*elements) - elements.flatten!(1) - reject { |element| elements.include?(element) } - end - alias :without :excluding - - # Extract the given key from each element in the enumerable. - # - # [{ name: "David" }, { name: "Rafael" }, { name: "Aaron" }].pluck(:name) - # # => ["David", "Rafael", "Aaron"] - # - # [{ id: 1, name: "David" }, { id: 2, name: "Rafael" }].pluck(:id, :name) - # # => [[1, "David"], [2, "Rafael"]] - def pluck(*keys) - if keys.many? - map { |element| keys.map { |key| element[key] } } - else - key = keys.first - map { |element| element[key] } - end - end - - # Extract the given key from the first element in the enumerable. - # - # [{ name: "David" }, { name: "Rafael" }, { name: "Aaron" }].pick(:name) - # # => "David" - # - # [{ id: 1, name: "David" }, { id: 2, name: "Rafael" }].pick(:id, :name) - # # => [1, "David"] - def pick(*keys) - return if none? - - if keys.many? - keys.map { |key| first[key] } - else - first[keys.first] - end - end - - # Returns a new +Array+ without the blank items. - # Uses Object#blank? for determining if an item is blank. - # - # [1, "", nil, 2, " ", [], {}, false, true].compact_blank - # # => [1, 2, true] - # - # Set.new([nil, "", 1, false]).compact_blank - # # => [1] - # - # When called on a +Hash+, returns a new +Hash+ without the blank values. - # - # { a: "", b: 1, c: nil, d: [], e: false, f: true }.compact_blank - # # => { b: 1, f: true } - def compact_blank - reject(&:blank?) - end - - # Returns a new +Array+ where the order has been set to that provided in the +series+, based on the +key+ of the - # objects in the original enumerable. - # - # [ Person.find(5), Person.find(3), Person.find(1) ].in_order_of(:id, [ 1, 5, 3 ]) - # # => [ Person.find(1), Person.find(5), Person.find(3) ] - # - # If the +series+ include keys that have no corresponding element in the Enumerable, these are ignored. - # If the Enumerable has additional elements that aren't named in the +series+, these are not included in the result, unless - # the +filter+ option is set to +false+. - def in_order_of(key, series, filter: true) - if filter - group_by(&key).values_at(*series).compact.flatten(1) - else - sort_by { |v| series.index(v.public_send(key)) || series.size } - end - end - - # Returns the sole item in the enumerable. If there are no items, or more - # than one item, raises Enumerable::SoleItemExpectedError. - # - # ["x"].sole # => "x" - # Set.new.sole # => Enumerable::SoleItemExpectedError: no item found - # { a: 1, b: 2 }.sole # => Enumerable::SoleItemExpectedError: multiple items found - def sole - result = nil - found = false - - each do |*element| - if found - raise SoleItemExpectedError, "multiple items found" - end - - result = element.size == 1 ? element[0] : element - found = true - end - - if found - result - else - raise SoleItemExpectedError, "no item found" - end - end -end - -class Hash - # Hash#reject has its own definition, so this needs one too. - def compact_blank # :nodoc: - reject { |_k, v| v.blank? } - end - - # Removes all blank values from the +Hash+ in place and returns self. - # Uses Object#blank? for determining if a value is blank. - # - # h = { a: "", b: 1, c: nil, d: [], e: false, f: true } - # h.compact_blank! - # # => { b: 1, f: true } - def compact_blank! - # use delete_if rather than reject! because it always returns self even if nothing changed - delete_if { |_k, v| v.blank? } - end -end - -class Range # :nodoc: - # Optimize range sum to use arithmetic progression if a block is not given and - # we have a range of numeric values. - def sum(initial_value = 0) - if block_given? || !(first.is_a?(Integer) && last.is_a?(Integer)) - super - else - actual_last = exclude_end? ? (last - 1) : last - if actual_last >= first - sum = initial_value || 0 - sum + (actual_last - first + 1) * (actual_last + first) / 2 - else - initial_value || 0 - end - end - end -end - -class Array # :nodoc: - # Removes all blank elements from the +Array+ in place and returns self. - # Uses Object#blank? for determining if an item is blank. - # - # a = [1, "", nil, 2, " ", [], {}, false, true] - # a.compact_blank! - # # => [1, 2, true] - def compact_blank! - # use delete_if rather than reject! because it always returns self even if nothing changed - delete_if(&:blank?) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/erb/util.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/erb/util.rb deleted file mode 100644 index 3fe5ed9..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/erb/util.rb +++ /dev/null @@ -1,201 +0,0 @@ -# frozen_string_literal: true - -require "erb" - -module ActiveSupport - module CoreExt - module ERBUtil - # HTML escapes strings but doesn't wrap them with an ActiveSupport::SafeBuffer. - # This method is not for public consumption! Seriously! - def html_escape(s) # :nodoc: - s = s.to_s - if s.html_safe? - s - else - super(s) - end - end - alias :unwrapped_html_escape :html_escape # :nodoc: - - # A utility method for escaping HTML tag characters. - # This method is also aliased as h. - # - # puts html_escape('is a > 0 & a < 10?') - # # => is a > 0 & a < 10? - def html_escape(s) # rubocop:disable Lint/DuplicateMethods - unwrapped_html_escape(s).html_safe - end - alias h html_escape - end - - module ERBUtilPrivate - include ERBUtil - private :unwrapped_html_escape, :html_escape, :h - end - end -end - -class ERB - module Util - HTML_ESCAPE = { "&" => "&", ">" => ">", "<" => "<", '"' => """, "'" => "'" } - HTML_ESCAPE_ONCE_REGEXP = /["><']|&(?!([a-zA-Z]+|(#\d+)|(#[xX][\dA-Fa-f]+));)/ - - # Following XML requirements: https://www.w3.org/TR/REC-xml/#NT-Name - TAG_NAME_START_CODEPOINTS = "@:A-Z_a-z\u{C0}-\u{D6}\u{D8}-\u{F6}\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}" \ - "\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}" \ - "\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}" - INVALID_TAG_NAME_START_REGEXP = /[^#{TAG_NAME_START_CODEPOINTS}]/ - TAG_NAME_FOLLOWING_CODEPOINTS = "#{TAG_NAME_START_CODEPOINTS}\\-.0-9\u{B7}\u{0300}-\u{036F}\u{203F}-\u{2040}" - INVALID_TAG_NAME_FOLLOWING_REGEXP = /[^#{TAG_NAME_FOLLOWING_CODEPOINTS}]/ - SAFE_XML_TAG_NAME_REGEXP = /\A[#{TAG_NAME_START_CODEPOINTS}][#{TAG_NAME_FOLLOWING_CODEPOINTS}]*\z/ - TAG_NAME_REPLACEMENT_CHAR = "_" - - prepend ActiveSupport::CoreExt::ERBUtilPrivate - singleton_class.prepend ActiveSupport::CoreExt::ERBUtil - - # A utility method for escaping HTML without affecting existing escaped entities. - # - # html_escape_once('1 < 2 & 3') - # # => "1 < 2 & 3" - # - # html_escape_once('<< Accept & Checkout') - # # => "<< Accept & Checkout" - def html_escape_once(s) - s.to_s.gsub(HTML_ESCAPE_ONCE_REGEXP, HTML_ESCAPE).html_safe - end - - module_function :html_escape_once - - # A utility method for escaping HTML entities in JSON strings. Specifically, the - # &, > and < characters are replaced with their equivalent unicode escaped form - - # \u0026, \u003e, and \u003c. The Unicode sequences \u2028 and \u2029 are also - # escaped as they are treated as newline characters in some JavaScript engines. - # These sequences have identical meaning as the original characters inside the - # context of a JSON string, so assuming the input is a valid and well-formed - # JSON value, the output will have equivalent meaning when parsed: - # - # json = JSON.generate({ name: ""}) - # # => "{\"name\":\"\"}" - # - # json_escape(json) - # # => "{\"name\":\"\\u003C/script\\u003E\\u003Cscript\\u003Ealert('PWNED!!!')\\u003C/script\\u003E\"}" - # - # JSON.parse(json) == JSON.parse(json_escape(json)) - # # => true - # - # The intended use case for this method is to escape JSON strings before including - # them inside a script tag to avoid XSS vulnerability: - # - # - # - # It is necessary to +raw+ the result of +json_escape+, so that quotation marks - # don't get converted to " entities. +json_escape+ doesn't - # automatically flag the result as HTML safe, since the raw value is unsafe to - # use inside HTML attributes. - # - # If your JSON is being used downstream for insertion into the DOM, be aware of - # whether or not it is being inserted via html(). Most jQuery plugins do this. - # If that is the case, be sure to +html_escape+ or +sanitize+ any user-generated - # content returned by your JSON. - # - # If you need to output JSON elsewhere in your HTML, you can just do something - # like this, as any unsafe characters (including quotation marks) will be - # automatically escaped for you: - # - #
...
- # - # WARNING: this helper only works with valid JSON. Using this on non-JSON values - # will open up serious XSS vulnerabilities. For example, if you replace the - # +current_user.to_json+ in the example above with user input instead, the browser - # will happily eval() that string as JavaScript. - # - # The escaping performed in this method is identical to those performed in the - # Active Support JSON encoder when +ActiveSupport.escape_html_entities_in_json+ is - # set to true. Because this transformation is idempotent, this helper can be - # applied even if +ActiveSupport.escape_html_entities_in_json+ is already true. - # - # Therefore, when you are unsure if +ActiveSupport.escape_html_entities_in_json+ - # is enabled, or if you are unsure where your JSON string originated from, it - # is recommended that you always apply this helper (other libraries, such as the - # JSON gem, do not provide this kind of protection by default; also some gems - # might override +to_json+ to bypass Active Support's encoder). - def json_escape(s) - result = s.to_s.dup - result.gsub!(">", '\u003e') - result.gsub!("<", '\u003c') - result.gsub!("&", '\u0026') - result.gsub!("\u2028", '\u2028') - result.gsub!("\u2029", '\u2029') - s.html_safe? ? result.html_safe : result - end - - module_function :json_escape - - # A utility method for escaping XML names of tags and names of attributes. - # - # xml_name_escape('1 < 2 & 3') - # # => "1___2___3" - # - # It follows the requirements of the specification: https://www.w3.org/TR/REC-xml/#NT-Name - def xml_name_escape(name) - name = name.to_s - return "" if name.blank? - return name if name.match?(SAFE_XML_TAG_NAME_REGEXP) - - starting_char = name[0] - starting_char.gsub!(INVALID_TAG_NAME_START_REGEXP, TAG_NAME_REPLACEMENT_CHAR) - - return starting_char if name.size == 1 - - following_chars = name[1..-1] - following_chars.gsub!(INVALID_TAG_NAME_FOLLOWING_REGEXP, TAG_NAME_REPLACEMENT_CHAR) - - starting_char << following_chars - end - module_function :xml_name_escape - - # Tokenizes a line of ERB. This is really just for error reporting and - # nobody should use it. - def self.tokenize(source) # :nodoc: - require "strscan" - source = StringScanner.new(source.chomp) - tokens = [] - - start_re = /<%(?:={1,2}|-|\#|%)?/m - finish_re = /(?:[-=])?%>/m - - while !source.eos? - pos = source.pos - source.scan_until(/(?:#{start_re}|#{finish_re})/) - return [[:PLAIN, source.string]] unless source.matched? - len = source.pos - source.matched.bytesize - pos - - case source.matched - when start_re - tokens << [:TEXT, source.string.byteslice(pos, len)] if len > 0 - tokens << [:OPEN, source.matched] - if source.scan(/(.*?)(?=#{finish_re}|\z)/m) - tokens << [:CODE, source.matched] unless source.matched.empty? - tokens << [:CLOSE, source.scan(finish_re)] unless source.eos? - else - raise NotImplementedError - end - when finish_re - tokens << [:CODE, source.string.byteslice(pos, len)] if len > 0 - tokens << [:CLOSE, source.matched] - else - raise NotImplementedError, source.matched - end - - unless source.eos? || source.exist?(start_re) || source.exist?(finish_re) - tokens << [:TEXT, source.rest] - source.terminate - end - end - - tokens - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/file.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/file.rb deleted file mode 100644 index 3c23641..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/file.rb +++ /dev/null @@ -1,3 +0,0 @@ -# frozen_string_literal: true - -require_relative "file/atomic" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/file/atomic.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/file/atomic.rb deleted file mode 100644 index b442ea3..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/file/atomic.rb +++ /dev/null @@ -1,72 +0,0 @@ -# frozen_string_literal: true - -require "fileutils" - -class File - # Write to a file atomically. Useful for situations where you don't - # want other processes or threads to see half-written files. - # - # File.atomic_write('important.file') do |file| - # file.write('hello') - # end - # - # This method needs to create a temporary file. By default it will create it - # in the same directory as the destination file. If you don't like this - # behavior you can provide a different directory but it must be on the - # same physical filesystem as the file you're trying to write. - # - # File.atomic_write('/data/something.important', '/data/tmp') do |file| - # file.write('hello') - # end - def self.atomic_write(file_name, temp_dir = dirname(file_name)) - require "tempfile" unless defined?(Tempfile) - - Tempfile.open(".#{basename(file_name)}", temp_dir) do |temp_file| - temp_file.binmode - return_val = yield temp_file - temp_file.close - - old_stat = if exist?(file_name) - # Get original file permissions - stat(file_name) - else - # If not possible, probe which are the default permissions in the - # destination directory. - probe_stat_in(dirname(file_name)) - end - - if old_stat - # Set correct permissions on new file - begin - chown(old_stat.uid, old_stat.gid, temp_file.path) - # This operation will affect filesystem ACL's - chmod(old_stat.mode, temp_file.path) - rescue Errno::EPERM, Errno::EACCES - # Changing file ownership failed, moving on. - end - end - - # Overwrite original file with temp file - rename(temp_file.path, file_name) - return_val - end - end - - # Private utility method. - def self.probe_stat_in(dir) # :nodoc: - basename = [ - ".permissions_check", - Thread.current.object_id, - Process.pid, - rand(1000000) - ].join(".") - - file_name = join(dir, basename) - FileUtils.touch(file_name) - stat(file_name) - rescue Errno::ENOENT - file_name = nil - ensure - FileUtils.rm_f(file_name) if file_name - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash.rb deleted file mode 100644 index 363cd8b..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -require_relative "hash/conversions" -require_relative "hash/deep_merge" -require_relative "hash/deep_transform_values" -require_relative "hash/except" -require_relative "hash/indifferent_access" -require_relative "hash/keys" -require_relative "hash/reverse_merge" -require_relative "hash/slice" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/conversions.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/conversions.rb deleted file mode 100644 index 8ab2fd6..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/conversions.rb +++ /dev/null @@ -1,262 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/blank" -require "active_support/core_ext/object/to_param" -require "active_support/core_ext/object/to_query" -require "active_support/core_ext/object/try" -require "active_support/core_ext/array/wrap" -require "active_support/core_ext/hash/reverse_merge" -require "active_support/core_ext/string/inflections" - -class Hash - # Returns a string containing an XML representation of its receiver: - # - # { foo: 1, bar: 2 }.to_xml - # # => - # # - # # - # # 1 - # # 2 - # # - # - # To do so, the method loops over the pairs and builds nodes that depend on - # the _values_. Given a pair +key+, +value+: - # - # * If +value+ is a hash there's a recursive call with +key+ as :root. - # - # * If +value+ is an array there's a recursive call with +key+ as :root, - # and +key+ singularized as :children. - # - # * If +value+ is a callable object it must expect one or two arguments. Depending - # on the arity, the callable is invoked with the +options+ hash as first argument - # with +key+ as :root, and +key+ singularized as second argument. The - # callable can add nodes by using options[:builder]. - # - # {foo: lambda { |options, key| options[:builder].b(key) }}.to_xml - # # => "foo" - # - # * If +value+ responds to +to_xml+ the method is invoked with +key+ as :root. - # - # class Foo - # def to_xml(options) - # options[:builder].bar 'fooing!' - # end - # end - # - # { foo: Foo.new }.to_xml(skip_instruct: true) - # # => - # # - # # fooing! - # # - # - # * Otherwise, a node with +key+ as tag is created with a string representation of - # +value+ as text node. If +value+ is +nil+ an attribute "nil" set to "true" is added. - # Unless the option :skip_types exists and is true, an attribute "type" is - # added as well according to the following mapping: - # - # XML_TYPE_NAMES = { - # "Symbol" => "symbol", - # "Integer" => "integer", - # "BigDecimal" => "decimal", - # "Float" => "float", - # "TrueClass" => "boolean", - # "FalseClass" => "boolean", - # "Date" => "date", - # "DateTime" => "dateTime", - # "Time" => "dateTime" - # } - # - # By default the root node is "hash", but that's configurable via the :root option. - # - # The default XML builder is a fresh instance of +Builder::XmlMarkup+. You can - # configure your own builder with the :builder option. The method also accepts - # options like :dasherize and friends, they are forwarded to the builder. - def to_xml(options = {}) - require "active_support/builder" unless defined?(Builder::XmlMarkup) - - options = options.dup - options[:indent] ||= 2 - options[:root] ||= "hash" - options[:builder] ||= Builder::XmlMarkup.new(indent: options[:indent]) - - builder = options[:builder] - builder.instruct! unless options.delete(:skip_instruct) - - root = ActiveSupport::XmlMini.rename_key(options[:root].to_s, options) - - builder.tag!(root) do - each { |key, value| ActiveSupport::XmlMini.to_tag(key, value, options) } - yield builder if block_given? - end - end - - class << self - # Returns a Hash containing a collection of pairs when the key is the node name and the value is - # its content - # - # xml = <<-XML - # - # - # 1 - # 2 - # - # XML - # - # hash = Hash.from_xml(xml) - # # => {"hash"=>{"foo"=>1, "bar"=>2}} - # - # +DisallowedType+ is raised if the XML contains attributes with type="yaml" or - # type="symbol". Use Hash.from_trusted_xml to - # parse this XML. - # - # Custom +disallowed_types+ can also be passed in the form of an - # array. - # - # xml = <<-XML - # - # - # 1 - # "David" - # - # XML - # - # hash = Hash.from_xml(xml, ['integer']) - # # => ActiveSupport::XMLConverter::DisallowedType: Disallowed type attribute: "integer" - # - # Note that passing custom disallowed types will override the default types, - # which are Symbol and YAML. - def from_xml(xml, disallowed_types = nil) - ActiveSupport::XMLConverter.new(xml, disallowed_types).to_h - end - - # Builds a Hash from XML just like Hash.from_xml, but also allows Symbol and YAML. - def from_trusted_xml(xml) - from_xml xml, [] - end - end -end - -module ActiveSupport - class XMLConverter # :nodoc: - # Raised if the XML contains attributes with type="yaml" or - # type="symbol". Read Hash#from_xml for more details. - class DisallowedType < StandardError - def initialize(type) - super "Disallowed type attribute: #{type.inspect}" - end - end - - DISALLOWED_TYPES = %w(symbol yaml) - - def initialize(xml, disallowed_types = nil) - @xml = normalize_keys(XmlMini.parse(xml)) - @disallowed_types = disallowed_types || DISALLOWED_TYPES - end - - def to_h - deep_to_h(@xml) - end - - private - def normalize_keys(params) - case params - when Hash - Hash[params.map { |k, v| [k.to_s.tr("-", "_"), normalize_keys(v)] } ] - when Array - params.map { |v| normalize_keys(v) } - else - params - end - end - - def deep_to_h(value) - case value - when Hash - process_hash(value) - when Array - process_array(value) - when String - value - else - raise "can't typecast #{value.class.name} - #{value.inspect}" - end - end - - def process_hash(value) - if value.include?("type") && !value["type"].is_a?(Hash) && @disallowed_types.include?(value["type"]) - raise DisallowedType, value["type"] - end - - if become_array?(value) - _, entries = Array.wrap(value.detect { |k, v| not v.is_a?(String) }) - if entries.nil? || value["__content__"].try(:empty?) - [] - else - case entries - when Array - entries.collect { |v| deep_to_h(v) } - when Hash - [deep_to_h(entries)] - else - raise "can't typecast #{entries.inspect}" - end - end - elsif become_content?(value) - process_content(value) - - elsif become_empty_string?(value) - "" - elsif become_hash?(value) - xml_value = value.transform_values { |v| deep_to_h(v) } - - # Turn { files: { file: # } } into { files: # } so it is compatible with - # how multipart uploaded files from HTML appear - xml_value["file"].is_a?(StringIO) ? xml_value["file"] : xml_value - end - end - - def become_content?(value) - value["type"] == "file" || (value["__content__"] && (value.keys.size == 1 || value["__content__"].present?)) - end - - def become_array?(value) - value["type"] == "array" - end - - def become_empty_string?(value) - # { "string" => true } - # No tests fail when the second term is removed. - value["type"] == "string" && value["nil"] != "true" - end - - def become_hash?(value) - !nothing?(value) && !garbage?(value) - end - - def nothing?(value) - # blank or nil parsed values are represented by nil - value.blank? || value["nil"] == "true" - end - - def garbage?(value) - # If the type is the only element which makes it then - # this still makes the value nil, except if type is - # an XML node(where type['value'] is a Hash) - value["type"] && !value["type"].is_a?(::Hash) && value.size == 1 - end - - def process_content(value) - content = value["__content__"] - if parser = ActiveSupport::XmlMini::PARSING[value["type"]] - parser.arity == 1 ? parser.call(content) : parser.call(content, value) - else - content - end - end - - def process_array(value) - value.map! { |i| deep_to_h(i) } - value.length > 1 ? value : value.first - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/deep_merge.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/deep_merge.rb deleted file mode 100644 index 9af3572..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/deep_merge.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -require "active_support/deep_mergeable" - -class Hash - include ActiveSupport::DeepMergeable - - ## - # :method: deep_merge - # :call-seq: deep_merge(other_hash, &block) - # - # Returns a new hash with +self+ and +other_hash+ merged recursively. - # - # h1 = { a: true, b: { c: [1, 2, 3] } } - # h2 = { a: false, b: { x: [3, 4, 5] } } - # - # h1.deep_merge(h2) # => { a: false, b: { c: [1, 2, 3], x: [3, 4, 5] } } - # - # Like with Hash#merge in the standard library, a block can be provided - # to merge values: - # - # h1 = { a: 100, b: 200, c: { c1: 100 } } - # h2 = { b: 250, c: { c1: 200 } } - # h1.deep_merge(h2) { |key, this_val, other_val| this_val + other_val } - # # => { a: 100, b: 450, c: { c1: 300 } } - # - #-- - # Implemented by ActiveSupport::DeepMergeable#deep_merge. - - ## - # :method: deep_merge! - # :call-seq: deep_merge!(other_hash, &block) - # - # Same as #deep_merge, but modifies +self+. - # - #-- - # Implemented by ActiveSupport::DeepMergeable#deep_merge!. - - ## - def deep_merge?(other) # :nodoc: - other.is_a?(Hash) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/deep_transform_values.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/deep_transform_values.rb deleted file mode 100644 index f7aeae5..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/deep_transform_values.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -class Hash - # Returns a new hash with all values converted by the block operation. - # This includes the values from the root hash and from all - # nested hashes and arrays. - # - # hash = { person: { name: 'Rob', age: '28' } } - # - # hash.deep_transform_values{ |value| value.to_s.upcase } - # # => {person: {name: "ROB", age: "28"}} - def deep_transform_values(&block) - _deep_transform_values_in_object(self, &block) - end - - # Destructively converts all values by using the block operation. - # This includes the values from the root hash and from all - # nested hashes and arrays. - def deep_transform_values!(&block) - _deep_transform_values_in_object!(self, &block) - end - - private - # Support methods for deep transforming nested hashes and arrays. - def _deep_transform_values_in_object(object, &block) - case object - when Hash - object.transform_values { |value| _deep_transform_values_in_object(value, &block) } - when Array - object.map { |e| _deep_transform_values_in_object(e, &block) } - else - yield(object) - end - end - - def _deep_transform_values_in_object!(object, &block) - case object - when Hash - object.transform_values! { |value| _deep_transform_values_in_object!(value, &block) } - when Array - object.map! { |e| _deep_transform_values_in_object!(e, &block) } - else - yield(object) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/except.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/except.rb deleted file mode 100644 index d94acd7..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/except.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -class Hash - # Removes the given keys from hash and returns it. - # hash = { a: true, b: false, c: nil } - # hash.except!(:c) # => { a: true, b: false } - # hash # => { a: true, b: false } - def except!(*keys) - keys.each { |key| delete(key) } - self - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/indifferent_access.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/indifferent_access.rb deleted file mode 100644 index 4437363..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/indifferent_access.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -require "active_support/hash_with_indifferent_access" - -class Hash - # Returns an ActiveSupport::HashWithIndifferentAccess out of its receiver: - # - # { a: 1 }.with_indifferent_access['a'] # => 1 - def with_indifferent_access - ActiveSupport::HashWithIndifferentAccess.new(self) - end - - # Called when object is nested under an object that receives - # #with_indifferent_access. This method will be called on the current object - # by the enclosing object and is aliased to #with_indifferent_access by - # default. Subclasses of Hash may override this method to return +self+ if - # converting to an ActiveSupport::HashWithIndifferentAccess would not be - # desirable. - # - # b = { b: 1 } - # { a: b }.with_indifferent_access['a'] # calls b.nested_under_indifferent_access - # # => {"b"=>1} - alias nested_under_indifferent_access with_indifferent_access -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/keys.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/keys.rb deleted file mode 100644 index fd74f03..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/keys.rb +++ /dev/null @@ -1,143 +0,0 @@ -# frozen_string_literal: true - -class Hash - # Returns a new hash with all keys converted to strings. - # - # hash = { name: 'Rob', age: '28' } - # - # hash.stringify_keys - # # => {"name"=>"Rob", "age"=>"28"} - def stringify_keys - transform_keys { |k| Symbol === k ? k.name : k.to_s } - end - - # Destructively converts all keys to strings. Same as - # +stringify_keys+, but modifies +self+. - def stringify_keys! - transform_keys! { |k| Symbol === k ? k.name : k.to_s } - end - - # Returns a new hash with all keys converted to symbols, as long as - # they respond to +to_sym+. - # - # hash = { 'name' => 'Rob', 'age' => '28' } - # - # hash.symbolize_keys - # # => {:name=>"Rob", :age=>"28"} - def symbolize_keys - transform_keys { |key| key.to_sym rescue key } - end - alias_method :to_options, :symbolize_keys - - # Destructively converts all keys to symbols, as long as they respond - # to +to_sym+. Same as +symbolize_keys+, but modifies +self+. - def symbolize_keys! - transform_keys! { |key| key.to_sym rescue key } - end - alias_method :to_options!, :symbolize_keys! - - # Validates all keys in a hash match *valid_keys, raising - # +ArgumentError+ on a mismatch. - # - # Note that keys are treated differently than HashWithIndifferentAccess, - # meaning that string and symbol keys will not match. - # - # { name: 'Rob', years: '28' }.assert_valid_keys(:name, :age) # => raises "ArgumentError: Unknown key: :years. Valid keys are: :name, :age" - # { name: 'Rob', age: '28' }.assert_valid_keys('name', 'age') # => raises "ArgumentError: Unknown key: :name. Valid keys are: 'name', 'age'" - # { name: 'Rob', age: '28' }.assert_valid_keys(:name, :age) # => passes, raises nothing - def assert_valid_keys(*valid_keys) - valid_keys.flatten! - each_key do |k| - unless valid_keys.include?(k) - raise ArgumentError.new("Unknown key: #{k.inspect}. Valid keys are: #{valid_keys.map(&:inspect).join(', ')}") - end - end - end - - # Returns a new hash with all keys converted by the block operation. - # This includes the keys from the root hash and from all - # nested hashes and arrays. - # - # hash = { person: { name: 'Rob', age: '28' } } - # - # hash.deep_transform_keys{ |key| key.to_s.upcase } - # # => {"PERSON"=>{"NAME"=>"Rob", "AGE"=>"28"}} - def deep_transform_keys(&block) - _deep_transform_keys_in_object(self, &block) - end - - # Destructively converts all keys by using the block operation. - # This includes the keys from the root hash and from all - # nested hashes and arrays. - def deep_transform_keys!(&block) - _deep_transform_keys_in_object!(self, &block) - end - - # Returns a new hash with all keys converted to strings. - # This includes the keys from the root hash and from all - # nested hashes and arrays. - # - # hash = { person: { name: 'Rob', age: '28' } } - # - # hash.deep_stringify_keys - # # => {"person"=>{"name"=>"Rob", "age"=>"28"}} - def deep_stringify_keys - deep_transform_keys { |k| Symbol === k ? k.name : k.to_s } - end - - # Destructively converts all keys to strings. - # This includes the keys from the root hash and from all - # nested hashes and arrays. - def deep_stringify_keys! - deep_transform_keys! { |k| Symbol === k ? k.name : k.to_s } - end - - # Returns a new hash with all keys converted to symbols, as long as - # they respond to +to_sym+. This includes the keys from the root hash - # and from all nested hashes and arrays. - # - # hash = { 'person' => { 'name' => 'Rob', 'age' => '28' } } - # - # hash.deep_symbolize_keys - # # => {:person=>{:name=>"Rob", :age=>"28"}} - def deep_symbolize_keys - deep_transform_keys { |key| key.to_sym rescue key } - end - - # Destructively converts all keys to symbols, as long as they respond - # to +to_sym+. This includes the keys from the root hash and from all - # nested hashes and arrays. - def deep_symbolize_keys! - deep_transform_keys! { |key| key.to_sym rescue key } - end - - private - # Support methods for deep transforming nested hashes and arrays. - def _deep_transform_keys_in_object(object, &block) - case object - when Hash - object.each_with_object(self.class.new) do |(key, value), result| - result[yield(key)] = _deep_transform_keys_in_object(value, &block) - end - when Array - object.map { |e| _deep_transform_keys_in_object(e, &block) } - else - object - end - end - - def _deep_transform_keys_in_object!(object, &block) - case object - when Hash - object.keys.each do |key| - value = object.delete(key) - object[yield(key)] = _deep_transform_keys_in_object!(value, &block) - end - object - when Array - object.map! { |e| _deep_transform_keys_in_object!(e, &block) } - else - object - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/reverse_merge.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/reverse_merge.rb deleted file mode 100644 index ef8d592..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/reverse_merge.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class Hash - # Merges the caller into +other_hash+. For example, - # - # options = options.reverse_merge(size: 25, velocity: 10) - # - # is equivalent to - # - # options = { size: 25, velocity: 10 }.merge(options) - # - # This is particularly useful for initializing an options hash - # with default values. - def reverse_merge(other_hash) - other_hash.merge(self) - end - alias_method :with_defaults, :reverse_merge - - # Destructive +reverse_merge+. - def reverse_merge!(other_hash) - replace(reverse_merge(other_hash)) - end - alias_method :reverse_update, :reverse_merge! - alias_method :with_defaults!, :reverse_merge! -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/slice.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/slice.rb deleted file mode 100644 index 56bc5de..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/hash/slice.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class Hash - # Replaces the hash with only the given keys. - # Returns a hash containing the removed key/value pairs. - # - # hash = { a: 1, b: 2, c: 3, d: 4 } - # hash.slice!(:a, :b) # => {:c=>3, :d=>4} - # hash # => {:a=>1, :b=>2} - def slice!(*keys) - omit = slice(*self.keys - keys) - hash = slice(*keys) - hash.default = default - hash.default_proc = default_proc if default_proc - replace(hash) - omit - end - - # Removes and returns the key/value pairs matching the given keys. - # - # hash = { a: 1, b: 2, c: 3, d: 4 } - # hash.extract!(:a, :b) # => {:a=>1, :b=>2} - # hash # => {:c=>3, :d=>4} - def extract!(*keys) - keys.each_with_object(self.class.new) { |key, result| result[key] = delete(key) if has_key?(key) } - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/integer.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/integer.rb deleted file mode 100644 index df80e7f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/integer.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -require_relative "integer/multiple" -require_relative "integer/inflections" -require_relative "integer/time" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/integer/inflections.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/integer/inflections.rb deleted file mode 100644 index c987990..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/integer/inflections.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -require "active_support/inflector" - -class Integer - # Ordinalize turns a number into an ordinal string used to denote the - # position in an ordered sequence such as 1st, 2nd, 3rd, 4th. - # - # 1.ordinalize # => "1st" - # 2.ordinalize # => "2nd" - # 1002.ordinalize # => "1002nd" - # 1003.ordinalize # => "1003rd" - # -11.ordinalize # => "-11th" - # -1001.ordinalize # => "-1001st" - def ordinalize - ActiveSupport::Inflector.ordinalize(self) - end - - # Ordinal returns the suffix used to denote the position - # in an ordered sequence such as 1st, 2nd, 3rd, 4th. - # - # 1.ordinal # => "st" - # 2.ordinal # => "nd" - # 1002.ordinal # => "nd" - # 1003.ordinal # => "rd" - # -11.ordinal # => "th" - # -1001.ordinal # => "st" - def ordinal - ActiveSupport::Inflector.ordinal(self) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/integer/multiple.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/integer/multiple.rb deleted file mode 100644 index bd57a90..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/integer/multiple.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -class Integer - # Check whether the integer is evenly divisible by the argument. - # - # 0.multiple_of?(0) # => true - # 6.multiple_of?(5) # => false - # 10.multiple_of?(2) # => true - def multiple_of?(number) - number == 0 ? self == 0 : self % number == 0 - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/integer/time.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/integer/time.rb deleted file mode 100644 index 5efb89c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/integer/time.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -require "active_support/duration" -require "active_support/core_ext/numeric/time" - -class Integer - # Returns a Duration instance matching the number of months provided. - # - # 2.months # => 2 months - def months - ActiveSupport::Duration.months(self) - end - alias :month :months - - # Returns a Duration instance matching the number of years provided. - # - # 2.years # => 2 years - def years - ActiveSupport::Duration.years(self) - end - alias :year :years -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/kernel.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/kernel.rb deleted file mode 100644 index 55a44fd..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/kernel.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -require_relative "kernel/concern" -require_relative "kernel/reporting" -require_relative "kernel/singleton_class" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/kernel/concern.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/kernel/concern.rb deleted file mode 100644 index 0b2baed..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/kernel/concern.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/module/concerning" - -module Kernel - module_function - - # A shortcut to define a toplevel concern, not within a module. - # - # See Module::Concerning for more. - def concern(topic, &module_definition) - Object.concern topic, &module_definition - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/kernel/reporting.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/kernel/reporting.rb deleted file mode 100644 index 1ae1ae8..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/kernel/reporting.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -module Kernel - module_function - - # Sets $VERBOSE to +nil+ for the duration of the block and back to its original - # value afterwards. - # - # silence_warnings do - # value = noisy_call # no warning voiced - # end - # - # noisy_call # warning voiced - def silence_warnings(&block) - with_warnings(nil, &block) - end - - # Sets $VERBOSE to +true+ for the duration of the block and back to its - # original value afterwards. - def enable_warnings(&block) - with_warnings(true, &block) - end - - # Sets $VERBOSE for the duration of the block and back to its original - # value afterwards. - def with_warnings(flag) - old_verbose, $VERBOSE = $VERBOSE, flag - yield - ensure - $VERBOSE = old_verbose - end - - # Blocks and ignores any exception passed as argument if raised within the block. - # - # suppress(ZeroDivisionError) do - # 1/0 - # puts 'This code is NOT reached' - # end - # - # puts 'This code gets executed and nothing related to ZeroDivisionError was seen' - def suppress(*exception_classes) - yield - rescue *exception_classes - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/kernel/singleton_class.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/kernel/singleton_class.rb deleted file mode 100644 index 31335b6..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/kernel/singleton_class.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -module Kernel - # class_eval on an object acts like +singleton_class.class_eval+. - def class_eval(*args, &block) - singleton_class.class_eval(*args, &block) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/load_error.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/load_error.rb deleted file mode 100644 index 03df2dd..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/load_error.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class LoadError - # Returns true if the given path name (except perhaps for the ".rb" - # extension) is the missing file which caused the exception to be raised. - def is_missing?(location) - location.delete_suffix(".rb") == path.to_s.delete_suffix(".rb") - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module.rb deleted file mode 100644 index 9a30fe2..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -require_relative "module/aliasing" -require_relative "module/introspection" -require_relative "module/anonymous" -require_relative "module/attribute_accessors" -require_relative "module/attribute_accessors_per_thread" -require_relative "module/attr_internal" -require_relative "module/concerning" -require_relative "module/delegation" -require_relative "module/deprecation" -require_relative "module/redefine_method" -require_relative "module/remove_method" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/aliasing.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/aliasing.rb deleted file mode 100644 index 6f64d11..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/aliasing.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class Module - # Allows you to make aliases for attributes, which includes - # getter, setter, and a predicate. - # - # class Content < ActiveRecord::Base - # # has a title attribute - # end - # - # class Email < Content - # alias_attribute :subject, :title - # end - # - # e = Email.find(1) - # e.title # => "Superstars" - # e.subject # => "Superstars" - # e.subject? # => true - # e.subject = "Megastars" - # e.title # => "Megastars" - def alias_attribute(new_name, old_name) - # The following reader methods use an explicit `self` receiver in order to - # support aliases that start with an uppercase letter. Otherwise, they would - # be resolved as constants instead. - module_eval <<-STR, __FILE__, __LINE__ + 1 - def #{new_name}; self.#{old_name}; end # def subject; self.title; end - def #{new_name}?; self.#{old_name}?; end # def subject?; self.title?; end - def #{new_name}=(v); self.#{old_name} = v; end # def subject=(v); self.title = v; end - STR - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/anonymous.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/anonymous.rb deleted file mode 100644 index d1c86b8..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/anonymous.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -class Module - # A module may or may not have a name. - # - # module M; end - # M.name # => "M" - # - # m = Module.new - # m.name # => nil - # - # +anonymous?+ method returns true if module does not have a name, false otherwise: - # - # Module.new.anonymous? # => true - # - # module M; end - # M.anonymous? # => false - # - # A module gets a name when it is first assigned to a constant. Either - # via the +module+ or +class+ keyword or by an explicit assignment: - # - # m = Module.new # creates an anonymous module - # m.anonymous? # => true - # M = m # m gets a name here as a side-effect - # m.name # => "M" - # m.anonymous? # => false - def anonymous? - name.nil? - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/attr_internal.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/attr_internal.rb deleted file mode 100644 index ecf57d8..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/attr_internal.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -class Module - # Declares an attribute reader backed by an internally-named instance variable. - def attr_internal_reader(*attrs) - attrs.each { |attr_name| attr_internal_define(attr_name, :reader) } - end - - # Declares an attribute writer backed by an internally-named instance variable. - def attr_internal_writer(*attrs) - attrs.each { |attr_name| attr_internal_define(attr_name, :writer) } - end - - # Declares an attribute reader and writer backed by an internally-named instance - # variable. - def attr_internal_accessor(*attrs) - attr_internal_reader(*attrs) - attr_internal_writer(*attrs) - end - alias_method :attr_internal, :attr_internal_accessor - - class << self - attr_reader :attr_internal_naming_format - - def attr_internal_naming_format=(format) - if format.start_with?("@") - raise ArgumentError, <<~MESSAGE.squish - Setting `attr_internal_naming_format` with a `@` prefix is not supported. - - You can simply replace #{format.inspect} by #{format.delete_prefix("@").inspect}. - MESSAGE - end - - @attr_internal_naming_format = format - end - end - self.attr_internal_naming_format = "_%s" - - private - def attr_internal_define(attr_name, type) - internal_name = Module.attr_internal_naming_format % attr_name - # use native attr_* methods as they are faster on some Ruby implementations - public_send("attr_#{type}", internal_name) - attr_name, internal_name = "#{attr_name}=", "#{internal_name}=" if type == :writer - alias_method attr_name, internal_name - remove_method internal_name - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/attribute_accessors.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/attribute_accessors.rb deleted file mode 100644 index 8511e0f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/attribute_accessors.rb +++ /dev/null @@ -1,214 +0,0 @@ -# frozen_string_literal: true - -# == Attribute Accessors -# -# Extends the module object with class/module and instance accessors for -# class/module attributes, just like the native attr* accessors for instance -# attributes. -class Module - # Defines a class attribute and creates a class and instance reader methods. - # The underlying class variable is set to +nil+, if it is not previously - # defined. All class and instance methods created will be public, even if - # this method is called with a private or protected access modifier. - # - # module HairColors - # mattr_reader :hair_colors - # end - # - # HairColors.hair_colors # => nil - # HairColors.class_variable_set("@@hair_colors", [:brown, :black]) - # HairColors.hair_colors # => [:brown, :black] - # - # The attribute name must be a valid method name in Ruby. - # - # module Foo - # mattr_reader :"1_Badname" - # end - # # => NameError: invalid attribute name: 1_Badname - # - # To omit the instance reader method, pass - # instance_reader: false or instance_accessor: false. - # - # module HairColors - # mattr_reader :hair_colors, instance_reader: false - # end - # - # class Person - # include HairColors - # end - # - # Person.new.hair_colors # => NoMethodError - # - # You can set a default value for the attribute. - # - # module HairColors - # mattr_reader :hair_colors, default: [:brown, :black, :blonde, :red] - # mattr_reader(:hair_styles) { [:long, :short] } - # end - # - # class Person - # include HairColors - # end - # - # Person.new.hair_colors # => [:brown, :black, :blonde, :red] - # Person.new.hair_styles # => [:long, :short] - def mattr_reader(*syms, instance_reader: true, instance_accessor: true, default: nil, location: nil) - raise TypeError, "module attributes should be defined directly on class, not singleton" if singleton_class? - location ||= caller_locations(1, 1).first - - definition = [] - syms.each do |sym| - raise NameError.new("invalid attribute name: #{sym}") unless /\A[_A-Za-z]\w*\z/.match?(sym) - - definition << "def self.#{sym}; @@#{sym}; end" - - if instance_reader && instance_accessor - definition << "def #{sym}; @@#{sym}; end" - end - - sym_default_value = (block_given? && default.nil?) ? yield : default - class_variable_set("@@#{sym}", sym_default_value) unless sym_default_value.nil? && class_variable_defined?("@@#{sym}") - end - - module_eval(definition.join(";"), location.path, location.lineno) - end - alias :cattr_reader :mattr_reader - - # Defines a class attribute and creates a class and instance writer methods to - # allow assignment to the attribute. All class and instance methods created - # will be public, even if this method is called with a private or protected - # access modifier. - # - # module HairColors - # mattr_writer :hair_colors - # end - # - # class Person - # include HairColors - # end - # - # HairColors.hair_colors = [:brown, :black] - # Person.class_variable_get("@@hair_colors") # => [:brown, :black] - # Person.new.hair_colors = [:blonde, :red] - # HairColors.class_variable_get("@@hair_colors") # => [:blonde, :red] - # - # To omit the instance writer method, pass - # instance_writer: false or instance_accessor: false. - # - # module HairColors - # mattr_writer :hair_colors, instance_writer: false - # end - # - # class Person - # include HairColors - # end - # - # Person.new.hair_colors = [:blonde, :red] # => NoMethodError - # - # You can set a default value for the attribute. - # - # module HairColors - # mattr_writer :hair_colors, default: [:brown, :black, :blonde, :red] - # mattr_writer(:hair_styles) { [:long, :short] } - # end - # - # class Person - # include HairColors - # end - # - # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red] - # Person.class_variable_get("@@hair_styles") # => [:long, :short] - def mattr_writer(*syms, instance_writer: true, instance_accessor: true, default: nil, location: nil) - raise TypeError, "module attributes should be defined directly on class, not singleton" if singleton_class? - location ||= caller_locations(1, 1).first - - definition = [] - syms.each do |sym| - raise NameError.new("invalid attribute name: #{sym}") unless /\A[_A-Za-z]\w*\z/.match?(sym) - definition << "def self.#{sym}=(val); @@#{sym} = val; end" - - if instance_writer && instance_accessor - definition << "def #{sym}=(val); @@#{sym} = val; end" - end - - sym_default_value = (block_given? && default.nil?) ? yield : default - class_variable_set("@@#{sym}", sym_default_value) unless sym_default_value.nil? && class_variable_defined?("@@#{sym}") - end - - module_eval(definition.join(";"), location.path, location.lineno) - end - alias :cattr_writer :mattr_writer - - # Defines both class and instance accessors for class attributes. - # All class and instance methods created will be public, even if - # this method is called with a private or protected access modifier. - # - # module HairColors - # mattr_accessor :hair_colors - # end - # - # class Person - # include HairColors - # end - # - # HairColors.hair_colors = [:brown, :black, :blonde, :red] - # HairColors.hair_colors # => [:brown, :black, :blonde, :red] - # Person.new.hair_colors # => [:brown, :black, :blonde, :red] - # - # If a subclass changes the value then that would also change the value for - # parent class. Similarly if parent class changes the value then that would - # change the value of subclasses too. - # - # class Citizen < Person - # end - # - # Citizen.new.hair_colors << :blue - # Person.new.hair_colors # => [:brown, :black, :blonde, :red, :blue] - # - # To omit the instance writer method, pass instance_writer: false. - # To omit the instance reader method, pass instance_reader: false. - # - # module HairColors - # mattr_accessor :hair_colors, instance_writer: false, instance_reader: false - # end - # - # class Person - # include HairColors - # end - # - # Person.new.hair_colors = [:brown] # => NoMethodError - # Person.new.hair_colors # => NoMethodError - # - # Or pass instance_accessor: false, to omit both instance methods. - # - # module HairColors - # mattr_accessor :hair_colors, instance_accessor: false - # end - # - # class Person - # include HairColors - # end - # - # Person.new.hair_colors = [:brown] # => NoMethodError - # Person.new.hair_colors # => NoMethodError - # - # You can set a default value for the attribute. - # - # module HairColors - # mattr_accessor :hair_colors, default: [:brown, :black, :blonde, :red] - # mattr_accessor(:hair_styles) { [:long, :short] } - # end - # - # class Person - # include HairColors - # end - # - # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red] - # Person.class_variable_get("@@hair_styles") # => [:long, :short] - def mattr_accessor(*syms, instance_reader: true, instance_writer: true, instance_accessor: true, default: nil, &blk) - location = caller_locations(1, 1).first - mattr_reader(*syms, instance_reader: instance_reader, instance_accessor: instance_accessor, default: default, location: location, &blk) - mattr_writer(*syms, instance_writer: instance_writer, instance_accessor: instance_accessor, default: default, location: location) - end - alias :cattr_accessor :mattr_accessor -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb deleted file mode 100644 index 628da9c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +++ /dev/null @@ -1,175 +0,0 @@ -# frozen_string_literal: true - -# == Attribute Accessors per Thread -# -# Extends the module object with class/module and instance accessors for -# class/module attributes, just like the native attr* accessors for instance -# attributes, but does so on a per-thread basis. -# -# So the values are scoped within the Thread.current space under the class name -# of the module. -# -# Note that it can also be scoped per-fiber if +Rails.application.config.active_support.isolation_level+ -# is set to +:fiber+. -class Module - # Defines a per-thread class attribute and creates class and instance reader methods. - # The underlying per-thread class variable is set to +nil+, if it is not previously defined. - # - # module Current - # thread_mattr_reader :user - # end - # - # Current.user = "DHH" - # Current.user # => "DHH" - # Thread.new { Current.user }.value # => nil - # - # The attribute name must be a valid method name in Ruby. - # - # module Foo - # thread_mattr_reader :"1_Badname" - # end - # # => NameError: invalid attribute name: 1_Badname - # - # To omit the instance reader method, pass - # instance_reader: false or instance_accessor: false. - # - # class Current - # thread_mattr_reader :user, instance_reader: false - # end - # - # Current.new.user # => NoMethodError - def thread_mattr_reader(*syms, instance_reader: true, instance_accessor: true, default: nil) # :nodoc: - syms.each do |sym| - raise NameError.new("invalid attribute name: #{sym}") unless /^[_A-Za-z]\w*$/.match?(sym) - - # The following generated method concatenates `object_id` because we want - # subclasses to maintain independent values. - if default.nil? - class_eval(<<-EOS, __FILE__, __LINE__ + 1) - def self.#{sym} - @__thread_mattr_#{sym} ||= "attr_#{sym}_\#{object_id}" - ::ActiveSupport::IsolatedExecutionState[@__thread_mattr_#{sym}] - end - EOS - else - default = default.dup.freeze unless default.frozen? - singleton_class.define_method("#{sym}_default_value") { default } - - class_eval(<<-EOS, __FILE__, __LINE__ + 1) - def self.#{sym} - @__thread_mattr_#{sym} ||= "attr_#{sym}_\#{object_id}" - value = ::ActiveSupport::IsolatedExecutionState[@__thread_mattr_#{sym}] - - if value.nil? && !::ActiveSupport::IsolatedExecutionState.key?(@__thread_mattr_#{sym}) - ::ActiveSupport::IsolatedExecutionState[@__thread_mattr_#{sym}] = #{sym}_default_value - else - value - end - end - EOS - end - - if instance_reader && instance_accessor - class_eval(<<-EOS, __FILE__, __LINE__ + 1) - def #{sym} - self.class.#{sym} - end - EOS - end - end - end - alias :thread_cattr_reader :thread_mattr_reader - - # Defines a per-thread class attribute and creates a class and instance writer methods to - # allow assignment to the attribute. - # - # module Current - # thread_mattr_writer :user - # end - # - # Current.user = "DHH" - # Thread.current[:attr_Current_user] # => "DHH" - # - # To omit the instance writer method, pass - # instance_writer: false or instance_accessor: false. - # - # class Current - # thread_mattr_writer :user, instance_writer: false - # end - # - # Current.new.user = "DHH" # => NoMethodError - def thread_mattr_writer(*syms, instance_writer: true, instance_accessor: true) # :nodoc: - syms.each do |sym| - raise NameError.new("invalid attribute name: #{sym}") unless /^[_A-Za-z]\w*$/.match?(sym) - - # The following generated method concatenates `object_id` because we want - # subclasses to maintain independent values. - class_eval(<<-EOS, __FILE__, __LINE__ + 1) - def self.#{sym}=(obj) - @__thread_mattr_#{sym} ||= "attr_#{sym}_\#{object_id}" - ::ActiveSupport::IsolatedExecutionState[@__thread_mattr_#{sym}] = obj - end - EOS - - if instance_writer && instance_accessor - class_eval(<<-EOS, __FILE__, __LINE__ + 1) - def #{sym}=(obj) - self.class.#{sym} = obj - end - EOS - end - end - end - alias :thread_cattr_writer :thread_mattr_writer - - # Defines both class and instance accessors for class attributes. - # - # class Account - # thread_mattr_accessor :user - # end - # - # Account.user = "DHH" - # Account.user # => "DHH" - # Account.new.user # => "DHH" - # - # Unlike +mattr_accessor+, values are *not* shared with subclasses or parent classes. - # If a subclass changes the value, the parent class' value is not changed. - # If the parent class changes the value, the value of subclasses is not changed. - # - # class Customer < Account - # end - # - # Account.user # => "DHH" - # Customer.user # => nil - # Customer.user = "Rafael" - # Customer.user # => "Rafael" - # Account.user # => "DHH" - # - # To omit the instance writer method, pass instance_writer: false. - # To omit the instance reader method, pass instance_reader: false. - # - # class Current - # thread_mattr_accessor :user, instance_writer: false, instance_reader: false - # end - # - # Current.new.user = "DHH" # => NoMethodError - # Current.new.user # => NoMethodError - # - # Or pass instance_accessor: false, to omit both instance methods. - # - # class Current - # thread_mattr_accessor :user, instance_accessor: false - # end - # - # Current.new.user = "DHH" # => NoMethodError - # Current.new.user # => NoMethodError - # - # A default value may be specified using the +:default+ option. Because - # multiple threads can access the default value, non-frozen default values - # will be duped and frozen. - def thread_mattr_accessor(*syms, instance_reader: true, instance_writer: true, instance_accessor: true, default: nil) - thread_mattr_reader(*syms, instance_reader: instance_reader, instance_accessor: instance_accessor, default: default) - thread_mattr_writer(*syms, instance_writer: instance_writer, instance_accessor: instance_accessor) - end - alias :thread_cattr_accessor :thread_mattr_accessor -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/concerning.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/concerning.rb deleted file mode 100644 index c852320..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/concerning.rb +++ /dev/null @@ -1,140 +0,0 @@ -# frozen_string_literal: true - -require "active_support/concern" - -class Module - # == Bite-sized separation of concerns - # - # We often find ourselves with a medium-sized chunk of behavior that we'd - # like to extract, but only mix in to a single class. - # - # Extracting a plain old Ruby object to encapsulate it and collaborate or - # delegate to the original object is often a good choice, but when there's - # no additional state to encapsulate or we're making DSL-style declarations - # about the parent class, introducing new collaborators can obfuscate rather - # than simplify. - # - # The typical route is to just dump everything in a monolithic class, perhaps - # with a comment, as a least-bad alternative. Using modules in separate files - # means tedious sifting to get a big-picture view. - # - # == Dissatisfying ways to separate small concerns - # - # === Using comments: - # - # class Todo < ApplicationRecord - # # Other todo implementation - # # ... - # - # ## Event tracking - # has_many :events - # - # before_create :track_creation - # - # private - # def track_creation - # # ... - # end - # end - # - # === With an inline module: - # - # Noisy syntax. - # - # class Todo < ApplicationRecord - # # Other todo implementation - # # ... - # - # module EventTracking - # extend ActiveSupport::Concern - # - # included do - # has_many :events - # before_create :track_creation - # end - # - # private - # def track_creation - # # ... - # end - # end - # include EventTracking - # end - # - # === Mix-in noise exiled to its own file: - # - # Once our chunk of behavior starts pushing the scroll-to-understand-it - # boundary, we give in and move it to a separate file. At this size, the - # increased overhead can be a reasonable tradeoff even if it reduces our - # at-a-glance perception of how things work. - # - # class Todo < ApplicationRecord - # # Other todo implementation - # # ... - # - # include TodoEventTracking - # end - # - # == Introducing Module#concerning - # - # By quieting the mix-in noise, we arrive at a natural, low-ceremony way to - # separate bite-sized concerns. - # - # class Todo < ApplicationRecord - # # Other todo implementation - # # ... - # - # concerning :EventTracking do - # included do - # has_many :events - # before_create :track_creation - # end - # - # private - # def track_creation - # # ... - # end - # end - # end - # - # Todo.ancestors - # # => [Todo, Todo::EventTracking, ApplicationRecord, Object] - # - # This small step has some wonderful ripple effects. We can - # * grok the behavior of our class in one glance, - # * clean up monolithic junk-drawer classes by separating their concerns, and - # * stop leaning on protected/private for crude "this is internal stuff" modularity. - # - # === Prepending concerning - # - # concerning supports a prepend: true argument which will prepend the - # concern instead of using include for it. - module Concerning - # Define a new concern and mix it in. - def concerning(topic, prepend: false, &block) - method = prepend ? :prepend : :include - __send__(method, concern(topic, &block)) - end - - # A low-cruft shortcut to define a concern. - # - # concern :EventTracking do - # ... - # end - # - # is equivalent to - # - # module EventTracking - # extend ActiveSupport::Concern - # - # ... - # end - def concern(topic, &module_definition) - const_set topic, Module.new { - extend ::ActiveSupport::Concern - module_eval(&module_definition) - } - end - end - include Concerning -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/delegation.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/delegation.rb deleted file mode 100644 index f306d55..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/delegation.rb +++ /dev/null @@ -1,225 +0,0 @@ -# frozen_string_literal: true - -class Module - require "active_support/delegation" - DelegationError = ActiveSupport::DelegationError # :nodoc: - - # Provides a +delegate+ class method to easily expose contained objects' - # public methods as your own. - # - # ==== Options - # * :to - Specifies the target object name as a symbol or string - # * :prefix - Prefixes the new method with the target name or a custom prefix - # * :allow_nil - If set to true, prevents a +ActiveSupport::DelegationError+ - # from being raised - # * :private - If set to true, changes method visibility to private - # - # The macro receives one or more method names (specified as symbols or - # strings) and the name of the target object via the :to option - # (also a symbol or string). - # - # Delegation is particularly useful with Active Record associations: - # - # class Greeter < ActiveRecord::Base - # def hello - # 'hello' - # end - # - # def goodbye - # 'goodbye' - # end - # end - # - # class Foo < ActiveRecord::Base - # belongs_to :greeter - # delegate :hello, to: :greeter - # end - # - # Foo.new.hello # => "hello" - # Foo.new.goodbye # => NoMethodError: undefined method `goodbye' for # - # - # Multiple delegates to the same target are allowed: - # - # class Foo < ActiveRecord::Base - # belongs_to :greeter - # delegate :hello, :goodbye, to: :greeter - # end - # - # Foo.new.goodbye # => "goodbye" - # - # Methods can be delegated to instance variables, class variables, or constants - # by providing them as a symbols: - # - # class Foo - # CONSTANT_ARRAY = [0,1,2,3] - # @@class_array = [4,5,6,7] - # - # def initialize - # @instance_array = [8,9,10,11] - # end - # delegate :sum, to: :CONSTANT_ARRAY - # delegate :min, to: :@@class_array - # delegate :max, to: :@instance_array - # end - # - # Foo.new.sum # => 6 - # Foo.new.min # => 4 - # Foo.new.max # => 11 - # - # It's also possible to delegate a method to the class by using +:class+: - # - # class Foo - # def self.hello - # "world" - # end - # - # delegate :hello, to: :class - # end - # - # Foo.new.hello # => "world" - # - # Delegates can optionally be prefixed using the :prefix option. If the value - # is true, the delegate methods are prefixed with the name of the object being - # delegated to. - # - # Person = Struct.new(:name, :address) - # - # class Invoice < Struct.new(:client) - # delegate :name, :address, to: :client, prefix: true - # end - # - # john_doe = Person.new('John Doe', 'Vimmersvej 13') - # invoice = Invoice.new(john_doe) - # invoice.client_name # => "John Doe" - # invoice.client_address # => "Vimmersvej 13" - # - # It is also possible to supply a custom prefix. - # - # class Invoice < Struct.new(:client) - # delegate :name, :address, to: :client, prefix: :customer - # end - # - # invoice = Invoice.new(john_doe) - # invoice.customer_name # => 'John Doe' - # invoice.customer_address # => 'Vimmersvej 13' - # - # The delegated methods are public by default. - # Pass private: true to change that. - # - # class User < ActiveRecord::Base - # has_one :profile - # delegate :first_name, to: :profile - # delegate :date_of_birth, to: :profile, private: true - # - # def age - # Date.today.year - date_of_birth.year - # end - # end - # - # User.new.first_name # => "Tomas" - # User.new.date_of_birth # => NoMethodError: private method `date_of_birth' called for # - # User.new.age # => 2 - # - # If the target is +nil+ and does not respond to the delegated method a - # +ActiveSupport::DelegationError+ is raised. If you wish to instead return +nil+, - # use the :allow_nil option. - # - # class User < ActiveRecord::Base - # has_one :profile - # delegate :age, to: :profile - # end - # - # User.new.age - # # => ActiveSupport::DelegationError: User#age delegated to profile.age, but profile is nil - # - # But if not having a profile yet is fine and should not be an error - # condition: - # - # class User < ActiveRecord::Base - # has_one :profile - # delegate :age, to: :profile, allow_nil: true - # end - # - # User.new.age # nil - # - # Note that if the target is not +nil+ then the call is attempted regardless of the - # :allow_nil option, and thus an exception is still raised if said object - # does not respond to the method: - # - # class Foo - # def initialize(bar) - # @bar = bar - # end - # - # delegate :name, to: :@bar, allow_nil: true - # end - # - # Foo.new("Bar").name # raises NoMethodError: undefined method `name' - # - # The target method must be public, otherwise it will raise +NoMethodError+. - def delegate(*methods, to: nil, prefix: nil, allow_nil: nil, private: nil) - ::ActiveSupport::Delegation.generate( - self, - methods, - location: caller_locations(1, 1).first, - to: to, - prefix: prefix, - allow_nil: allow_nil, - private: private, - ) - end - - # When building decorators, a common pattern may emerge: - # - # class Partition - # def initialize(event) - # @event = event - # end - # - # def person - # detail.person || creator - # end - # - # private - # def respond_to_missing?(name, include_private = false) - # @event.respond_to?(name, include_private) - # end - # - # def method_missing(method, *args, &block) - # @event.send(method, *args, &block) - # end - # end - # - # With Module#delegate_missing_to, the above is condensed to: - # - # class Partition - # delegate_missing_to :@event - # - # def initialize(event) - # @event = event - # end - # - # def person - # detail.person || creator - # end - # end - # - # The target can be anything callable within the object, e.g. instance - # variables, methods, constants, etc. - # - # The delegated method must be public on the target, otherwise it will - # raise +ActiveSupport::DelegationError+. If you wish to instead return +nil+, - # use the :allow_nil option. - # - # The marshal_dump and _dump methods are exempt from - # delegation due to possible interference when calling - # Marshal.dump(object), should the delegation target method - # of object add or remove instance variables. - def delegate_missing_to(target, allow_nil: nil) - ::ActiveSupport::Delegation.generate_method_missing( - self, - target, - allow_nil: allow_nil, - ) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/deprecation.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/deprecation.rb deleted file mode 100644 index 420311b..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/deprecation.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class Module - # deprecate :foo, deprecator: MyLib.deprecator - # deprecate :foo, bar: "warning!", deprecator: MyLib.deprecator - # - # A deprecator is typically an instance of ActiveSupport::Deprecation, but you can also pass any object that responds - # to deprecation_warning(deprecated_method_name, message, caller_backtrace) where you can implement your - # custom warning behavior. - # - # class MyLib::Deprecator - # def deprecation_warning(deprecated_method_name, message, caller_backtrace = nil) - # message = "#{deprecated_method_name} is deprecated and will be removed from MyLibrary | #{message}" - # Kernel.warn message - # end - # end - def deprecate(*method_names, deprecator:, **options) - if deprecator.is_a?(ActiveSupport::Deprecation) - deprecator.deprecate_methods(self, *method_names, **options) - elsif deprecator - # we just need any instance to call deprecate_methods, but the deprecation will be emitted by deprecator - ActiveSupport.deprecator.deprecate_methods(self, *method_names, **options, deprecator: deprecator) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/introspection.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/introspection.rb deleted file mode 100644 index 97ee421..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/introspection.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true - -require "active_support/inflector" - -class Module - # Returns the name of the module containing this one. - # - # M::N.module_parent_name # => "M" - def module_parent_name - if defined?(@parent_name) - @parent_name - else - name = self.name - return if name.nil? - - parent_name = name =~ /::[^:]+\z/ ? -$` : nil - @parent_name = parent_name unless frozen? - parent_name - end - end - - # Returns the module which contains this one according to its name. - # - # module M - # module N - # end - # end - # X = M::N - # - # M::N.module_parent # => M - # X.module_parent # => M - # - # The parent of top-level and anonymous modules is Object. - # - # M.module_parent # => Object - # Module.new.module_parent # => Object - def module_parent - module_parent_name ? ActiveSupport::Inflector.constantize(module_parent_name) : Object - end - - # Returns all the parents of this module according to its name, ordered from - # nested outwards. The receiver is not contained within the result. - # - # module M - # module N - # end - # end - # X = M::N - # - # M.module_parents # => [Object] - # M::N.module_parents # => [M, Object] - # X.module_parents # => [M, Object] - def module_parents - parents = [] - if module_parent_name - parts = module_parent_name.split("::") - until parts.empty? - parents << ActiveSupport::Inflector.constantize(parts * "::") - parts.pop - end - end - parents << Object unless parents.include? Object - parents - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/redefine_method.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/redefine_method.rb deleted file mode 100644 index 5bd8e6e..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/redefine_method.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -class Module - # Marks the named method as intended to be redefined, if it exists. - # Suppresses the Ruby method redefinition warning. Prefer - # #redefine_method where possible. - def silence_redefinition_of_method(method) - if method_defined?(method) || private_method_defined?(method) - # This suppresses the "method redefined" warning; the self-alias - # looks odd, but means we don't need to generate a unique name - alias_method method, method - end - end - - # Replaces the existing method definition, if there is one, with the passed - # block as its body. - def redefine_method(method, &block) - visibility = method_visibility(method) - silence_redefinition_of_method(method) - define_method(method, &block) - send(visibility, method) - end - - # Replaces the existing singleton method definition, if there is one, with - # the passed block as its body. - def redefine_singleton_method(method, &block) - singleton_class.redefine_method(method, &block) - end - - def method_visibility(method) # :nodoc: - case - when private_method_defined?(method) - :private - when protected_method_defined?(method) - :protected - else - :public - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/remove_method.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/remove_method.rb deleted file mode 100644 index 97eb5f9..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/module/remove_method.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/module/redefine_method" - -class Module - # Removes the named method, if it exists. - def remove_possible_method(method) - if method_defined?(method) || private_method_defined?(method) - undef_method(method) - end - end - - # Removes the named singleton method, if it exists. - def remove_possible_singleton_method(method) - singleton_class.remove_possible_method(method) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/name_error.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/name_error.rb deleted file mode 100644 index 18ea275..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/name_error.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -class NameError - # Extract the name of the missing constant from the exception message. - # - # begin - # HelloWorld - # rescue NameError => e - # e.missing_name - # end - # # => "HelloWorld" - def missing_name - # Since ruby v2.3.0 `did_you_mean` gem is loaded by default. - # It extends NameError#message with spell corrections which are SLOW. - # We should use original_message message instead. - message = respond_to?(:original_message) ? original_message : self.message - return unless message.start_with?("uninitialized constant ") - - receiver = begin - self.receiver - rescue ArgumentError - nil - end - - if receiver == Object - name.to_s - elsif receiver - "#{real_mod_name(receiver)}::#{self.name}" - else - if match = message.match(/((::)?([A-Z]\w*)(::[A-Z]\w*)*)$/) - match[1] - end - end - end - - # Was this exception raised because the given name was missing? - # - # begin - # HelloWorld - # rescue NameError => e - # e.missing_name?("HelloWorld") - # end - # # => true - def missing_name?(name) - if name.is_a? Symbol - self.name == name - else - missing_name == name.to_s - end - end - - private - UNBOUND_METHOD_MODULE_NAME = Module.instance_method(:name) - private_constant :UNBOUND_METHOD_MODULE_NAME - - def real_mod_name(mod) - UNBOUND_METHOD_MODULE_NAME.bind_call(mod) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/numeric.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/numeric.rb deleted file mode 100644 index 949efcb..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/numeric.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -require_relative "numeric/bytes" -require_relative "numeric/time" -require_relative "numeric/conversions" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/numeric/bytes.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/numeric/bytes.rb deleted file mode 100644 index 45b38f2..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/numeric/bytes.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: true - -class Numeric - KILOBYTE = 1024 - MEGABYTE = KILOBYTE * 1024 - GIGABYTE = MEGABYTE * 1024 - TERABYTE = GIGABYTE * 1024 - PETABYTE = TERABYTE * 1024 - EXABYTE = PETABYTE * 1024 - ZETTABYTE = EXABYTE * 1024 - - # Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes - # - # 2.bytes # => 2 - def bytes - self - end - alias :byte :bytes - - # Returns the number of bytes equivalent to the kilobytes provided. - # - # 2.kilobytes # => 2048 - def kilobytes - self * KILOBYTE - end - alias :kilobyte :kilobytes - - # Returns the number of bytes equivalent to the megabytes provided. - # - # 2.megabytes # => 2_097_152 - def megabytes - self * MEGABYTE - end - alias :megabyte :megabytes - - # Returns the number of bytes equivalent to the gigabytes provided. - # - # 2.gigabytes # => 2_147_483_648 - def gigabytes - self * GIGABYTE - end - alias :gigabyte :gigabytes - - # Returns the number of bytes equivalent to the terabytes provided. - # - # 2.terabytes # => 2_199_023_255_552 - def terabytes - self * TERABYTE - end - alias :terabyte :terabytes - - # Returns the number of bytes equivalent to the petabytes provided. - # - # 2.petabytes # => 2_251_799_813_685_248 - def petabytes - self * PETABYTE - end - alias :petabyte :petabytes - - # Returns the number of bytes equivalent to the exabytes provided. - # - # 2.exabytes # => 2_305_843_009_213_693_952 - def exabytes - self * EXABYTE - end - alias :exabyte :exabytes - - # Returns the number of bytes equivalent to the zettabytes provided. - # - # 2.zettabytes # => 2_361_183_241_434_822_606_848 - def zettabytes - self * ZETTABYTE - end - alias :zettabyte :zettabytes -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/numeric/conversions.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/numeric/conversions.rb deleted file mode 100644 index e983993..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/numeric/conversions.rb +++ /dev/null @@ -1,145 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/big_decimal/conversions" -require "active_support/number_helper" - -module ActiveSupport - module NumericWithFormat - # \Numeric With Format - # - # Provides options for converting numbers into formatted strings. - # Options are provided for phone numbers, currency, percentage, - # precision, positional notation, file size, and pretty printing. - # - # This method is aliased to to_formatted_s. - # - # ==== Options - # - # For details on which formats use which options, see ActiveSupport::NumberHelper - # - # ==== Examples - # - # Phone Numbers: - # 5551234.to_fs(:phone) # => "555-1234" - # 1235551234.to_fs(:phone) # => "123-555-1234" - # 1235551234.to_fs(:phone, area_code: true) # => "(123) 555-1234" - # 1235551234.to_fs(:phone, delimiter: ' ') # => "123 555 1234" - # 1235551234.to_fs(:phone, area_code: true, extension: 555) # => "(123) 555-1234 x 555" - # 1235551234.to_fs(:phone, country_code: 1) # => "+1-123-555-1234" - # 1235551234.to_fs(:phone, country_code: 1, extension: 1343, delimiter: '.') - # # => "+1.123.555.1234 x 1343" - # - # Currency: - # 1234567890.50.to_fs(:currency) # => "$1,234,567,890.50" - # 1234567890.506.to_fs(:currency) # => "$1,234,567,890.51" - # 1234567890.506.to_fs(:currency, precision: 3) # => "$1,234,567,890.506" - # 1234567890.506.to_fs(:currency, round_mode: :down) # => "$1,234,567,890.50" - # 1234567890.506.to_fs(:currency, locale: :fr) # => "1 234 567 890,51 €" - # -1234567890.50.to_fs(:currency, negative_format: '(%u%n)') - # # => "($1,234,567,890.50)" - # 1234567890.50.to_fs(:currency, unit: '£', separator: ',', delimiter: '') - # # => "£1234567890,50" - # 1234567890.50.to_fs(:currency, unit: '£', separator: ',', delimiter: '', format: '%n %u') - # # => "1234567890,50 £" - # - # Percentage: - # 100.to_fs(:percentage) # => "100.000%" - # 100.to_fs(:percentage, precision: 0) # => "100%" - # 1000.to_fs(:percentage, delimiter: '.', separator: ',') # => "1.000,000%" - # 302.24398923423.to_fs(:percentage, precision: 5) # => "302.24399%" - # 302.24398923423.to_fs(:percentage, round_mode: :down) # => "302.243%" - # 1000.to_fs(:percentage, locale: :fr) # => "1 000,000%" - # 100.to_fs(:percentage, format: '%n %') # => "100.000 %" - # - # Delimited: - # 12345678.to_fs(:delimited) # => "12,345,678" - # 12345678.05.to_fs(:delimited) # => "12,345,678.05" - # 12345678.to_fs(:delimited, delimiter: '.') # => "12.345.678" - # 12345678.to_fs(:delimited, delimiter: ',') # => "12,345,678" - # 12345678.05.to_fs(:delimited, separator: ' ') # => "12,345,678 05" - # 12345678.05.to_fs(:delimited, locale: :fr) # => "12 345 678,05" - # 98765432.98.to_fs(:delimited, delimiter: ' ', separator: ',') - # # => "98 765 432,98" - # - # Rounded: - # 111.2345.to_fs(:rounded) # => "111.235" - # 111.2345.to_fs(:rounded, precision: 2) # => "111.23" - # 111.2345.to_fs(:rounded, precision: 2, round_mode: :up) # => "111.24" - # 13.to_fs(:rounded, precision: 5) # => "13.00000" - # 389.32314.to_fs(:rounded, precision: 0) # => "389" - # 111.2345.to_fs(:rounded, significant: true) # => "111" - # 111.2345.to_fs(:rounded, precision: 1, significant: true) # => "100" - # 13.to_fs(:rounded, precision: 5, significant: true) # => "13.000" - # 111.234.to_fs(:rounded, locale: :fr) # => "111,234" - # 13.to_fs(:rounded, precision: 5, significant: true, strip_insignificant_zeros: true) - # # => "13" - # 389.32314.to_fs(:rounded, precision: 4, significant: true) # => "389.3" - # 1111.2345.to_fs(:rounded, precision: 2, separator: ',', delimiter: '.') - # # => "1.111,23" - # - # Human-friendly size in Bytes: - # 123.to_fs(:human_size) # => "123 Bytes" - # 1234.to_fs(:human_size) # => "1.21 KB" - # 12345.to_fs(:human_size) # => "12.1 KB" - # 1234567.to_fs(:human_size) # => "1.18 MB" - # 1234567890.to_fs(:human_size) # => "1.15 GB" - # 1234567890123.to_fs(:human_size) # => "1.12 TB" - # 1234567890123456.to_fs(:human_size) # => "1.1 PB" - # 1234567890123456789.to_fs(:human_size) # => "1.07 EB" - # 1234567.to_fs(:human_size, precision: 2) # => "1.2 MB" - # 1234567.to_fs(:human_size, precision: 2, round_mode: :up) # => "1.3 MB" - # 483989.to_fs(:human_size, precision: 2) # => "470 KB" - # 1234567.to_fs(:human_size, precision: 2, separator: ',') # => "1,2 MB" - # 1234567890123.to_fs(:human_size, precision: 5) # => "1.1228 TB" - # 524288000.to_fs(:human_size, precision: 5) # => "500 MB" - # - # Human-friendly format: - # 123.to_fs(:human) # => "123" - # 1234.to_fs(:human) # => "1.23 Thousand" - # 12345.to_fs(:human) # => "12.3 Thousand" - # 1234567.to_fs(:human) # => "1.23 Million" - # 1234567890.to_fs(:human) # => "1.23 Billion" - # 1234567890123.to_fs(:human) # => "1.23 Trillion" - # 1234567890123456.to_fs(:human) # => "1.23 Quadrillion" - # 1234567890123456789.to_fs(:human) # => "1230 Quadrillion" - # 489939.to_fs(:human, precision: 2) # => "490 Thousand" - # 489939.to_fs(:human, precision: 2, round_mode: :down) # => "480 Thousand" - # 489939.to_fs(:human, precision: 4) # => "489.9 Thousand" - # 1234567.to_fs(:human, precision: 4, - # significant: false) # => "1.2346 Million" - # 1234567.to_fs(:human, precision: 1, - # separator: ',', - # significant: false) # => "1,2 Million" - def to_fs(format = nil, options = nil) - return to_s if format.nil? - - case format - when Integer, String - to_s(format) - when :phone - ActiveSupport::NumberHelper.number_to_phone(self, options || {}) - when :currency - ActiveSupport::NumberHelper.number_to_currency(self, options || {}) - when :percentage - ActiveSupport::NumberHelper.number_to_percentage(self, options || {}) - when :delimited - ActiveSupport::NumberHelper.number_to_delimited(self, options || {}) - when :rounded - ActiveSupport::NumberHelper.number_to_rounded(self, options || {}) - when :human - ActiveSupport::NumberHelper.number_to_human(self, options || {}) - when :human_size - ActiveSupport::NumberHelper.number_to_human_size(self, options || {}) - when Symbol - to_s - else - to_s(format) - end - end - alias_method :to_formatted_s, :to_fs - end -end - -Integer.include ActiveSupport::NumericWithFormat -Float.include ActiveSupport::NumericWithFormat -BigDecimal.include ActiveSupport::NumericWithFormat diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/numeric/time.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/numeric/time.rb deleted file mode 100644 index bc4627f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/numeric/time.rb +++ /dev/null @@ -1,66 +0,0 @@ -# frozen_string_literal: true - -require "active_support/duration" -require "active_support/core_ext/time/calculations" -require "active_support/core_ext/time/acts_like" -require "active_support/core_ext/date/calculations" -require "active_support/core_ext/date/acts_like" - -class Numeric - # Returns a Duration instance matching the number of seconds provided. - # - # 2.seconds # => 2 seconds - def seconds - ActiveSupport::Duration.seconds(self) - end - alias :second :seconds - - # Returns a Duration instance matching the number of minutes provided. - # - # 2.minutes # => 2 minutes - def minutes - ActiveSupport::Duration.minutes(self) - end - alias :minute :minutes - - # Returns a Duration instance matching the number of hours provided. - # - # 2.hours # => 2 hours - def hours - ActiveSupport::Duration.hours(self) - end - alias :hour :hours - - # Returns a Duration instance matching the number of days provided. - # - # 2.days # => 2 days - def days - ActiveSupport::Duration.days(self) - end - alias :day :days - - # Returns a Duration instance matching the number of weeks provided. - # - # 2.weeks # => 2 weeks - def weeks - ActiveSupport::Duration.weeks(self) - end - alias :week :weeks - - # Returns a Duration instance matching the number of fortnights provided. - # - # 2.fortnights # => 4 weeks - def fortnights - ActiveSupport::Duration.weeks(self * 2) - end - alias :fortnight :fortnights - - # Returns the number of milliseconds equivalent to the seconds provided. - # Used with the standard time durations. - # - # 2.in_milliseconds # => 2000 - # 1.hour.in_milliseconds # => 3600000 - def in_milliseconds - self * 1000 - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object.rb deleted file mode 100644 index 097e471..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -require_relative "object/acts_like" -require_relative "object/blank" -require_relative "object/duplicable" -require_relative "object/deep_dup" -require_relative "object/try" -require_relative "object/inclusion" - -require_relative "object/conversions" -require_relative "object/instance_variables" - -require_relative "object/json" -require_relative "object/to_param" -require_relative "object/to_query" -require_relative "object/with" -require_relative "object/with_options" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/acts_like.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/acts_like.rb deleted file mode 100644 index 292826c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/acts_like.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -class Object - # Provides a way to check whether some class acts like some other class based on the existence of - # an appropriately-named marker method. - # - # A class that provides the same interface as SomeClass may define a marker method named - # acts_like_some_class? to signal its compatibility to callers of - # acts_like?(:some_class). - # - # For example, Active Support extends Date to define an acts_like_date? method, - # and extends Time to define acts_like_time?. As a result, developers can call - # x.acts_like?(:time) and x.acts_like?(:date) to test duck-type compatibility, - # and classes that are able to act like Time can also define an acts_like_time? - # method to interoperate. - # - # Note that the marker method is only expected to exist. It isn't called, so its body or return - # value are irrelevant. - # - # ==== Example: A class that provides the same interface as String - # - # This class may define: - # - # class Stringish - # def acts_like_string? - # end - # end - # - # Then client code can query for duck-type-safeness this way: - # - # Stringish.new.acts_like?(:string) # => true - # - def acts_like?(duck) - case duck - when :time - respond_to? :acts_like_time? - when :date - respond_to? :acts_like_date? - when :string - respond_to? :acts_like_string? - else - respond_to? :"acts_like_#{duck}?" - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/blank.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/blank.rb deleted file mode 100644 index 967c82e..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/blank.rb +++ /dev/null @@ -1,199 +0,0 @@ -# frozen_string_literal: true - -require "concurrent/map" - -class Object - # An object is blank if it's false, empty, or a whitespace string. - # For example, +nil+, '', ' ', [], {}, and +false+ are all blank. - # - # This simplifies - # - # !address || address.empty? - # - # to - # - # address.blank? - # - # @return [true, false] - def blank? - respond_to?(:empty?) ? !!empty? : false - end - - # An object is present if it's not blank. - # - # @return [true, false] - def present? - !blank? - end - - # Returns the receiver if it's present otherwise returns +nil+. - # object.presence is equivalent to - # - # object.present? ? object : nil - # - # For example, something like - # - # state = params[:state] if params[:state].present? - # country = params[:country] if params[:country].present? - # region = state || country || 'US' - # - # becomes - # - # region = params[:state].presence || params[:country].presence || 'US' - # - # @return [Object] - def presence - self if present? - end -end - -class NilClass - # +nil+ is blank: - # - # nil.blank? # => true - # - # @return [true] - def blank? - true - end - - def present? # :nodoc: - false - end -end - -class FalseClass - # +false+ is blank: - # - # false.blank? # => true - # - # @return [true] - def blank? - true - end - - def present? # :nodoc: - false - end -end - -class TrueClass - # +true+ is not blank: - # - # true.blank? # => false - # - # @return [false] - def blank? - false - end - - def present? # :nodoc: - true - end -end - -class Array - # An array is blank if it's empty: - # - # [].blank? # => true - # [1,2,3].blank? # => false - # - # @return [true, false] - alias_method :blank?, :empty? - - def present? # :nodoc: - !empty? - end -end - -class Hash - # A hash is blank if it's empty: - # - # {}.blank? # => true - # { key: 'value' }.blank? # => false - # - # @return [true, false] - alias_method :blank?, :empty? - - def present? # :nodoc: - !empty? - end -end - -class Symbol - # A Symbol is blank if it's empty: - # - # :''.blank? # => true - # :symbol.blank? # => false - alias_method :blank?, :empty? - - def present? # :nodoc: - !empty? - end -end - -class String - BLANK_RE = /\A[[:space:]]*\z/ - ENCODED_BLANKS = Concurrent::Map.new do |h, enc| - h[enc] = Regexp.new(BLANK_RE.source.encode(enc), BLANK_RE.options | Regexp::FIXEDENCODING) - end - - # A string is blank if it's empty or contains whitespaces only: - # - # ''.blank? # => true - # ' '.blank? # => true - # "\t\n\r".blank? # => true - # ' blah '.blank? # => false - # - # Unicode whitespace is supported: - # - # "\u00a0".blank? # => true - # - # @return [true, false] - def blank? - # The regexp that matches blank strings is expensive. For the case of empty - # strings we can speed up this method (~3.5x) with an empty? call. The - # penalty for the rest of strings is marginal. - empty? || - begin - BLANK_RE.match?(self) - rescue Encoding::CompatibilityError - ENCODED_BLANKS[self.encoding].match?(self) - end - end - - def present? # :nodoc: - !blank? - end -end - -class Numeric # :nodoc: - # No number is blank: - # - # 1.blank? # => false - # 0.blank? # => false - # - # @return [false] - def blank? - false - end - - def present? - true - end -end - -class Time # :nodoc: - # No Time is blank: - # - # Time.now.blank? # => false - # - # @return [false] - def blank? - false - end - - def present? - true - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/conversions.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/conversions.rb deleted file mode 100644 index 624fb8d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/conversions.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/to_param" -require "active_support/core_ext/object/to_query" -require "active_support/core_ext/array/conversions" -require "active_support/core_ext/hash/conversions" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/deep_dup.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/deep_dup.rb deleted file mode 100644 index 7d54d0c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/deep_dup.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/duplicable" - -class Object - # Returns a deep copy of object if it's duplicable. If it's - # not duplicable, returns +self+. - # - # object = Object.new - # dup = object.deep_dup - # dup.instance_variable_set(:@a, 1) - # - # object.instance_variable_defined?(:@a) # => false - # dup.instance_variable_defined?(:@a) # => true - def deep_dup - duplicable? ? dup : self - end -end - -class Array - # Returns a deep copy of array. - # - # array = [1, [2, 3]] - # dup = array.deep_dup - # dup[1][2] = 4 - # - # array[1][2] # => nil - # dup[1][2] # => 4 - def deep_dup - map(&:deep_dup) - end -end - -class Hash - # Returns a deep copy of hash. - # - # hash = { a: { b: 'b' } } - # dup = hash.deep_dup - # dup[:a][:c] = 'c' - # - # hash[:a][:c] # => nil - # dup[:a][:c] # => "c" - def deep_dup - hash = dup - each_pair do |key, value| - if ::String === key || ::Symbol === key - hash[key] = value.deep_dup - else - hash.delete(key) - hash[key.deep_dup] = value.deep_dup - end - end - hash - end -end - -class Module - # Returns a copy of module or class if it's anonymous. If it's - # named, returns +self+. - # - # Object.deep_dup == Object # => true - # klass = Class.new - # klass.deep_dup == klass # => false - def deep_dup - if name.nil? - super - else - self - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/duplicable.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/duplicable.rb deleted file mode 100644 index 505455f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/duplicable.rb +++ /dev/null @@ -1,69 +0,0 @@ -# frozen_string_literal: true - -#-- -# Most objects are cloneable, but not all. For example you can't dup methods: -# -# method(:puts).dup # => TypeError: allocator undefined for Method -# -# Classes may signal their instances are not duplicable removing +dup+/+clone+ -# or raising exceptions from them. So, to dup an arbitrary object you normally -# use an optimistic approach and are ready to catch an exception, say: -# -# arbitrary_object.dup rescue object -# -# Rails dups objects in a few critical spots where they are not that arbitrary. -# That rescue is very expensive (like 40 times slower than a predicate), and it -# is often triggered. -# -# That's why we hardcode the following cases and check duplicable? instead of -# using that rescue idiom. -#++ -class Object - # Can you safely dup this object? - # - # False for method objects; - # true otherwise. - def duplicable? - true - end -end - -methods_are_duplicable = begin - Object.instance_method(:duplicable?).dup - true -rescue TypeError - false -end - -unless methods_are_duplicable - class Method - # Methods are not duplicable: - # - # method(:puts).duplicable? # => false - # method(:puts).dup # => TypeError: allocator undefined for Method - def duplicable? - false - end - end - - class UnboundMethod - # Unbound methods are not duplicable: - # - # method(:puts).unbind.duplicable? # => false - # method(:puts).unbind.dup # => TypeError: allocator undefined for UnboundMethod - def duplicable? - false - end - end -end - -require "singleton" - -module Singleton - # Singleton instances are not duplicable: - # - # Class.new.include(Singleton).instance.dup # TypeError (can't dup instance of singleton - def duplicable? - false - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/inclusion.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/inclusion.rb deleted file mode 100644 index 1b3cf2c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/inclusion.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -class Object - # Returns true if this object is included in the argument. - # - # When argument is a +Range+, +#cover?+ is used to properly handle inclusion - # check within open ranges. Otherwise, argument must be any object which responds - # to +#include?+. Usage: - # - # characters = ["Konata", "Kagami", "Tsukasa"] - # "Konata".in?(characters) # => true - # - # For non +Range+ arguments, this will throw an +ArgumentError+ if the argument - # doesn't respond to +#include?+. - def in?(another_object) - case another_object - when Range - another_object.cover?(self) - else - another_object.include?(self) - end - rescue NoMethodError - raise ArgumentError.new("The parameter passed to #in? must respond to #include?") - end - - # Returns the receiver if it's included in the argument otherwise returns +nil+. - # Argument must be any object which responds to +#include?+. Usage: - # - # params[:bucket_type].presence_in %w( project calendar ) - # - # This will throw an +ArgumentError+ if the argument doesn't respond to +#include?+. - # - # @return [Object] - def presence_in(another_object) - in?(another_object) ? self : nil - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/instance_variables.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/instance_variables.rb deleted file mode 100644 index d515e6d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/instance_variables.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -class Object - # Returns a hash with string keys that maps instance variable names without "@" to their - # corresponding values. - # - # class C - # def initialize(x, y) - # @x, @y = x, y - # end - # end - # - # C.new(0, 1).instance_values # => {"x" => 0, "y" => 1} - def instance_values - instance_variables.to_h do |ivar| - [ivar[1..-1].freeze, instance_variable_get(ivar)] - end - end - - # Returns an array of instance variable names as strings including "@". - # - # class C - # def initialize(x, y) - # @x, @y = x, y - # end - # end - # - # C.new(0, 1).instance_variable_names # => ["@x", "@y"] - def instance_variable_names - instance_variables.map(&:name) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/json.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/json.rb deleted file mode 100644 index bd4bc5d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/json.rb +++ /dev/null @@ -1,267 +0,0 @@ -# frozen_string_literal: true - -# Hack to load JSON gem first so we can override its to_json. -require "json" -require "bigdecimal" -require "ipaddr" -require "uri" -require "pathname" -require "active_support/core_ext/big_decimal/conversions" # for #to_s -require "active_support/core_ext/hash/except" -require "active_support/core_ext/hash/slice" -require "active_support/core_ext/object/instance_variables" -require "time" -require "active_support/core_ext/time/conversions" -require "active_support/core_ext/date_time/conversions" -require "active_support/core_ext/date/conversions" - -#-- -# The JSON gem adds a few modules to Ruby core classes containing :to_json definition, overwriting -# their default behavior. That said, we need to define the basic to_json method in all of them, -# otherwise they will always use to_json gem implementation, which is backwards incompatible in -# several cases (for instance, the JSON implementation for Hash does not work) with inheritance. -# -# On the other hand, we should avoid conflict with ::JSON.{generate,dump}(obj). Unfortunately, the -# JSON gem's encoder relies on its own to_json implementation to encode objects. Since it always -# passes a ::JSON::State object as the only argument to to_json, we can detect that and forward the -# calls to the original to_json method. -# -# It should be noted that when using ::JSON.{generate,dump} directly, ActiveSupport's encoder is -# bypassed completely. This means that as_json won't be invoked and the JSON gem will simply -# ignore any options it does not natively understand. This also means that ::JSON.{generate,dump} -# should give exactly the same results with or without Active Support. - -module ActiveSupport - module ToJsonWithActiveSupportEncoder # :nodoc: - def to_json(options = nil) - if options.is_a?(::JSON::State) - # Called from JSON.{generate,dump}, forward it to JSON gem's to_json - super(options) - else - # to_json is being invoked directly, use ActiveSupport's encoder - ActiveSupport::JSON.encode(self, options) - end - end - end -end - -[Enumerable, Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass].reverse_each do |klass| - klass.include(ActiveSupport::ToJsonWithActiveSupportEncoder) -end - -class Module - def as_json(options = nil) # :nodoc: - name - end -end - -class Object - def as_json(options = nil) # :nodoc: - if respond_to?(:to_hash) - to_hash.as_json(options) - else - instance_values.as_json(options) - end - end -end - -class Data # :nodoc: - def as_json(options = nil) - to_h.as_json(options) - end -end - -class Struct # :nodoc: - def as_json(options = nil) - to_h.as_json(options) - end -end - -class TrueClass - def as_json(options = nil) # :nodoc: - self - end -end - -class FalseClass - def as_json(options = nil) # :nodoc: - self - end -end - -class NilClass - def as_json(options = nil) # :nodoc: - self - end -end - -class String - def as_json(options = nil) # :nodoc: - self - end -end - -class Symbol - def as_json(options = nil) # :nodoc: - name - end -end - -class Numeric - def as_json(options = nil) # :nodoc: - self - end -end - -class Float - # Encoding Infinity or NaN to JSON should return "null". The default returns - # "Infinity" or "NaN" which are not valid JSON. - def as_json(options = nil) # :nodoc: - finite? ? self : nil - end -end - -class BigDecimal - # A BigDecimal would be naturally represented as a JSON number. Most libraries, - # however, parse non-integer JSON numbers directly as floats. Clients using - # those libraries would get in general a wrong number and no way to recover - # other than manually inspecting the string with the JSON code itself. - # - # That's why a JSON string is returned. The JSON literal is not numeric, but - # if the other end knows by contract that the data is supposed to be a - # BigDecimal, it still has the chance to post-process the string and get the - # real value. - def as_json(options = nil) # :nodoc: - finite? ? to_s : nil - end -end - -class Regexp - def as_json(options = nil) # :nodoc: - to_s - end -end - -module Enumerable - def as_json(options = nil) # :nodoc: - to_a.as_json(options) - end -end - -class IO - def as_json(options = nil) # :nodoc: - to_s - end -end - -class Range - def as_json(options = nil) # :nodoc: - to_s - end -end - -class Array - def as_json(options = nil) # :nodoc: - if options - options = options.dup.freeze unless options.frozen? - map { |v| v.as_json(options) } - else - map { |v| v.as_json } - end - end -end - -class Hash - def as_json(options = nil) # :nodoc: - # create a subset of the hash by applying :only or :except - subset = if options - if attrs = options[:only] - slice(*Array(attrs)) - elsif attrs = options[:except] - except(*Array(attrs)) - else - self - end - else - self - end - - result = {} - if options - options = options.dup.freeze unless options.frozen? - subset.each { |k, v| result[k.to_s] = v.as_json(options) } - else - subset.each { |k, v| result[k.to_s] = v.as_json } - end - result - end -end - -class Time - def as_json(options = nil) # :nodoc: - if ActiveSupport::JSON::Encoding.use_standard_json_time_format - xmlschema(ActiveSupport::JSON::Encoding.time_precision) - else - %(#{strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)}) - end - end -end - -class Date - def as_json(options = nil) # :nodoc: - if ActiveSupport::JSON::Encoding.use_standard_json_time_format - strftime("%Y-%m-%d") - else - strftime("%Y/%m/%d") - end - end -end - -class DateTime - def as_json(options = nil) # :nodoc: - if ActiveSupport::JSON::Encoding.use_standard_json_time_format - xmlschema(ActiveSupport::JSON::Encoding.time_precision) - else - strftime("%Y/%m/%d %H:%M:%S %z") - end - end -end - -class URI::Generic # :nodoc: - def as_json(options = nil) - to_s - end -end - -class Pathname # :nodoc: - def as_json(options = nil) - to_s - end -end - -unless IPAddr.method_defined?(:as_json, false) - # Use `IPAddr#as_json` from the IPAddr gem if the version is 1.2.7 or higher. - class IPAddr # :nodoc: - def as_json(options = nil) - if ipv4? && prefix == 32 - to_s - elsif ipv6? && prefix == 128 - to_s - else - "#{self}/#{prefix}" - end - end - end -end - -class Process::Status # :nodoc: - def as_json(options = nil) - { exitstatus: exitstatus, pid: pid } - end -end - -class Exception - def as_json(options = nil) - to_s - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/to_param.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/to_param.rb deleted file mode 100644 index 6d2bdd7..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/to_param.rb +++ /dev/null @@ -1,3 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/to_query" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/to_query.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/to_query.rb deleted file mode 100644 index 5358e29..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/to_query.rb +++ /dev/null @@ -1,93 +0,0 @@ -# frozen_string_literal: true - -require "cgi/escape" -require "cgi/util" if RUBY_VERSION < "3.5" - -class Object - # Alias of to_s. - def to_param - to_s - end - - # Converts an object into a string suitable for use as a URL query string, - # using the given key as the param name. - def to_query(key) - "#{CGI.escape(key.to_param)}=#{CGI.escape(to_param.to_s)}" - end -end - -class NilClass - # Returns a CGI-escaped +key+. - def to_query(key) - CGI.escape(key.to_param) - end - - # Returns +self+. - def to_param - self - end -end - -class TrueClass - # Returns +self+. - def to_param - self - end -end - -class FalseClass - # Returns +self+. - def to_param - self - end -end - -class Array - # Calls to_param on all its elements and joins the result with - # slashes. This is used by url_for in Action Pack. - def to_param - collect(&:to_param).join "/" - end - - # Converts an array into a string suitable for use as a URL query string, - # using the given +key+ as the param name. - # - # ['Rails', 'coding'].to_query('hobbies') # => "hobbies%5B%5D=Rails&hobbies%5B%5D=coding" - def to_query(key) - prefix = "#{key}[]" - - if empty? - nil.to_query(prefix) - else - collect { |value| value.to_query(prefix) }.join "&" - end - end -end - -class Hash - # Returns a string representation of the receiver suitable for use as a URL - # query string: - # - # {name: 'David', nationality: 'Danish'}.to_query - # # => "name=David&nationality=Danish" - # - # An optional namespace can be passed to enclose key names: - # - # {name: 'David', nationality: 'Danish'}.to_query('user') - # # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish" - # - # The string pairs "key=value" that conform the query string - # are sorted lexicographically in ascending order. - def to_query(namespace = nil) - query = filter_map do |key, value| - unless (value.is_a?(Hash) || value.is_a?(Array)) && value.empty? - value.to_query(namespace ? "#{namespace}[#{key}]" : key) - end - end - - query.sort! unless namespace.to_s.include?("[]") - query.join("&") - end - - alias_method :to_param, :to_query -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/try.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/try.rb deleted file mode 100644 index 5a8d546..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/try.rb +++ /dev/null @@ -1,158 +0,0 @@ -# frozen_string_literal: true - -require "delegate" - -module ActiveSupport - module Tryable # :nodoc: - def try(*args, &block) - if args.empty? && block_given? - if block.arity == 0 - instance_eval(&block) - else - yield self - end - elsif respond_to?(args.first) - public_send(*args, &block) - end - end - ruby2_keywords(:try) - - def try!(*args, &block) - if args.empty? && block_given? - if block.arity == 0 - instance_eval(&block) - else - yield self - end - else - public_send(*args, &block) - end - end - ruby2_keywords(:try!) - end -end - -class Object - include ActiveSupport::Tryable - - ## - # :method: try - # - # :call-seq: - # try(*args, &block) - # - # Invokes the public method whose name goes as first argument just like - # +public_send+ does, except that if the receiver does not respond to it the - # call returns +nil+ rather than raising an exception. - # - # This method is defined to be able to write - # - # @person.try(:name) - # - # instead of - # - # @person.name if @person - # - # +try+ calls can be chained: - # - # @person.try(:spouse).try(:name) - # - # instead of - # - # @person.spouse.name if @person && @person.spouse - # - # +try+ will also return +nil+ if the receiver does not respond to the method: - # - # @person.try(:non_existing_method) # => nil - # - # instead of - # - # @person.non_existing_method if @person.respond_to?(:non_existing_method) # => nil - # - # +try+ returns +nil+ when called on +nil+ regardless of whether it responds - # to the method: - # - # nil.try(:to_i) # => nil, rather than 0 - # - # Arguments and blocks are forwarded to the method if invoked: - # - # @posts.try(:each_slice, 2) do |a, b| - # ... - # end - # - # The number of arguments in the signature must match. If the object responds - # to the method the call is attempted and +ArgumentError+ is still raised - # in case of argument mismatch. - # - # If +try+ is called without arguments it yields the receiver to a given - # block unless it is +nil+: - # - # @person.try do |p| - # ... - # end - # - # You can also call try with a block without accepting an argument, and the block - # will be instance_eval'ed instead: - # - # @person.try { upcase.truncate(50) } - # - # Please also note that +try+ is defined on +Object+. Therefore, it won't work - # with instances of classes that do not have +Object+ among their ancestors, - # like direct subclasses of +BasicObject+. - - ## - # :method: try! - # - # :call-seq: - # try!(*args, &block) - # - # Same as #try, but raises a +NoMethodError+ exception if the receiver is - # not +nil+ and does not implement the tried method. - # - # "a".try!(:upcase) # => "A" - # nil.try!(:upcase) # => nil - # 123.try!(:upcase) # => NoMethodError: undefined method `upcase' for 123:Integer -end - -class Delegator - include ActiveSupport::Tryable - - ## - # :method: try - # - # :call-seq: - # try(*args, &block) - # - # See Object#try - - ## - # :method: try! - # - # :call-seq: - # try!(*args, &block) - # - # See Object#try! -end - -class NilClass - # Calling +try+ on +nil+ always returns +nil+. - # It becomes especially helpful when navigating through associations that may return +nil+. - # - # nil.try(:name) # => nil - # - # Without +try+ - # @person && @person.children.any? && @person.children.first.name - # - # With +try+ - # @person.try(:children).try(:first).try(:name) - def try(*, &) - nil - end - - # Calling +try!+ on +nil+ always returns +nil+. - # - # nil.try!(:name) # => nil - def try!(*, &) - nil - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/with.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/with.rb deleted file mode 100644 index 29f6108..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/with.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -class Object - # Set and restore public attributes around a block. - # - # client.timeout # => 5 - # client.with(timeout: 1) do |c| - # c.timeout # => 1 - # end - # client.timeout # => 5 - # - # The receiver is yielded to the provided block. - # - # This method is a shorthand for the common begin/ensure pattern: - # - # old_value = object.attribute - # begin - # object.attribute = new_value - # # do things - # ensure - # object.attribute = old_value - # end - # - # It can be used on any object as long as both the reader and writer methods - # are public. - def with(**attributes) - old_values = {} - begin - attributes.each do |key, value| - old_values[key] = public_send(key) - public_send("#{key}=", value) - end - yield self - ensure - old_values.each do |key, old_value| - public_send("#{key}=", old_value) - end - end - end -end - -# #with isn't usable on immediates, so we might as well undefine the -# method in common immediate classes to avoid potential confusion. -[NilClass, TrueClass, FalseClass, Integer, Float, Symbol].each do |klass| - klass.undef_method(:with) -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/with_options.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/with_options.rb deleted file mode 100644 index 932aec2..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/object/with_options.rb +++ /dev/null @@ -1,101 +0,0 @@ -# frozen_string_literal: true - -require "active_support/option_merger" - -class Object - # An elegant way to factor duplication out of options passed to a series of - # method calls. Each method called in the block, with the block variable as - # the receiver, will have its options merged with the default +options+ - # Hash or Hash-like object provided. Each method called on - # the block variable must take an options hash as its final argument. - # - # Without with_options, this code contains duplication: - # - # class Account < ActiveRecord::Base - # has_many :customers, dependent: :destroy - # has_many :products, dependent: :destroy - # has_many :invoices, dependent: :destroy - # has_many :expenses, dependent: :destroy - # end - # - # Using with_options, we can remove the duplication: - # - # class Account < ActiveRecord::Base - # with_options dependent: :destroy do |assoc| - # assoc.has_many :customers - # assoc.has_many :products - # assoc.has_many :invoices - # assoc.has_many :expenses - # end - # end - # - # It can also be used with an explicit receiver: - # - # I18n.with_options locale: user.locale, scope: 'newsletter' do |i18n| - # subject i18n.t :subject - # body i18n.t :body, user_name: user.name - # end - # - # When you don't pass an explicit receiver, it executes the whole block - # in merging options context: - # - # class Account < ActiveRecord::Base - # with_options dependent: :destroy do - # has_many :customers - # has_many :products - # has_many :invoices - # has_many :expenses - # end - # end - # - # with_options can also be nested since the call is forwarded to its receiver. - # - # NOTE: Each nesting level will merge inherited defaults in addition to their own. - # - # class Post < ActiveRecord::Base - # with_options if: :persisted?, length: { minimum: 50 } do - # validates :content, if: -> { content.present? } - # end - # end - # - # The code is equivalent to: - # - # validates :content, length: { minimum: 50 }, if: -> { content.present? } - # - # Hence the inherited default for +if+ key is ignored. - # - # NOTE: You cannot call class methods implicitly inside of +with_options+. - # You can access these methods using the class name instead: - # - # class Phone < ActiveRecord::Base - # enum :phone_number_type, { home: 0, office: 1, mobile: 2 } - # - # with_options presence: true do - # validates :phone_number_type, inclusion: { in: Phone.phone_number_types.keys } - # end - # end - # - # When the block argument is omitted, the decorated Object instance is returned: - # - # module MyStyledHelpers - # def styled - # with_options style: "color: red;" - # end - # end - # - # styled.link_to "I'm red", "/" - # # => I'm red - # - # styled.button_tag "I'm red too!" - # # => - # - def with_options(options, &block) - option_merger = ActiveSupport::OptionMerger.new(self, options) - - if block - block.arity.zero? ? option_merger.instance_eval(&block) : block.call(option_merger) - else - option_merger - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/pathname.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/pathname.rb deleted file mode 100644 index 8d1f42b..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/pathname.rb +++ /dev/null @@ -1,4 +0,0 @@ -# frozen_string_literal: true - -require_relative "pathname/blank" -require_relative "pathname/existence" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/pathname/blank.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/pathname/blank.rb deleted file mode 100644 index 8a9be3c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/pathname/blank.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -require "pathname" - -class Pathname - # An Pathname is blank if it's empty: - # - # Pathname.new("").blank? # => true - # Pathname.new(" ").blank? # => false - # Pathname.new("test").blank? # => false - # - # @return [true, false] - def blank? - to_s.empty? - end - - def present? # :nodoc: - !to_s.empty? - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/pathname/existence.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/pathname/existence.rb deleted file mode 100644 index 848eb4d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/pathname/existence.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -require "pathname" - -class Pathname - # Returns the receiver if the named file exists otherwise returns +nil+. - # pathname.existence is equivalent to - # - # pathname.exist? ? pathname : nil - # - # For example, something like - # - # content = pathname.read if pathname.exist? - # - # becomes - # - # content = pathname.existence&.read - # - # @return [Pathname] - def existence - self if exist? - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/range.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/range.rb deleted file mode 100644 index d9fc271..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/range.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -require_relative "range/conversions" -require_relative "range/compare_range" -require_relative "range/overlap" -require_relative "range/sole" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/range/compare_range.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/range/compare_range.rb deleted file mode 100644 index ec5b53a..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/range/compare_range.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module CompareWithRange - # Extends the default Range#=== to support range comparisons. - # (1..5) === (1..5) # => true - # (1..5) === (2..3) # => true - # (1..5) === (1...6) # => true - # (1..5) === (2..6) # => false - # - # The native Range#=== behavior is untouched. - # ('a'..'f') === ('c') # => true - # (5..9) === (11) # => false - # - # The given range must be fully bounded, with both start and end. - def ===(value) - if value.is_a?(::Range) - cover?(value) - else - super - end - end - - # Extends the default Range#include? to support range comparisons. - # (1..5).include?(1..5) # => true - # (1..5).include?(2..3) # => true - # (1..5).include?(1...6) # => true - # (1..5).include?(2..6) # => false - # - # The native Range#include? behavior is untouched. - # ('a'..'f').include?('c') # => true - # (5..9).include?(11) # => false - # - # The given range must be fully bounded, with both start and end. - def include?(value) - if value.is_a?(::Range) - cover?(value) - else - super - end - end - end -end - -Range.prepend(ActiveSupport::CompareWithRange) diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/range/conversions.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/range/conversions.rb deleted file mode 100644 index b6d8186..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/range/conversions.rb +++ /dev/null @@ -1,62 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # = \Range With Format - module RangeWithFormat - RANGE_FORMATS = { - db: -> (start, stop) do - if start && stop - case start - when String then "BETWEEN '#{start}' AND '#{stop}'" - else - "BETWEEN '#{start.to_fs(:db)}' AND '#{stop.to_fs(:db)}'" - end - elsif start - case start - when String then ">= '#{start}'" - else - ">= '#{start.to_fs(:db)}'" - end - elsif stop - case stop - when String then "<= '#{stop}'" - else - "<= '#{stop.to_fs(:db)}'" - end - end - end - } - - # Convert range to a formatted string. See RANGE_FORMATS for predefined formats. - # - # This method is aliased to to_formatted_s. - # - # range = (1..100) # => 1..100 - # - # range.to_s # => "1..100" - # range.to_fs(:db) # => "BETWEEN '1' AND '100'" - # - # range = (1..) # => 1.. - # range.to_fs(:db) # => ">= '1'" - # - # range = (..100) # => ..100 - # range.to_fs(:db) # => "<= '100'" - # - # == Adding your own range formats to to_fs - # You can add your own formats to the Range::RANGE_FORMATS hash. - # Use the format name as the hash key and a Proc instance. - # - # # config/initializers/range_formats.rb - # Range::RANGE_FORMATS[:short] = ->(start, stop) { "Between #{start.to_fs(:db)} and #{stop.to_fs(:db)}" } - def to_fs(format = :default) - if formatter = RANGE_FORMATS[format] - formatter.call(self.begin, self.end) - else - to_s - end - end - alias_method :to_formatted_s, :to_fs - end -end - -Range.prepend(ActiveSupport::RangeWithFormat) diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/range/overlap.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/range/overlap.rb deleted file mode 100644 index c26b8b0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/range/overlap.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -class Range - unless Range.method_defined?(:overlap?) # Ruby 3.3+ - # Compare two ranges and see if they overlap each other - # (1..5).overlap?(4..6) # => true - # (1..5).overlap?(7..9) # => false - def overlap?(other) - raise TypeError unless other.is_a? Range - - self_begin = self.begin - other_end = other.end - other_excl = other.exclude_end? - - return false if _empty_range?(self_begin, other_end, other_excl) - - other_begin = other.begin - self_end = self.end - self_excl = self.exclude_end? - - return false if _empty_range?(other_begin, self_end, self_excl) - return true if self_begin == other_begin - - return false if _empty_range?(self_begin, self_end, self_excl) - return false if _empty_range?(other_begin, other_end, other_excl) - - true - end - - private - def _empty_range?(b, e, excl) - return false if b.nil? || e.nil? - - comp = b <=> e - comp.nil? || comp > 0 || (comp == 0 && excl) - end - end - - alias :overlaps? :overlap? -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/range/sole.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/range/sole.rb deleted file mode 100644 index 71dd229..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/range/sole.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/enumerable" - -class Range - # Returns the sole item in the range. If there are no items, or more - # than one item, raises Enumerable::SoleItemExpectedError. - # - # (1..1).sole # => 1 - # (2..1).sole # => Enumerable::SoleItemExpectedError: no item found - # (..1).sole # => Enumerable::SoleItemExpectedError: infinite range cannot represent a sole item - def sole - if self.begin.nil? || self.end.nil? - raise ActiveSupport::EnumerableCoreExt::SoleItemExpectedError, "infinite range '#{inspect}' cannot represent a sole item" - end - - super - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/regexp.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/regexp.rb deleted file mode 100644 index 15534ff..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/regexp.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -class Regexp - # Returns +true+ if the regexp has the multiline flag set. - # - # (/./).multiline? # => false - # (/./m).multiline? # => true - # - # Regexp.new(".").multiline? # => false - # Regexp.new(".", Regexp::MULTILINE).multiline? # => true - def multiline? - options & MULTILINE == MULTILINE - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/securerandom.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/securerandom.rb deleted file mode 100644 index aae7529..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/securerandom.rb +++ /dev/null @@ -1,57 +0,0 @@ -# frozen_string_literal: true - -require "securerandom" - -module SecureRandom - BASE58_ALPHABET = ("0".."9").to_a + ("A".."Z").to_a + ("a".."z").to_a - ["0", "O", "I", "l"] - BASE36_ALPHABET = ("0".."9").to_a + ("a".."z").to_a - - # SecureRandom.base58 generates a random base58 string. - # - # The argument _n_ specifies the length of the random string to be generated. - # - # If _n_ is not specified or is +nil+, 16 is assumed. It may be larger in the future. - # - # The result may contain alphanumeric characters except 0, O, I, and l. - # - # p SecureRandom.base58 # => "4kUgL2pdQMSCQtjE" - # p SecureRandom.base58(24) # => "77TMHrHJFvFDwodq8w7Ev2m7" - if SecureRandom.method(:alphanumeric).parameters.size == 2 # Remove check when Ruby 3.3 is the minimum supported version - def self.base58(n = 16) - alphanumeric(n, chars: BASE58_ALPHABET) - end - else - def self.base58(n = 16) - SecureRandom.random_bytes(n).unpack("C*").map do |byte| - idx = byte % 64 - idx = SecureRandom.random_number(58) if idx >= 58 - BASE58_ALPHABET[idx] - end.join - end - end - - # SecureRandom.base36 generates a random base36 string in lowercase. - # - # The argument _n_ specifies the length of the random string to be generated. - # - # If _n_ is not specified or is +nil+, 16 is assumed. It may be larger in the future. - # This method can be used over +base58+ if a deterministic case key is necessary. - # - # The result will contain alphanumeric characters in lowercase. - # - # p SecureRandom.base36 # => "4kugl2pdqmscqtje" - # p SecureRandom.base36(24) # => "77tmhrhjfvfdwodq8w7ev2m7" - if SecureRandom.method(:alphanumeric).parameters.size == 2 # Remove check when Ruby 3.3 is the minimum supported version - def self.base36(n = 16) - alphanumeric(n, chars: BASE36_ALPHABET) - end - else - def self.base36(n = 16) - SecureRandom.random_bytes(n).unpack("C*").map do |byte| - idx = byte % 64 - idx = SecureRandom.random_number(36) if idx >= 36 - BASE36_ALPHABET[idx] - end.join - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string.rb deleted file mode 100644 index 491eec2..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -require_relative "string/conversions" -require_relative "string/filters" -require_relative "string/multibyte" -require_relative "string/starts_ends_with" -require_relative "string/inflections" -require_relative "string/access" -require_relative "string/behavior" -require_relative "string/output_safety" -require_relative "string/exclude" -require_relative "string/strip" -require_relative "string/inquiry" -require_relative "string/indent" -require_relative "string/zones" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/access.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/access.rb deleted file mode 100644 index f6a14c0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/access.rb +++ /dev/null @@ -1,95 +0,0 @@ -# frozen_string_literal: true - -class String - # If you pass a single integer, returns a substring of one character at that - # position. The first character of the string is at position 0, the next at - # position 1, and so on. If a range is supplied, a substring containing - # characters at offsets given by the range is returned. In both cases, if an - # offset is negative, it is counted from the end of the string. Returns +nil+ - # if the initial offset falls outside the string. Returns an empty string if - # the beginning of the range is greater than the end of the string. - # - # str = "hello" - # str.at(0) # => "h" - # str.at(1..3) # => "ell" - # str.at(-2) # => "l" - # str.at(-2..-1) # => "lo" - # str.at(5) # => nil - # str.at(5..-1) # => "" - # - # If a Regexp is given, the matching portion of the string is returned. - # If a String is given, that given string is returned if it occurs in - # the string. In both cases, +nil+ is returned if there is no match. - # - # str = "hello" - # str.at(/lo/) # => "lo" - # str.at(/ol/) # => nil - # str.at("lo") # => "lo" - # str.at("ol") # => nil - def at(position) - self[position] - end - - # Returns a substring from the given position to the end of the string. - # If the position is negative, it is counted from the end of the string. - # - # str = "hello" - # str.from(0) # => "hello" - # str.from(3) # => "lo" - # str.from(-2) # => "lo" - # - # You can mix it with +to+ method and do fun things like: - # - # str = "hello" - # str.from(0).to(-1) # => "hello" - # str.from(1).to(-2) # => "ell" - def from(position) - self[position, length] - end - - # Returns a substring from the beginning of the string to the given position. - # If the position is negative, it is counted from the end of the string. - # - # str = "hello" - # str.to(0) # => "h" - # str.to(3) # => "hell" - # str.to(-2) # => "hell" - # - # You can mix it with +from+ method and do fun things like: - # - # str = "hello" - # str.from(0).to(-1) # => "hello" - # str.from(1).to(-2) # => "ell" - def to(position) - position += size if position < 0 - self[0, position + 1] || +"" - end - - # Returns the first character. If a limit is supplied, returns a substring - # from the beginning of the string until it reaches the limit value. If the - # given limit is greater than or equal to the string length, returns a copy of self. - # - # str = "hello" - # str.first # => "h" - # str.first(1) # => "h" - # str.first(2) # => "he" - # str.first(0) # => "" - # str.first(6) # => "hello" - def first(limit = 1) - self[0, limit] || raise(ArgumentError, "negative limit") - end - - # Returns the last character of the string. If a limit is supplied, returns a substring - # from the end of the string until it reaches the limit value (counting backwards). If - # the given limit is greater than or equal to the string length, returns a copy of self. - # - # str = "hello" - # str.last # => "o" - # str.last(1) # => "o" - # str.last(2) # => "lo" - # str.last(0) # => "" - # str.last(6) # => "hello" - def last(limit = 1) - self[[length - limit, 0].max, limit] || raise(ArgumentError, "negative limit") - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/behavior.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/behavior.rb deleted file mode 100644 index 35a5aa7..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/behavior.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -class String - # Enables more predictable duck-typing on String-like classes. See Object#acts_like?. - def acts_like_string? - true - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/conversions.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/conversions.rb deleted file mode 100644 index 107721c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/conversions.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true - -require "date" -require "active_support/core_ext/time/calculations" - -class String - # Converts a string to a Time value. - # The +form+ can be either +:utc+ or +:local+ (default +:local+). - # - # The time is parsed using Time.parse method. - # If +form+ is +:local+, then the time is in the system timezone. - # If the date part is missing then the current date is used and if - # the time part is missing then it is assumed to be 00:00:00. - # - # "13-12-2012".to_time # => 2012-12-13 00:00:00 +0100 - # "06:12".to_time # => 2012-12-13 06:12:00 +0100 - # "2012-12-13 06:12".to_time # => 2012-12-13 06:12:00 +0100 - # "2012-12-13T06:12".to_time # => 2012-12-13 06:12:00 +0100 - # "2012-12-13T06:12".to_time(:utc) # => 2012-12-13 06:12:00 UTC - # "12/13/2012".to_time # => ArgumentError: argument out of range - # "1604326192".to_time # => ArgumentError: argument out of range - def to_time(form = :local) - parts = Date._parse(self, false) - used_keys = %i(year mon mday hour min sec sec_fraction offset) - return if !parts.keys.intersect?(used_keys) - - now = Time.now - time = Time.new( - parts.fetch(:year, now.year), - parts.fetch(:mon, now.month), - parts.fetch(:mday, now.day), - parts.fetch(:hour, 0), - parts.fetch(:min, 0), - parts.fetch(:sec, 0) + parts.fetch(:sec_fraction, 0), - parts.fetch(:offset, form == :utc ? 0 : nil) - ) - - form == :utc ? time.utc : time.to_time - end - - # Converts a string to a Date value. - # - # "1-1-2012".to_date # => Sun, 01 Jan 2012 - # "01/01/2012".to_date # => Sun, 01 Jan 2012 - # "2012-12-13".to_date # => Thu, 13 Dec 2012 - # "12/13/2012".to_date # => ArgumentError: invalid date - def to_date - ::Date.parse(self, false) unless blank? - end - - # Converts a string to a DateTime value. - # - # "1-1-2012".to_datetime # => Sun, 01 Jan 2012 00:00:00 +0000 - # "01/01/2012 23:59:59".to_datetime # => Sun, 01 Jan 2012 23:59:59 +0000 - # "2012-12-13 12:50".to_datetime # => Thu, 13 Dec 2012 12:50:00 +0000 - # "12/13/2012".to_datetime # => ArgumentError: invalid date - def to_datetime - ::DateTime.parse(self, false) unless blank? - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/exclude.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/exclude.rb deleted file mode 100644 index 8e46268..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/exclude.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class String - # The inverse of String#include?. Returns true if the string - # does not include the other string. - # - # "hello".exclude? "lo" # => false - # "hello".exclude? "ol" # => true - # "hello".exclude? ?h # => false - def exclude?(string) - !include?(string) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/filters.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/filters.rb deleted file mode 100644 index ae79912..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/filters.rb +++ /dev/null @@ -1,153 +0,0 @@ -# frozen_string_literal: true - -class String - # Returns the string, first removing all whitespace on both ends of - # the string, and then changing remaining consecutive whitespace - # groups into one space each. - # - # Note that it handles both ASCII and Unicode whitespace. - # - # %{ Multi-line - # string }.squish # => "Multi-line string" - # " foo bar \n \t boo".squish # => "foo bar boo" - def squish - dup.squish! - end - - # Performs a destructive squish. See String#squish. - # str = " foo bar \n \t boo" - # str.squish! # => "foo bar boo" - # str # => "foo bar boo" - def squish! - gsub!(/[[:space:]]+/, " ") - strip! - self - end - - # Returns a new string with all occurrences of the patterns removed. - # str = "foo bar test" - # str.remove(" test") # => "foo bar" - # str.remove(" test", /bar/) # => "foo " - # str # => "foo bar test" - def remove(*patterns) - dup.remove!(*patterns) - end - - # Alters the string by removing all occurrences of the patterns. - # str = "foo bar test" - # str.remove!(" test", /bar/) # => "foo " - # str # => "foo " - def remove!(*patterns) - patterns.each do |pattern| - gsub! pattern, "" - end - - self - end - - # Truncates a given +text+ to length truncate_to if +text+ is longer than truncate_to: - # - # 'Once upon a time in a world far far away'.truncate(27) - # # => "Once upon a time in a wo..." - # - # Pass a string or regexp :separator to truncate +text+ at a natural break: - # - # 'Once upon a time in a world far far away'.truncate(27, separator: ' ') - # # => "Once upon a time in a..." - # - # 'Once upon a time in a world far far away'.truncate(27, separator: /\s/) - # # => "Once upon a time in a..." - # - # The last characters will be replaced with the :omission string (defaults to "..."). - # The total length will not exceed truncate_to unless both +text+ and :omission - # are longer than truncate_to: - # - # 'And they found that many people were sleeping better.'.truncate(25, omission: '... (continued)') - # # => "And they f... (continued)" - # - # 'And they found that many people were sleeping better.'.truncate(4, omission: '... (continued)') - # # => "... (continued)" - def truncate(truncate_to, options = {}) - return dup unless length > truncate_to - - omission = options[:omission] || "..." - length_with_room_for_omission = truncate_to - omission.length - return omission.dup if length_with_room_for_omission <= 0 - - stop = \ - if options[:separator] - rindex(options[:separator], length_with_room_for_omission) || length_with_room_for_omission - else - length_with_room_for_omission - end - - +"#{self[0, stop]}#{omission}" - end - - # Truncates +text+ to at most truncate_to bytes in length without - # breaking string encoding by splitting multibyte characters or breaking - # grapheme clusters ("perceptual characters") by truncating at combining - # characters. - # - # >> "🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪".size - # # => 20 - # >> "🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪".bytesize - # # => 80 - # >> "🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪".truncate_bytes(20) - # # => "🔪🔪🔪🔪…" - # - # The truncated text ends with the :omission string, defaulting - # to "…", for a total length not exceeding truncate_to. - # - # Raises +ArgumentError+ when the bytesize of :omission exceeds truncate_to. - def truncate_bytes(truncate_to, omission: "…") - omission ||= "" - - case - when bytesize <= truncate_to - dup - when omission.bytesize > truncate_to - raise ArgumentError, "Omission #{omission.inspect} is #{omission.bytesize}, larger than the truncation length of #{truncate_to} bytes" - when omission.bytesize == truncate_to - omission.dup - else - self.class.new.force_encoding(encoding).tap do |cut| - cut_at = truncate_to - omission.bytesize - - each_grapheme_cluster do |grapheme| - if cut.bytesize + grapheme.bytesize <= cut_at - cut << grapheme - else - break - end - end - - cut << omission - end - end - end - - # Truncates a given +text+ after a given number of words (words_count): - # - # 'Once upon a time in a world far far away'.truncate_words(4) - # # => "Once upon a time..." - # - # Pass a string or regexp :separator to specify a different separator of words: - # - # 'Once
upon
a
time
in
a
world'.truncate_words(5, separator: '
') - # # => "Once
upon
a
time
in..." - # - # The last characters will be replaced with the :omission string (defaults to "..."): - # - # 'And they found that many people were sleeping better.'.truncate_words(5, omission: '... (continued)') - # # => "And they found that many... (continued)" - def truncate_words(words_count, options = {}) - sep = options[:separator] || /\s+/ - sep = Regexp.escape(sep.to_s) unless Regexp === sep - if self =~ /\A((?>.+?#{sep}){#{words_count - 1}}.+?)#{sep}.*/m - $1 + (options[:omission] || "...") - else - dup - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/indent.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/indent.rb deleted file mode 100644 index 9dcc430..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/indent.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -class String - # Same as +indent+, except it indents the receiver in-place. - # - # Returns the indented string, or +nil+ if there was nothing to indent. - def indent!(amount, indent_string = nil, indent_empty_lines = false) - indent_string = indent_string || self[/^[ \t]/] || " " - re = indent_empty_lines ? /^/ : /^(?!$)/ - gsub!(re, indent_string * amount) - end - - # Indents the lines in the receiver: - # - # < - # def some_method - # some_code - # end - # - # The second argument, +indent_string+, specifies which indent string to - # use. The default is +nil+, which tells the method to make a guess by - # peeking at the first indented line, and fall back to a space if there is - # none. - # - # " foo".indent(2) # => " foo" - # "foo\n\t\tbar".indent(2) # => "\t\tfoo\n\t\t\t\tbar" - # "foo".indent(2, "\t") # => "\t\tfoo" - # - # While +indent_string+ is typically one space or tab, it may be any string. - # - # The third argument, +indent_empty_lines+, is a flag that says whether - # empty lines should be indented. Default is false. - # - # "foo\n\nbar".indent(2) # => " foo\n\n bar" - # "foo\n\nbar".indent(2, nil, true) # => " foo\n \n bar" - # - def indent(amount, indent_string = nil, indent_empty_lines = false) - dup.tap { |_| _.indent!(amount, indent_string, indent_empty_lines) } - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/inflections.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/inflections.rb deleted file mode 100644 index b950876..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/inflections.rb +++ /dev/null @@ -1,300 +0,0 @@ -# frozen_string_literal: true - -require "active_support/inflector/methods" -require "active_support/inflector/transliterate" - -# String inflections define new methods on the String class to transform names for different purposes. -# For instance, you can figure out the name of a table from the name of a class. -# -# 'ScaleScore'.tableize # => "scale_scores" -# -class String - # Returns the plural form of the word in the string. - # - # If the optional parameter +count+ is specified, - # the singular form will be returned if count == 1. - # For any other value of +count+ the plural will be returned. - # - # If the optional parameter +locale+ is specified, - # the word will be pluralized as a word of that language. - # By default, this parameter is set to :en. - # You must define your own inflection rules for languages other than English. - # - # 'post'.pluralize # => "posts" - # 'octopus'.pluralize # => "octopi" - # 'sheep'.pluralize # => "sheep" - # 'words'.pluralize # => "words" - # 'the blue mailman'.pluralize # => "the blue mailmen" - # 'CamelOctopus'.pluralize # => "CamelOctopi" - # 'apple'.pluralize(1) # => "apple" - # 'apple'.pluralize(2) # => "apples" - # 'ley'.pluralize(:es) # => "leyes" - # 'ley'.pluralize(1, :es) # => "ley" - # - # See ActiveSupport::Inflector.pluralize. - def pluralize(count = nil, locale = :en) - locale = count if count.is_a?(Symbol) - if count == 1 - dup - else - ActiveSupport::Inflector.pluralize(self, locale) - end - end - - # The reverse of +pluralize+, returns the singular form of a word in a string. - # - # If the optional parameter +locale+ is specified, - # the word will be singularized as a word of that language. - # By default, this parameter is set to :en. - # You must define your own inflection rules for languages other than English. - # - # 'posts'.singularize # => "post" - # 'octopi'.singularize # => "octopus" - # 'sheep'.singularize # => "sheep" - # 'word'.singularize # => "word" - # 'the blue mailmen'.singularize # => "the blue mailman" - # 'CamelOctopi'.singularize # => "CamelOctopus" - # 'leyes'.singularize(:es) # => "ley" - # - # See ActiveSupport::Inflector.singularize. - def singularize(locale = :en) - ActiveSupport::Inflector.singularize(self, locale) - end - - # +constantize+ tries to find a declared constant with the name specified - # in the string. It raises a NameError when the name is not in CamelCase - # or is not initialized. - # - # 'Module'.constantize # => Module - # 'Class'.constantize # => Class - # 'blargle'.constantize # => NameError: wrong constant name blargle - # - # See ActiveSupport::Inflector.constantize. - def constantize - ActiveSupport::Inflector.constantize(self) - end - - # +safe_constantize+ tries to find a declared constant with the name specified - # in the string. It returns +nil+ when the name is not in CamelCase - # or is not initialized. - # - # 'Module'.safe_constantize # => Module - # 'Class'.safe_constantize # => Class - # 'blargle'.safe_constantize # => nil - # - # See ActiveSupport::Inflector.safe_constantize. - def safe_constantize - ActiveSupport::Inflector.safe_constantize(self) - end - - # By default, +camelize+ converts strings to UpperCamelCase. If the argument to camelize - # is set to :lower then camelize produces lowerCamelCase. - # - # +camelize+ will also convert '/' to '::' which is useful for converting paths to namespaces. - # - # 'active_record'.camelize # => "ActiveRecord" - # 'active_record'.camelize(:lower) # => "activeRecord" - # 'active_record/errors'.camelize # => "ActiveRecord::Errors" - # 'active_record/errors'.camelize(:lower) # => "activeRecord::Errors" - # - # See ActiveSupport::Inflector.camelize. - def camelize(first_letter = :upper) - case first_letter - when :upper - ActiveSupport::Inflector.camelize(self, true) - when :lower - ActiveSupport::Inflector.camelize(self, false) - else - raise ArgumentError, "Invalid option, use either :upper or :lower." - end - end - alias_method :camelcase, :camelize - - # Capitalizes all the words and replaces some characters in the string to create - # a nicer looking title. +titleize+ is meant for creating pretty output. It is not - # used in the \Rails internals. - # - # The trailing '_id','Id'.. can be kept and capitalized by setting the - # optional parameter +keep_id_suffix+ to true. - # By default, this parameter is false. - # - # 'man from the boondocks'.titleize # => "Man From The Boondocks" - # 'x-men: the last stand'.titleize # => "X Men: The Last Stand" - # 'string_ending_with_id'.titleize(keep_id_suffix: true) # => "String Ending With Id" - # - # See ActiveSupport::Inflector.titleize. - def titleize(keep_id_suffix: false) - ActiveSupport::Inflector.titleize(self, keep_id_suffix: keep_id_suffix) - end - alias_method :titlecase, :titleize - - # The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string. - # - # +underscore+ will also change '::' to '/' to convert namespaces to paths. - # - # 'ActiveModel'.underscore # => "active_model" - # 'ActiveModel::Errors'.underscore # => "active_model/errors" - # - # See ActiveSupport::Inflector.underscore. - def underscore - ActiveSupport::Inflector.underscore(self) - end - - # Replaces underscores with dashes in the string. - # - # 'puni_puni'.dasherize # => "puni-puni" - # - # See ActiveSupport::Inflector.dasherize. - def dasherize - ActiveSupport::Inflector.dasherize(self) - end - - # Removes the module part from the constant expression in the string. - # - # 'ActiveSupport::Inflector::Inflections'.demodulize # => "Inflections" - # 'Inflections'.demodulize # => "Inflections" - # '::Inflections'.demodulize # => "Inflections" - # ''.demodulize # => '' - # - # See ActiveSupport::Inflector.demodulize. - # - # See also +deconstantize+. - def demodulize - ActiveSupport::Inflector.demodulize(self) - end - - # Removes the rightmost segment from the constant expression in the string. - # - # 'Net::HTTP'.deconstantize # => "Net" - # '::Net::HTTP'.deconstantize # => "::Net" - # 'String'.deconstantize # => "" - # '::String'.deconstantize # => "" - # ''.deconstantize # => "" - # - # See ActiveSupport::Inflector.deconstantize. - # - # See also +demodulize+. - def deconstantize - ActiveSupport::Inflector.deconstantize(self) - end - - # Replaces special characters in a string so that it may be used as part of a 'pretty' URL. - # - # If the optional parameter +locale+ is specified, - # the word will be parameterized as a word of that language. - # By default, this parameter is set to nil and it will use - # the configured I18n.locale. - # - # class Person - # def to_param - # "#{id}-#{name.parameterize}" - # end - # end - # - # @person = Person.find(1) - # # => # - # - # <%= link_to(@person.name, person_path) %> - # # => Donald E. Knuth - # - # To preserve the case of the characters in a string, use the +preserve_case+ argument. - # - # class Person - # def to_param - # "#{id}-#{name.parameterize(preserve_case: true)}" - # end - # end - # - # @person = Person.find(1) - # # => # - # - # <%= link_to(@person.name, person_path) %> - # # => Donald E. Knuth - # - # See ActiveSupport::Inflector.parameterize. - def parameterize(separator: "-", preserve_case: false, locale: nil) - ActiveSupport::Inflector.parameterize(self, separator: separator, preserve_case: preserve_case, locale: locale) - end - - # Creates the name of a table like \Rails does for models to table names. This method - # uses the +pluralize+ method on the last word in the string. - # - # 'RawScaledScorer'.tableize # => "raw_scaled_scorers" - # 'ham_and_egg'.tableize # => "ham_and_eggs" - # 'fancyCategory'.tableize # => "fancy_categories" - # - # See ActiveSupport::Inflector.tableize. - def tableize - ActiveSupport::Inflector.tableize(self) - end - - # Creates a class name from a plural table name like \Rails does for table names to models. - # Note that this returns a string and not a class. (To convert to an actual class - # follow +classify+ with +constantize+.) - # - # 'ham_and_eggs'.classify # => "HamAndEgg" - # 'posts'.classify # => "Post" - # - # See ActiveSupport::Inflector.classify. - def classify - ActiveSupport::Inflector.classify(self) - end - - # Capitalizes the first word, turns underscores into spaces, and (by default) strips a - # trailing '_id' if present. - # Like +titleize+, this is meant for creating pretty output. - # - # The capitalization of the first word can be turned off by setting the - # optional parameter +capitalize+ to false. - # By default, this parameter is true. - # - # The trailing '_id' can be kept by setting the - # optional parameter +keep_id_suffix+ to true. - # By default, this parameter is false. - # - # 'employee_salary'.humanize # => "Employee salary" - # 'author_id'.humanize # => "Author" - # 'author_id'.humanize(capitalize: false) # => "author" - # '_id'.humanize # => "Id" - # 'author_id'.humanize(keep_id_suffix: true) # => "Author id" - # - # See ActiveSupport::Inflector.humanize. - def humanize(capitalize: true, keep_id_suffix: false) - ActiveSupport::Inflector.humanize(self, capitalize: capitalize, keep_id_suffix: keep_id_suffix) - end - - # Converts the first character to uppercase. - # - # 'what a Lovely Day'.upcase_first # => "What a Lovely Day" - # 'w'.upcase_first # => "W" - # ''.upcase_first # => "" - # - # See ActiveSupport::Inflector.upcase_first. - def upcase_first - ActiveSupport::Inflector.upcase_first(self) - end - - # Converts the first character to lowercase. - # - # 'If they enjoyed The Matrix'.downcase_first # => "if they enjoyed The Matrix" - # 'I'.downcase_first # => "i" - # ''.downcase_first # => "" - # - # See ActiveSupport::Inflector.downcase_first. - def downcase_first - ActiveSupport::Inflector.downcase_first(self) - end - - # Creates a foreign key name from a class name. - # +separate_class_name_and_id_with_underscore+ sets whether - # the method should put '_' between the name and 'id'. - # - # 'Message'.foreign_key # => "message_id" - # 'Message'.foreign_key(false) # => "messageid" - # 'Admin::Post'.foreign_key # => "post_id" - # - # See ActiveSupport::Inflector.foreign_key. - def foreign_key(separate_class_name_and_id_with_underscore = true) - ActiveSupport::Inflector.foreign_key(self, separate_class_name_and_id_with_underscore) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/inquiry.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/inquiry.rb deleted file mode 100644 index a3b42da..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/inquiry.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -require "active_support/string_inquirer" -require "active_support/environment_inquirer" - -class String - # Wraps the current string in the ActiveSupport::StringInquirer class, - # which gives you a prettier way to test for equality. - # - # env = 'production'.inquiry - # env.production? # => true - # env.development? # => false - def inquiry - ActiveSupport::StringInquirer.new(self) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/multibyte.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/multibyte.rb deleted file mode 100644 index c869066..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/multibyte.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -require "active_support/multibyte" - -class String - # == Multibyte proxy - # - # +mb_chars+ is a multibyte safe proxy for string methods. - # - # It creates and returns an instance of the ActiveSupport::Multibyte::Chars class which - # encapsulates the original string. A Unicode safe version of all the String methods are defined on this proxy - # class. If the proxy class doesn't respond to a certain method, it's forwarded to the encapsulated string. - # - # >> "lj".mb_chars.upcase.to_s - # # => "LJ" - # - # NOTE: Ruby 2.4 and later support native Unicode case mappings: - # - # >> "lj".upcase - # # => "LJ" - # - # == \Method chaining - # - # All the methods on the Chars proxy which normally return a string will return a Chars object. This allows - # method chaining on the result of any of these methods. - # - # name.mb_chars.reverse.length # => 12 - # - # == Interoperability and configuration - # - # The Chars object tries to be as interchangeable with String objects as possible: sorting and comparing between - # String and Char work like expected. The bang! methods change the internal string representation in the Chars - # object. Interoperability problems can be resolved easily with a +to_s+ call. - # - # For more information about the methods defined on the Chars proxy see ActiveSupport::Multibyte::Chars. For - # information about how to change the default Multibyte behavior see ActiveSupport::Multibyte. - def mb_chars - ActiveSupport.deprecator.warn( - "String#mb_chars is deprecated and will be removed in Rails 8.2. " \ - "Use normal string methods instead." - ) - - if ActiveSupport::Multibyte.proxy_class == ActiveSupport::Multibyte::Chars - ActiveSupport::Multibyte::Chars.new(self, deprecation: false) - else - ActiveSupport::Multibyte.proxy_class.new(self) - end - end - - # Returns +true+ if string has utf_8 encoding. - # - # utf_8_str = "some string".encode "UTF-8" - # iso_str = "some string".encode "ISO-8859-1" - # - # utf_8_str.is_utf8? # => true - # iso_str.is_utf8? # => false - def is_utf8? - case encoding - when Encoding::UTF_8, Encoding::US_ASCII - valid_encoding? - when Encoding::ASCII_8BIT - dup.force_encoding(Encoding::UTF_8).valid_encoding? - else - false - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/output_safety.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/output_safety.rb deleted file mode 100644 index c6102a0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/output_safety.rb +++ /dev/null @@ -1,244 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/erb/util" -require "active_support/multibyte/unicode" - -class Object - def html_safe? - false - end -end - -class Numeric - def html_safe? - true - end -end - -module ActiveSupport # :nodoc: - class SafeBuffer < String - UNSAFE_STRING_METHODS = %w( - capitalize chomp chop delete delete_prefix delete_suffix - downcase lstrip next reverse rstrip scrub squeeze strip - succ swapcase tr tr_s unicode_normalize upcase - ) - - UNSAFE_STRING_METHODS_WITH_BACKREF = %w(gsub sub) - - alias_method :original_concat, :concat - private :original_concat - - # Raised when ActiveSupport::SafeBuffer#safe_concat is called on unsafe buffers. - class SafeConcatError < StandardError - def initialize - super "Could not concatenate to the buffer because it is not HTML safe." - end - end - - def [](*args) - if html_safe? - new_string = super - - return unless new_string - - string_into_safe_buffer(new_string, true) - else - to_str[*args] - end - end - alias_method :slice, :[] - - def slice!(*args) - new_string = super - - return new_string if !html_safe? || new_string.nil? - - string_into_safe_buffer(new_string, true) - end - - def chr - return super unless html_safe? - - string_into_safe_buffer(super, true) - end - - def safe_concat(value) - raise SafeConcatError unless html_safe? - original_concat(value) - end - - def initialize(_str = "") - super - end - - def initialize_copy(other) - super - @html_unsafe = true unless other.html_safe? - end - - def concat(value) - unless value.nil? - super(implicit_html_escape_interpolated_argument(value)) - end - self - end - alias << concat - - def bytesplice(*args, value) - super(*args, implicit_html_escape_interpolated_argument(value)) - end - - def insert(index, value) - super(index, implicit_html_escape_interpolated_argument(value)) - end - - def prepend(value) - super(implicit_html_escape_interpolated_argument(value)) - end - - def replace(value) - super(implicit_html_escape_interpolated_argument(value)) - end - - def []=(arg1, arg2, arg3 = nil) - if arg3 - super(arg1, arg2, implicit_html_escape_interpolated_argument(arg3)) - else - super(arg1, implicit_html_escape_interpolated_argument(arg2)) - end - end - - def +(other) - dup.concat(other) - end - - def *(_) - new_string = super - new_safe_buffer = new_string.is_a?(SafeBuffer) ? new_string : SafeBuffer.new(new_string) - if @html_unsafe - new_safe_buffer.mark_unsafe! - end - new_safe_buffer - end - - def %(args) - case args - when Hash - escaped_args = args.transform_values { |arg| explicit_html_escape_interpolated_argument(arg) } - else - escaped_args = Array(args).map { |arg| explicit_html_escape_interpolated_argument(arg) } - end - - new_safe_buffer = self.class.new(super(escaped_args)) - if @html_unsafe - new_safe_buffer.mark_unsafe! - end - new_safe_buffer - end - - def html_safe? - @html_unsafe.nil? - end - - def to_s - self - end - - def as_json(*) - to_str - end - - def to_param - to_str - end - - def encode_with(coder) - coder.represent_object nil, to_str - end - - UNSAFE_STRING_METHODS.each do |unsafe_method| - if unsafe_method.respond_to?(unsafe_method) - class_eval <<-EOT, __FILE__, __LINE__ + 1 - def #{unsafe_method}(*args, &block) # def capitalize(*args, &block) - to_str.#{unsafe_method}(*args, &block) # to_str.capitalize(*args, &block) - end # end - - def #{unsafe_method}!(*args) # def capitalize!(*args) - @html_unsafe = true # @html_unsafe = true - super # super - end # end - EOT - end - end - - UNSAFE_STRING_METHODS_WITH_BACKREF.each do |unsafe_method| - class_eval <<-EOT, __FILE__, __LINE__ + 1 - def #{unsafe_method}(*args, &block) # def gsub(*args, &block) - if block # if block - to_str.#{unsafe_method}(*args) { |*params| # to_str.gsub(*args) { |*params| - set_block_back_references(block, $~) # set_block_back_references(block, $~) - block.call(*params) # block.call(*params) - } # } - else # else - to_str.#{unsafe_method}(*args) # to_str.gsub(*args) - end # end - end # end - - def #{unsafe_method}!(*args, &block) # def gsub!(*args, &block) - @html_unsafe = true # @html_unsafe = true - if block # if block - super(*args) { |*params| # super(*args) { |*params| - set_block_back_references(block, $~) # set_block_back_references(block, $~) - block.call(*params) # block.call(*params) - } # } - else # else - super # super - end # end - end # end - EOT - end - - protected - def mark_unsafe! - @html_unsafe = true - end - - private - def explicit_html_escape_interpolated_argument(arg) - (!html_safe? || arg.html_safe?) ? arg : ERB::Util.unwrapped_html_escape(arg) - end - - def implicit_html_escape_interpolated_argument(arg) - if !html_safe? || arg.html_safe? - arg - else - ERB::Util.unwrapped_html_escape(arg.to_str) - end - end - - def set_block_back_references(block, match_data) - block.binding.eval("proc { |m| $~ = m }").call(match_data) - rescue ArgumentError - # Can't create binding from C level Proc - end - - def string_into_safe_buffer(new_string, is_html_safe) - new_safe_buffer = new_string.is_a?(SafeBuffer) ? new_string : SafeBuffer.new(new_string) - unless is_html_safe - new_safe_buffer.instance_variable_set :@html_unsafe, true - end - new_safe_buffer - end - end -end - -class String - # Marks a string as trusted safe. It will be inserted into HTML with no - # additional escaping performed. It is your responsibility to ensure that the - # string contains no malicious content. This method is equivalent to the - # +raw+ helper in views. It is recommended that you use +sanitize+ instead of - # this method. It should never be called on user input. - def html_safe - ActiveSupport::SafeBuffer.new(self) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/starts_ends_with.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/starts_ends_with.rb deleted file mode 100644 index 1e21637..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/starts_ends_with.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -class String - alias :starts_with? :start_with? - alias :ends_with? :end_with? -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/strip.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/strip.rb deleted file mode 100644 index 60e9952..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/strip.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class String - # Strips indentation in heredocs. - # - # For example in - # - # if options[:usage] - # puts <<-USAGE.strip_heredoc - # This command does such and such. - # - # Supported options are: - # -h This message - # ... - # USAGE - # end - # - # the user would see the usage message aligned against the left margin. - # - # Technically, it looks for the least indented non-empty line - # in the whole string, and removes that amount of leading whitespace. - def strip_heredoc - gsub(/^#{scan(/^[ \t]*(?=\S)/).min}/, "").tap do |stripped| - stripped.freeze if frozen? - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/zones.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/zones.rb deleted file mode 100644 index 55dc231..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/string/zones.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/string/conversions" -require "active_support/core_ext/time/zones" - -class String - # Converts String to a TimeWithZone in the current zone if Time.zone or Time.zone_default - # is set, otherwise converts String to a Time via String#to_time - def in_time_zone(zone = ::Time.zone) - if zone - ::Time.find_zone!(zone).parse(self) - else - to_time - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/symbol.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/symbol.rb deleted file mode 100644 index f5379ff..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/symbol.rb +++ /dev/null @@ -1,3 +0,0 @@ -# frozen_string_literal: true - -require_relative "symbol/starts_ends_with" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/symbol/starts_ends_with.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/symbol/starts_ends_with.rb deleted file mode 100644 index 4f85217..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/symbol/starts_ends_with.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -class Symbol - alias :starts_with? :start_with? - alias :ends_with? :end_with? -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/thread/backtrace/location.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/thread/backtrace/location.rb deleted file mode 100644 index d21acff..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/thread/backtrace/location.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class Thread::Backtrace::Location # :nodoc: - def spot(ex) - ErrorHighlight.spot(ex, backtrace_location: self) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/time.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/time.rb deleted file mode 100644 index 4e16274..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/time.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -require_relative "time/acts_like" -require_relative "time/calculations" -require_relative "time/compatibility" -require_relative "time/conversions" -require_relative "time/zones" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/time/acts_like.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/time/acts_like.rb deleted file mode 100644 index 8572b49..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/time/acts_like.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/acts_like" - -class Time - # Duck-types as a Time-like class. See Object#acts_like?. - def acts_like_time? - true - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/time/calculations.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/time/calculations.rb deleted file mode 100644 index ea82216..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/time/calculations.rb +++ /dev/null @@ -1,383 +0,0 @@ -# frozen_string_literal: true - -require "active_support/duration" -require "active_support/core_ext/time/conversions" -require "active_support/time_with_zone" -require "active_support/core_ext/time/zones" -require "active_support/core_ext/date_and_time/calculations" -require "active_support/core_ext/date/calculations" -require "active_support/core_ext/module/redefine_method" -require "active_support/core_ext/module/remove_method" - -class Time - include DateAndTime::Calculations - - COMMON_YEAR_DAYS_IN_MONTH = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] - - class << self - # Overriding case equality method so that it returns true for ActiveSupport::TimeWithZone instances - def ===(other) - super || (self == Time && other.is_a?(ActiveSupport::TimeWithZone)) - end - - # Returns the number of days in the given month. - # If no year is specified, it will use the current year. - def days_in_month(month, year = current.year) - if month == 2 && ::Date.gregorian_leap?(year) - 29 - else - COMMON_YEAR_DAYS_IN_MONTH[month] - end - end - - # Returns the number of days in the given year. - # If no year is specified, it will use the current year. - def days_in_year(year = current.year) - days_in_month(2, year) + 337 - end - - # Returns Time.zone.now when Time.zone or config.time_zone are set, otherwise just returns Time.now. - def current - ::Time.zone ? ::Time.zone.now : ::Time.now - end - - # Layers additional behavior on Time.at so that ActiveSupport::TimeWithZone and DateTime - # instances can be used when called with a single argument - def at_with_coercion(time_or_number, *args) - if args.empty? - if time_or_number.is_a?(ActiveSupport::TimeWithZone) - at_without_coercion(time_or_number.to_r).getlocal - elsif time_or_number.is_a?(DateTime) - at_without_coercion(time_or_number.to_f).getlocal - else - at_without_coercion(time_or_number) - end - else - at_without_coercion(time_or_number, *args) - end - end - ruby2_keywords :at_with_coercion - alias_method :at_without_coercion, :at - alias_method :at, :at_with_coercion - - silence_redefinition_of_method :rfc3339 - - # Creates a +Time+ instance from an RFC 3339 string. - # - # Time.rfc3339('1999-12-31T14:00:00-10:00') # => 2000-01-01 00:00:00 -1000 - # - # If the time or offset components are missing then an +ArgumentError+ will be raised. - # - # Time.rfc3339('1999-12-31') # => ArgumentError: invalid date - def rfc3339(str) - parts = Date._rfc3339(str) - - raise ArgumentError, "invalid date" if parts.empty? - - Time.new( - parts.fetch(:year), - parts.fetch(:mon), - parts.fetch(:mday), - parts.fetch(:hour), - parts.fetch(:min), - parts.fetch(:sec) + parts.fetch(:sec_fraction, 0), - parts.fetch(:offset) - ) - end - end - - # Returns the number of seconds since 00:00:00. - # - # Time.new(2012, 8, 29, 0, 0, 0).seconds_since_midnight # => 0.0 - # Time.new(2012, 8, 29, 12, 34, 56).seconds_since_midnight # => 45296.0 - # Time.new(2012, 8, 29, 23, 59, 59).seconds_since_midnight # => 86399.0 - def seconds_since_midnight - to_i - change(hour: 0).to_i + (usec / 1.0e+6) - end - - # Returns the number of seconds until 23:59:59. - # - # Time.new(2012, 8, 29, 0, 0, 0).seconds_until_end_of_day # => 86399 - # Time.new(2012, 8, 29, 12, 34, 56).seconds_until_end_of_day # => 41103 - # Time.new(2012, 8, 29, 23, 59, 59).seconds_until_end_of_day # => 0 - def seconds_until_end_of_day - end_of_day.to_i - to_i - end - - # Returns the fraction of a second as a +Rational+ - # - # Time.new(2012, 8, 29, 0, 0, 0.5).sec_fraction # => (1/2) - def sec_fraction - subsec - end - - # Returns a new Time where one or more of the elements have been changed according - # to the +options+ parameter. The time options (:hour, :min, - # :sec, :usec, :nsec) reset cascadingly, so if only - # the hour is passed, then minute, sec, usec, and nsec is set to 0. If the hour - # and minute is passed, then sec, usec, and nsec is set to 0. The +options+ parameter - # takes a hash with any of these keys: :year, :month, :day, - # :hour, :min, :sec, :usec, :nsec, - # :offset. Pass either :usec or :nsec, not both. - # - # Time.new(2012, 8, 29, 22, 35, 0).change(day: 1) # => Time.new(2012, 8, 1, 22, 35, 0) - # Time.new(2012, 8, 29, 22, 35, 0).change(year: 1981, day: 1) # => Time.new(1981, 8, 1, 22, 35, 0) - # Time.new(2012, 8, 29, 22, 35, 0).change(year: 1981, hour: 0) # => Time.new(1981, 8, 29, 0, 0, 0) - def change(options) - new_year = options.fetch(:year, year) - new_month = options.fetch(:month, month) - new_day = options.fetch(:day, day) - new_hour = options.fetch(:hour, hour) - new_min = options.fetch(:min, options[:hour] ? 0 : min) - new_sec = options.fetch(:sec, (options[:hour] || options[:min]) ? 0 : sec) - new_offset = options.fetch(:offset, nil) - - if new_nsec = options[:nsec] - raise ArgumentError, "Can't change both :nsec and :usec at the same time: #{options.inspect}" if options[:usec] - new_usec = Rational(new_nsec, 1000) - else - new_usec = options.fetch(:usec, (options[:hour] || options[:min] || options[:sec]) ? 0 : Rational(nsec, 1000)) - end - - raise ArgumentError, "argument out of range" if new_usec >= 1000000 - - new_sec += Rational(new_usec, 1000000) - - if new_offset - ::Time.new(new_year, new_month, new_day, new_hour, new_min, new_sec, new_offset) - elsif utc? - ::Time.utc(new_year, new_month, new_day, new_hour, new_min, new_sec) - elsif zone.respond_to?(:utc_to_local) - new_time = ::Time.new(new_year, new_month, new_day, new_hour, new_min, new_sec, zone) - - # Some versions of Ruby have a bug where Time.new with a zone object and - # fractional seconds will end up with a broken utc_offset. - # This is fixed in Ruby 3.3.1 and 3.2.4 - unless new_time.utc_offset.integer? - new_time += 0 - end - - # When there are two occurrences of a nominal time due to DST ending, - # `Time.new` chooses the first chronological occurrence (the one with a - # larger UTC offset). However, for `change`, we want to choose the - # occurrence that matches this time's UTC offset. - # - # If the new time's UTC offset is larger than this time's UTC offset, the - # new time might be a first chronological occurrence. So we add the offset - # difference to fast-forward the new time, and check if the result has the - # desired UTC offset (i.e. is the second chronological occurrence). - offset_difference = new_time.utc_offset - utc_offset - if offset_difference > 0 && (new_time_2 = new_time + offset_difference).utc_offset == utc_offset - new_time_2 - else - new_time - end - elsif zone - ::Time.local(new_sec, new_min, new_hour, new_day, new_month, new_year, nil, nil, isdst, nil) - else - ::Time.new(new_year, new_month, new_day, new_hour, new_min, new_sec, utc_offset) - end - end - - # Uses Date to provide precise Time calculations for years, months, and days - # according to the proleptic Gregorian calendar. The +options+ parameter - # takes a hash with any of these keys: :years, :months, - # :weeks, :days, :hours, :minutes, - # :seconds. - # - # Time.new(2015, 8, 1, 14, 35, 0).advance(seconds: 1) # => 2015-08-01 14:35:01 -0700 - # Time.new(2015, 8, 1, 14, 35, 0).advance(minutes: 1) # => 2015-08-01 14:36:00 -0700 - # Time.new(2015, 8, 1, 14, 35, 0).advance(hours: 1) # => 2015-08-01 15:35:00 -0700 - # Time.new(2015, 8, 1, 14, 35, 0).advance(days: 1) # => 2015-08-02 14:35:00 -0700 - # Time.new(2015, 8, 1, 14, 35, 0).advance(weeks: 1) # => 2015-08-08 14:35:00 -0700 - # - # Just like Date#advance, increments are applied in order of time units from - # largest to smallest. This order can affect the result around the end of a - # month. - def advance(options) - options = options.dup - unless options[:weeks].nil? - options[:weeks], partial_weeks = options[:weeks].divmod(1) - options[:days] = options.fetch(:days, 0) + 7 * partial_weeks - end - - unless options[:days].nil? - options[:days], partial_days = options[:days].divmod(1) - options[:hours] = options.fetch(:hours, 0) + 24 * partial_days - end - - d = to_date.gregorian.advance(options) - time_advanced_by_date = change(year: d.year, month: d.month, day: d.day) - seconds_to_advance = \ - options.fetch(:seconds, 0) + - options.fetch(:minutes, 0) * 60 + - options.fetch(:hours, 0) * 3600 - - if seconds_to_advance.zero? - time_advanced_by_date - else - time_advanced_by_date.since(seconds_to_advance) - end - end - - # Returns a new Time representing the time a number of seconds ago, this is basically a wrapper around the Numeric extension - def ago(seconds) - since(-seconds) - end - - # Returns a new Time representing the time a number of seconds since the instance time - def since(seconds) - self + seconds - end - alias :in :since - - # Returns a new Time representing the start of the day (0:00) - def beginning_of_day - change(hour: 0) - end - alias :midnight :beginning_of_day - alias :at_midnight :beginning_of_day - alias :at_beginning_of_day :beginning_of_day - - # Returns a new Time representing the middle of the day (12:00) - def middle_of_day - change(hour: 12) - end - alias :midday :middle_of_day - alias :noon :middle_of_day - alias :at_midday :middle_of_day - alias :at_noon :middle_of_day - alias :at_middle_of_day :middle_of_day - - # Returns a new Time representing the end of the day, 23:59:59.999999 - def end_of_day - change( - hour: 23, - min: 59, - sec: 59, - usec: Rational(999999999, 1000) - ) - end - alias :at_end_of_day :end_of_day - - # Returns a new Time representing the start of the hour (x:00) - def beginning_of_hour - change(min: 0) - end - alias :at_beginning_of_hour :beginning_of_hour - - # Returns a new Time representing the end of the hour, x:59:59.999999 - def end_of_hour - change( - min: 59, - sec: 59, - usec: Rational(999999999, 1000) - ) - end - alias :at_end_of_hour :end_of_hour - - # Returns a new Time representing the start of the minute (x:xx:00) - def beginning_of_minute - change(sec: 0) - end - alias :at_beginning_of_minute :beginning_of_minute - - # Returns a new Time representing the end of the minute, x:xx:59.999999 - def end_of_minute - change( - sec: 59, - usec: Rational(999999999, 1000) - ) - end - alias :at_end_of_minute :end_of_minute - - def plus_with_duration(other) # :nodoc: - if ActiveSupport::Duration === other - other.since(self) - else - plus_without_duration(other) - end - end - alias_method :plus_without_duration, :+ - alias_method :+, :plus_with_duration - - def minus_with_duration(other) # :nodoc: - if ActiveSupport::Duration === other - other.until(self) - else - minus_without_duration(other) - end - end - alias_method :minus_without_duration, :- - alias_method :-, :minus_with_duration - - # Time#- can also be used to determine the number of seconds between two Time instances. - # We're layering on additional behavior so that ActiveSupport::TimeWithZone instances - # are coerced into values that Time#- will recognize - def minus_with_coercion(other) - other = other.comparable_time if other.respond_to?(:comparable_time) - other.is_a?(DateTime) ? to_f - other.to_f : minus_without_coercion(other) - end - alias_method :minus_without_coercion, :- - alias_method :-, :minus_with_coercion # rubocop:disable Lint/DuplicateMethods - - # Layers additional behavior on Time#<=> so that DateTime and ActiveSupport::TimeWithZone instances - # can be chronologically compared with a Time - def compare_with_coercion(other) - # we're avoiding Time#to_datetime and Time#to_time because they're expensive - if other.class == Time - compare_without_coercion(other) - elsif other.is_a?(Time) - # also avoid ActiveSupport::TimeWithZone#to_time before Rails 8.0 - if other.respond_to?(:comparable_time) - compare_without_coercion(other.comparable_time) - else - compare_without_coercion(other.to_time) - end - else - to_datetime <=> other - end - end - alias_method :compare_without_coercion, :<=> - alias_method :<=>, :compare_with_coercion - - # Layers additional behavior on Time#eql? so that ActiveSupport::TimeWithZone instances - # can be eql? to an equivalent Time - def eql_with_coercion(other) - # if other is an ActiveSupport::TimeWithZone, coerce a Time instance from it so we can do eql? comparison - other = other.comparable_time if other.respond_to?(:comparable_time) - eql_without_coercion(other) - end - alias_method :eql_without_coercion, :eql? - alias_method :eql?, :eql_with_coercion - - # Returns a new time the specified number of days ago. - def prev_day(days = 1) - advance(days: -days) - end - - # Returns a new time the specified number of days in the future. - def next_day(days = 1) - advance(days: days) - end - - # Returns a new time the specified number of months ago. - def prev_month(months = 1) - advance(months: -months) - end - - # Returns a new time the specified number of months in the future. - def next_month(months = 1) - advance(months: months) - end - - # Returns a new time the specified number of years ago. - def prev_year(years = 1) - advance(years: -years) - end - - # Returns a new time the specified number of years in the future. - def next_year(years = 1) - advance(years: years) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/time/compatibility.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/time/compatibility.rb deleted file mode 100644 index de5290c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/time/compatibility.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/date_and_time/compatibility" -require "active_support/core_ext/module/redefine_method" - -class Time - include DateAndTime::Compatibility - - silence_redefinition_of_method :to_time - - # Return +self+. - def to_time - self - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/time/conversions.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/time/conversions.rb deleted file mode 100644 index 8913f3f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/time/conversions.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: true - -require "time" -require "active_support/inflector/methods" -require "active_support/values/time_zone" - -class Time - DATE_FORMATS = { - db: "%Y-%m-%d %H:%M:%S", - inspect: "%Y-%m-%d %H:%M:%S.%9N %z", - number: "%Y%m%d%H%M%S", - nsec: "%Y%m%d%H%M%S%9N", - usec: "%Y%m%d%H%M%S%6N", - time: "%H:%M", - short: "%d %b %H:%M", - long: "%B %d, %Y %H:%M", - long_ordinal: lambda { |time| - day_format = ActiveSupport::Inflector.ordinalize(time.day) - time.strftime("%B #{day_format}, %Y %H:%M") - }, - rfc822: lambda { |time| - offset_format = time.formatted_offset(false) - time.strftime("%a, %d %b %Y %H:%M:%S #{offset_format}") - }, - rfc2822: lambda { |time| time.rfc2822 }, - iso8601: lambda { |time| time.iso8601 } - } - - # Converts to a formatted string. See DATE_FORMATS for built-in formats. - # - # This method is aliased to to_formatted_s. - # - # time = Time.now # => 2007-01-18 06:10:17 -06:00 - # - # time.to_fs(:time) # => "06:10" - # time.to_formatted_s(:time) # => "06:10" - # - # time.to_fs(:db) # => "2007-01-18 06:10:17" - # time.to_fs(:number) # => "20070118061017" - # time.to_fs(:short) # => "18 Jan 06:10" - # time.to_fs(:long) # => "January 18, 2007 06:10" - # time.to_fs(:long_ordinal) # => "January 18th, 2007 06:10" - # time.to_fs(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600" - # time.to_fs(:rfc2822) # => "Thu, 18 Jan 2007 06:10:17 -0600" - # time.to_fs(:iso8601) # => "2007-01-18T06:10:17-06:00" - # - # == Adding your own time formats to +to_fs+ - # You can add your own formats to the Time::DATE_FORMATS hash. - # Use the format name as the hash key and either a strftime string - # or Proc instance that takes a time argument as the value. - # - # # config/initializers/time_formats.rb - # Time::DATE_FORMATS[:month_and_year] = '%B %Y' - # Time::DATE_FORMATS[:short_ordinal] = ->(time) { time.strftime("%B #{time.day.ordinalize}") } - def to_fs(format = :default) - if formatter = DATE_FORMATS[format] - formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter) - else - to_s - end - end - alias_method :to_formatted_s, :to_fs - - # Returns a formatted string of the offset from UTC, or an alternative - # string if the time zone is already UTC. - # - # Time.local(2000).formatted_offset # => "-06:00" - # Time.local(2000).formatted_offset(false) # => "-0600" - def formatted_offset(colon = true, alternate_utc_string = nil) - utc? && alternate_utc_string || ActiveSupport::TimeZone.seconds_to_utc_offset(utc_offset, colon) - end - - # Aliased to +xmlschema+ for compatibility with +DateTime+ - alias_method :rfc3339, :xmlschema -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/time/zones.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/time/zones.rb deleted file mode 100644 index 5f0d3c7..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/core_ext/time/zones.rb +++ /dev/null @@ -1,97 +0,0 @@ -# frozen_string_literal: true - -require "active_support/time_with_zone" -require "active_support/core_ext/time/acts_like" -require "active_support/core_ext/date_and_time/zones" - -class Time - include DateAndTime::Zones - class << self - attr_accessor :zone_default - - # Returns the TimeZone for the current request, if this has been set (via Time.zone=). - # If Time.zone has not been set for the current request, returns the TimeZone specified in config.time_zone. - def zone - ::ActiveSupport::IsolatedExecutionState[:time_zone] || zone_default - end - - # Sets Time.zone to a TimeZone object for the current request/thread. - # - # This method accepts any of the following: - # - # * A \Rails TimeZone object. - # * An identifier for a \Rails TimeZone object (e.g., "Eastern \Time (US & Canada)", -5.hours). - # * A +TZInfo::Timezone+ object. - # * An identifier for a +TZInfo::Timezone+ object (e.g., "America/New_York"). - # - # Here's an example of how you might set Time.zone on a per request basis and reset it when the request is done. - # current_user.time_zone just needs to return a string identifying the user's preferred time zone: - # - # class ApplicationController < ActionController::Base - # around_action :set_time_zone - # - # def set_time_zone - # if logged_in? - # Time.use_zone(current_user.time_zone) { yield } - # else - # yield - # end - # end - # end - def zone=(time_zone) - ::ActiveSupport::IsolatedExecutionState[:time_zone] = find_zone!(time_zone) - end - - # Allows override of Time.zone locally inside supplied block; - # resets Time.zone to existing value when done. - # - # class ApplicationController < ActionController::Base - # around_action :set_time_zone - # - # private - # def set_time_zone - # Time.use_zone(current_user.timezone) { yield } - # end - # end - # - # NOTE: This won't affect any ActiveSupport::TimeWithZone - # objects that have already been created, e.g. any model timestamp - # attributes that have been read before the block will remain in - # the application's default timezone. - def use_zone(time_zone) - new_zone = find_zone!(time_zone) - begin - old_zone, ::Time.zone = ::Time.zone, new_zone - yield - ensure - ::Time.zone = old_zone - end - end - - # Returns a TimeZone instance matching the time zone provided. - # Accepts the time zone in any format supported by Time.zone=. - # Raises an +ArgumentError+ for invalid time zones. - # - # Time.find_zone! "America/New_York" # => # - # Time.find_zone! "EST" # => # - # Time.find_zone! -5.hours # => # - # Time.find_zone! nil # => nil - # Time.find_zone! false # => false - # Time.find_zone! "NOT-A-TIMEZONE" # => ArgumentError: Invalid Timezone: NOT-A-TIMEZONE - def find_zone!(time_zone) - return time_zone unless time_zone - - ActiveSupport::TimeZone[time_zone] || raise(ArgumentError, "Invalid Timezone: #{time_zone}") - end - - # Returns a TimeZone instance matching the time zone provided. - # Accepts the time zone in any format supported by Time.zone=. - # Returns +nil+ for invalid time zones. - # - # Time.find_zone "America/New_York" # => # - # Time.find_zone "NOT-A-TIMEZONE" # => nil - def find_zone(time_zone) - find_zone!(time_zone) rescue nil - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/current_attributes.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/current_attributes.rb deleted file mode 100644 index 25330fd..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/current_attributes.rb +++ /dev/null @@ -1,243 +0,0 @@ -# frozen_string_literal: true - -require "active_support/callbacks" -require "active_support/execution_context" -require "active_support/core_ext/object/with" -require "active_support/core_ext/enumerable" -require "active_support/core_ext/module/delegation" - -module ActiveSupport - # = Current Attributes - # - # Abstract super class that provides a thread-isolated attributes singleton, which resets automatically - # before and after each request. This allows you to keep all the per-request attributes easily - # available to the whole system. - # - # The following full app-like example demonstrates how to use a Current class to - # facilitate easy access to the global, per-request attributes without passing them deeply - # around everywhere: - # - # # app/models/current.rb - # class Current < ActiveSupport::CurrentAttributes - # attribute :account, :user - # attribute :request_id, :user_agent, :ip_address - # - # resets { Time.zone = nil } - # - # def user=(user) - # super - # self.account = user.account - # Time.zone = user.time_zone - # end - # end - # - # # app/controllers/concerns/authentication.rb - # module Authentication - # extend ActiveSupport::Concern - # - # included do - # before_action :authenticate - # end - # - # private - # def authenticate - # if authenticated_user = User.find_by(id: cookies.encrypted[:user_id]) - # Current.user = authenticated_user - # else - # redirect_to new_session_url - # end - # end - # end - # - # # app/controllers/concerns/set_current_request_details.rb - # module SetCurrentRequestDetails - # extend ActiveSupport::Concern - # - # included do - # before_action do - # Current.request_id = request.uuid - # Current.user_agent = request.user_agent - # Current.ip_address = request.ip - # end - # end - # end - # - # class ApplicationController < ActionController::Base - # include Authentication - # include SetCurrentRequestDetails - # end - # - # class MessagesController < ApplicationController - # def create - # Current.account.messages.create(message_params) - # end - # end - # - # class Message < ApplicationRecord - # belongs_to :creator, default: -> { Current.user } - # after_create { |message| Event.create(record: message) } - # end - # - # class Event < ApplicationRecord - # before_create do - # self.request_id = Current.request_id - # self.user_agent = Current.user_agent - # self.ip_address = Current.ip_address - # end - # end - # - # A word of caution: It's easy to overdo a global singleton like Current and tangle your model as a result. - # Current should only be used for a few, top-level globals, like account, user, and request details. - # The attributes stuck in Current should be used by more or less all actions on all requests. If you start - # sticking controller-specific attributes in there, you're going to create a mess. - class CurrentAttributes - include ActiveSupport::Callbacks - define_callbacks :reset - - INVALID_ATTRIBUTE_NAMES = [:set, :reset, :resets, :instance, :before_reset, :after_reset, :reset_all, :clear_all] # :nodoc: - - NOT_SET = Object.new.freeze # :nodoc: - - class << self - # Returns singleton instance for this class in this thread. If none exists, one is created. - def instance - current_instances[current_instances_key] ||= new - end - - # Declares one or more attributes that will be given both class and instance accessor methods. - # - # ==== Options - # - # * :default - The default value for the attributes. If the value - # is a proc or lambda, it will be called whenever an instance is - # constructed. Otherwise, the value will be duplicated with +#dup+. - # Default values are re-assigned when the attributes are reset. - def attribute(*names, default: NOT_SET) - invalid_attribute_names = names.map(&:to_sym) & INVALID_ATTRIBUTE_NAMES - if invalid_attribute_names.any? - raise ArgumentError, "Restricted attribute names: #{invalid_attribute_names.join(", ")}" - end - - Delegation.generate(singleton_class, names, to: :instance, nilable: false, signature: "") - Delegation.generate(singleton_class, names.map { |n| "#{n}=" }, to: :instance, nilable: false, signature: "value") - - ActiveSupport::CodeGenerator.batch(generated_attribute_methods, __FILE__, __LINE__) do |owner| - names.each do |name| - owner.define_cached_method(name, namespace: :current_attributes) do |batch| - batch << - "def #{name}" << - "@attributes[:#{name}]" << - "end" - end - owner.define_cached_method("#{name}=", namespace: :current_attributes) do |batch| - batch << - "def #{name}=(value)" << - "@attributes[:#{name}] = value" << - "end" - end - end - end - - self.defaults = defaults.merge(names.index_with { default }) - end - - # Calls this callback before #reset is called on the instance. Used for resetting external collaborators that depend on current values. - def before_reset(*methods, &block) - set_callback :reset, :before, *methods, &block - end - - # Calls this callback after #reset is called on the instance. Used for resetting external collaborators, like Time.zone. - def resets(*methods, &block) - set_callback :reset, :after, *methods, &block - end - alias_method :after_reset, :resets - - delegate :set, :reset, to: :instance - - def clear_all # :nodoc: - if instances = current_instances - instances.values.each(&:reset) - instances.clear - end - end - - private - def generated_attribute_methods - @generated_attribute_methods ||= Module.new.tap { |mod| include mod } - end - - def current_instances - ExecutionContext.current_attributes_instances - end - - def current_instances_key - @current_instances_key ||= name.to_sym - end - - def method_missing(name, ...) - instance.public_send(name, ...) - end - - def respond_to_missing?(name, _) - instance.respond_to?(name) || super - end - - def method_added(name) - super - - # We try to generate instance delegators early to not rely on method_missing. - return if name == :initialize - - # If the added method isn't public, we don't delegate it. - return unless public_method_defined?(name) - - # If we already have a class method by that name, we don't override it. - return if singleton_class.method_defined?(name) || singleton_class.private_method_defined?(name) - - Delegation.generate(singleton_class, [name], to: :instance, as: self, nilable: false) - end - end - - class_attribute :defaults, instance_writer: false, default: {}.freeze - - attr_writer :attributes - - def initialize - @attributes = resolve_defaults - end - - def attributes - @attributes.dup - end - - # Expose one or more attributes within a block. Old values are returned after the block concludes. - # Example demonstrating the common use of needing to set Current attributes outside the request-cycle: - # - # class Chat::PublicationJob < ApplicationJob - # def perform(attributes, room_number, creator) - # Current.set(person: creator) do - # Chat::Publisher.publish(attributes: attributes, room_number: room_number) - # end - # end - # end - def set(attributes, &block) - with(**attributes, &block) - end - - # Reset all attributes. Should be called before and after actions, when used as a per-request singleton. - def reset - run_callbacks :reset do - self.attributes = resolve_defaults - end - end - - private - def resolve_defaults - defaults.each_with_object({}) do |(key, value), result| - if value != NOT_SET - result[key] = Proc === value ? value.call : value.dup - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/current_attributes/test_helper.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/current_attributes/test_helper.rb deleted file mode 100644 index 6810032..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/current_attributes/test_helper.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport::CurrentAttributes::TestHelper # :nodoc: - def before_setup - ActiveSupport::CurrentAttributes.clear_all - super - end - - def after_teardown - super - ActiveSupport::CurrentAttributes.clear_all - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deep_mergeable.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deep_mergeable.rb deleted file mode 100644 index c00a240..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deep_mergeable.rb +++ /dev/null @@ -1,53 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # Provides +deep_merge+ and +deep_merge!+ methods. Expects the including class - # to provide a merge!(other, &block) method. - module DeepMergeable # :nodoc: - # Returns a new instance with the values from +other+ merged recursively. - # - # class Hash - # include ActiveSupport::DeepMergeable - # end - # - # hash_1 = { a: true, b: { c: [1, 2, 3] } } - # hash_2 = { a: false, b: { x: [3, 4, 5] } } - # - # hash_1.deep_merge(hash_2) - # # => { a: false, b: { c: [1, 2, 3], x: [3, 4, 5] } } - # - # A block can be provided to merge non-DeepMergeable values: - # - # hash_1 = { a: 100, b: 200, c: { c1: 100 } } - # hash_2 = { b: 250, c: { c1: 200 } } - # - # hash_1.deep_merge(hash_2) do |key, this_val, other_val| - # this_val + other_val - # end - # # => { a: 100, b: 450, c: { c1: 300 } } - # - def deep_merge(other, &block) - dup.deep_merge!(other, &block) - end - - # Same as #deep_merge, but modifies +self+. - def deep_merge!(other, &block) - merge!(other) do |key, this_val, other_val| - if this_val.is_a?(DeepMergeable) && this_val.deep_merge?(other_val) - this_val.deep_merge(other_val, &block) - elsif block_given? - block.call(key, this_val, other_val) - else - other_val - end - end - end - - # Returns true if +other+ can be deep merged into +self+. Classes may - # override this method to restrict or expand the domain of deep mergeable - # values. Defaults to checking that +other+ is of type +self.class+. - def deep_merge?(other) - other.is_a?(self.class) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/delegation.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/delegation.rb deleted file mode 100644 index f8504fe..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/delegation.rb +++ /dev/null @@ -1,183 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # Error generated by +delegate+ when a method is called on +nil+ and +allow_nil+ - # option is not used. - class DelegationError < NoMethodError - class << self - def nil_target(method_name, target) # :nodoc: - new("#{method_name} delegated to #{target}, but #{target} is nil") - end - end - end - - module Delegation # :nodoc: - RUBY_RESERVED_KEYWORDS = %w(__ENCODING__ __LINE__ __FILE__ alias and BEGIN begin break - case class def defined? do else elsif END end ensure false for if in module next nil - not or redo rescue retry return self super then true undef unless until when while yield) - RESERVED_METHOD_NAMES = (RUBY_RESERVED_KEYWORDS + %w(_ arg args block)).to_set.freeze - - class << self - def generate(owner, methods, location: nil, to: nil, prefix: nil, allow_nil: nil, nilable: true, private: nil, as: nil, signature: nil) - unless to - raise ArgumentError, "Delegation needs a target. Supply a keyword argument 'to' (e.g. delegate :hello, to: :greeter)." - end - - if prefix == true && /^[^a-z_]/.match?(to) - raise ArgumentError, "Can only automatically set the delegation prefix when delegating to a method." - end - - method_prefix = \ - if prefix - "#{prefix == true ? to : prefix}_" - else - "" - end - - location ||= caller_locations(1, 1).first - file, line = location.path, location.lineno - - receiver = if to.is_a?(Module) - if to.name.nil? - raise ArgumentError, "Can't delegate to anonymous class or module: #{to}" - end - - unless Inflector.safe_constantize(to.name).equal?(to) - raise ArgumentError, "Can't delegate to detached class or module: #{to.name}" - end - - "::#{to.name}" - else - to.to_s - end - receiver = "self.#{receiver}" if RESERVED_METHOD_NAMES.include?(receiver) - - explicit_receiver = false - receiver_class = if as - explicit_receiver = true - as - elsif to.is_a?(Module) - to.singleton_class - elsif receiver == "self.class" - nilable = false # self.class can't possibly be nil - owner.singleton_class - end - - method_def = [] - method_names = [] - - method_def << "self.private" if private - - methods.each do |method| - method_name = prefix ? "#{method_prefix}#{method}" : method - method_names << method_name.to_sym - - # Attribute writer methods only accept one argument. Makes sure []= - # methods still accept two arguments. - definition = \ - if signature - signature - elsif /[^\]]=\z/.match?(method) - "arg" - else - method_object = if receiver_class - begin - receiver_class.public_instance_method(method) - rescue NameError - raise if explicit_receiver - # Do nothing. Fall back to `"..."` - end - end - - if method_object - parameters = method_object.parameters - - if parameters.map(&:first).intersect?([:opt, :rest, :keyreq, :key, :keyrest]) - "..." - else - defn = parameters.filter_map { |type, arg| arg if type == :req } - defn << "&" - defn.join(", ") - end - else - "..." - end - end - - # The following generated method calls the target exactly once, storing - # the returned value in a dummy variable. - # - # Reason is twofold: On one hand doing less calls is in general better. - # On the other hand it could be that the target has side-effects, - # whereas conceptually, from the user point of view, the delegator should - # be doing one call. - if nilable == false - method_def << - "def #{method_name}(#{definition})" << - " (#{receiver}).#{method}(#{definition})" << - "end" - elsif allow_nil - method = method.to_s - - method_def << - "def #{method_name}(#{definition})" << - " _ = #{receiver}" << - " if !_.nil? || nil.respond_to?(:#{method})" << - " _.#{method}(#{definition})" << - " end" << - "end" - else - method = method.to_s - method_name = method_name.to_s - - method_def << - "def #{method_name}(#{definition})" << - " _ = #{receiver}" << - " _.#{method}(#{definition})" << - "rescue ::NoMethodError => e" << - " if _.nil? && e.name == :#{method}" << - " ::Kernel.raise ::ActiveSupport::DelegationError.nil_target(:#{method_name}, :'#{receiver}')" << - " else" << - " ::Kernel.raise" << - " end" << - "end" - end - end - owner.module_eval(method_def.join(";"), file, line) - method_names - end - - def generate_method_missing(owner, target, allow_nil: nil) - target = target.to_s - target = "self.#{target}" if RESERVED_METHOD_NAMES.include?(target) || target == "__target" - - nil_behavior = if allow_nil - "nil" - else - "::Kernel.raise ::ActiveSupport::DelegationError.nil_target(method, :'#{target}')" - end - - owner.module_eval <<~RUBY, __FILE__, __LINE__ + 1 - def respond_to_missing?(name, include_private = false) - # It may look like an oversight, but we deliberately do not pass - # +include_private+, because they do not get delegated. - - return false if name == :marshal_dump || name == :_dump - #{target}.respond_to?(name) || super - end - - def method_missing(method, ...) - __target = #{target} - if __target.nil? && !nil.respond_to?(method) - #{nil_behavior} - elsif __target.respond_to?(method) - __target.public_send(method, ...) - else - super - end - end - RUBY - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/dependencies.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/dependencies.rb deleted file mode 100644 index c43cd5a..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/dependencies.rb +++ /dev/null @@ -1,102 +0,0 @@ -# frozen_string_literal: true - -require "active_support/dependencies/interlock" - -module ActiveSupport # :nodoc: - module Dependencies # :nodoc: - require_relative "dependencies/require_dependency" - - singleton_class.attr_accessor :interlock - @interlock = Interlock.new - - # :doc: - - # Execute the supplied block without interference from any - # concurrent loads. - def self.run_interlock(&block) - interlock.running(&block) - end - - # Execute the supplied block while holding an exclusive lock, - # preventing any other thread from being inside a #run_interlock - # block at the same time. - def self.load_interlock(&block) - ActiveSupport.deprecator.warn( - "ActiveSupport::Dependencies.load_interlock is deprecated and " \ - "will be removed in Rails 9.0. The loading interlock is no longer " \ - "used since Rails switched to Zeitwerk for autoloading." - ) - yield if block - end - - # Execute the supplied block while holding an exclusive lock, - # preventing any other thread from being inside a #run_interlock - # block at the same time. - def self.unload_interlock(&block) - interlock.unloading(&block) - end - - # :nodoc: - - # The array of directories from which we autoload and reload, if reloading - # is enabled. The public interface to push directories to this collection - # from applications or engines is config.autoload_paths. - # - # This collection is allowed to have intersection with autoload_once_paths. - # Common directories are not reloaded. - singleton_class.attr_accessor :autoload_paths - self.autoload_paths = [] - - # The array of directories from which we autoload and never reload, even if - # reloading is enabled. The public interface to push directories to this - # collection from applications or engines is config.autoload_once_paths. - singleton_class.attr_accessor :autoload_once_paths - self.autoload_once_paths = [] - - # This is a private set that collects all eager load paths during bootstrap. - # Useful for Zeitwerk integration. The public interface to push custom - # directories to this collection from applications or engines is - # config.eager_load_paths. - singleton_class.attr_accessor :_eager_load_paths - self._eager_load_paths = Set.new - - # If reloading is enabled, this private set holds autoloaded classes tracked - # by the descendants tracker. It is populated by an on_load callback in the - # main autoloader. Used to clear state. - singleton_class.attr_accessor :_autoloaded_tracked_classes - self._autoloaded_tracked_classes = Set.new - - # If reloading is enabled, this private attribute stores the main autoloader - # of a Rails application. It is `nil` otherwise. - # - # The public interface for this autoloader is `Rails.autoloaders.main`. - singleton_class.attr_accessor :autoloader - - # Private method that reloads constants autoloaded by the main autoloader. - # - # Rails.application.reloader.reload! is the public interface for application - # reload. That involves more things, like deleting unloaded classes from the - # internal state of the descendants tracker, or reloading routes. - def self.clear - unload_interlock do - _autoloaded_tracked_classes.clear - autoloader.reload - end - end - - # Private method used by require_dependency. - def self.search_for_file(relpath) - relpath += ".rb" unless relpath.end_with?(".rb") - autoload_paths.each do |autoload_path| - abspath = File.join(autoload_path, relpath) - return abspath if File.file?(abspath) - end - nil - end - - # Private method that helps configuring the autoloaders. - def self.eager_load?(path) - _eager_load_paths.member?(path) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/dependencies/autoload.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/dependencies/autoload.rb deleted file mode 100644 index 747f1fe..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/dependencies/autoload.rb +++ /dev/null @@ -1,72 +0,0 @@ -# frozen_string_literal: true - -require "active_support/inflector/methods" - -module ActiveSupport - # = Active Support \Autoload - # - # Autoload and eager load conveniences for your library. - # - # This module allows you to define autoloads based on - # \Rails conventions (i.e. no need to define the path - # it is automatically guessed based on the filename) - # and also define a set of constants that needs to be - # eager loaded: - # - # module MyLib - # extend ActiveSupport::Autoload - # - # autoload :Model - # - # eager_autoload do - # autoload :Cache - # end - # end - # - # Then your library can be eager loaded by simply calling: - # - # MyLib.eager_load! - module Autoload - def autoload(const_name, path = @_at_path) - unless path - full = [name, @_under_path, const_name.to_s].compact.join("::") - path = Inflector.underscore(full) - end - - if @_eager_autoload - @_eagerloaded_constants ||= [] - @_eagerloaded_constants << const_name - end - - super const_name, path - end - - def autoload_under(path) - @_under_path, old_path = path, @_under_path - yield - ensure - @_under_path = old_path - end - - def autoload_at(path) - @_at_path, old_path = path, @_at_path - yield - ensure - @_at_path = old_path - end - - def eager_autoload - old_eager, @_eager_autoload = @_eager_autoload, true - yield - ensure - @_eager_autoload = old_eager - end - - def eager_load! - if @_eagerloaded_constants - @_eagerloaded_constants.each { |const_name| const_get(const_name) } - @_eagerloaded_constants = nil - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/dependencies/interlock.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/dependencies/interlock.rb deleted file mode 100644 index 88b69b0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/dependencies/interlock.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -require "active_support/concurrency/share_lock" - -module ActiveSupport # :nodoc: - module Dependencies # :nodoc: - class Interlock - def initialize # :nodoc: - @lock = ActiveSupport::Concurrency::ShareLock.new - end - - def loading(&block) - ActiveSupport.deprecator.warn( - "ActiveSupport::Dependencies::Interlock#loading is deprecated and " \ - "will be removed in Rails 9.0. The loading interlock is no longer " \ - "used since Rails switched to Zeitwerk for autoloading." - ) - yield if block - end - - def unloading(&block) - @lock.exclusive(purpose: :unload, compatible: [:unload], after_compatible: [:unload], &block) - end - - def start_unloading - @lock.start_exclusive(purpose: :unload, compatible: [:unload]) - end - - def done_unloading - @lock.stop_exclusive(compatible: [:unload]) - end - - def start_running - @lock.start_sharing - end - - def done_running - @lock.stop_sharing - end - - def running(&block) - @lock.sharing(&block) - end - - def permit_concurrent_loads(&block) - # Soft deprecated: no deprecation warning for now, but this is a no-op. - yield if block - end - - def raw_state(&block) # :nodoc: - @lock.raw_state(&block) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/dependencies/require_dependency.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/dependencies/require_dependency.rb deleted file mode 100644 index 403f5fa..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/dependencies/require_dependency.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport::Dependencies::RequireDependency - # Warning: This method is obsolete. The semantics of the autoloader - # match Ruby's and you do not need to be defensive with load order anymore. - # Just refer to classes and modules normally. - # - # Engines that do not control the mode in which their parent application runs - # should call +require_dependency+ where needed in case the runtime mode is - # +:classic+. - def require_dependency(filename) - filename = filename.to_path if filename.respond_to?(:to_path) - - unless filename.is_a?(String) - raise ArgumentError, "the file name must be either a String or implement #to_path -- you passed #{filename.inspect}" - end - - if abspath = ActiveSupport::Dependencies.search_for_file(filename) - require abspath - else - require filename - end - end - - # We could define require_dependency in Object directly, but a module makes - # the extension apparent if you list ancestors. - Object.prepend(self) -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation.rb deleted file mode 100644 index e66653d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation.rb +++ /dev/null @@ -1,81 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # = Active Support \Deprecation - # - # \Deprecation specifies the API used by \Rails to deprecate methods, instance variables, objects, and constants. It's - # also available for gems or applications. - # - # For a gem, use Deprecation.new to create a Deprecation object and store it in your module or class (in order for - # users to be able to configure it). - # - # module MyLibrary - # def self.deprecator - # @deprecator ||= ActiveSupport::Deprecation.new("2.0", "MyLibrary") - # end - # end - # - # For a Railtie or Engine, you may also want to add it to the application's deprecators, so that the application's - # configuration can be applied to it. - # - # module MyLibrary - # class Railtie < Rails::Railtie - # initializer "my_library.deprecator" do |app| - # app.deprecators[:my_library] = MyLibrary.deprecator - # end - # end - # end - # - # With the above initializer, configuration settings like the following will affect +MyLibrary.deprecator+: - # - # # in config/environments/test.rb - # config.active_support.deprecation = :raise - class Deprecation - # active_support.rb sets an autoload for ActiveSupport::Deprecation. - # - # If these requires were at the top of the file the constant would not be - # defined by the time their files were loaded. Since some of them reopen - # ActiveSupport::Deprecation its autoload would be triggered, resulting in - # a circular require warning for active_support/deprecation.rb. - # - # So, we define the constant first, and load dependencies later. - require "active_support/deprecation/behaviors" - require "active_support/deprecation/reporting" - require "active_support/deprecation/disallowed" - require "active_support/deprecation/constant_accessor" - require "active_support/deprecation/method_wrappers" - require "active_support/deprecation/proxy_wrappers" - require "active_support/deprecation/deprecators" - require "active_support/core_ext/module/deprecation" - require "concurrent/atomic/thread_local_var" - - include Behavior - include Reporting - include Disallowed - include MethodWrapper - - MUTEX = Mutex.new # :nodoc: - private_constant :MUTEX - - def self._instance # :nodoc: - @_instance ||= MUTEX.synchronize { @_instance ||= new } - end - - # The version number in which the deprecated behavior will be removed, by default. - attr_accessor :deprecation_horizon - - # It accepts two parameters on initialization. The first is a version of library - # and the second is a library name. - # - # ActiveSupport::Deprecation.new('2.0', 'MyLibrary') - def initialize(deprecation_horizon = "8.2", gem_name = "Rails") - self.gem_name = gem_name - self.deprecation_horizon = deprecation_horizon - # By default, warnings are not silenced and debugging is off. - self.silenced = false - self.debug = false - @silence_counter = Concurrent::ThreadLocalVar.new(0) - @explicitly_allowed_warnings = Concurrent::ThreadLocalVar.new(nil) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/behaviors.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/behaviors.rb deleted file mode 100644 index 2473263..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/behaviors.rb +++ /dev/null @@ -1,148 +0,0 @@ -# frozen_string_literal: true - -require "active_support/notifications" - -module ActiveSupport - # Raised when ActiveSupport::Deprecation::Behavior#behavior is set with :raise. - # You would set :raise, as a behavior to raise errors and proactively report exceptions from deprecations. - class DeprecationException < StandardError - end - - class Deprecation - # Default warning behaviors per Rails.env. - DEFAULT_BEHAVIORS = { - raise: ->(message, callstack, deprecator) do - e = DeprecationException.new(message) - e.set_backtrace(callstack.map(&:to_s)) - raise e - end, - - stderr: ->(message, callstack, deprecator) do - $stderr.puts(message) - $stderr.puts callstack.join("\n ") if deprecator.debug - end, - - log: ->(message, callstack, deprecator) do - logger = - if defined?(Rails.logger) && Rails.logger - Rails.logger - else - require "active_support/logger" - ActiveSupport::Logger.new($stderr) - end - logger.warn message - logger.debug callstack.join("\n ") if deprecator.debug - end, - - notify: ->(message, callstack, deprecator) do - ActiveSupport::Notifications.instrument( - "deprecation.#{deprecator.gem_name.underscore.tr("/", "_")}", - message: message, - callstack: callstack, - gem_name: deprecator.gem_name, - deprecation_horizon: deprecator.deprecation_horizon, - ) - end, - - silence: ->(message, callstack, deprecator) { }, - - report: ->(message, callstack, deprecator) do - error = DeprecationException.new(message) - error.set_backtrace(callstack.map(&:to_s)) - ActiveSupport.error_reporter.report(error) - end - } - - # Behavior module allows to determine how to display deprecation messages. - # You can create a custom behavior or set any from the +DEFAULT_BEHAVIORS+ - # constant. Available behaviors are: - # - # [+:raise+] Raise ActiveSupport::DeprecationException. - # [+:stderr+] Log all deprecation warnings to $stderr. - # [+:log+] Log all deprecation warnings to +Rails.logger+. - # [+:notify+] Use ActiveSupport::Notifications to notify +deprecation.rails+. - # [+:report+] Use ActiveSupport::ErrorReporter to report deprecations. - # [+:silence+] Do nothing. On \Rails, set config.active_support.report_deprecations = false to disable all behaviors. - # - # Setting behaviors only affects deprecations that happen after boot time. - # For more information you can read the documentation of the #behavior= method. - module Behavior - # Whether to print a backtrace along with the warning. - attr_accessor :debug - - # Returns the current behavior or if one isn't set, defaults to +:stderr+. - def behavior - @behavior ||= [DEFAULT_BEHAVIORS[:stderr]] - end - - # Returns the current behavior for disallowed deprecations or if one isn't set, defaults to +:raise+. - def disallowed_behavior - @disallowed_behavior ||= [DEFAULT_BEHAVIORS[:raise]] - end - - # Sets the behavior to the specified value. Can be a single value, array, - # or an object that responds to +call+. - # - # Available behaviors: - # - # [+:raise+] Raise ActiveSupport::DeprecationException. - # [+:stderr+] Log all deprecation warnings to $stderr. - # [+:log+] Log all deprecation warnings to +Rails.logger+. - # [+:notify+] Use ActiveSupport::Notifications to notify +deprecation.rails+. - # [+:report+] Use ActiveSupport::ErrorReporter to report deprecations. - # [+:silence+] Do nothing. - # - # Setting behaviors only affects deprecations that happen after boot time. - # Deprecation warnings raised by gems are not affected by this setting - # because they happen before \Rails boots up. - # - # deprecator = ActiveSupport::Deprecation.new - # deprecator.behavior = :stderr - # deprecator.behavior = [:stderr, :log] - # deprecator.behavior = MyCustomHandler - # deprecator.behavior = ->(message, callstack, deprecation_horizon, gem_name) { - # # custom stuff - # } - # - # If you are using \Rails, you can set - # config.active_support.report_deprecations = false to disable - # all deprecation behaviors. This is similar to the +:silence+ option but - # more performant. - def behavior=(behavior) - @behavior = Array(behavior).map { |b| DEFAULT_BEHAVIORS[b] || arity_coerce(b) } - end - - # Sets the behavior for disallowed deprecations (those configured by - # ActiveSupport::Deprecation#disallowed_warnings=) to the specified - # value. As with #behavior=, this can be a single value, array, or an - # object that responds to +call+. - def disallowed_behavior=(behavior) - @disallowed_behavior = Array(behavior).map { |b| DEFAULT_BEHAVIORS[b] || arity_coerce(b) } - end - - private - def arity_coerce(behavior) - unless behavior.respond_to?(:call) - raise ArgumentError, "#{behavior.inspect} is not a valid deprecation behavior." - end - - case arity_of_callable(behavior) - when 2 - ->(message, callstack, deprecator) do - behavior.call(message, callstack) - end - when -2..3 - behavior - else - ->(message, callstack, deprecator) do - behavior.call(message, callstack, deprecator.deprecation_horizon, deprecator.gem_name) - end - end - end - - def arity_of_callable(callable) - callable.respond_to?(:arity) ? callable.arity : callable.method(:call).arity - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/constant_accessor.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/constant_accessor.rb deleted file mode 100644 index d6ff5b4..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/constant_accessor.rb +++ /dev/null @@ -1,74 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - class Deprecation - module DeprecatedConstantAccessor - def self.included(base) - require "active_support/inflector/methods" - - extension = Module.new do - def const_missing(missing_const_name) - if class_variable_defined?(:@@_deprecated_constants) - if (replacement = class_variable_get(:@@_deprecated_constants)[missing_const_name.to_s]) - replacement[:deprecator].warn(replacement[:message] || "#{name}::#{missing_const_name} is deprecated! Use #{replacement[:new]} instead.", caller_locations) - return ActiveSupport::Inflector.constantize(replacement[:new].to_s) - end - end - super - end - - # Provides a way to rename constants with a deprecation cycle in which - # both the old and new names work, but using the old one prints a - # deprecation message. - # - # In order to rename A::B to C::D, you need to delete the - # definition of A::B and declare the deprecation in +A+: - # - # require "active_support/deprecation" - # - # module A - # include ActiveSupport::Deprecation::DeprecatedConstantAccessor - # - # deprecate_constant "B", "C::D", deprecator: ActiveSupport::Deprecation.new - # end - # - # The first argument is a constant name (no colons). It is the name of - # the constant you want to deprecate in the enclosing class or module. - # - # The second argument is the constant path of the replacement. That - # has to be a full path even if the replacement is defined in the same - # namespace as the deprecated one was. - # - # In both cases, strings and symbols are supported. - # - # The +deprecator+ keyword argument is the object that will print the - # deprecation message, an instance of ActiveSupport::Deprecation. - # - # With that in place, references to A::B still work, they - # evaluate to C::D now, and trigger a deprecation warning: - # - # DEPRECATION WARNING: A::B is deprecated! Use C::D instead. - # (called from ...) - # - # The message can be customized with the optional +message+ keyword - # argument. - # - # For this to work, a +const_missing+ hook is installed. When client - # code references the deprecated constant, the callback prints the - # message and constantizes the replacement. - # - # Caveat: If the deprecated constant name is reachable in a different - # namespace and Ruby constant lookup finds it, the hook won't be - # called and the deprecation won't work as intended. This may happen, - # for example, if an ancestor of the enclosing namespace has a - # constant with the same name. This is an unsupported edge case. - def deprecate_constant(old_constant_name, new_constant_path, deprecator:, message: nil) - class_variable_set(:@@_deprecated_constants, {}) unless class_variable_defined?(:@@_deprecated_constants) - class_variable_get(:@@_deprecated_constants)[old_constant_name.to_s] = { new: new_constant_path, message: message, deprecator: deprecator } - end - end - base.singleton_class.prepend extension - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/deprecators.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/deprecators.rb deleted file mode 100644 index 08f3fae..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/deprecators.rb +++ /dev/null @@ -1,104 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - class Deprecation - # A managed collection of deprecators. Configuration methods, such as - # #behavior=, affect all deprecators in the collection. Additionally, the - # #silence method silences all deprecators in the collection for the - # duration of a given block. - class Deprecators - def initialize - @options = {} - @deprecators = {} - end - - # Returns a deprecator added to this collection via #[]=. - def [](name) - @deprecators[name] - end - - # Adds a given +deprecator+ to this collection. The deprecator will be - # immediately configured with any options previously set on this - # collection. - # - # deprecators = ActiveSupport::Deprecation::Deprecators.new - # deprecators.debug = true - # - # foo_deprecator = ActiveSupport::Deprecation.new("2.0", "Foo") - # foo_deprecator.debug # => false - # - # deprecators[:foo] = foo_deprecator - # deprecators[:foo].debug # => true - # foo_deprecator.debug # => true - # - def []=(name, deprecator) - apply_options(deprecator) - @deprecators[name] = deprecator - end - - # Iterates over all deprecators in this collection. If no block is given, - # returns an +Enumerator+. - def each(&block) - return to_enum(__method__) unless block - @deprecators.each_value(&block) - end - - # Sets the silenced flag for all deprecators in this collection. - def silenced=(silenced) - set_option(:silenced, silenced) - end - - # Sets the debug flag for all deprecators in this collection. - def debug=(debug) - set_option(:debug, debug) - end - - # Sets the deprecation warning behavior for all deprecators in this - # collection. - # - # See ActiveSupport::Deprecation#behavior=. - def behavior=(behavior) - set_option(:behavior, behavior) - end - - # Sets the disallowed deprecation warning behavior for all deprecators in - # this collection. - # - # See ActiveSupport::Deprecation#disallowed_behavior=. - def disallowed_behavior=(disallowed_behavior) - set_option(:disallowed_behavior, disallowed_behavior) - end - - # Sets the disallowed deprecation warnings for all deprecators in this - # collection. - # - # See ActiveSupport::Deprecation#disallowed_warnings=. - def disallowed_warnings=(disallowed_warnings) - set_option(:disallowed_warnings, disallowed_warnings) - end - - # Silences all deprecators in this collection for the duration of the - # given block. - # - # See ActiveSupport::Deprecation#silence. - def silence(&block) - each { |deprecator| deprecator.begin_silence } - block.call - ensure - each { |deprecator| deprecator.end_silence } - end - - private - def set_option(name, value) - @options[name] = value - each { |deprecator| deprecator.public_send("#{name}=", value) } - end - - def apply_options(deprecator) - @options.each do |name, value| - deprecator.public_send("#{name}=", value) - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/disallowed.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/disallowed.rb deleted file mode 100644 index 85fdf5d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/disallowed.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - class Deprecation - module Disallowed - # Sets the criteria used to identify deprecation messages which should be - # disallowed. Can be an array containing strings, symbols, or regular - # expressions. (Symbols are treated as strings.) These are compared against - # the text of the generated deprecation warning. - # - # Additionally the scalar symbol +:all+ may be used to treat all - # deprecations as disallowed. - # - # Deprecations matching a substring or regular expression will be handled - # using the configured Behavior#disallowed_behavior rather than - # Behavior#behavior. - attr_writer :disallowed_warnings - - # Returns the configured criteria used to identify deprecation messages - # which should be treated as disallowed. - def disallowed_warnings - @disallowed_warnings ||= [] - end - - private - def deprecation_disallowed?(message) - return false if explicitly_allowed?(message) - return true if disallowed_warnings == :all - message && disallowed_warnings.any? do |rule| - case rule - when String, Symbol - message.include?(rule.to_s) - when Regexp - rule.match?(message) - end - end - end - - def explicitly_allowed?(message) - allowances = @explicitly_allowed_warnings.value - return false unless allowances - return true if allowances == :all - message && Array(allowances).any? do |rule| - case rule - when String, Symbol - message.include?(rule.to_s) - when Regexp - rule.match?(message) - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/method_wrappers.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/method_wrappers.rb deleted file mode 100644 index 921168c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/method_wrappers.rb +++ /dev/null @@ -1,68 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/array/extract_options" -require "active_support/core_ext/module/redefine_method" - -module ActiveSupport - class Deprecation - module MethodWrapper - # Declare that a method has been deprecated. - # - # class Fred - # def aaa; end - # def bbb; end - # def ccc; end - # def ddd; end - # def eee; end - # end - # - # deprecator = ActiveSupport::Deprecation.new('next-release', 'MyGem') - # - # deprecator.deprecate_methods(Fred, :aaa, bbb: :zzz, ccc: 'use Bar#ccc instead') - # # => Fred - # - # Fred.new.aaa - # # DEPRECATION WARNING: aaa is deprecated and will be removed from MyGem next-release. (called from irb_binding at (irb):10) - # # => nil - # - # Fred.new.bbb - # # DEPRECATION WARNING: bbb is deprecated and will be removed from MyGem next-release (use zzz instead). (called from irb_binding at (irb):11) - # # => nil - # - # Fred.new.ccc - # # DEPRECATION WARNING: ccc is deprecated and will be removed from MyGem next-release (use Bar#ccc instead). (called from irb_binding at (irb):12) - # # => nil - def deprecate_methods(target_module, *method_names) - options = method_names.extract_options! - deprecator = options.delete(:deprecator) || self - method_names += options.keys - mod = nil - - method_names.each do |method_name| - message = options[method_name] - if target_module.method_defined?(method_name) || target_module.private_method_defined?(method_name) - method = target_module.instance_method(method_name) - target_module.module_eval do - redefine_method(method_name) do |*args, &block| - deprecator.deprecation_warning(method_name, message) - method.bind_call(self, *args, &block) - end - ruby2_keywords(method_name) - end - else - mod ||= Module.new - mod.module_eval do - define_method(method_name) do |*args, &block| - deprecator.deprecation_warning(method_name, message) - super(*args, &block) - end - ruby2_keywords(method_name) - end - end - end - - target_module.prepend(mod) if mod - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/proxy_wrappers.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/proxy_wrappers.rb deleted file mode 100644 index 80e4ab2..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/proxy_wrappers.rb +++ /dev/null @@ -1,189 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - class Deprecation - class DeprecationProxy # :nodoc: - def self.new(*args, **kwargs, &block) - object = args.first - - return object unless object - super - end - - instance_methods.each { |m| undef_method m unless /^__|^object_id$/.match?(m) } - - # Don't give a deprecation warning on inspect since test/unit and error - # logs rely on it for diagnostics. - def inspect - target.inspect - end - - private - def method_missing(called, *args, &block) - warn caller_locations, called, args - target.__send__(called, *args, &block) - end - end - - # DeprecatedObjectProxy transforms an object into a deprecated one. It takes an object, a deprecation message, and - # a deprecator. - # - # deprecated_object = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(Object.new, "This object is now deprecated", ActiveSupport::Deprecation.new) - # # => # - # - # deprecated_object.to_s - # DEPRECATION WARNING: This object is now deprecated. - # (Backtrace) - # # => "#" - class DeprecatedObjectProxy < DeprecationProxy - def initialize(object, message, deprecator) - @object = object - @message = message - @deprecator = deprecator - end - - private - def target - @object - end - - def warn(callstack, called, args) - @deprecator.warn(@message, callstack) - end - end - - # DeprecatedInstanceVariableProxy transforms an instance variable into a deprecated one. It takes an instance of a - # class, a method on that class, an instance variable, and a deprecator as the last argument. - # - # Trying to use the deprecated instance variable will result in a deprecation warning, pointing to the method as a - # replacement. - # - # class Example - # def initialize - # @request = ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new(self, :request, :@request, ActiveSupport::Deprecation.new) - # @_request = :special_request - # end - # - # def request - # @_request - # end - # - # def old_request - # @request - # end - # end - # - # example = Example.new - # # => # - # - # example.old_request.to_s - # # => DEPRECATION WARNING: @request is deprecated! Call request.to_s instead of - # @request.to_s - # (Backtrace information…) - # "special_request" - # - # example.request.to_s - # # => "special_request" - class DeprecatedInstanceVariableProxy < DeprecationProxy - def initialize(instance, method, var = "@#{method}", deprecator:) - @instance = instance - @method = method - @var = var - @deprecator = deprecator - end - - private - def target - @instance.__send__(@method) - end - - def warn(callstack, called, args) - @deprecator.warn("#{@var} is deprecated! Call #{@method}.#{called} instead of #{@var}.#{called}. Args: #{args.inspect}", callstack) - end - end - - # DeprecatedConstantProxy transforms a constant into a deprecated one. It takes the full names of an old - # (deprecated) constant and of a new constant (both in string form) and a deprecator. The deprecated constant now - # returns the value of the new one. - # - # PLANETS = %w(mercury venus earth mars jupiter saturn uranus neptune pluto) - # - # # (In a later update, the original implementation of `PLANETS` has been removed.) - # - # PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune) - # PLANETS = ActiveSupport::Deprecation::DeprecatedConstantProxy.new("PLANETS", "PLANETS_POST_2006", ActiveSupport::Deprecation.new) - # - # PLANETS.map { |planet| planet.capitalize } - # # => DEPRECATION WARNING: PLANETS is deprecated! Use PLANETS_POST_2006 instead. - # (Backtrace information…) - # ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"] - class DeprecatedConstantProxy < Module - def self.new(*args, **options, &block) - object = args.first - - return object unless object - super - end - - def initialize(old_const, new_const, deprecator, message: "#{old_const} is deprecated! Use #{new_const} instead.") - Kernel.require "active_support/inflector/methods" - - @old_const = old_const - @new_const = new_const - @deprecator = deprecator - @message = message - end - - instance_methods.each { |m| undef_method m unless /^__|^object_id$/.match?(m) } - - # Don't give a deprecation warning on inspect since test/unit and error - # logs rely on it for diagnostics. - def inspect - target.inspect - end - - # Don't give a deprecation warning on methods that IRB may invoke - # during tab-completion. - delegate :hash, :instance_methods, :name, :respond_to?, to: :target - - # Returns the class of the new constant. - # - # PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune) - # PLANETS = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('PLANETS', 'PLANETS_POST_2006') - # PLANETS.class # => Array - def class - target.class - end - - def append_features(base) - @deprecator.warn(@message, caller_locations) - base.include(target) - end - - def prepend_features(base) - @deprecator.warn(@message, caller_locations) - base.prepend(target) - end - - def extended(base) - @deprecator.warn(@message, caller_locations) - base.extend(target) - end - - private - def target - ActiveSupport::Inflector.constantize(@new_const.to_s) - end - - def const_missing(name) - @deprecator.warn(@message, caller_locations) - target.const_get(name) - end - - def method_missing(...) - @deprecator.warn(@message, caller_locations) - target.__send__(...) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/reporting.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/reporting.rb deleted file mode 100644 index 187a758..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/deprecation/reporting.rb +++ /dev/null @@ -1,162 +0,0 @@ -# frozen_string_literal: true - -require "rbconfig" - -module ActiveSupport - class Deprecation - module Reporting - # Whether to print a message (silent mode) - attr_writer :silenced - # Name of gem where method is deprecated - attr_accessor :gem_name - - # Outputs a deprecation warning to the output configured by - # ActiveSupport::Deprecation#behavior. - # - # ActiveSupport::Deprecation.new.warn('something broke!') - # # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)" - def warn(message = nil, callstack = nil) - return if silenced - - callstack ||= caller_locations(2) - deprecation_message(callstack, message).tap do |full_message| - if deprecation_disallowed?(message) - disallowed_behavior.each { |b| b.call(full_message, callstack, self) } - else - behavior.each { |b| b.call(full_message, callstack, self) } - end - end - end - - # Silence deprecation warnings within the block. - # - # deprecator = ActiveSupport::Deprecation.new - # deprecator.warn('something broke!') - # # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)" - # - # deprecator.silence do - # deprecator.warn('something broke!') - # end - # # => nil - def silence(&block) - begin_silence - block.call - ensure - end_silence - end - - def begin_silence # :nodoc: - @silence_counter.value += 1 - end - - def end_silence # :nodoc: - @silence_counter.value -= 1 - end - - def silenced - @silenced || @silence_counter.value.nonzero? - end - - # Allow previously disallowed deprecation warnings within the block. - # allowed_warnings can be an array containing strings, symbols, or regular - # expressions. (Symbols are treated as strings). These are compared against - # the text of deprecation warning messages generated within the block. - # Matching warnings will be exempt from the rules set by - # ActiveSupport::Deprecation#disallowed_warnings. - # - # The optional if: argument accepts a truthy/falsy value or an object that - # responds to .call. If truthy, then matching warnings will be allowed. - # If falsey then the method yields to the block without allowing the warning. - # - # deprecator = ActiveSupport::Deprecation.new - # deprecator.disallowed_behavior = :raise - # deprecator.disallowed_warnings = [ - # "something broke" - # ] - # - # deprecator.warn('something broke!') - # # => ActiveSupport::DeprecationException - # - # deprecator.allow ['something broke'] do - # deprecator.warn('something broke!') - # end - # # => nil - # - # deprecator.allow ['something broke'], if: Rails.env.production? do - # deprecator.warn('something broke!') - # end - # # => ActiveSupport::DeprecationException for dev/test, nil for production - def allow(allowed_warnings = :all, if: true, &block) - conditional = binding.local_variable_get(:if) - conditional = conditional.call if conditional.respond_to?(:call) - if conditional - @explicitly_allowed_warnings.bind(allowed_warnings, &block) - else - yield - end - end - - def deprecation_warning(deprecated_method_name, message = nil, caller_backtrace = nil) - caller_backtrace ||= caller_locations(2) - deprecated_method_warning(deprecated_method_name, message).tap do |msg| - warn(msg, caller_backtrace) - end - end - - private - # Outputs a deprecation warning message - # - # deprecated_method_warning(:method_name) - # # => "method_name is deprecated and will be removed from Rails #{deprecation_horizon}" - # deprecated_method_warning(:method_name, :another_method) - # # => "method_name is deprecated and will be removed from Rails #{deprecation_horizon} (use another_method instead)" - # deprecated_method_warning(:method_name, "Optional message") - # # => "method_name is deprecated and will be removed from Rails #{deprecation_horizon} (Optional message)" - def deprecated_method_warning(method_name, message = nil) - warning = "#{method_name} is deprecated and will be removed from #{gem_name} #{deprecation_horizon}" - case message - when Symbol then "#{warning} (use #{message} instead)" - when String then "#{warning} (#{message})" - else warning - end - end - - def deprecation_message(callstack, message = nil) - message ||= "You are using deprecated behavior which will be removed from the next major or minor release." - "DEPRECATION WARNING: #{message} #{deprecation_caller_message(callstack)}" - end - - def deprecation_caller_message(callstack) - file, line, method = extract_callstack(callstack) - if file - if line && method - "(called from #{method} at #{file}:#{line})" - else - "(called from #{file}:#{line})" - end - end - end - - def extract_callstack(callstack) - return [] if callstack.empty? - - offending_line = callstack.find { |frame| - # Code generated with `eval` doesn't have an `absolute_path`, e.g. templates. - path = frame.absolute_path || frame.path - path && !ignored_callstack?(path) - } || callstack.first - - [offending_line.path, offending_line.lineno, offending_line.label] - end - - RAILS_GEM_ROOT = File.expand_path("../../../..", __dir__) + "/" - private_constant :RAILS_GEM_ROOT - LIB_DIR = RbConfig::CONFIG["libdir"] - private_constant :LIB_DIR - - def ignored_callstack?(path) - path.start_with?(RAILS_GEM_ROOT, LIB_DIR) || path.include?("(other) - if Scalar === other || Duration === other - value <=> other.value - elsif Numeric === other - value <=> other - else - nil - end - end - - def +(other) - if Duration === other - seconds = value + other._parts.fetch(:seconds, 0) - new_parts = other._parts.merge(seconds: seconds) - new_value = value + other.value - - Duration.new(new_value, new_parts, other.variable?) - else - calculate(:+, other) - end - end - - def -(other) - if Duration === other - seconds = value - other._parts.fetch(:seconds, 0) - new_parts = other._parts.transform_values(&:-@) - new_parts = new_parts.merge(seconds: seconds) - new_value = value - other.value - - Duration.new(new_value, new_parts, other.variable?) - else - calculate(:-, other) - end - end - - def *(other) - if Duration === other - new_parts = other._parts.transform_values { |other_value| value * other_value } - new_value = value * other.value - - Duration.new(new_value, new_parts, other.variable?) - else - calculate(:*, other) - end - end - - def /(other) - if Duration === other - value / other.value - else - calculate(:/, other) - end - end - - def %(other) - if Duration === other - Duration.build(value % other.value) - else - calculate(:%, other) - end - end - - def variable? # :nodoc: - false - end - - private - def calculate(op, other) - if Scalar === other - Scalar.new(value.public_send(op, other.value)) - elsif Numeric === other - Scalar.new(value.public_send(op, other)) - else - raise_type_error(other) - end - end - - def raise_type_error(other) - raise TypeError, "no implicit conversion of #{other.class} into #{self.class}" - end - end - - SECONDS_PER_MINUTE = 60 - SECONDS_PER_HOUR = 3600 - SECONDS_PER_DAY = 86400 - SECONDS_PER_WEEK = 604800 - SECONDS_PER_MONTH = 2629746 # 1/12 of a gregorian year - SECONDS_PER_YEAR = 31556952 # length of a gregorian year (365.2425 days) - - PARTS_IN_SECONDS = { - seconds: 1, - minutes: SECONDS_PER_MINUTE, - hours: SECONDS_PER_HOUR, - days: SECONDS_PER_DAY, - weeks: SECONDS_PER_WEEK, - months: SECONDS_PER_MONTH, - years: SECONDS_PER_YEAR - }.freeze - - PARTS = [:years, :months, :weeks, :days, :hours, :minutes, :seconds].freeze - VARIABLE_PARTS = [:years, :months, :weeks, :days].freeze - - attr_reader :value - - autoload :ISO8601Parser, "active_support/duration/iso8601_parser" - autoload :ISO8601Serializer, "active_support/duration/iso8601_serializer" - - class << self - # Creates a new Duration from string formatted according to ISO 8601 Duration. - # - # See {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601#Durations] for more information. - # This method allows negative parts to be present in pattern. - # If invalid string is provided, it will raise +ActiveSupport::Duration::ISO8601Parser::ParsingError+. - def parse(iso8601duration) - parts = ISO8601Parser.new(iso8601duration).parse! - new(calculate_total_seconds(parts), parts) - end - - def ===(other) # :nodoc: - other.is_a?(Duration) - rescue ::NoMethodError - false - end - - def seconds(value) # :nodoc: - new(value, { seconds: value }, false) - end - - def minutes(value) # :nodoc: - new(value * SECONDS_PER_MINUTE, { minutes: value }, false) - end - - def hours(value) # :nodoc: - new(value * SECONDS_PER_HOUR, { hours: value }, false) - end - - def days(value) # :nodoc: - new(value * SECONDS_PER_DAY, { days: value }, true) - end - - def weeks(value) # :nodoc: - new(value * SECONDS_PER_WEEK, { weeks: value }, true) - end - - def months(value) # :nodoc: - new(value * SECONDS_PER_MONTH, { months: value }, true) - end - - def years(value) # :nodoc: - new(value * SECONDS_PER_YEAR, { years: value }, true) - end - - # Creates a new Duration from a seconds value that is converted - # to the individual parts: - # - # ActiveSupport::Duration.build(31556952).parts # => {:years=>1} - # ActiveSupport::Duration.build(2716146).parts # => {:months=>1, :days=>1} - # - def build(value) - unless value.is_a?(::Numeric) - raise TypeError, "can't build an #{self.name} from a #{value.class.name}" - end - - parts = {} - remainder_sign = value <=> 0 - remainder = value.round(9).abs - variable = false - - PARTS.each do |part| - unless part == :seconds - part_in_seconds = PARTS_IN_SECONDS[part] - parts[part] = remainder.div(part_in_seconds) * remainder_sign - remainder %= part_in_seconds - - unless parts[part].zero? - variable ||= VARIABLE_PARTS.include?(part) - end - end - end unless value == 0 - - parts[:seconds] = remainder * remainder_sign - - new(value, parts, variable) - end - - private - def calculate_total_seconds(parts) - parts.inject(0) do |total, (part, value)| - total + value * PARTS_IN_SECONDS[part] - end - end - end - - Delegation.generate(self, [:to_f, :positive?, :negative?, :zero?, :abs], to: :@value, as: Integer, nilable: false) - - def initialize(value, parts, variable = nil) # :nodoc: - @value, @parts = value, parts - @parts.reject! { |k, v| v.zero? } unless value == 0 - @parts.freeze - @variable = variable - - if @variable.nil? - @variable = @parts.any? { |part, _| VARIABLE_PARTS.include?(part) } - end - end - - # Returns a copy of the parts hash that defines the duration. - # - # 5.minutes.parts # => {:minutes=>5} - # 3.years.parts # => {:years=>3} - def parts - @parts.dup - end - - def coerce(other) # :nodoc: - case other - when Scalar - [other, self] - when Duration - [Scalar.new(other.value), self] - else - [Scalar.new(other), self] - end - end - - # Compares one Duration with another or a Numeric to this Duration. - # Numeric values are treated as seconds. - def <=>(other) - if Duration === other - value <=> other.value - elsif Numeric === other - value <=> other - end - end - - # Adds another Duration or a Numeric to this Duration. Numeric values - # are treated as seconds. - def +(other) - if Duration === other - parts = @parts.merge(other._parts) do |_key, value, other_value| - value + other_value - end - Duration.new(value + other.value, parts, @variable || other.variable?) - else - seconds = @parts.fetch(:seconds, 0) + other - Duration.new(value + other, @parts.merge(seconds: seconds), @variable) - end - end - - # Subtracts another Duration or a Numeric from this Duration. Numeric - # values are treated as seconds. - def -(other) - self + (-other) - end - - # Multiplies this Duration by a Numeric and returns a new Duration. - def *(other) - if Scalar === other || Duration === other - Duration.new(value * other.value, @parts.transform_values { |number| number * other.value }, @variable || other.variable?) - elsif Numeric === other - Duration.new(value * other, @parts.transform_values { |number| number * other }, @variable) - else - raise_type_error(other) - end - end - - # Divides this Duration by a Numeric and returns a new Duration. - def /(other) - if Scalar === other - Duration.new(value / other.value, @parts.transform_values { |number| number / other.value }, @variable) - elsif Duration === other - value / other.value - elsif Numeric === other - Duration.new(value / other, @parts.transform_values { |number| number / other }, @variable) - else - raise_type_error(other) - end - end - - # Returns the modulo of this Duration by another Duration or Numeric. - # Numeric values are treated as seconds. - def %(other) - if Duration === other || Scalar === other - Duration.build(value % other.value) - elsif Numeric === other - Duration.build(value % other) - else - raise_type_error(other) - end - end - - def -@ # :nodoc: - Duration.new(-value, @parts.transform_values(&:-@), @variable) - end - - def +@ # :nodoc: - self - end - - def is_a?(klass) # :nodoc: - Duration == klass || value.is_a?(klass) - end - alias :kind_of? :is_a? - - def instance_of?(klass) # :nodoc: - Duration == klass || value.instance_of?(klass) - end - - # Returns +true+ if +other+ is also a Duration instance with the - # same +value+, or if other == value. - def ==(other) - if Duration === other - other.value == value - else - other == value - end - end - - # Returns the amount of seconds a duration covers as a string. - # For more information check to_i method. - # - # 1.day.to_s # => "86400" - def to_s - @value.to_s - end - - # Returns the number of seconds that this Duration represents. - # - # 1.minute.to_i # => 60 - # 1.hour.to_i # => 3600 - # 1.day.to_i # => 86400 - # - # Note that this conversion makes some assumptions about the - # duration of some periods, e.g. months are always 1/12 of year - # and years are 365.2425 days: - # - # # equivalent to (1.year / 12).to_i - # 1.month.to_i # => 2629746 - # - # # equivalent to 365.2425.days.to_i - # 1.year.to_i # => 31556952 - # - # In such cases, Ruby's core - # Date[https://docs.ruby-lang.org/en/master/Date.html] and - # Time[https://docs.ruby-lang.org/en/master/Time.html] should be used for precision - # date and time arithmetic. - def to_i - @value.to_i - end - alias :in_seconds :to_i - - # Returns the amount of minutes a duration covers as a float - # - # 1.day.in_minutes # => 1440.0 - def in_minutes - value / SECONDS_PER_MINUTE.to_f - end - - # Returns the amount of hours a duration covers as a float - # - # 1.day.in_hours # => 24.0 - def in_hours - value / SECONDS_PER_HOUR.to_f - end - - # Returns the amount of days a duration covers as a float - # - # 12.hours.in_days # => 0.5 - def in_days - value / SECONDS_PER_DAY.to_f - end - - # Returns the amount of weeks a duration covers as a float - # - # 2.months.in_weeks # => 8.696 - def in_weeks - value / SECONDS_PER_WEEK.to_f - end - - # Returns the amount of months a duration covers as a float - # - # 9.weeks.in_months # => 2.07 - def in_months - value / SECONDS_PER_MONTH.to_f - end - - # Returns the amount of years a duration covers as a float - # - # 30.days.in_years # => 0.082 - def in_years - value / SECONDS_PER_YEAR.to_f - end - - # Returns +true+ if +other+ is also a Duration instance, which has the - # same parts as this one. - def eql?(other) - Duration === other && other.value.eql?(value) - end - - def hash - @value.hash - end - - # Calculates a new Time or Date that is as far in the future - # as this Duration represents. - def since(time = ::Time.current) - sum(1, time) - end - alias :from_now :since - alias :after :since - - # Calculates a new Time or Date that is as far in the past - # as this Duration represents. - def ago(time = ::Time.current) - sum(-1, time) - end - alias :until :ago - alias :before :ago - - def inspect # :nodoc: - return "#{value} seconds" if @parts.empty? - - @parts. - sort_by { |unit, _ | PARTS.index(unit) }. - map { |unit, val| "#{val} #{val == 1 ? unit.to_s.chop : unit.to_s}" }. - to_sentence(locale: false) - end - - def as_json(options = nil) # :nodoc: - to_i - end - - def init_with(coder) # :nodoc: - initialize(coder["value"], coder["parts"]) - end - - def encode_with(coder) # :nodoc: - coder.map = { "value" => @value, "parts" => @parts } - end - - # Build ISO 8601 Duration string for this duration. - # The +precision+ parameter can be used to limit seconds' precision of duration. - def iso8601(precision: nil) - ISO8601Serializer.new(self, precision: precision).serialize - end - - def variable? # :nodoc: - @variable - end - - def _parts # :nodoc: - @parts - end - - private - def sum(sign, time = ::Time.current) - unless time.acts_like?(:time) || time.acts_like?(:date) - raise ::ArgumentError, "expected a time or date, got #{time.inspect}" - end - - if @parts.empty? - time.since(sign * value) - else - @parts.each do |type, number| - t = time - time = - if type == :seconds - t.since(sign * number) - elsif type == :minutes - t.since(sign * number * 60) - elsif type == :hours - t.since(sign * number * 3600) - else - t.advance(type => sign * number) - end - end - - time - end - end - - def respond_to_missing?(method, _) - value.respond_to?(method) - end - - def method_missing(...) - value.public_send(...) - end - - def raise_type_error(other) - raise TypeError, "no implicit conversion of #{other.class} into #{self.class}" - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/duration/iso8601_parser.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/duration/iso8601_parser.rb deleted file mode 100644 index 8ccd0cf..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/duration/iso8601_parser.rb +++ /dev/null @@ -1,123 +0,0 @@ -# frozen_string_literal: true - -require "strscan" - -module ActiveSupport - class Duration - # Parses a string formatted according to ISO 8601 Duration into the hash. - # - # See {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601#Durations] for more information. - # - # This parser allows negative parts to be present in pattern. - class ISO8601Parser # :nodoc: - class ParsingError < ::ArgumentError; end - - PERIOD_OR_COMMA = /\.|,/ - PERIOD = "." - COMMA = "," - - SIGN_MARKER = /\A-|\+|/ - DATE_MARKER = /P/ - TIME_MARKER = /T/ - DATE_COMPONENT = /(-?\d+(?:[.,]\d+)?)(Y|M|D|W)/ - TIME_COMPONENT = /(-?\d+(?:[.,]\d+)?)(H|M|S)/ - - DATE_TO_PART = { "Y" => :years, "M" => :months, "W" => :weeks, "D" => :days } - TIME_TO_PART = { "H" => :hours, "M" => :minutes, "S" => :seconds } - - DATE_COMPONENTS = [:years, :months, :days] - TIME_COMPONENTS = [:hours, :minutes, :seconds] - - attr_reader :parts, :scanner - attr_accessor :mode, :sign - - def initialize(string) - @scanner = StringScanner.new(string) - @parts = {} - @mode = :start - @sign = 1 - end - - def parse! - while !finished? - case mode - when :start - if scan(SIGN_MARKER) - self.sign = (scanner.matched == "-") ? -1 : 1 - self.mode = :sign - else - raise_parsing_error - end - - when :sign - if scan(DATE_MARKER) - self.mode = :date - else - raise_parsing_error - end - - when :date - if scan(TIME_MARKER) - self.mode = :time - elsif scan(DATE_COMPONENT) - parts[DATE_TO_PART[scanner[2]]] = number * sign - else - raise_parsing_error - end - - when :time - if scan(TIME_COMPONENT) - parts[TIME_TO_PART[scanner[2]]] = number * sign - else - raise_parsing_error - end - - end - end - - validate! - parts - end - - private - def finished? - scanner.eos? - end - - # Parses number which can be a float with either comma or period. - def number - PERIOD_OR_COMMA.match?(scanner[1]) ? scanner[1].tr(COMMA, PERIOD).to_f : scanner[1].to_i - end - - def scan(pattern) - scanner.scan(pattern) - end - - def raise_parsing_error(reason = nil) - raise ParsingError, "Invalid ISO 8601 duration: #{scanner.string.inspect} #{reason}".strip - end - - # Checks for various semantic errors as stated in ISO 8601 standard. - def validate! - raise_parsing_error("is empty duration") if parts.empty? - - # Mixing any of Y, M, D with W is invalid. - if parts.key?(:weeks) && parts.keys.intersect?(DATE_COMPONENTS) - raise_parsing_error("mixing weeks with other date parts not allowed") - end - - # Specifying an empty T part is invalid. - if mode == :time && !parts.keys.intersect?(TIME_COMPONENTS) - raise_parsing_error("time part marker is present but time part is empty") - end - - fractions = parts.values.reject(&:zero?).select { |a| (a % 1) != 0 } - unless fractions.empty? || (fractions.size == 1 && fractions.last == @parts.values.reject(&:zero?).last) - raise_parsing_error "(only last part can be fractional)" - end - - true - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/duration/iso8601_serializer.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/duration/iso8601_serializer.rb deleted file mode 100644 index ca9c912..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/duration/iso8601_serializer.rb +++ /dev/null @@ -1,64 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - class Duration - # Serializes duration to string according to ISO 8601 Duration format. - class ISO8601Serializer # :nodoc: - DATE_COMPONENTS = %i(years months days) - - def initialize(duration, precision: nil) - @duration = duration - @precision = precision - end - - # Builds and returns output string. - def serialize - parts = normalize - return "PT0S" if parts.empty? - - output = +"P" - output << "#{parts[:years]}Y" if parts.key?(:years) - output << "#{parts[:months]}M" if parts.key?(:months) - output << "#{parts[:days]}D" if parts.key?(:days) - output << "#{parts[:weeks]}W" if parts.key?(:weeks) - time = +"" - time << "#{parts[:hours]}H" if parts.key?(:hours) - time << "#{parts[:minutes]}M" if parts.key?(:minutes) - if parts.key?(:seconds) - time << "#{format_seconds(parts[:seconds])}S" - end - output << "T#{time}" unless time.empty? - output - end - - private - # Return pair of duration's parts and whole duration sign. - # Parts are summarized (as they can become repetitive due to addition, etc). - # Zero parts are removed as not significant. - def normalize - parts = @duration.parts.each_with_object(Hash.new(0)) do |(k, v), p| - p[k] += v unless v.zero? - end - - # Convert weeks to days and remove weeks if mixed with date parts - if week_mixed_with_date?(parts) - parts[:days] += parts.delete(:weeks) * SECONDS_PER_WEEK / SECONDS_PER_DAY - end - - parts - end - - def week_mixed_with_date?(parts) - parts.key?(:weeks) && parts.keys.intersect?(DATE_COMPONENTS) - end - - def format_seconds(seconds) - if @precision - sprintf("%0.0#{@precision}f", seconds) - else - seconds.to_s - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/editor.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/editor.rb deleted file mode 100644 index 5a52df0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/editor.rb +++ /dev/null @@ -1,70 +0,0 @@ -# frozen_string_literal: true - -# :markup: markdown - -module ActiveSupport - class Editor - @editors = {} - @current = false - - class << self - # Registers a URL pattern for opening file in a given editor. - # This allows Rails to generate clickable links to control known editors. - # - # Example: - # - # ActiveSupport::Editor.register("myeditor", "myeditor://%s:%d") - def register(name, url_pattern, aliases: []) - editor = new(url_pattern) - @editors[name] = editor - aliases.each do |a| - @editors[a] = editor - end - end - - # Returns the current editor pattern if it is known. - # First check for the `RAILS_EDITOR` environment variable, and if it's - # missing, check for the `EDITOR` environment variable. - def current - if @current == false - @current = if editor_name = ENV["RAILS_EDITOR"] || ENV["EDITOR"] - @editors[editor_name] - end - end - @current - end - - # :nodoc: - - def find(name) - @editors[name] - end - - def reset - @current = false - end - end - - def initialize(url_pattern) - @url_pattern = url_pattern - end - - def url_for(path, line) - sprintf(@url_pattern, path, line) - end - - register "atom", "atom://core/open/file?filename=%s&line=%d" - register "cursor", "cursor://file/%s:%f" - register "emacs", "emacs://open?url=file://%s&line=%d", aliases: ["emacsclient"] - register "idea", "idea://open?file=%s&line=%d" - register "macvim", "mvim://open?url=file://%s&line=%d", aliases: ["mvim"] - register "nova", "nova://open?path=%s&line=%d" - register "rubymine", "x-mine://open?file=%s&line=%d" - register "sublime", "subl://open?url=file://%s&line=%d", aliases: ["subl"] - register "textmate", "txmt://open?url=file://%s&line=%d", aliases: ["mate"] - register "vscode", "vscode://file/%s:%d", aliases: ["code"] - register "vscodium", "vscodium://file/%s:%d", aliases: ["codium"] - register "windsurf", "windsurf://file/%s:%d" - register "zed", "zed://file/%s:%d" - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/encrypted_configuration.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/encrypted_configuration.rb deleted file mode 100644 index 39c7636..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/encrypted_configuration.rb +++ /dev/null @@ -1,126 +0,0 @@ -# frozen_string_literal: true - -require "yaml" -require "active_support/encrypted_file" -require "active_support/ordered_options" -require "active_support/core_ext/object/inclusion" -require "active_support/core_ext/hash/keys" -require "active_support/core_ext/module/delegation" - -module ActiveSupport - # = Encrypted Configuration - # - # Provides convenience methods on top of EncryptedFile to access values stored - # as encrypted YAML. - # - # Values can be accessed via +Hash+ methods, such as +fetch+ and +dig+, or via - # dynamic accessor methods, similar to OrderedOptions. - # - # my_config = ActiveSupport::EncryptedConfiguration.new(...) - # my_config.read # => "some_secret: 123\nsome_namespace:\n another_secret: 456" - # - # my_config[:some_secret] - # # => 123 - # my_config.some_secret - # # => 123 - # my_config.dig(:some_namespace, :another_secret) - # # => 456 - # my_config.some_namespace.another_secret - # # => 456 - # my_config.fetch(:foo) - # # => KeyError - # my_config.foo! - # # => KeyError - # - class EncryptedConfiguration < EncryptedFile - class InvalidContentError < RuntimeError - def initialize(content_path) - super "Invalid YAML in '#{content_path}'." - end - - def message - cause.is_a?(Psych::SyntaxError) ? "#{super}\n\n #{cause.message}" : super - end - end - - class InvalidKeyError < RuntimeError - def initialize(content_path, key) - super "Key '#{key}' is invalid, it must respond to '#to_sym' from configuration in '#{content_path}'." - end - end - - delegate_missing_to :options - - def initialize(config_path:, key_path:, env_key:, raise_if_missing_key:) - super content_path: config_path, key_path: key_path, - env_key: env_key, raise_if_missing_key: raise_if_missing_key - @config = nil - @options = nil - end - - # Reads the file and returns the decrypted content. See EncryptedFile#read. - def read - super - rescue ActiveSupport::EncryptedFile::MissingContentError - # Allow a config to be started without a file present - "" - end - - def validate! # :nodoc: - deserialize(read).each_key do |key| - key.to_sym - rescue NoMethodError - raise InvalidKeyError.new(content_path, key) - end - end - - # Returns the decrypted content as a Hash with symbolized keys. - # - # my_config = ActiveSupport::EncryptedConfiguration.new(...) - # my_config.read # => "some_secret: 123\nsome_namespace:\n another_secret: 456" - # - # my_config.config - # # => { some_secret: 123, some_namespace: { another_secret: 789 } } - # - def config - @config ||= deep_symbolize_keys(deserialize(read)) - end - - def inspect # :nodoc: - "#<#{self.class.name}:#{'%#016x' % (object_id << 1)}>" - end - - private - def deep_symbolize_keys(hash) - hash.deep_transform_keys do |key| - key.to_sym - rescue NoMethodError - raise InvalidKeyError.new(content_path, key) - end - end - - def deep_transform(hash) - return hash unless hash.is_a?(Hash) - - h = ActiveSupport::OrderedOptions.new - hash.each do |k, v| - h[k] = deep_transform(v) - end - h - end - - def options - @options ||= deep_transform(config) - end - - def deserialize(content) - config = YAML.respond_to?(:unsafe_load) ? - YAML.unsafe_load(content, filename: content_path) : - YAML.load(content, filename: content_path) - - config.presence || {} - rescue Psych::SyntaxError - raise InvalidContentError.new(content_path) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/encrypted_file.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/encrypted_file.rb deleted file mode 100644 index 6522e00..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/encrypted_file.rb +++ /dev/null @@ -1,133 +0,0 @@ -# frozen_string_literal: true - -require "pathname" -require "tempfile" -require "active_support/message_encryptor" - -module ActiveSupport - class EncryptedFile - class MissingContentError < RuntimeError - def initialize(content_path) - super "Missing encrypted content file in #{content_path}." - end - end - - class MissingKeyError < RuntimeError - def initialize(key_path:, env_key:) - super \ - "Missing encryption key to decrypt file with. " + - "Ask your team for your master key and write it to #{key_path} or put it in the ENV['#{env_key}']." - end - end - - class InvalidKeyLengthError < RuntimeError - def initialize - super "Encryption key must be exactly #{EncryptedFile.expected_key_length} characters." - end - end - - CIPHER = "aes-128-gcm" - - def self.generate_key - SecureRandom.hex(ActiveSupport::MessageEncryptor.key_len(CIPHER)) - end - - def self.expected_key_length # :nodoc: - @expected_key_length ||= generate_key.length - end - - - attr_reader :content_path, :key_path, :env_key, :raise_if_missing_key - - def initialize(content_path:, key_path:, env_key:, raise_if_missing_key:) - @content_path = Pathname.new(content_path).yield_self { |path| path.symlink? ? path.realpath : path } - @key_path = Pathname.new(key_path) - @env_key, @raise_if_missing_key = env_key, raise_if_missing_key - end - - # Returns the encryption key, first trying the environment variable - # specified by +env_key+, then trying the key file specified by +key_path+. - # If +raise_if_missing_key+ is true, raises MissingKeyError if the - # environment variable is not set and the key file does not exist. - def key - read_env_key || read_key_file || handle_missing_key - end - - # Returns truthy if #key is truthy. Returns falsy otherwise. Unlike #key, - # does not raise MissingKeyError when +raise_if_missing_key+ is true. - def key? - read_env_key || read_key_file - end - - # Reads the file and returns the decrypted content. - # - # Raises: - # - MissingKeyError if the key is missing and +raise_if_missing_key+ is true. - # - MissingContentError if the encrypted file does not exist or otherwise - # if the key is missing. - # - ActiveSupport::MessageEncryptor::InvalidMessage if the content cannot be - # decrypted or verified. - def read - if !key.nil? && content_path.exist? - decrypt content_path.binread.strip - else - raise MissingContentError, content_path - end - end - - def write(contents) - IO.binwrite "#{content_path}.tmp", encrypt(contents) - FileUtils.mv "#{content_path}.tmp", content_path - end - - def change(&block) - writing read, &block - end - - - private - def writing(contents) - Tempfile.create(["", "-" + content_path.basename.to_s.chomp(".enc")]) do |tmp_file| - tmp_path = Pathname.new(tmp_file) - tmp_path.binwrite contents - - yield tmp_path - - updated_contents = tmp_path.binread - - write(updated_contents) if updated_contents != contents - end - end - - - def encrypt(contents) - check_key_length - encryptor.encrypt_and_sign contents - end - - def decrypt(contents) - encryptor.decrypt_and_verify contents - end - - def encryptor - @encryptor ||= ActiveSupport::MessageEncryptor.new([ key ].pack("H*"), cipher: CIPHER, serializer: Marshal) - end - - - def read_env_key - ENV[env_key].presence - end - - def read_key_file - @key_file_contents ||= (key_path.binread.strip if key_path.exist?) - end - - def handle_missing_key - raise MissingKeyError.new(key_path: key_path, env_key: env_key) if raise_if_missing_key - end - - def check_key_length - raise InvalidKeyLengthError if key&.length != self.class.expected_key_length - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/environment_inquirer.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/environment_inquirer.rb deleted file mode 100644 index 6fa4fa1..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/environment_inquirer.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -require "active_support/string_inquirer" -require "active_support/core_ext/object/inclusion" - -module ActiveSupport - class EnvironmentInquirer < StringInquirer # :nodoc: - # Optimization for the three default environments, so this inquirer doesn't need to rely on - # the slower delegation through method_missing that StringInquirer would normally entail. - DEFAULT_ENVIRONMENTS = %w[ development test production ] - - # Environments that'll respond true for #local? - LOCAL_ENVIRONMENTS = %w[ development test ] - - def initialize(env) - raise(ArgumentError, "'local' is a reserved environment name") if env == "local" - - super(env) - - DEFAULT_ENVIRONMENTS.each do |default| - instance_variable_set :"@#{default}", env == default - end - - @local = in? LOCAL_ENVIRONMENTS - end - - DEFAULT_ENVIRONMENTS.each do |env| - class_eval <<~RUBY, __FILE__, __LINE__ + 1 - def #{env}? - @#{env} - end - RUBY - end - - # Returns true if we're in the development or test environment. - def local? - @local - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/error_reporter.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/error_reporter.rb deleted file mode 100644 index 68559f0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/error_reporter.rb +++ /dev/null @@ -1,318 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # = Active Support \Error Reporter - # - # +ActiveSupport::ErrorReporter+ is a common interface for error reporting services. - # - # To rescue and report any unhandled error, you can use the #handle method: - # - # Rails.error.handle do - # do_something! - # end - # - # If an error is raised, it will be reported and swallowed. - # - # Alternatively, if you want to report the error but not swallow it, you can use #record: - # - # Rails.error.record do - # do_something! - # end - # - # Both methods can be restricted to handle only a specific error class: - # - # maybe_tags = Rails.error.handle(Redis::BaseError) { redis.get("tags") } - # - class ErrorReporter - SEVERITIES = %i(error warning info) - DEFAULT_SOURCE = "application" - DEFAULT_RESCUE = [StandardError].freeze - - attr_accessor :logger, :debug_mode - - UnexpectedError = Class.new(Exception) - - def initialize(*subscribers, logger: nil) - @subscribers = subscribers.flatten - @logger = logger - @debug_mode = false - @context_middlewares = ErrorContextMiddlewareStack.new - end - - # Evaluates the given block, reporting and swallowing any unhandled error. - # If no error is raised, returns the return value of the block. Otherwise, - # returns the result of +fallback.call+, or +nil+ if +fallback+ is not - # specified. - # - # # Will report a TypeError to all subscribers and return nil. - # Rails.error.handle do - # 1 + '1' - # end - # - # Can be restricted to handle only specific error classes: - # - # maybe_tags = Rails.error.handle(Redis::BaseError) { redis.get("tags") } - # - # ==== Options - # - # * +:severity+ - This value is passed along to subscribers to indicate how - # important the error report is. Can be +:error+, +:warning+, or +:info+. - # Defaults to +:warning+. - # - # * +:context+ - Extra information that is passed along to subscribers. For - # example: - # - # Rails.error.handle(context: { section: "admin" }) do - # # ... - # end - # - # * +:fallback+ - A callable that provides +handle+'s return value when an - # unhandled error is raised. For example: - # - # user = Rails.error.handle(fallback: -> { User.anonymous }) do - # User.find_by(params) - # end - # - # * +:source+ - This value is passed along to subscribers to indicate the - # source of the error. Subscribers can use this value to ignore certain - # errors. Defaults to "application". - def handle(*error_classes, severity: :warning, context: {}, fallback: nil, source: DEFAULT_SOURCE) - error_classes = DEFAULT_RESCUE if error_classes.empty? - yield - rescue *error_classes => error - report(error, handled: true, severity: severity, context: context, source: source) - fallback.call if fallback - end - - # Evaluates the given block, reporting and re-raising any unhandled error. - # If no error is raised, returns the return value of the block. - # - # # Will report a TypeError to all subscribers and re-raise it. - # Rails.error.record do - # 1 + '1' - # end - # - # Can be restricted to handle only specific error classes: - # - # tags = Rails.error.record(Redis::BaseError) { redis.get("tags") } - # - # ==== Options - # - # * +:severity+ - This value is passed along to subscribers to indicate how - # important the error report is. Can be +:error+, +:warning+, or +:info+. - # Defaults to +:error+. - # - # * +:context+ - Extra information that is passed along to subscribers. For - # example: - # - # Rails.error.record(context: { section: "admin" }) do - # # ... - # end - # - # * +:source+ - This value is passed along to subscribers to indicate the - # source of the error. Subscribers can use this value to ignore certain - # errors. Defaults to "application". - def record(*error_classes, severity: :error, context: {}, source: DEFAULT_SOURCE) - error_classes = DEFAULT_RESCUE if error_classes.empty? - yield - rescue *error_classes => error - report(error, handled: false, severity: severity, context: context, source: source) - raise - end - - # Either report the given error when in production, or raise it when in development or test. - # - # When called in production, after the error is reported, this method will return - # nil and execution will continue. - # - # When called in development, the original error is wrapped in a different error class to ensure - # it's not being rescued higher in the stack and will be surfaced to the developer. - # - # This method is intended for reporting violated assertions about preconditions, or similar - # cases that can and should be gracefully handled in production, but that aren't supposed to happen. - # - # The error can be either an exception instance or a String. - # - # example: - # - # def edit - # if published? - # Rails.error.unexpected("[BUG] Attempting to edit a published article, that shouldn't be possible") - # return false - # end - # # ... - # end - # - def unexpected(error, severity: :warning, context: {}, source: DEFAULT_SOURCE) - error = RuntimeError.new(error) if error.is_a?(String) - - if @debug_mode - ensure_backtrace(error) - raise UnexpectedError, "#{error.class.name}: #{error.message}", error.backtrace, cause: error - else - report(error, handled: true, severity: severity, context: context, source: source) - end - end - - # Register a new error subscriber. The subscriber must respond to - # - # report(Exception, handled: Boolean, severity: (:error OR :warning OR :info), context: Hash, source: String) - # - # The +report+ method should never raise an error. - def subscribe(subscriber) - unless subscriber.respond_to?(:report) - raise ArgumentError, "Error subscribers must respond to #report" - end - @subscribers << subscriber - end - - # Unregister an error subscriber. Accepts either a subscriber or a class. - # - # subscriber = MyErrorSubscriber.new - # Rails.error.subscribe(subscriber) - # - # Rails.error.unsubscribe(subscriber) - # # or - # Rails.error.unsubscribe(MyErrorSubscriber) - def unsubscribe(subscriber) - @subscribers.delete_if { |s| subscriber === s } - end - - # Prevent a subscriber from being notified of errors for the - # duration of the block. You may pass in the subscriber itself, or its class. - # - # This can be helpful for error reporting service integrations, when they wish - # to handle any errors higher in the stack. - def disable(subscriber) - disabled_subscribers = (ActiveSupport::IsolatedExecutionState[self] ||= []) - disabled_subscribers << subscriber - begin - yield - ensure - disabled_subscribers.delete(subscriber) - end - end - - # Update the execution context that is accessible to error subscribers. Any - # context passed to #handle, #record, or #report will be merged with the - # context set here. - # - # Rails.error.set_context(section: "checkout", user_id: @user.id) - # - def set_context(...) - ActiveSupport::ExecutionContext.set(...) - end - - # Add a middleware to modify the error context before it is sent to subscribers. - # - # Middleware is added to a stack of callables run on an error's execution context - # before passing to subscribers. Allows creation of entries in error context that - # are shared by all subscribers. - # - # A context middleware receives the same parameters as #report. - # It must return a hash - the middleware stack returns the hash after it has - # run through all middlewares. A middleware can mutate or replace the hash. - # - # Rails.error.add_middleware(-> (error, context) { context.merge({ foo: :bar }) }) - # - def add_middleware(middleware) - @context_middlewares.use(middleware) - end - - # Report an error directly to subscribers. You can use this method when the - # block-based #handle and #record methods are not suitable. - # - # Rails.error.report(error) - # - # The +error+ argument must be an instance of Exception. - # - # Rails.error.report(Exception.new("Something went wrong")) - # - # Otherwise you can use #unexpected to report an error which does accept a - # string argument. - def report(error, handled: true, severity: handled ? :warning : :error, context: {}, source: DEFAULT_SOURCE) - return if error.instance_variable_defined?(:@__rails_error_reported) - raise ArgumentError, "Reported error must be an Exception, got: #{error.inspect}" unless error.is_a?(Exception) - - ensure_backtrace(error) - - unless SEVERITIES.include?(severity) - raise ArgumentError, "severity must be one of #{SEVERITIES.map(&:inspect).join(", ")}, got: #{severity.inspect}" - end - - full_context = @context_middlewares.execute( - error, - context: ActiveSupport::ExecutionContext.to_h.merge(context || {}), - handled:, - severity:, - source: - ) - - disabled_subscribers = ActiveSupport::IsolatedExecutionState[self] - @subscribers.each do |subscriber| - unless disabled_subscribers&.any? { |s| s === subscriber } - subscriber.report(error, handled: handled, severity: severity, context: full_context, source: source) - end - rescue => subscriber_error - if logger - logger.fatal( - "Error subscriber raised an error: #{subscriber_error.message} (#{subscriber_error.class})\n" + - subscriber_error.backtrace.join("\n") - ) - else - raise - end - end - - while error - unless error.frozen? - error.instance_variable_set(:@__rails_error_reported, true) - end - error = error.cause - end - - nil - end - - private - def ensure_backtrace(error) - return if error.frozen? # re-raising won't add a backtrace or set the cause - return unless error.backtrace.nil? - - begin - # As of Ruby 3.4, we could use Exception#set_backtrace to set the backtrace, - # but there's nothing like Exception#set_cause. Raising+rescuing is the only way to set the cause. - raise error - rescue error.class => error - end - - count = 0 - while error.backtrace_locations.first&.path == __FILE__ - count += 1 - error.backtrace_locations.shift - end - - error.backtrace.shift(count) - end - - class ErrorContextMiddlewareStack # :nodoc: - def initialize - @stack = [] - end - - # Add a middleware to the error context stack. - def use(middleware) - unless middleware.respond_to?(:call) - raise ArgumentError, "Error context middleware must respond to #call" - end - - @stack << middleware - end - - # Run all middlewares in the stack - def execute(error, handled:, severity:, context:, source:) - @stack.inject(context) { |c, middleware| middleware.call(error, context: c, handled:, severity:, source:) } - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/error_reporter/test_helper.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/error_reporter/test_helper.rb deleted file mode 100644 index bc67efa..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/error_reporter/test_helper.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport::ErrorReporter::TestHelper # :nodoc: - class ErrorSubscriber - attr_reader :events - - def initialize - @events = [] - end - - def report(error, handled:, severity:, source:, context:) - @events << [error, handled, severity, source, context] - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/event_reporter.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/event_reporter.rb deleted file mode 100644 index 6ed26ef..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/event_reporter.rb +++ /dev/null @@ -1,592 +0,0 @@ -# frozen_string_literal: true - -require "active_support/parameter_filter" - -module ActiveSupport - class TagStack # :nodoc: - EMPTY_TAGS = {}.freeze - FIBER_KEY = :event_reporter_tags - - class << self - def tags - Fiber[FIBER_KEY] || EMPTY_TAGS - end - - def with_tags(*args, **kwargs) - existing_tags = tags - tags = existing_tags.dup - tags.merge!(resolve_tags(args, kwargs)) - new_tags = tags.freeze - - begin - Fiber[FIBER_KEY] = new_tags - yield - ensure - Fiber[FIBER_KEY] = existing_tags - end - end - - private - def resolve_tags(args, kwargs) - tags = args.each_with_object({}) do |arg, tags| - case arg - when String - tags[arg.to_sym] = true - when Symbol - tags[arg] = true - when Hash - arg.each { |key, value| tags[key.to_sym] = value } - else - tags[arg.class.name.to_sym] = arg - end - end - kwargs.each { |key, value| tags[key.to_sym] = value } - tags - end - end - end - - class EventContext # :nodoc: - EMPTY_CONTEXT = {}.freeze - FIBER_KEY = :event_reporter_context - - class << self - def context - Fiber[FIBER_KEY] || EMPTY_CONTEXT - end - - def set_context(context_hash) - new_context = self.context.dup - context_hash.each { |key, value| new_context[key.to_sym] = value } - - Fiber[FIBER_KEY] = new_context.freeze - end - - def clear - Fiber[FIBER_KEY] = EMPTY_CONTEXT - end - end - end - - # = Active Support \Event Reporter - # - # +ActiveSupport::EventReporter+ provides an interface for reporting structured events to subscribers. - # - # To report an event, you can use the +notify+ method: - # - # Rails.event.notify("user_created", { id: 123 }) - # # Emits event: - # # { - # # name: "user_created", - # # payload: { id: 123 }, - # # timestamp: 1738964843208679035, - # # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } - # # } - # - # The +notify+ API can receive either an event name and a payload hash, or an event object. Names are coerced to strings. - # - # === Event Objects - # - # If an event object is passed to the +notify+ API, it will be passed through to subscribers as-is, and the name of the - # object's class will be used as the event name. - # - # class UserCreatedEvent - # def initialize(id:, name:) - # @id = id - # @name = name - # end - # - # def serialize - # { - # id: @id, - # name: @name - # } - # end - # end - # - # Rails.event.notify(UserCreatedEvent.new(id: 123, name: "John Doe")) - # # Emits event: - # # { - # # name: "UserCreatedEvent", - # # payload: #, - # # timestamp: 1738964843208679035, - # # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } - # # } - # - # An event is any Ruby object representing a schematized event. While payload hashes allow arbitrary, - # implicitly-structured data, event objects are intended to enforce a particular schema. - # - # Subscribers are responsible for serializing event objects. - # - # === Subscribers - # - # Subscribers must implement the +emit+ method, which will be called with the event hash. - # - # The event hash has the following keys: - # - # name: String (The name of the event) - # payload: Hash, Object (The payload of the event, or the event object itself) - # tags: Hash (The tags of the event) - # context: Hash (The context of the event) - # timestamp: Integer (The timestamp of the event, in nanoseconds) - # source_location: Hash (The source location of the event, containing the filepath, lineno, and label) - # - # Subscribers are responsible for encoding events to their desired format before emitting them to their - # target destination, such as a streaming platform, a log device, or an alerting service. - # - # class JSONEventSubscriber - # def emit(event) - # json_data = JSON.generate(event) - # LogExporter.export(json_data) - # end - # end - # - # class LogSubscriber - # def emit(event) - # payload = event[:payload].map { |key, value| "#{key}=#{value}" }.join(" ") - # source_location = event[:source_location] - # log = "[#{event[:name]}] #{payload} at #{source_location[:filepath]}:#{source_location[:lineno]}" - # Rails.logger.info(log) - # end - # end - # - # Note that event objects are passed through to subscribers as-is, and may need to be serialized before being encoded: - # - # class UserCreatedEvent - # def initialize(id:, name:) - # @id = id - # @name = name - # end - # - # def serialize - # { - # id: @id, - # name: @name - # } - # end - # end - # - # class LogSubscriber - # def emit(event) - # payload = event[:payload] - # json_data = JSON.generate(payload.serialize) - # LogExporter.export(json_data) - # end - # end - # - # ==== Filtered Subscriptions - # - # Subscribers can be configured with an optional filter proc to only receive a subset of events: - # - # # Only receive events with names starting with "user." - # Rails.event.subscribe(user_subscriber) { |event| event[:name].start_with?("user.") } - # - # # Only receive events with specific payload types - # Rails.event.subscribe(audit_subscriber) { |event| event[:payload].is_a?(AuditEvent) } - # - # === Debug Events - # - # You can use the +debug+ method to report an event that will only be reported if the - # event reporter is in debug mode: - # - # Rails.event.debug("my_debug_event", { foo: "bar" }) - # - # === Tags - # - # To add additional context to an event, separate from the event payload, you can add - # tags via the +tagged+ method: - # - # Rails.event.tagged("graphql") do - # Rails.event.notify("user_created", { id: 123 }) - # end - # - # # Emits event: - # # { - # # name: "user_created", - # # payload: { id: 123 }, - # # tags: { graphql: true }, - # # context: {}, - # # timestamp: 1738964843208679035, - # # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } - # # } - # - # === Context Store - # - # You may want to attach metadata to every event emitted by the reporter. While tags - # provide domain-specific context for a series of events, context is scoped to the job / request - # and should be used for metadata associated with the execution context. - # Context can be set via the +set_context+ method: - # - # Rails.event.set_context(request_id: "abcd123", user_agent: "TestAgent") - # Rails.event.notify("user_created", { id: 123 }) - # - # # Emits event: - # # { - # # name: "user_created", - # # payload: { id: 123 }, - # # tags: {}, - # # context: { request_id: "abcd123", user_agent: "TestAgent" }, - # # timestamp: 1738964843208679035, - # # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } - # # } - # - # Context is reset automatically before and after each request. - # - # A custom context store can be configured via +config.active_support.event_reporter_context_store+. - # - # # config/application.rb - # config.active_support.event_reporter_context_store = CustomContextStore - # - # class CustomContextStore - # class << self - # def context - # # Return the context. - # end - # - # def set_context(context_hash) - # # Append context_hash to the existing context store. - # end - # - # def clear - # # Delete the stored context. - # end - # end - # end - # - # The Event Reporter standardizes on symbol keys for all payload data, tags, and context store entries. - # String keys are automatically converted to symbols for consistency. - # - # Rails.event.notify("user.created", { "id" => 123 }) - # # Emits event: - # # { - # # name: "user.created", - # # payload: { id: 123 }, - # # } - # - # === Security - # - # When reporting events, Hash-based payloads are automatically filtered to remove sensitive data based on {Rails.application.filter_parameters}[https://guides.rubyonrails.org/configuring.html#config-filter-parameters]. - # - # If an {event object}[rdoc-ref:EventReporter@Event+Objects] is given instead, subscribers will need to filter sensitive data themselves, e.g. with ActiveSupport::ParameterFilter. - class EventReporter - # Sets whether to raise an error if a subscriber raises an error during - # event emission, or when unexpected arguments are passed to +notify+. - attr_writer :raise_on_error - - attr_writer :debug_mode # :nodoc: - - attr_reader :subscribers # :nodoc - - class << self - attr_accessor :context_store # :nodoc: - end - - self.context_store = EventContext - - def initialize(*subscribers, raise_on_error: false) - @subscribers = [] - subscribers.each { |subscriber| subscribe(subscriber) } - @debug_mode = false - @raise_on_error = raise_on_error - end - - # Registers a new event subscriber. The subscriber must respond to - # - # emit(event: Hash) - # - # The event hash will have the following keys: - # - # name: String (The name of the event) - # payload: Hash, Object (The payload of the event, or the event object itself) - # tags: Hash (The tags of the event) - # context: Hash (The context of the event) - # timestamp: Integer (The timestamp of the event, in nanoseconds) - # source_location: Hash (The source location of the event, containing the filepath, lineno, and label) - # - # An optional filter proc can be provided to only receive a subset of events: - # - # Rails.event.subscribe(subscriber) { |event| event[:name].start_with?("user.") } - # Rails.event.subscribe(subscriber) { |event| event[:payload].is_a?(UserEvent) } - # - def subscribe(subscriber, &filter) - unless subscriber.respond_to?(:emit) - raise ArgumentError, "Event subscriber #{subscriber.class.name} must respond to #emit" - end - @subscribers << { subscriber: subscriber, filter: filter } - end - - # Unregister an event subscriber. Accepts either a subscriber or a class. - # - # subscriber = MyEventSubscriber.new - # Rails.event.subscribe(subscriber) - # - # Rails.event.unsubscribe(subscriber) - # # or - # Rails.event.unsubscribe(MyEventSubscriber) - def unsubscribe(subscriber) - @subscribers.delete_if { |s| subscriber === s[:subscriber] } - end - - # Reports an event to all registered subscribers. An event name and payload can be provided: - # - # Rails.event.notify("user.created", { id: 123 }) - # # Emits event: - # # { - # # name: "user.created", - # # payload: { id: 123 }, - # # tags: {}, - # # context: {}, - # # timestamp: 1738964843208679035, - # # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } - # # } - # - # Alternatively, an event object can be provided: - # - # Rails.event.notify(UserCreatedEvent.new(id: 123)) - # # Emits event: - # # { - # # name: "UserCreatedEvent", - # # payload: #, - # # tags: {}, - # # context: {}, - # # timestamp: 1738964843208679035, - # # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } - # # } - # - # ==== Arguments - # - # * +:payload+ - The event payload when using string/symbol event names. - # - # * +:caller_depth+ - The stack depth to use for source location (default: 1). - # - # * +:kwargs+ - Additional payload data when using string/symbol event names. - def notify(name_or_object, payload = nil, caller_depth: 1, **kwargs) - name = resolve_name(name_or_object) - payload = resolve_payload(name_or_object, payload, **kwargs) - - event = { - name: name, - payload: payload, - tags: TagStack.tags, - context: context_store.context, - timestamp: Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond), - } - - caller_location = caller_locations(caller_depth, 1)&.first - - if caller_location - source_location = { - filepath: caller_location.path, - lineno: caller_location.lineno, - label: caller_location.label, - } - event[:source_location] = source_location - end - - @subscribers.each do |subscriber_entry| - subscriber = subscriber_entry[:subscriber] - filter = subscriber_entry[:filter] - - next if filter && !filter.call(event) - - subscriber.emit(event) - rescue => subscriber_error - if raise_on_error? - raise - else - ActiveSupport.error_reporter.report(subscriber_error, handled: true) - end - end - - nil - end - - # Temporarily enables debug mode for the duration of the block. - # Calls to +debug+ will only be reported if debug mode is enabled. - # - # Rails.event.with_debug do - # Rails.event.debug("sql.query", { sql: "SELECT * FROM users" }) - # end - def with_debug - prior = Fiber[:event_reporter_debug_mode] - Fiber[:event_reporter_debug_mode] = true - yield - ensure - Fiber[:event_reporter_debug_mode] = prior - end - - # Check if debug mode is currently enabled. Debug mode is enabled on the reporter - # via +with_debug+, and in local environments. - def debug_mode? - @debug_mode || Fiber[:event_reporter_debug_mode] - end - - # Report an event only when in debug mode. For example: - # - # Rails.event.debug("sql.query", { sql: "SELECT * FROM users" }) - # - # ==== Arguments - # - # * +:payload+ - The event payload when using string/symbol event names. - # - # * +:caller_depth+ - The stack depth to use for source location (default: 1). - # - # * +:kwargs+ - Additional payload data when using string/symbol event names. - def debug(name_or_object, payload = nil, caller_depth: 1, **kwargs) - if debug_mode? - if block_given? - notify(name_or_object, payload, caller_depth: caller_depth + 1, **kwargs.merge(yield)) - else - notify(name_or_object, payload, caller_depth: caller_depth + 1, **kwargs) - end - end - end - - # Add tags to events to supply additional context. Tags operate in a stack-oriented manner, - # so all events emitted within the block inherit the same set of tags. For example: - # - # Rails.event.tagged("graphql") do - # Rails.event.notify("user.created", { id: 123 }) - # end - # - # # Emits event: - # # { - # # name: "user.created", - # # payload: { id: 123 }, - # # tags: { graphql: true }, - # # context: {}, - # # timestamp: 1738964843208679035, - # # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } - # # } - # - # Tags can be provided as arguments or as keyword arguments, and can be nested: - # - # Rails.event.tagged("graphql") do - # # Other code here... - # Rails.event.tagged(section: "admin") do - # Rails.event.notify("user.created", { id: 123 }) - # end - # end - # - # # Emits event: - # # { - # # name: "user.created", - # # payload: { id: 123 }, - # # tags: { section: "admin", graphql: true }, - # # context: {}, - # # timestamp: 1738964843208679035, - # # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } - # # } - # - # The +tagged+ API can also receive a tag object: - # - # graphql_tag = GraphqlTag.new(operation_name: "user_created", operation_type: "mutation") - # Rails.event.tagged(graphql_tag) do - # Rails.event.notify("user.created", { id: 123 }) - # end - # - # # Emits event: - # # { - # # name: "user.created", - # # payload: { id: 123 }, - # # tags: { "GraphqlTag": # }, - # # context: {}, - # # timestamp: 1738964843208679035, - # # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } - # # } - def tagged(*args, **kwargs, &block) - TagStack.with_tags(*args, **kwargs, &block) - end - - # Sets context data that will be included with all events emitted by the reporter. - # Context data should be scoped to the job or request, and is reset automatically - # before and after each request and job. - # - # Rails.event.set_context(user_agent: "TestAgent") - # Rails.event.set_context(job_id: "abc123") - # Rails.event.tagged("graphql") do - # Rails.event.notify("user_created", { id: 123 }) - # end - # - # # Emits event: - # # { - # # name: "user_created", - # # payload: { id: 123 }, - # # tags: { graphql: true }, - # # context: { user_agent: "TestAgent", job_id: "abc123" }, - # # timestamp: 1738964843208679035 - # # source_location: { filepath: "path/to/file.rb", lineno: 123, label: "UserService#create" } - # # } - def set_context(context) - context_store.set_context(context) - end - - # Clears all context data. - def clear_context - context_store.clear - end - - # Returns the current context data. - def context - context_store.context - end - - def reload_payload_filter # :nodoc: - @payload_filter = nil - payload_filter - end - - private - def raise_on_error? - @raise_on_error - end - - def context_store - self.class.context_store - end - - def payload_filter - @payload_filter ||= begin - mask = ActiveSupport::ParameterFilter::FILTERED - ActiveSupport::ParameterFilter.new(ActiveSupport.filter_parameters, mask: mask) - end - end - - def resolve_name(name_or_object) - case name_or_object - when String, Symbol - name_or_object.to_s - else - name_or_object.class.name - end - end - - def resolve_payload(name_or_object, payload, **kwargs) - case name_or_object - when String, Symbol - handle_unexpected_args(name_or_object, payload, kwargs) if payload && kwargs.any? - if kwargs.any? - payload_filter.filter(kwargs.transform_keys(&:to_sym)) - elsif payload - payload_filter.filter(payload.transform_keys(&:to_sym)) - end - else - handle_unexpected_args(name_or_object, payload, kwargs) if payload || kwargs.any? - name_or_object - end - end - - def handle_unexpected_args(name_or_object, payload, kwargs) - message = <<~MESSAGE - Rails.event.notify accepts either an event object, a payload hash, or keyword arguments. - Received: #{name_or_object.inspect}, #{payload.inspect}, #{kwargs.inspect} - MESSAGE - - if raise_on_error? - raise ArgumentError, message - else - ActiveSupport.error_reporter.report(ArgumentError.new(message), handled: true) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/event_reporter/test_helper.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/event_reporter/test_helper.rb deleted file mode 100644 index 8d317f2..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/event_reporter/test_helper.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport::EventReporter::TestHelper # :nodoc: - class EventSubscriber # :nodoc: - attr_reader :events - - def initialize - @events = [] - end - - def emit(event) - @events << event - end - end - - def event_matcher(name:, payload: nil, tags: {}, context: {}, source_location: nil) - ->(event) { - return false unless event[:name] == name - return false unless event[:payload] == payload - return false unless event[:tags] == tags - return false unless event[:context] == context - - [:filepath, :lineno, :label].each do |key| - if source_location && source_location[key] - return false unless event[:source_location][key] == source_location[key] - end - end - - true - } - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/evented_file_update_checker.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/evented_file_update_checker.rb deleted file mode 100644 index f1aa1f4..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/evented_file_update_checker.rb +++ /dev/null @@ -1,185 +0,0 @@ -# frozen_string_literal: true - -gem "listen", "~> 3.5" -require "listen" - -require "pathname" -require "concurrent/atomic/atomic_boolean" - -module ActiveSupport - # Allows you to "listen" to changes in a file system. - # The evented file updater does not hit disk when checking for updates. - # Instead, it uses platform-specific file system events to trigger a change - # in state. - # - # The file checker takes an array of files to watch or a hash specifying directories - # and file extensions to watch. It also takes a block that is called when - # EventedFileUpdateChecker#execute is run or when EventedFileUpdateChecker#execute_if_updated - # is run and there have been changes to the file system. - # - # Example: - # - # checker = ActiveSupport::EventedFileUpdateChecker.new(["/tmp/foo"]) { puts "changed" } - # checker.updated? - # # => false - # checker.execute_if_updated - # # => nil - # - # FileUtils.touch("/tmp/foo") - # - # checker.updated? - # # => true - # checker.execute_if_updated - # # => "changed" - # - class EventedFileUpdateChecker # :nodoc: all - def initialize(files, dirs = {}, &block) - unless block - raise ArgumentError, "A block is required to initialize an EventedFileUpdateChecker" - end - - @block = block - @core = Core.new(files, dirs) - ObjectSpace.define_finalizer(self, @core.finalizer) - end - - def inspect - "# error - error_reporter&.report(error, handled: false, source: source) - raise - ensure - instance.complete! - end - end - - def self.perform # :nodoc: - instance = new - instance.run - begin - yield - ensure - instance.complete - end - end - - def self.error_reporter # :nodoc: - ActiveSupport.error_reporter - end - - def self.active_key # :nodoc: - @active_key ||= :"active_execution_wrapper_#{object_id}" - end - - def self.active? # :nodoc: - IsolatedExecutionState.key?(active_key) - end - - def run! # :nodoc: - IsolatedExecutionState[self.class.active_key] = self - run - end - - def run # :nodoc: - run_callbacks(:run) - end - - # Complete this in-flight execution. This method *must* be called - # exactly once on the result of any call to +run!+. - # - # Where possible, prefer +wrap+. - def complete! - complete - ensure - IsolatedExecutionState.delete(self.class.active_key) - end - - def complete # :nodoc: - run_callbacks(:complete) - end - - private - def hook_state - @_hook_state ||= {} - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/executor.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/executor.rb deleted file mode 100644 index ce391b0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/executor.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -require "active_support/execution_wrapper" - -module ActiveSupport - class Executor < ExecutionWrapper - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/executor/test_helper.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/executor/test_helper.rb deleted file mode 100644 index 97f489d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/executor/test_helper.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport::Executor::TestHelper # :nodoc: - def run(...) - Rails.application.executor.perform { super } - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/file_update_checker.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/file_update_checker.rb deleted file mode 100644 index 93acc09..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/file_update_checker.rb +++ /dev/null @@ -1,166 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/time/calculations" - -module ActiveSupport - # = \File Update Checker - # - # FileUpdateChecker specifies the API used by \Rails to watch files - # and control reloading. The API depends on four methods: - # - # * +initialize+ which expects two parameters and one block as - # described below. - # - # * +updated?+ which returns a boolean if there were updates in - # the filesystem or not. - # - # * +execute+ which executes the given block on initialization - # and updates the latest watched files and timestamp. - # - # * +execute_if_updated+ which just executes the block if it was updated. - # - # After initialization, a call to +execute_if_updated+ must execute - # the block only if there was really a change in the filesystem. - # - # This class is used by \Rails to reload the I18n framework whenever - # they are changed upon a new request. - # - # i18n_reloader = ActiveSupport::FileUpdateChecker.new(paths) do - # I18n.reload! - # end - # - # ActiveSupport::Reloader.to_prepare do - # i18n_reloader.execute_if_updated - # end - class FileUpdateChecker - # It accepts two parameters on initialization. The first is an array - # of files and the second is an optional hash of directories. The hash must - # have directories as keys and the value is an array of extensions to be - # watched under that directory. - # - # This method must also receive a block that will be called once a path - # changes. The array of files and list of directories cannot be changed - # after FileUpdateChecker has been initialized. - def initialize(files, dirs = {}, &block) - unless block - raise ArgumentError, "A block is required to initialize a FileUpdateChecker" - end - - gem_paths = Gem.path - @files = files.reject { |file| File.expand_path(file).start_with?(*gem_paths) }.freeze - - @globs = compile_glob(dirs)&.reject { |dir| dir.start_with?(*gem_paths) } - - @block = block - - @watched = nil - @updated_at = nil - - @last_watched = watched - @last_update_at = updated_at(@last_watched) - end - - # Check if any of the entries were updated. If so, the watched and/or - # updated_at values are cached until the block is executed via +execute+ - # or +execute_if_updated+. - def updated? - current_watched = watched - if @last_watched.size != current_watched.size - @watched = current_watched - true - else - current_updated_at = updated_at(current_watched) - if @last_update_at < current_updated_at - @watched = current_watched - @updated_at = current_updated_at - true - else - false - end - end - end - - # Executes the given block and updates the latest watched files and - # timestamp. - def execute - @last_watched = watched - @last_update_at = updated_at(@last_watched) - @block.call - ensure - @watched = nil - @updated_at = nil - end - - # Execute the block given if updated. - def execute_if_updated - if updated? - yield if block_given? - execute - true - else - false - end - end - - private - def watched - @watched || begin - all = @files.select { |f| File.exist?(f) } - all.concat(Dir[*@globs]) if @globs - all.tap(&:uniq!) - end - end - - def updated_at(paths) - @updated_at || max_mtime(paths) || Time.at(0) - end - - # This method returns the maximum mtime of the files in +paths+, or +nil+ - # if the array is empty. - # - # Files with a mtime in the future are ignored. Such abnormal situation - # can happen for example if the user changes the clock by hand. It is - # healthy to consider this edge case because with mtimes in the future - # reloading is not triggered. - def max_mtime(paths) - time_now = Time.at(0, Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond), :nanosecond) - max_mtime = nil - - # Time comparisons are performed with #compare_without_coercion because - # AS redefines these operators in a way that is much slower and does not - # bring any benefit in this particular code. - # - # Read t1.compare_without_coercion(t2) < 0 as t1 < t2. - paths.each do |path| - mtime = File.mtime(path) - - next if time_now.compare_without_coercion(mtime) < 0 - - if max_mtime.nil? || max_mtime.compare_without_coercion(mtime) < 0 - max_mtime = mtime - end - end - - max_mtime - end - - def compile_glob(hash) - hash.freeze # Freeze so changes aren't accidentally pushed - return if hash.empty? - - hash.map do |key, value| - "#{escape(key)}/**/*#{compile_ext(value)}" - end - end - - def escape(key) - key.gsub(",", '\,') - end - - def compile_ext(array) - array = Array(array) - return if array.empty? - ".{#{array.join(",")}}" - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/fork_tracker.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/fork_tracker.rb deleted file mode 100644 index 2ff8fc5..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/fork_tracker.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module ForkTracker # :nodoc: - module CoreExt - def _fork - pid = super - if pid == 0 - ForkTracker.after_fork_callback - end - pid - end - end - - @pid = Process.pid - @callbacks = [] - - class << self - def after_fork_callback - new_pid = Process.pid - if @pid != new_pid - @callbacks.each(&:call) - @pid = new_pid - end - end - - def hook! - ::Process.singleton_class.prepend(CoreExt) - end - - def after_fork(&block) - @callbacks << block - block - end - - def unregister(callback) - @callbacks.delete(callback) - end - end - end -end - -ActiveSupport::ForkTracker.hook! diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/gem_version.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/gem_version.rb deleted file mode 100644 index 8f30e9c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/gem_version.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # Returns the currently loaded version of Active Support as a +Gem::Version+. - def self.gem_version - Gem::Version.new VERSION::STRING - end - - module VERSION - MAJOR = 8 - MINOR = 1 - TINY = 4 - PRE = "1" - - STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/gzip.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/gzip.rb deleted file mode 100644 index 73e6ef6..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/gzip.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -require "zlib" -require "stringio" - -module ActiveSupport - # = Active Support \Gzip - # - # A convenient wrapper for the zlib standard library that allows - # compression/decompression of strings with gzip. - # - # gzip = ActiveSupport::Gzip.compress('compress me!') - # # => "\x1F\x8B\b\x00o\x8D\xCDO\x00\x03K\xCE\xCF-(J-.V\xC8MU\x04\x00R>n\x83\f\x00\x00\x00" - # - # ActiveSupport::Gzip.decompress(gzip) - # # => "compress me!" - module Gzip - class Stream < StringIO - def initialize(*) - super - set_encoding "BINARY" - end - def close; rewind; end - end - - # Decompresses a gzipped string. - def self.decompress(source) - Zlib::GzipReader.wrap(StringIO.new(source), &:read) - end - - # Compresses a string using gzip. - def self.compress(source, level = Zlib::DEFAULT_COMPRESSION, strategy = Zlib::DEFAULT_STRATEGY) - output = Stream.new - gz = Zlib::GzipWriter.new(output, level, strategy) - gz.mtime = 0 - gz.write(source) - gz.close - output.string - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/hash_with_indifferent_access.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/hash_with_indifferent_access.rb deleted file mode 100644 index 0494e6c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/hash_with_indifferent_access.rb +++ /dev/null @@ -1,465 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/hash/keys" -require "active_support/core_ext/hash/reverse_merge" -require "active_support/core_ext/hash/except" -require "active_support/core_ext/hash/slice" - -module ActiveSupport - # = \Hash With Indifferent Access - # - # Implements a hash where keys :foo and "foo" are considered - # to be the same. - # - # rgb = ActiveSupport::HashWithIndifferentAccess.new - # - # rgb[:black] = '#000000' - # rgb[:black] # => '#000000' - # rgb['black'] # => '#000000' - # - # rgb['white'] = '#FFFFFF' - # rgb[:white] # => '#FFFFFF' - # rgb['white'] # => '#FFFFFF' - # - # Internally symbols are mapped to strings when used as keys in the entire - # writing interface (calling []=, merge, etc). This - # mapping belongs to the public interface. For example, given: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new(a: 1) - # - # You are guaranteed that the key is returned as a string: - # - # hash.keys # => ["a"] - # - # Technically other types of keys are accepted: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new(a: 1) - # hash[0] = 0 - # hash # => {"a"=>1, 0=>0} - # - # but this class is intended for use cases where strings or symbols are the - # expected keys and it is convenient to understand both as the same. For - # example the +params+ hash in Ruby on \Rails. - # - # Note that core extensions define Hash#with_indifferent_access: - # - # rgb = { black: '#000000', white: '#FFFFFF' }.with_indifferent_access - # - # which may be handy. - # - # To access this class outside of \Rails, require the core extension with: - # - # require "active_support/core_ext/hash/indifferent_access" - # - # which will, in turn, require this file. - class HashWithIndifferentAccess < Hash - # Returns +true+ so that Array#extract_options! finds members of - # this class. - def extractable_options? - true - end - - def with_indifferent_access - dup - end - - def nested_under_indifferent_access - self - end - - def initialize(constructor = nil) - if constructor.nil? - super() - elsif constructor.respond_to?(:to_hash) - super() - update(constructor) - - hash = constructor.is_a?(Hash) ? constructor : constructor.to_hash - self.default = hash.default unless hash.default.nil? - self.default_proc = hash.default_proc if hash.default_proc - else - super(constructor) - end - end - - def self.[](*args) - new.merge!(Hash[*args]) - end - - alias_method :regular_writer, :[]= unless method_defined?(:regular_writer) - alias_method :regular_update, :update unless method_defined?(:regular_update) - - # Assigns a new value to the hash: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash[:key] = 'value' - # - # This value can be later fetched using either +:key+ or 'key'. - # - # If the value is a Hash or contains one or multiple Hashes, they will be - # converted to +HashWithIndifferentAccess+. - def []=(key, value) - regular_writer(convert_key(key), convert_value(value, conversion: :assignment)) - end - - # Assigns a new value to the hash: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash[:key] = 'value' - # - # This value can be later fetched using either +:key+ or 'key'. - # - # If the value is a Hash or contains one or multiple Hashes, they will be - # converted to +HashWithIndifferentAccess+. unless `convert_value: false` - # is set. - def store(key, value, convert_value: true) - value = convert_value(value, conversion: :assignment) if convert_value - regular_writer(convert_key(key), value) - end - - # Updates the receiver in-place, merging in the hashes passed as arguments: - # - # hash_1 = ActiveSupport::HashWithIndifferentAccess.new - # hash_1[:key] = 'value' - # - # hash_2 = ActiveSupport::HashWithIndifferentAccess.new - # hash_2[:key] = 'New Value!' - # - # hash_1.update(hash_2) # => {"key"=>"New Value!"} - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash.update({ "a" => 1 }, { "b" => 2 }) # => { "a" => 1, "b" => 2 } - # - # The arguments can be either an - # +ActiveSupport::HashWithIndifferentAccess+ or a regular +Hash+. - # In either case the merge respects the semantics of indifferent access. - # - # If the argument is a regular hash with keys +:key+ and "key" only one - # of the values end up in the receiver, but which one is unspecified. - # - # When given a block, the value for duplicated keys will be determined - # by the result of invoking the block with the duplicated key, the value - # in the receiver, and the value in +other_hash+. The rules for duplicated - # keys follow the semantics of indifferent access: - # - # hash_1[:key] = 10 - # hash_2['key'] = 12 - # hash_1.update(hash_2) { |key, old, new| old + new } # => {"key"=>22} - def update(*other_hashes, &block) - if other_hashes.size == 1 - update_with_single_argument(other_hashes.first, block) - else - other_hashes.each do |other_hash| - update_with_single_argument(other_hash, block) - end - end - self - end - - alias_method :merge!, :update - - # Checks the hash for a key matching the argument passed in: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash['key'] = 'value' - # hash.key?(:key) # => true - # hash.key?('key') # => true - def key?(key) - super(convert_key(key)) - end - - alias_method :include?, :key? - alias_method :has_key?, :key? - alias_method :member?, :key? - - # Same as Hash#[] where the key passed as argument can be - # either a string or a symbol: - # - # counters = ActiveSupport::HashWithIndifferentAccess.new - # counters[:foo] = 1 - # - # counters['foo'] # => 1 - # counters[:foo] # => 1 - # counters[:zoo] # => nil - def [](key) - super(convert_key(key)) - end - - # Same as Hash#assoc where the key passed as argument can be - # either a string or a symbol: - # - # counters = ActiveSupport::HashWithIndifferentAccess.new - # counters[:foo] = 1 - # - # counters.assoc('foo') # => ["foo", 1] - # counters.assoc(:foo) # => ["foo", 1] - # counters.assoc(:zoo) # => nil - def assoc(key) - super(convert_key(key)) - end - - # Same as Hash#fetch where the key passed as argument can be - # either a string or a symbol: - # - # counters = ActiveSupport::HashWithIndifferentAccess.new - # counters[:foo] = 1 - # - # counters.fetch('foo') # => 1 - # counters.fetch(:bar, 0) # => 0 - # counters.fetch(:bar) { |key| 0 } # => 0 - # counters.fetch(:zoo) # => KeyError: key not found: "zoo" - def fetch(key, *extras) - super(convert_key(key), *extras) - end - - # Same as Hash#dig where the key passed as argument can be - # either a string or a symbol: - # - # counters = ActiveSupport::HashWithIndifferentAccess.new - # counters[:foo] = { bar: 1 } - # - # counters.dig('foo', 'bar') # => 1 - # counters.dig(:foo, :bar) # => 1 - # counters.dig(:zoo) # => nil - def dig(*args) - args[0] = convert_key(args[0]) if args.size > 0 - super(*args) - end - - # Same as Hash#default where the key passed as argument can be - # either a string or a symbol: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new(1) - # hash.default # => 1 - # - # hash = ActiveSupport::HashWithIndifferentAccess.new { |hash, key| key } - # hash.default # => nil - # hash.default('foo') # => 'foo' - # hash.default(:foo) # => 'foo' - def default(key = (no_key = true)) - if no_key - super() - else - super(convert_key(key)) - end - end - - # Returns an array of the values at the specified indices: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash[:a] = 'x' - # hash[:b] = 'y' - # hash.values_at('a', 'b') # => ["x", "y"] - def values_at(*keys) - keys.map! { |key| convert_key(key) } - super - end - - # Returns an array of the values at the specified indices, but also - # raises an exception when one of the keys can't be found. - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash[:a] = 'x' - # hash[:b] = 'y' - # hash.fetch_values('a', 'b') # => ["x", "y"] - # hash.fetch_values('a', 'c') { |key| 'z' } # => ["x", "z"] - # hash.fetch_values('a', 'c') # => KeyError: key not found: "c" - def fetch_values(*indices, &block) - indices.map! { |key| convert_key(key) } - super - end - - # Returns a shallow copy of the hash. - # - # hash = ActiveSupport::HashWithIndifferentAccess.new({ a: { b: 'b' } }) - # dup = hash.dup - # dup[:a][:c] = 'c' - # - # hash[:a][:c] # => "c" - # dup[:a][:c] # => "c" - def dup - copy_defaults(self.class.new(self)) - end - - # This method has the same semantics of +update+, except it does not - # modify the receiver but rather returns a new hash with indifferent - # access with the result of the merge. - def merge(*hashes, &block) - dup.update(*hashes, &block) - end - - # Like +merge+ but the other way around: Merges the receiver into the - # argument and returns a new hash with indifferent access as result: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash['a'] = nil - # hash.reverse_merge(a: 0, b: 1) # => {"a"=>nil, "b"=>1} - def reverse_merge(other_hash) - super(cast(other_hash)) - end - alias_method :with_defaults, :reverse_merge - - # Same semantics as +reverse_merge+ but modifies the receiver in-place. - def reverse_merge!(other_hash) - super(cast(other_hash)) - end - alias_method :with_defaults!, :reverse_merge! - - # Replaces the contents of this hash with other_hash. - # - # h = { "a" => 100, "b" => 200 } - # h.replace({ "c" => 300, "d" => 400 }) # => {"c"=>300, "d"=>400} - def replace(other_hash) - super(cast(other_hash)) - end - - # Removes the specified key from the hash. - def delete(key) - super(convert_key(key)) - end - - # Returns a hash with indifferent access that includes everything except given keys. - # hash = { a: "x", b: "y", c: 10 }.with_indifferent_access - # hash.except(:a, "b") # => {c: 10}.with_indifferent_access - # hash # => { a: "x", b: "y", c: 10 }.with_indifferent_access - def except(*keys) - dup.except!(*keys) - end - alias_method :without, :except - - undef :symbolize_keys! - undef :deep_symbolize_keys! - def symbolize_keys; to_hash.symbolize_keys! end - alias_method :to_options, :symbolize_keys - def deep_symbolize_keys; to_hash.deep_symbolize_keys! end - def to_options!; self end - - def select(*args, &block) - return to_enum(:select) unless block_given? - dup.tap { |hash| hash.select!(*args, &block) } - end - alias_method :filter, :select - - def reject(*args, &block) - return to_enum(:reject) unless block_given? - dup.tap { |hash| hash.reject!(*args, &block) } - end - - def transform_values(&block) - return to_enum(:transform_values) unless block_given? - dup.tap { |hash| hash.transform_values!(&block) } - end - - NOT_GIVEN = Object.new # :nodoc: - - def transform_keys(hash = NOT_GIVEN, &block) - if NOT_GIVEN.equal?(hash) - if block_given? - self.class.new(super(&block)) - else - to_enum(:transform_keys) - end - else - self.class.new(super) - end - end - - def transform_keys!(hash = NOT_GIVEN, &block) - if NOT_GIVEN.equal?(hash) - if block_given? - replace(copy_defaults(transform_keys(&block))) - else - return to_enum(:transform_keys!) - end - else - replace(copy_defaults(transform_keys(hash, &block))) - end - - self - end - - def slice(*keys) - keys.map! { |key| convert_key(key) } - self.class.new(super) - end - - def slice!(*keys) - keys.map! { |key| convert_key(key) } - super - end - - def compact - dup.tap(&:compact!) - end - - # Convert to a regular hash with string keys. - def to_hash - copy = Hash[self] - copy.transform_values! { |v| convert_value_to_hash(v) } - copy_defaults(copy) - end - - def to_proc - proc { |key| self[key] } - end - - private - def cast(other) - self.class === other ? other : self.class.new(other) - end - - def convert_key(key) - Symbol === key ? key.name : key - end - - def convert_value(value, conversion: nil) - if value.is_a? Hash - value.nested_under_indifferent_access - elsif value.is_a?(Array) - if conversion != :assignment || value.frozen? - value = value.dup - end - value.map! { |e| convert_value(e, conversion: conversion) } - else - value - end - end - - def convert_value_to_hash(value) - if value.is_a? Hash - value.to_hash - elsif value.is_a?(Array) - value.map { |e| convert_value_to_hash(e) } - else - value - end - end - - - def copy_defaults(target) - if default_proc - target.default_proc = default_proc.dup - else - target.default = default - end - target - end - - def update_with_single_argument(other_hash, block) - if other_hash.is_a? HashWithIndifferentAccess - regular_update(other_hash, &block) - else - other_hash.to_hash.each_pair do |key, value| - if block && key?(key) - value = block.call(convert_key(key), self[key], value) - end - regular_writer(convert_key(key), convert_value(value)) - end - end - end - end -end - -# :stopdoc: - -HashWithIndifferentAccess = ActiveSupport::HashWithIndifferentAccess diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/html_safe_translation.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/html_safe_translation.rb deleted file mode 100644 index 69ff23d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/html_safe_translation.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module HtmlSafeTranslation # :nodoc: - extend self - - def translate(key, **options) - if html_safe_translation_key?(key) - html_safe_options = html_escape_translation_options(options) - - exception = false - - exception_handler = ->(*args) do - exception = true - I18n.exception_handler.call(*args) - end - - translation = I18n.translate(key, **html_safe_options, exception_handler: exception_handler) - - if exception - translation - else - html_safe_translation(translation) - end - else - I18n.translate(key, **options) - end - end - - def html_safe_translation_key?(key) - /(?:_|\b)html\z/.match?(key) - end - - private - def html_escape_translation_options(options) - options.each do |name, value| - unless i18n_option?(name) || (name == :count && value.is_a?(Numeric)) - options[name] = ERB::Util.html_escape(value.to_s) - end - end - end - - def i18n_option?(name) - (@i18n_option_names ||= I18n::RESERVED_KEYS.to_set).include?(name) - end - - - def html_safe_translation(translation) - if translation.respond_to?(:map) - translation.map { |element| element.respond_to?(:html_safe) ? element.html_safe : element } - else - translation.respond_to?(:html_safe) ? translation.html_safe : translation - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/i18n.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/i18n.rb deleted file mode 100644 index f4f06d4..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/i18n.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/hash/deep_merge" -require "active_support/core_ext/hash/except" -require "active_support/core_ext/hash/slice" -begin - require "i18n" - require "i18n/backend/fallbacks" -rescue LoadError => e - warn "The i18n gem is not available. Please add it to your Gemfile and run bundle install" - raise e -end -require "active_support/lazy_load_hooks" - -ActiveSupport.run_load_hooks(:i18n) -I18n.load_path << File.expand_path("locale/en.yml", __dir__) -I18n.load_path << File.expand_path("locale/en.rb", __dir__) diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/i18n_railtie.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/i18n_railtie.rb deleted file mode 100644 index ed32655..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/i18n_railtie.rb +++ /dev/null @@ -1,140 +0,0 @@ -# frozen_string_literal: true - -require "active_support" -require "active_support/core_ext/array/wrap" -require "rails/railtie" - -# :enddoc: - -module I18n - class Railtie < Rails::Railtie - config.i18n = ActiveSupport::OrderedOptions.new - config.i18n.railties_load_path = [] - config.i18n.load_path = [] - config.i18n.fallbacks = ActiveSupport::OrderedOptions.new - - config.eager_load_namespaces << I18n - - # Make sure i18n is ready before eager loading, in case any eager loaded - # code needs it. - config.before_eager_load do |app| - I18n::Railtie.initialize_i18n(app) - end - - # i18n initialization needs to run after application initialization, since - # initializers may configure i18n. - # - # If the application eager loaded, this was done on before_eager_load. The - # hook is still OK, though, because initialize_i18n is idempotent. - config.after_initialize do |app| - I18n::Railtie.initialize_i18n(app) - end - - @i18n_inited = false - - # Setup i18n configuration. - def self.initialize_i18n(app) - return if @i18n_inited - - fallbacks = app.config.i18n.delete(:fallbacks) - - # Avoid issues with setting the default_locale by disabling available locales - # check while configuring. - enforce_available_locales = app.config.i18n.delete(:enforce_available_locales) - enforce_available_locales = I18n.enforce_available_locales if enforce_available_locales.nil? - I18n.enforce_available_locales = false - - reloadable_paths = [] - app.config.i18n.each do |setting, value| - case setting - when :railties_load_path - reloadable_paths = value - app.config.i18n.load_path.unshift(*value.flat_map(&:existent)) - when :load_path - I18n.load_path += value - when :raise_on_missing_translations - strict = value == :strict - setup_raise_on_missing_translations_config(app, strict) - else - I18n.public_send("#{setting}=", value) - end - end - - init_fallbacks(fallbacks) if fallbacks && validate_fallbacks(fallbacks) - - # Restore available locales check so it will take place from now on. - I18n.enforce_available_locales = enforce_available_locales - - if app.config.reloading_enabled? - directories = watched_dirs_with_extensions(reloadable_paths) - reloader = app.config.file_watcher.new(I18n.load_path, directories) do - I18n.load_path.delete_if { |path| path.to_s.start_with?(Rails.root.to_s) && !File.exist?(path) } - I18n.load_path |= reloadable_paths.flat_map(&:existent) - end - - app.reloaders << reloader - app.reloader.to_run do - reloader.execute_if_updated { require_unload_lock! } - end - end - - @i18n_inited = true - end - - def self.setup_raise_on_missing_translations_config(app, strict) - ActiveSupport.on_load(:action_view) do - ActionView::Helpers::TranslationHelper.raise_on_missing_translations = app.config.i18n.raise_on_missing_translations - end - - ActiveSupport.on_load(:active_model_translation) do - ActiveModel::Translation.raise_on_missing_translations = app.config.i18n.raise_on_missing_translations if strict - end - - if app.config.i18n.raise_on_missing_translations && - I18n.exception_handler.is_a?(I18n::ExceptionHandler) # Only override the i18n gem's default exception handler. - - I18n.exception_handler = ->(exception, *) { - exception = exception.to_exception if exception.is_a?(I18n::MissingTranslation) - raise exception - } - end - end - - def self.include_fallbacks_module - I18n.backend.class.include(I18n::Backend::Fallbacks) - end - - def self.init_fallbacks(fallbacks) - include_fallbacks_module - - args = \ - case fallbacks - when ActiveSupport::OrderedOptions - [*(fallbacks[:defaults] || []) << fallbacks[:map]].compact - when Hash, Array - Array.wrap(fallbacks) - else # TrueClass - [I18n.default_locale] - end - - I18n.fallbacks = I18n::Locale::Fallbacks.new(*args) - end - - def self.validate_fallbacks(fallbacks) - case fallbacks - when ActiveSupport::OrderedOptions - !fallbacks.empty? - when TrueClass, Array, Hash - true - else - raise "Unexpected fallback type #{fallbacks.inspect}" - end - end - - def self.watched_dirs_with_extensions(paths) - paths.each_with_object({}) do |path, result| - result[path.absolute_current] = path.extensions - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/inflections.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/inflections.rb deleted file mode 100644 index baf1cb3..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/inflections.rb +++ /dev/null @@ -1,72 +0,0 @@ -# frozen_string_literal: true - -require "active_support/inflector/inflections" - -#-- -# Defines the standard inflection rules. These are the starting point for -# new projects and are not considered complete. The current set of inflection -# rules is frozen. This means, we do not change them to become more complete. -# This is a safety measure to keep existing applications from breaking. -#++ -module ActiveSupport - Inflector.inflections(:en) do |inflect| - inflect.plural(/$/, "s") - inflect.plural(/s$/i, "s") - inflect.plural(/^(ax|test)is$/i, '\1es') - inflect.plural(/(octop|vir)us$/i, '\1i') - inflect.plural(/(octop|vir)i$/i, '\1i') - inflect.plural(/(alias|status)$/i, '\1es') - inflect.plural(/(bu)s$/i, '\1ses') - inflect.plural(/(buffal|tomat)o$/i, '\1oes') - inflect.plural(/([ti])um$/i, '\1a') - inflect.plural(/([ti])a$/i, '\1a') - inflect.plural(/sis$/i, "ses") - inflect.plural(/(?:([^f])fe|([lr])f)$/i, '\1\2ves') - inflect.plural(/(hive)$/i, '\1s') - inflect.plural(/([^aeiouy]|qu)y$/i, '\1ies') - inflect.plural(/(x|ch|ss|sh)$/i, '\1es') - inflect.plural(/(matr|vert|ind)(?:ix|ex)$/i, '\1ices') - inflect.plural(/^(m|l)ouse$/i, '\1ice') - inflect.plural(/^(m|l)ice$/i, '\1ice') - inflect.plural(/^(ox)$/i, '\1en') - inflect.plural(/^(oxen)$/i, '\1') - inflect.plural(/(quiz)$/i, '\1zes') - - inflect.singular(/s$/i, "") - inflect.singular(/(ss)$/i, '\1') - inflect.singular(/(n)ews$/i, '\1ews') - inflect.singular(/([ti])a$/i, '\1um') - inflect.singular(/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i, '\1sis') - inflect.singular(/(^analy)(sis|ses)$/i, '\1sis') - inflect.singular(/([^f])ves$/i, '\1fe') - inflect.singular(/(hive)s$/i, '\1') - inflect.singular(/(tive)s$/i, '\1') - inflect.singular(/([lr])ves$/i, '\1f') - inflect.singular(/([^aeiouy]|qu)ies$/i, '\1y') - inflect.singular(/(s)eries$/i, '\1eries') - inflect.singular(/(m)ovies$/i, '\1ovie') - inflect.singular(/(x|ch|ss|sh)es$/i, '\1') - inflect.singular(/^(m|l)ice$/i, '\1ouse') - inflect.singular(/(bus)(es)?$/i, '\1') - inflect.singular(/(o)es$/i, '\1') - inflect.singular(/(shoe)s$/i, '\1') - inflect.singular(/(cris|test)(is|es)$/i, '\1is') - inflect.singular(/^(a)x[ie]s$/i, '\1xis') - inflect.singular(/(octop|vir)(us|i)$/i, '\1us') - inflect.singular(/(alias|status)(es)?$/i, '\1') - inflect.singular(/^(ox)en/i, '\1') - inflect.singular(/(vert|ind)ices$/i, '\1ex') - inflect.singular(/(matr)ices$/i, '\1ix') - inflect.singular(/(quiz)zes$/i, '\1') - inflect.singular(/(database)s$/i, '\1') - - inflect.irregular("person", "people") - inflect.irregular("man", "men") - inflect.irregular("child", "children") - inflect.irregular("sex", "sexes") - inflect.irregular("move", "moves") - inflect.irregular("zombie", "zombies") - - inflect.uncountable(%w(equipment information rice money species series fish sheep jeans police)) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/inflector.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/inflector.rb deleted file mode 100644 index d77f04c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/inflector.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# in case active_support/inflector is required without the rest of active_support -require "active_support/inflector/inflections" -require "active_support/inflector/transliterate" -require "active_support/inflector/methods" - -require "active_support/inflections" -require "active_support/core_ext/string/inflections" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/inflector/inflections.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/inflector/inflections.rb deleted file mode 100644 index 8f7645b..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/inflector/inflections.rb +++ /dev/null @@ -1,291 +0,0 @@ -# frozen_string_literal: true - -require "concurrent/map" -require "active_support/core_ext/module/delegation" -require "active_support/i18n" - -module ActiveSupport - module Inflector - extend self - - # = Active Support \Inflections - # - # A singleton instance of this class is yielded by Inflector.inflections, - # which can then be used to specify additional inflection rules. If passed - # an optional locale, rules for other languages can be specified. The - # default locale is :en. Only rules for English are provided. - # - # ActiveSupport::Inflector.inflections(:en) do |inflect| - # inflect.plural /^(ox)$/i, '\1\2en' - # inflect.singular /^(ox)en/i, '\1' - # - # inflect.irregular 'cactus', 'cacti' - # - # inflect.uncountable 'equipment' - # end - # - # New rules are added at the top. So in the example above, the irregular - # rule for cactus will now be the first of the pluralization and - # singularization rules that is runs. This guarantees that your rules run - # before any of the rules that may already have been loaded. - class Inflections - @__instance__ = Concurrent::Map.new - @__en_instance__ = nil - - class Uncountables # :nodoc: - include Enumerable - - delegate :each, :pop, :empty?, :to_s, :==, :to_a, :to_ary, to: :@members - - def initialize - @members = [] - @pattern = nil - end - - def delete(entry) - @members.delete(entry) - @pattern = nil - end - - def <<(word) - word = word.downcase - @members << word - @pattern = nil - self - end - - def flatten - @members.dup - end - - def add(words) - words = words.flatten.map(&:downcase) - @members.concat(words) - @pattern = nil - self - end - - def uncountable?(str) - if @pattern.nil? - members_pattern = Regexp.union(@members.map { |w| /#{Regexp.escape(w)}/i }) - @pattern = /\b#{members_pattern}\Z/i - end - @pattern.match?(str) - end - end - - def self.instance(locale = :en) - return @__en_instance__ ||= new if locale == :en - - @__instance__[locale] ||= new - end - - def self.instance_or_fallback(locale) - return @__en_instance__ ||= new if locale == :en - - I18n.fallbacks[locale].each do |k| - return @__en_instance__ if k == :en && @__en_instance__ - return @__instance__[k] if @__instance__.key?(k) - end - instance(locale) - end - - attr_reader :plurals, :singulars, :uncountables, :humans, :acronyms - - attr_reader :acronyms_camelize_regex, :acronyms_underscore_regex # :nodoc: - - def initialize - @plurals, @singulars, @uncountables, @humans, @acronyms = [], [], Uncountables.new, [], {} - define_acronym_regex_patterns - end - - # Private, for the test suite. - def initialize_dup(orig) # :nodoc: - %w(plurals singulars uncountables humans acronyms).each do |scope| - instance_variable_set("@#{scope}", orig.public_send(scope).dup) - end - define_acronym_regex_patterns - end - - # Specifies a new acronym. An acronym must be specified as it will appear - # in a camelized string. An underscore string that contains the acronym - # will retain the acronym when passed to +camelize+, +humanize+, or - # +titleize+. A camelized string that contains the acronym will maintain - # the acronym when titleized or humanized, and will convert the acronym - # into a non-delimited single lowercase word when passed to +underscore+. - # - # acronym 'HTML' - # titleize 'html' # => 'HTML' - # camelize 'html' # => 'HTML' - # underscore 'MyHTML' # => 'my_html' - # - # The acronym, however, must occur as a delimited unit and not be part of - # another word for conversions to recognize it: - # - # acronym 'HTTP' - # camelize 'my_http_delimited' # => 'MyHTTPDelimited' - # camelize 'https' # => 'Https', not 'HTTPs' - # underscore 'HTTPS' # => 'http_s', not 'https' - # - # acronym 'HTTPS' - # camelize 'https' # => 'HTTPS' - # underscore 'HTTPS' # => 'https' - # - # Note: Acronyms that are passed to +pluralize+ will no longer be - # recognized, since the acronym will not occur as a delimited unit in the - # pluralized result. To work around this, you must specify the pluralized - # form as an acronym as well: - # - # acronym 'API' - # camelize(pluralize('api')) # => 'Apis' - # - # acronym 'APIs' - # camelize(pluralize('api')) # => 'APIs' - # - # +acronym+ may be used to specify any word that contains an acronym or - # otherwise needs to maintain a non-standard capitalization. The only - # restriction is that the word must begin with a capital letter. - # - # acronym 'RESTful' - # underscore 'RESTful' # => 'restful' - # underscore 'RESTfulController' # => 'restful_controller' - # titleize 'RESTfulController' # => 'RESTful Controller' - # camelize 'restful' # => 'RESTful' - # camelize 'restful_controller' # => 'RESTfulController' - # - # acronym 'McDonald' - # underscore 'McDonald' # => 'mcdonald' - # camelize 'mcdonald' # => 'McDonald' - def acronym(word) - @acronyms[word.downcase] = word - define_acronym_regex_patterns - end - - # Specifies a new pluralization rule and its replacement. The rule can - # either be a string or a regular expression. The replacement should - # always be a string that may include references to the matched data from - # the rule. - def plural(rule, replacement) - @uncountables.delete(rule) if rule.is_a?(String) - @uncountables.delete(replacement) - @plurals.prepend([rule, replacement]) - end - - # Specifies a new singularization rule and its replacement. The rule can - # either be a string or a regular expression. The replacement should - # always be a string that may include references to the matched data from - # the rule. - def singular(rule, replacement) - @uncountables.delete(rule) if rule.is_a?(String) - @uncountables.delete(replacement) - @singulars.prepend([rule, replacement]) - end - - # Specifies a new irregular that applies to both pluralization and - # singularization at the same time. This can only be used for strings, not - # regular expressions. You simply pass the irregular in singular and - # plural form. - # - # irregular 'cactus', 'cacti' - # irregular 'person', 'people' - def irregular(singular, plural) - @uncountables.delete(singular) - @uncountables.delete(plural) - - s0 = singular[0] - srest = singular[1..-1] - - p0 = plural[0] - prest = plural[1..-1] - - if s0.upcase == p0.upcase - plural(/(#{s0})#{srest}$/i, '\1' + prest) - plural(/(#{p0})#{prest}$/i, '\1' + prest) - - singular(/(#{s0})#{srest}$/i, '\1' + srest) - singular(/(#{p0})#{prest}$/i, '\1' + srest) - else - plural(/#{s0.upcase}(?i)#{srest}$/, p0.upcase + prest) - plural(/#{s0.downcase}(?i)#{srest}$/, p0.downcase + prest) - plural(/#{p0.upcase}(?i)#{prest}$/, p0.upcase + prest) - plural(/#{p0.downcase}(?i)#{prest}$/, p0.downcase + prest) - - singular(/#{s0.upcase}(?i)#{srest}$/, s0.upcase + srest) - singular(/#{s0.downcase}(?i)#{srest}$/, s0.downcase + srest) - singular(/#{p0.upcase}(?i)#{prest}$/, s0.upcase + srest) - singular(/#{p0.downcase}(?i)#{prest}$/, s0.downcase + srest) - end - end - - # Specifies words that are uncountable and should not be inflected. - # - # uncountable 'money' - # uncountable 'money', 'information' - # uncountable %w( money information rice ) - def uncountable(*words) - @uncountables.add(words) - end - - # Specifies a humanized form of a string by a regular expression rule or - # by a string mapping. When using a regular expression based replacement, - # the normal humanize formatting is called after the replacement. When a - # string is used, the human form should be specified as desired (example: - # 'The name', not 'the_name'). - # - # human /_cnt$/i, '\1_count' - # human 'legacy_col_person_name', 'Name' - def human(rule, replacement) - @humans.prepend([rule, replacement]) - end - - # Clears the loaded inflections within a given scope (default is - # :all). Give the scope as a symbol of the inflection type, the - # options are: :plurals, :singulars, :uncountables, - # :humans, :acronyms. - # - # clear :all - # clear :plurals - def clear(scope = :all) - case scope - when :all - clear(:acronyms) - clear(:plurals) - clear(:singulars) - clear(:uncountables) - clear(:humans) - when :acronyms - @acronyms = {} - define_acronym_regex_patterns - when :uncountables - @uncountables = Uncountables.new - when :plurals, :singulars, :humans - instance_variable_set "@#{scope}", [] - end - end - - private - def define_acronym_regex_patterns - sorted_acronyms = @acronyms.empty? ? [] : @acronyms.values.sort_by { |a| -a.length } - @acronym_regex = sorted_acronyms.empty? ? /(?=a)b/ : /#{sorted_acronyms.join("|")}/ - @acronyms_camelize_regex = /^(?:#{@acronym_regex}(?=\b|[A-Z_])|\w)/ - @acronyms_underscore_regex = /(?:(?<=([A-Za-z\d]))|\b)(#{@acronym_regex})(?=\b|[^a-z])/ - end - end - - # Yields a singleton instance of Inflector::Inflections so you can specify - # additional inflector rules. If passed an optional locale, rules for other - # languages can be specified. If not specified, defaults to :en. - # Only rules for English are provided. - # - # ActiveSupport::Inflector.inflections(:en) do |inflect| - # inflect.uncountable 'rails' - # end - def inflections(locale = :en) - if block_given? - yield Inflections.instance(locale) - else - Inflections.instance_or_fallback(locale) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/inflector/methods.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/inflector/methods.rb deleted file mode 100644 index 87db94d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/inflector/methods.rb +++ /dev/null @@ -1,371 +0,0 @@ -# frozen_string_literal: true - -require "active_support/inflections" - -module ActiveSupport - # = Active Support \Inflector - # - # The Inflector transforms words from singular to plural, class names to table - # names, modularized class names to ones without, and class names to foreign - # keys. The default inflections for pluralization, singularization, and - # uncountable words are kept in inflections.rb. - # - # The \Rails core team has stated patches for the inflections library will not - # be accepted in order to avoid breaking legacy applications which may be - # relying on errant inflections. If you discover an incorrect inflection and - # require it for your application or wish to define rules for languages other - # than English, please correct or add them yourself (explained below). - module Inflector - extend self - - # Returns the plural form of the word in the string. - # - # If passed an optional +locale+ parameter, the word will be - # pluralized using rules defined for that language. By default, - # this parameter is set to :en. - # - # pluralize('post') # => "posts" - # pluralize('octopus') # => "octopi" - # pluralize('sheep') # => "sheep" - # pluralize('words') # => "words" - # pluralize('CamelOctopus') # => "CamelOctopi" - # pluralize('ley', :es) # => "leyes" - def pluralize(word, locale = :en) - apply_inflections(word, inflections(locale).plurals, locale) - end - - # The reverse of #pluralize, returns the singular form of a word in a - # string. - # - # If passed an optional +locale+ parameter, the word will be - # singularized using rules defined for that language. By default, - # this parameter is set to :en. - # - # singularize('posts') # => "post" - # singularize('octopi') # => "octopus" - # singularize('sheep') # => "sheep" - # singularize('word') # => "word" - # singularize('CamelOctopi') # => "CamelOctopus" - # singularize('leyes', :es) # => "ley" - def singularize(word, locale = :en) - apply_inflections(word, inflections(locale).singulars, locale) - end - - # Converts strings to UpperCamelCase. - # If the +uppercase_first_letter+ parameter is set to false, then produces - # lowerCamelCase. - # - # Also converts '/' to '::' which is useful for converting - # paths to namespaces. - # - # camelize('active_model') # => "ActiveModel" - # camelize('active_model', false) # => "activeModel" - # camelize('active_model/errors') # => "ActiveModel::Errors" - # camelize('active_model/errors', false) # => "activeModel::Errors" - # - # As a rule of thumb you can think of +camelize+ as the inverse of - # #underscore, though there are cases where that does not hold: - # - # camelize(underscore('SSLError')) # => "SslError" - def camelize(term, uppercase_first_letter = true) - string = term.to_s - # String#camelize takes a symbol (:upper or :lower), so here we also support :lower to keep the methods consistent. - if !uppercase_first_letter || uppercase_first_letter == :lower - string = string.sub(inflections.acronyms_camelize_regex) { |match| match.downcase! || match } - elsif string.match?(/\A[a-z\d]*\z/) - return inflections.acronyms[string]&.dup || string.capitalize - else - string = string.sub(/^[a-z\d]*/) { |match| inflections.acronyms[match] || match.capitalize! || match } - end - string.gsub!(/(?:_|(\/))([a-z\d]*)/i) do - word = $2 - substituted = inflections.acronyms[word] || word.capitalize! || word - $1 ? "::#{substituted}" : substituted - end - string - end - - # Makes an underscored, lowercase form from the expression in the string. - # - # Changes '::' to '/' to convert namespaces to paths. - # - # underscore('ActiveModel') # => "active_model" - # underscore('ActiveModel::Errors') # => "active_model/errors" - # - # As a rule of thumb you can think of +underscore+ as the inverse of - # #camelize, though there are cases where that does not hold: - # - # camelize(underscore('SSLError')) # => "SslError" - def underscore(camel_cased_word) - return camel_cased_word.to_s.dup unless /[A-Z-]|::/.match?(camel_cased_word) - word = camel_cased_word.to_s.gsub("::", "/") - word.gsub!(inflections.acronyms_underscore_regex) { "#{$1 && '_' }#{$2.downcase}" } - word.gsub!(/(?<=[A-Z])(?=[A-Z][a-z])|(?<=[a-z\d])(?=[A-Z])/, "_") - word.tr!("-", "_") - word.downcase! - word - end - - # Tweaks an attribute name for display to end users. - # - # Specifically, performs these transformations: - # - # * Applies human inflection rules to the argument. - # * Deletes leading underscores, if any. - # * Removes an "_id" suffix if present. - # * Replaces underscores with spaces, if any. - # * Downcases all words except acronyms. - # * Capitalizes the first word. - # The capitalization of the first word can be turned off by setting the - # +:capitalize+ option to false (default is true). - # - # The trailing '_id' can be kept by setting the - # optional parameter +keep_id_suffix+ to true (default is false). - # - # humanize('employee_salary') # => "Employee salary" - # humanize('author_id') # => "Author" - # humanize('author_id', capitalize: false) # => "author" - # humanize('_id') # => "Id" - # humanize('author_id', keep_id_suffix: true) # => "Author id" - # - # If "SSL" was defined to be an acronym: - # - # humanize('ssl_error') # => "SSL error" - # - def humanize(lower_case_and_underscored_word, capitalize: true, keep_id_suffix: false) - result = lower_case_and_underscored_word.to_s.dup - - inflections.humans.each { |(rule, replacement)| break if result.sub!(rule, replacement) } - - result.tr!("_", " ") - result.lstrip! - if !keep_id_suffix && lower_case_and_underscored_word&.end_with?("_id") - result.delete_suffix!(" id") - end - - result.gsub!(/([[[:alpha:]]\d]+)/i) do |match| - match.downcase! - inflections.acronyms[match] || match - end - - if capitalize - result.sub!(/\A[[:alpha:]]/) do |match| - match.upcase! - match - end - end - - result - end - - # Converts the first character in the string to uppercase. - # - # upcase_first('what a Lovely Day') # => "What a Lovely Day" - # upcase_first('w') # => "W" - # upcase_first('') # => "" - def upcase_first(string) - string.length > 0 ? string[0].upcase.concat(string[1..-1]) : +"" - end - - # Converts the first character in the string to lowercase. - # - # downcase_first('If they enjoyed The Matrix') # => "if they enjoyed The Matrix" - # downcase_first('I') # => "i" - # downcase_first('') # => "" - def downcase_first(string) - string.length > 0 ? string[0].downcase.concat(string[1..-1]) : +"" - end - - # Capitalizes all the words and replaces some characters in the string to - # create a nicer looking title. +titleize+ is meant for creating pretty - # output. It is not used in the \Rails internals. - # - # The trailing '_id','Id'.. can be kept and capitalized by setting the - # optional parameter +keep_id_suffix+ to true. - # By default, this parameter is false. - # - # titleize('man from the boondocks') # => "Man From The Boondocks" - # titleize('x-men: the last stand') # => "X Men: The Last Stand" - # titleize('TheManWithoutAPast') # => "The Man Without A Past" - # titleize('raiders_of_the_lost_ark') # => "Raiders Of The Lost Ark" - # titleize('string_ending_with_id', keep_id_suffix: true) # => "String Ending With Id" - def titleize(word, keep_id_suffix: false) - humanize(underscore(word), keep_id_suffix: keep_id_suffix).gsub(/\b(? "raw_scaled_scorers" - # tableize('ham_and_egg') # => "ham_and_eggs" - # tableize('fancyCategory') # => "fancy_categories" - def tableize(class_name) - pluralize(underscore(class_name)) - end - - # Creates a class name from a plural table name like \Rails does for table - # names to models. Note that this returns a string and not a Class. (To - # convert to an actual class follow +classify+ with #constantize.) - # - # classify('ham_and_eggs') # => "HamAndEgg" - # classify('posts') # => "Post" - # - # Singular names are not handled correctly: - # - # classify('calculus') # => "Calculu" - def classify(table_name) - # strip out any leading schema name - camelize(singularize(table_name.to_s.sub(/.*\./, ""))) - end - - # Replaces underscores with dashes in the string. - # - # dasherize('puni_puni') # => "puni-puni" - def dasherize(underscored_word) - underscored_word.tr("_", "-") - end - - # Removes the module part from the expression in the string. - # - # demodulize('ActiveSupport::Inflector::Inflections') # => "Inflections" - # demodulize('Inflections') # => "Inflections" - # demodulize('::Inflections') # => "Inflections" - # demodulize('') # => "" - # - # See also #deconstantize. - def demodulize(path) - path = path.to_s - if i = path.rindex("::") - path[(i + 2), path.length] - else - path - end - end - - # Removes the rightmost segment from the constant expression in the string. - # - # deconstantize('Net::HTTP') # => "Net" - # deconstantize('::Net::HTTP') # => "::Net" - # deconstantize('String') # => "" - # deconstantize('::String') # => "" - # deconstantize('') # => "" - # - # See also #demodulize. - def deconstantize(path) - path.to_s[0, path.rindex("::") || 0] # implementation based on the one in facets' Module#spacename - end - - # Creates a foreign key name from a class name. - # +separate_class_name_and_id_with_underscore+ sets whether - # the method should put '_' between the name and 'id'. - # - # foreign_key('Message') # => "message_id" - # foreign_key('Message', false) # => "messageid" - # foreign_key('Admin::Post') # => "post_id" - def foreign_key(class_name, separate_class_name_and_id_with_underscore = true) - underscore(demodulize(class_name)) + (separate_class_name_and_id_with_underscore ? "_id" : "id") - end - - # Tries to find a constant with the name specified in the argument string. - # - # constantize('Module') # => Module - # constantize('Foo::Bar') # => Foo::Bar - # - # The name is assumed to be the one of a top-level constant, no matter - # whether it starts with "::" or not. No lexical context is taken into - # account: - # - # C = 'outside' - # module M - # C = 'inside' - # C # => 'inside' - # constantize('C') # => 'outside', same as ::C - # end - # - # NameError is raised when the name is not in CamelCase or the constant is - # unknown. - def constantize(camel_cased_word) - Object.const_get(camel_cased_word) - end - - # Tries to find a constant with the name specified in the argument string. - # - # safe_constantize('Module') # => Module - # safe_constantize('Foo::Bar') # => Foo::Bar - # - # The name is assumed to be the one of a top-level constant, no matter - # whether it starts with "::" or not. No lexical context is taken into - # account: - # - # C = 'outside' - # module M - # C = 'inside' - # C # => 'inside' - # safe_constantize('C') # => 'outside', same as ::C - # end - # - # +nil+ is returned when the name is not in CamelCase or the constant (or - # part of it) is unknown. - # - # safe_constantize('blargle') # => nil - # safe_constantize('UnknownModule') # => nil - # safe_constantize('UnknownModule::Foo::Bar') # => nil - def safe_constantize(camel_cased_word) - constantize(camel_cased_word) - rescue NameError => e - raise if e.name && !(camel_cased_word.to_s.split("::").include?(e.name.to_s) || - e.name.to_s == camel_cased_word.to_s) - rescue LoadError => e - message = e.respond_to?(:original_message) ? e.original_message : e.message - constant_name = camel_cased_word.split("::").find { |part| !part.empty? } || camel_cased_word - raise unless message.include?("Unable to autoload constant #{constant_name}") - end - - # Returns the suffix that should be added to a number to denote the position - # in an ordered sequence such as 1st, 2nd, 3rd, 4th. - # - # ordinal(1) # => "st" - # ordinal(2) # => "nd" - # ordinal(1002) # => "nd" - # ordinal(1003) # => "rd" - # ordinal(-11) # => "th" - # ordinal(-1021) # => "st" - def ordinal(number) - I18n.translate("number.nth.ordinals", number: number) - end - - # Turns a number into an ordinal string used to denote the position in an - # ordered sequence such as 1st, 2nd, 3rd, 4th. - # - # ordinalize(1) # => "1st" - # ordinalize(2) # => "2nd" - # ordinalize(1002) # => "1002nd" - # ordinalize(1003) # => "1003rd" - # ordinalize(-11) # => "-11th" - # ordinalize(-1021) # => "-1021st" - def ordinalize(number) - I18n.translate("number.nth.ordinalized", number: number) - end - - private - # Applies inflection rules for +singularize+ and +pluralize+. - # - # If passed an optional +locale+ parameter, the uncountables will be - # found for that locale. - # - # apply_inflections('post', inflections.plurals, :en) # => "posts" - # apply_inflections('posts', inflections.singulars, :en) # => "post" - def apply_inflections(word, rules, locale = :en) - result = word.to_s.dup - - if word.empty? || inflections(locale).uncountables.uncountable?(result) - result - else - rules.each { |(rule, replacement)| break if result.sub!(rule, replacement) } - result - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/inflector/transliterate.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/inflector/transliterate.rb deleted file mode 100644 index 257a354..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/inflector/transliterate.rb +++ /dev/null @@ -1,157 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/string/multibyte" -require "active_support/i18n" - -module ActiveSupport - module Inflector - ALLOWED_ENCODINGS_FOR_TRANSLITERATE = [Encoding::UTF_8, Encoding::US_ASCII, Encoding::GB18030].freeze - - # Replaces non-ASCII characters with an ASCII approximation, or if none - # exists, a replacement character which defaults to "?". - # - # transliterate('Ærøskøbing') - # # => "AEroskobing" - # - # Default approximations are provided for Western/Latin characters, - # e.g, "ø", "ñ", "é", "ß", etc. - # - # This method is I18n aware, so you can set up custom approximations for a - # locale. This can be useful, for example, to transliterate German's "ü" - # and "ö" to "ue" and "oe", or to add support for transliterating Russian - # to ASCII. - # - # In order to make your custom transliterations available, you must set - # them as the i18n.transliterate.rule i18n key: - # - # # Store the transliterations in locales/de.yml - # i18n: - # transliterate: - # rule: - # ü: "ue" - # ö: "oe" - # - # # Or set them using Ruby - # I18n.backend.store_translations(:de, i18n: { - # transliterate: { - # rule: { - # 'ü' => 'ue', - # 'ö' => 'oe' - # } - # } - # }) - # - # The value for i18n.transliterate.rule can be a simple Hash that - # maps characters to ASCII approximations as shown above, or, for more - # complex requirements, a Proc: - # - # I18n.backend.store_translations(:de, i18n: { - # transliterate: { - # rule: ->(string) { MyTransliterator.transliterate(string) } - # } - # }) - # - # Now you can have different transliterations for each locale: - # - # transliterate('Jürgen', locale: :en) - # # => "Jurgen" - # - # transliterate('Jürgen', locale: :de) - # # => "Juergen" - # - # Transliteration is restricted to UTF-8, US-ASCII, and GB18030 strings. - # Other encodings will raise an ArgumentError. - def transliterate(string, replacement = "?", locale: nil) - raise ArgumentError, "Can only transliterate strings. Received #{string.class.name}" unless string.is_a?(String) - raise ArgumentError, "Cannot transliterate strings with #{string.encoding} encoding" unless ALLOWED_ENCODINGS_FOR_TRANSLITERATE.include?(string.encoding) - - return string.dup if string.ascii_only? - - # Operate on a copy so the in-place force_encoding/encode! below never - # mutate the caller's (possibly non-frozen) string. - string = string.dup - - input_encoding = string.encoding - - # US-ASCII is a subset of UTF-8 so we'll force encoding as UTF-8 if - # US-ASCII is given. This way we can let tidy_bytes handle the string - # in the same way as we do for UTF-8 - string.force_encoding(Encoding::UTF_8) if string.encoding == Encoding::US_ASCII - - # GB18030 is Unicode compatible but is not a direct mapping so needs to be - # transcoded. Using invalid/undef :replace will result in loss of data in - # the event of invalid characters, but since tidy_bytes will replace - # invalid/undef with a "?" we're safe to do the same beforehand - string.encode!(Encoding::UTF_8, invalid: :replace, undef: :replace) if string.encoding == Encoding::GB18030 - - transliterated = I18n.transliterate( - ActiveSupport::Multibyte::Unicode.tidy_bytes(string).unicode_normalize(:nfc), - replacement: replacement, - locale: locale - ) - - # Restore the string encoding of the input if it was not UTF-8. - # Apply invalid/undef :replace as tidy_bytes does - transliterated.encode!(input_encoding, invalid: :replace, undef: :replace) if input_encoding != transliterated.encoding - - transliterated - end - - # Replaces special characters in a string so that it may be used as part of - # a 'pretty' URL. - # - # parameterize("Donald E. Knuth") # => "donald-e-knuth" - # parameterize("^très|Jolie-- ") # => "tres-jolie" - # - # To use a custom separator, override the +separator+ argument. - # - # parameterize("Donald E. Knuth", separator: '_') # => "donald_e_knuth" - # parameterize("^très|Jolie__ ", separator: '_') # => "tres_jolie" - # - # To remove the unwanted characters instead of replacing them, pass an - # empty separator. +nil+ is treated the same way. - # - # parameterize("Donald E. Knuth", separator: '') # => "donaldeknuth" - # - # To preserve the case of the characters in a string, use the +preserve_case+ argument. - # - # parameterize("Donald E. Knuth", preserve_case: true) # => "Donald-E-Knuth" - # parameterize("^très|Jolie-- ", preserve_case: true) # => "tres-Jolie" - # - # It preserves dashes and underscores unless they are used as separators: - # - # parameterize("^très|Jolie__ ") # => "tres-jolie__" - # parameterize("^très|Jolie-- ", separator: "_") # => "tres_jolie--" - # parameterize("^très_Jolie-- ", separator: ".") # => "tres_jolie--" - # - # If the optional parameter +locale+ is specified, - # the word will be parameterized as a word of that language. - # By default, this parameter is set to nil and it will use - # the configured I18n.locale. - def parameterize(string, separator: "-", preserve_case: false, locale: nil) - separator ||= "" - - # Replace accented chars with their ASCII equivalents. - parameterized_string = transliterate(string, locale: locale) - - # Turn unwanted chars into the separator. - parameterized_string.gsub!(/[^a-z0-9\-_]+/i, separator) - - unless separator.empty? - # No more than one of the separator in a row. - if separator.length == 1 - parameterized_string.squeeze!(separator) - else - re_sep = Regexp.escape(separator) - parameterized_string.gsub!(/#{re_sep}{2,}/, separator) - end - # Remove leading/trailing separator. - parameterized_string.delete_prefix!(separator) - parameterized_string.delete_suffix!(separator) - end - - parameterized_string.downcase! unless preserve_case - parameterized_string - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/isolated_execution_state.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/isolated_execution_state.rb deleted file mode 100644 index 0be6217..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/isolated_execution_state.rb +++ /dev/null @@ -1,76 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module IsolatedExecutionState # :nodoc: - @isolation_level = nil - - Thread.attr_accessor :active_support_execution_state - Fiber.attr_accessor :active_support_execution_state - - class << self - attr_reader :isolation_level, :scope - - def isolation_level=(level) - return if level == @isolation_level - - unless %i(thread fiber).include?(level) - raise ArgumentError, "isolation_level must be `:thread` or `:fiber`, got: `#{level.inspect}`" - end - - clear if @isolation_level - - @scope = - case level - when :thread; Thread - when :fiber; Fiber - end - - @isolation_level = level - end - - def [](key) - if state = @scope.current.active_support_execution_state - state[key] - end - end - - def []=(key, value) - state = (@scope.current.active_support_execution_state ||= {}) - state[key] = value - end - - def key?(key) - @scope.current.active_support_execution_state&.key?(key) - end - - def delete(key) - @scope.current.active_support_execution_state&.delete(key) - end - - def clear - @scope.current.active_support_execution_state&.clear - end - - def context - scope.current - end - - def share_with(other, except: [], &block) - # Action Controller streaming spawns a new thread and copy thread locals. - # We do the same here for backward compatibility, but this is very much a hack - # and streaming should be rethought. - if state = other.active_support_execution_state - copied_state = state.dup - Array(except).each { |key| copied_state.delete(key) } - end - - old_state, context.active_support_execution_state = context.active_support_execution_state, copied_state - block.call - ensure - context.active_support_execution_state = old_state - end - end - - self.isolation_level = :thread - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/json.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/json.rb deleted file mode 100644 index d788717..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/json.rb +++ /dev/null @@ -1,4 +0,0 @@ -# frozen_string_literal: true - -require "active_support/json/decoding" -require "active_support/json/encoding" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/json/decoding.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/json/decoding.rb deleted file mode 100644 index 65dcb7c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/json/decoding.rb +++ /dev/null @@ -1,82 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/module/attribute_accessors" -require "active_support/core_ext/module/delegation" -require "json" - -module ActiveSupport - # Look for and parse JSON strings that look like ISO 8601 times. - mattr_accessor :parse_json_times - - module JSON - # matches YAML-formatted dates - DATE_REGEX = /\A\d{4}-\d{2}-\d{2}\z/ - DATETIME_REGEX = /\A(?:\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}[T \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?(([ \t]*)Z|[-+]\d{2}?(:\d{2})?)?)\z/ - - class << self - # Parses a JSON string (JavaScript Object Notation) into a Ruby object. - # See http://www.json.org for more info. - # - # ActiveSupport::JSON.decode("{\"team\":\"rails\",\"players\":\"36\"}") - # # => {"team" => "rails", "players" => "36"} - # ActiveSupport::JSON.decode("2.39") - # # => 2.39 - def decode(json, options = nil) - data = if options - ::JSON.parse(json, **options) - else - ::JSON.parse(json) - end - - if ActiveSupport.parse_json_times - convert_dates_from(data) - else - data - end - end - alias_method :load, :decode - - # Returns the class of the error that will be raised when there is an - # error in decoding JSON. Using this method means you won't directly - # depend on the ActiveSupport's JSON implementation, in case it changes - # in the future. - # - # begin - # obj = ActiveSupport::JSON.decode(some_string) - # rescue ActiveSupport::JSON.parse_error - # Rails.logger.warn("Attempted to decode invalid JSON: #{some_string}") - # end - def parse_error - ::JSON::ParserError - end - - private - def convert_dates_from(data) - case data - when nil - nil - when DATE_REGEX - begin - Date.parse(data) - rescue ArgumentError - data - end - when DATETIME_REGEX - begin - Time.zone.parse(data) - rescue ArgumentError - data - end - when Array - data.map! { |d| convert_dates_from(d) } - when Hash - data.transform_values! do |value| - convert_dates_from(value) - end - else - data - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/json/encoding.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/json/encoding.rb deleted file mode 100644 index ffad190..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/json/encoding.rb +++ /dev/null @@ -1,268 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/json" -require "active_support/core_ext/module/delegation" - -module ActiveSupport - class << self - delegate :use_standard_json_time_format, :use_standard_json_time_format=, - :time_precision, :time_precision=, - :escape_html_entities_in_json, :escape_html_entities_in_json=, - :escape_js_separators_in_json, :escape_js_separators_in_json=, - :json_encoder, :json_encoder=, - to: :'ActiveSupport::JSON::Encoding' - end - - module JSON - class << self - # Dumps objects in JSON (JavaScript Object Notation). - # See http://www.json.org for more info. - # - # ActiveSupport::JSON.encode({ team: 'rails', players: '36' }) - # # => "{\"team\":\"rails\",\"players\":\"36\"}" - # - # By default, it generates JSON that is safe to include in JavaScript, as - # it escapes U+2028 (Line Separator) and U+2029 (Paragraph Separator): - # - # ActiveSupport::JSON.encode({ key: "\u2028" }) - # # => "{\"key\":\"\\u2028\"}" - # - # By default, it also generates JSON that is safe to include in HTML, as - # it escapes <, >, and &: - # - # ActiveSupport::JSON.encode({ key: "<>&" }) - # # => "{\"key\":\"\\u003c\\u003e\\u0026\"}" - # - # This behavior can be changed with the +escape_html_entities+ option, or the - # global escape_html_entities_in_json configuration option. - # - # ActiveSupport::JSON.encode({ key: "<>&" }, escape_html_entities: false) - # # => "{\"key\":\"<>&\"}" - # - # For performance reasons, you can set the +escape+ option to false, - # which will skip all escaping: - # - # ActiveSupport::JSON.encode({ key: "\u2028<>&" }, escape: false) - # # => "{\"key\":\"\u2028<>&\"}" - def encode(value, options = nil) - if options.nil? || options.empty? - Encoding.encode_without_options(value) - elsif options == { escape: false }.freeze - Encoding.encode_without_escape(value) - else - Encoding.json_encoder.new(options).encode(value) - end - end - alias_method :dump, :encode - end - - module Encoding # :nodoc: - U2028 = -"\u2028".b - U2029 = -"\u2029".b - - ESCAPED_CHARS = { - U2028 => '\u2028'.b, - U2029 => '\u2029'.b, - ">".b => '\u003e'.b, - "<".b => '\u003c'.b, - "&".b => '\u0026'.b, - } - - HTML_ENTITIES_REGEX = Regexp.union(*(ESCAPED_CHARS.keys - [U2028, U2029])) - FULL_ESCAPE_REGEX = Regexp.union(*ESCAPED_CHARS.keys) - JS_SEPARATORS_REGEX = Regexp.union(U2028, U2029) - - class JSONGemEncoder # :nodoc: - attr_reader :options - - def initialize(options = nil) - @options = options || {} - end - - # Encode the given object into a JSON string - def encode(value) - unless options.empty? - value = value.as_json(options.dup.freeze) - end - json = stringify(jsonify(value)) - - return json unless @options.fetch(:escape, true) - - json.force_encoding(::Encoding::BINARY) - if @options.fetch(:escape_html_entities, Encoding.escape_html_entities_in_json) - if Encoding.escape_js_separators_in_json - json.gsub!(FULL_ESCAPE_REGEX, ESCAPED_CHARS) - else - json.gsub!(HTML_ENTITIES_REGEX, ESCAPED_CHARS) - end - elsif Encoding.escape_js_separators_in_json - json.gsub!(JS_SEPARATORS_REGEX, ESCAPED_CHARS) - end - json.force_encoding(::Encoding::UTF_8) - end - - private - # Convert an object into a "JSON-ready" representation composed of - # primitives like Hash, Array, String, Symbol, Numeric, - # and +true+/+false+/+nil+. - # Recursively calls #as_json to the object to recursively build a - # fully JSON-ready object. - # - # This allows developers to implement #as_json without having to - # worry about what base types of objects they are allowed to return - # or having to remember to call #as_json recursively. - # - # Note: the +options+ hash passed to +object.to_json+ is only passed - # to +object.as_json+, not any of this method's recursive +#as_json+ - # calls. - def jsonify(value) - case value - when String, Integer, Symbol, nil, true, false - value - when Numeric - value.as_json - when Hash - result = {} - value.each do |k, v| - k = k.to_s unless Symbol === k || String === k - result[k] = jsonify(v) - end - result - when Array - value.map { |v| jsonify(v) } - else - if defined?(::JSON::Fragment) && ::JSON::Fragment === value - value - else - jsonify value.as_json - end - end - end - - # Encode a "jsonified" Ruby data structure using the JSON gem - def stringify(jsonified) - ::JSON.generate(jsonified) - end - end - - # ruby/json 2.14.x yields non-String keys but doesn't let us know it's a key - if defined?(::JSON::Coder) && Gem::Version.new(::JSON::VERSION) >= Gem::Version.new("2.15.2") - class JSONGemCoderEncoder # :nodoc: - JSON_NATIVE_TYPES = [Hash, Array, Float, String, Symbol, Integer, NilClass, TrueClass, FalseClass, ::JSON::Fragment].freeze - CODER = ::JSON::Coder.new do |value, is_key| - # Serialize non-String/Symbol keys via #to_s based on the key's own type, - # mirroring the legacy `jsonify` encoder. (#as_json is intentionally not - # consulted here: Time#as_json returns an ISO8601 String, yet the key must - # still be emitted via #to_s for backward compatibility.) - if is_key - # Keep compatibility by calling to_s on non-String keys - if Symbol === value - next value # Symbol#to_s needlessly allocate a string. - else - next value.to_s - end - end - - json_value = value.as_json - - # Handle objects returning self from as_json - if json_value.equal?(value) - next ::JSON::Fragment.new(::JSON.generate(json_value)) - end - # Handle objects not returning JSON-native types from as_json - count = 5 - until JSON_NATIVE_TYPES.include?(json_value.class) - raise SystemStackError if count == 0 - json_value = json_value.as_json - count -= 1 - end - json_value - end - - - def initialize(options = nil) - if options - options = options.dup - @escape = options.delete(:escape) { true } - @options = options.freeze - else - @escape = true - @options = {}.freeze - end - end - - # Encode the given object into a JSON string - def encode(value) - value = value.as_json(@options) unless @options.empty? - - json = CODER.dump(value) - - return json unless @escape - - json.force_encoding(::Encoding::BINARY) - if @options.fetch(:escape_html_entities, Encoding.escape_html_entities_in_json) - if Encoding.escape_js_separators_in_json - json.gsub!(FULL_ESCAPE_REGEX, ESCAPED_CHARS) - else - json.gsub!(HTML_ENTITIES_REGEX, ESCAPED_CHARS) - end - elsif Encoding.escape_js_separators_in_json - json.gsub!(JS_SEPARATORS_REGEX, ESCAPED_CHARS) - end - json.force_encoding(::Encoding::UTF_8) - end - end - end - - class << self - # If true, use ISO 8601 format for dates and times. Otherwise, fall back - # to the Active Support legacy format. - attr_accessor :use_standard_json_time_format - - # If true, encode >, <, & as escaped unicode sequences (e.g. > as \u003e) - # as a safety measure. - attr_accessor :escape_html_entities_in_json - - # If true, encode LINE SEPARATOR (U+2028) and PARAGRAPH SEPARATOR (U+2029) - # as escaped unicode sequences ('\u2028' and '\u2029'). - # Historically these characters were not valid inside JavaScript strings - # but that changed in ECMAScript 2019. As such it's no longer a concern in - # modern browsers: https://caniuse.com/mdn-javascript_builtins_json_json_superset. - attr_accessor :escape_js_separators_in_json - - # Sets the precision of encoded time values. - # Defaults to 3 (equivalent to millisecond precision) - attr_accessor :time_precision - - # Sets the encoder used by \Rails to encode Ruby objects into JSON strings - # in +Object#to_json+ and +ActiveSupport::JSON.encode+. - attr_reader :json_encoder - - def json_encoder=(encoder) - @json_encoder = encoder - @encoder_without_options = encoder.new - @encoder_without_escape = encoder.new(escape: false) - end - - def encode_without_options(value) # :nodoc: - @encoder_without_options.encode(value) - end - - def encode_without_escape(value) # :nodoc: - @encoder_without_escape.encode(value) - end - end - - self.use_standard_json_time_format = true - self.escape_html_entities_in_json = true - self.escape_js_separators_in_json = true - self.json_encoder = - if defined?(JSONGemCoderEncoder) - JSONGemCoderEncoder - else - JSONGemEncoder - end - self.time_precision = 3 - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/key_generator.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/key_generator.rb deleted file mode 100644 index 8e75fba..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/key_generator.rb +++ /dev/null @@ -1,66 +0,0 @@ -# frozen_string_literal: true - -require "concurrent/map" -require "openssl" - -module ActiveSupport - # = Key Generator - # - # KeyGenerator is a simple wrapper around OpenSSL's implementation of PBKDF2. - # It can be used to derive a number of keys for various purposes from a given secret. - # This lets \Rails applications have a single secure secret, but avoid reusing that - # key in multiple incompatible contexts. - class KeyGenerator - class << self - def hash_digest_class=(klass) - if klass.kind_of?(Class) && klass < OpenSSL::Digest - @hash_digest_class = klass - else - raise ArgumentError, "#{klass} is expected to be an OpenSSL::Digest subclass" - end - end - - def hash_digest_class - @hash_digest_class ||= OpenSSL::Digest::SHA1 - end - end - - def initialize(secret, options = {}) - @secret = secret - # The default iterations are higher than required for our key derivation uses - # on the off chance someone uses this for password storage - @iterations = options[:iterations] || 2**16 - # Also allow configuration here so people can use this to build a rotation - # scheme when switching the digest class. - @hash_digest_class = options[:hash_digest_class] || self.class.hash_digest_class - end - - # Returns a derived key suitable for use. The default +key_size+ is chosen - # to be compatible with the default settings of ActiveSupport::MessageVerifier. - # i.e. OpenSSL::Digest::SHA1#block_length - def generate_key(salt, key_size = 64) - OpenSSL::PKCS5.pbkdf2_hmac(@secret, salt, @iterations, key_size, @hash_digest_class.new) - end - - def inspect # :nodoc: - "#<#{self.class.name}:#{'%#016x' % (object_id << 1)}>" - end - end - - # = Caching Key Generator - # - # CachingKeyGenerator is a wrapper around KeyGenerator which allows users to avoid - # re-executing the key generation process when it's called using the same +salt+ and - # +key_size+. - class CachingKeyGenerator - def initialize(key_generator) - @key_generator = key_generator - @cache_keys = Concurrent::Map.new - end - - # Returns a derived key suitable for use. - def generate_key(*args) - @cache_keys[args.join("|")] ||= @key_generator.generate_key(*args) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/lazy_load_hooks.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/lazy_load_hooks.rb deleted file mode 100644 index 456e7be..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/lazy_load_hooks.rb +++ /dev/null @@ -1,107 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # = Lazy Load Hooks - # - # LazyLoadHooks allows \Rails to lazily load a lot of components and thus - # making the app boot faster. Because of this feature now there is no need to - # require +ActiveRecord::Base+ at boot time purely to apply - # configuration. Instead a hook is registered that applies configuration once - # +ActiveRecord::Base+ is loaded. Here +ActiveRecord::Base+ is - # used as example but this feature can be applied elsewhere too. - # - # Here is an example where on_load method is called to register a hook. - # - # initializer 'active_record.initialize_timezone' do - # ActiveSupport.on_load(:active_record) do - # self.time_zone_aware_attributes = true - # self.default_timezone = :utc - # end - # end - # - # When the entirety of +ActiveRecord::Base+ has been - # evaluated then run_load_hooks is invoked. The very last line of - # +ActiveRecord::Base+ is: - # - # ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base) - # - # run_load_hooks will then execute all the hooks that were registered - # with the on_load method. In the case of the above example, it will - # execute the block of code that is in the +initializer+. - # - # Registering a hook that has already run results in that hook executing - # immediately. This allows hooks to be nested for code that relies on - # multiple lazily loaded components: - # - # initializer "action_text.renderer" do - # ActiveSupport.on_load(:action_controller_base) do - # ActiveSupport.on_load(:action_text_content) do - # self.default_renderer = Class.new(ActionController::Base).renderer - # end - # end - # end - module LazyLoadHooks - def self.extended(base) # :nodoc: - base.class_eval do - @load_hooks = Hash.new { |h, k| h[k] = [] } - @loaded = Hash.new { |h, k| h[k] = [] } - @run_once = Hash.new { |h, k| h[k] = [] } - end - end - - # Declares a block that will be executed when a \Rails component is fully - # loaded. If the component has already loaded, the block is executed - # immediately. - # - # ==== Options - # - # * :yield - Yields the object that run_load_hooks to +block+. - # * :run_once - Given +block+ will run only once. - def on_load(name, options = {}, &block) - @loaded[name].each do |base| - execute_hook(name, base, options, block) - end - - @load_hooks[name] << [block, options] - end - - # Executes all blocks registered to +name+ via on_load, using +base+ as the - # evaluation context. - # - # ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base) - # - # In the case of the above example, it will execute all hooks registered - # for +:active_record+ within the class +ActiveRecord::Base+. - def run_load_hooks(name, base = Object) - @loaded[name] << base - @load_hooks[name].each do |hook, options| - execute_hook(name, base, options, hook) - end - end - - private - def with_execution_control(name, block, once) - unless @run_once[name].include?(block) - @run_once[name] << block if once - - yield - end - end - - def execute_hook(name, base, options, block) - with_execution_control(name, block, options[:run_once]) do - if options[:yield] - block.call(base) - else - if base.is_a?(Module) - base.class_eval(&block) - else - base.instance_eval(&block) - end - end - end - end - end - - extend LazyLoadHooks -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/locale/en.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/locale/en.rb deleted file mode 100644 index 29eb9de..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/locale/en.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -{ - en: { - number: { - nth: { - ordinals: lambda do |_key, options| - number = options[:number] - case number - when 1; "st" - when 2; "nd" - when 3; "rd" - when 4, 5, 6, 7, 8, 9, 10, 11, 12, 13; "th" - else - num_modulo = number.to_i.abs % 100 - num_modulo %= 10 if num_modulo > 13 - case num_modulo - when 1; "st" - when 2; "nd" - when 3; "rd" - else "th" - end - end - end, - - ordinalized: lambda do |_key, options| - number = options[:number] - "#{number}#{ActiveSupport::Inflector.ordinal(number)}" - end - } - } - } -} diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/locale/en.yml b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/locale/en.yml deleted file mode 100644 index 5213420..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/locale/en.yml +++ /dev/null @@ -1,141 +0,0 @@ -en: - date: - formats: - # Use the strftime parameters for formats. - # When no format has been given, it uses default. - # You can provide other formats here if you like! - default: "%Y-%m-%d" - short: "%b %d" - long: "%B %d, %Y" - - day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday] - abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat] - - # Don't forget the nil at the beginning; there's no such thing as a 0th month - month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December] - abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec] - # Used in date_select and datetime_select. - order: - - year - - month - - day - - time: - formats: - default: "%a, %d %b %Y %H:%M:%S %z" - short: "%d %b %H:%M" - long: "%B %d, %Y %H:%M" - am: "am" - pm: "pm" - -# Used in array.to_sentence. - support: - array: - words_connector: ", " - two_words_connector: " and " - last_word_connector: ", and " - number: - # Used in NumberHelper.number_to_delimited() - # These are also the defaults for 'currency', 'percentage', 'precision', and 'human' - format: - # Sets the separator between the units, for more precision (e.g. 1.0 / 2.0 == 0.5) - separator: "." - # Delimits thousands (e.g. 1,000,000 is a million) (always in groups of three) - delimiter: "," - # Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00) - precision: 3 - # Determine how rounding is performed (see BigDecimal::mode) - round_mode: default - # If set to true, precision will mean the number of significant digits instead - # of the number of decimal digits (1234 with precision 2 becomes 1200, 1.23543 becomes 1.2) - significant: false - # If set, the zeros after the decimal separator will always be stripped (e.g.: 1.200 will be 1.2) - strip_insignificant_zeros: false - - # Used in NumberHelper.number_to_currency() - currency: - format: - # Where is the currency sign? %u is the currency unit, %n is the number (default: $5.00) - format: "%u%n" - negative_format: "-%u%n" - unit: "$" - # These six are to override number.format and are optional - separator: "." - delimiter: "," - precision: 2 - # round_mode: - significant: false - strip_insignificant_zeros: false - - # Used in NumberHelper.number_to_percentage() - percentage: - format: - # These five are to override number.format and are optional - # separator: - delimiter: "" - # precision: - # significant: false - # strip_insignificant_zeros: false - format: "%n%" - - # Used in NumberHelper.number_to_rounded() - precision: - format: - # These five are to override number.format and are optional - # separator: - delimiter: "" - # precision: - # significant: false - # strip_insignificant_zeros: false - - # Used in NumberHelper.number_to_human_size() and NumberHelper.number_to_human() - human: - format: - # These six are to override number.format and are optional - # separator: - delimiter: "" - precision: 3 - # round_mode: - significant: true - strip_insignificant_zeros: true - # Used in number_to_human_size() - storage_units: - # Storage units output formatting. - # %u is the storage unit, %n is the number (default: 2 MB) - format: "%n %u" - units: - byte: - one: "Byte" - other: "Bytes" - kb: "KB" - mb: "MB" - gb: "GB" - tb: "TB" - pb: "PB" - eb: "EB" - zb: "ZB" - # Used in NumberHelper.number_to_human() - decimal_units: - format: "%n %u" - # Decimal units output formatting - # By default we will only quantify some of the exponents - # but the commented ones might be defined or overridden - # by the user. - units: - # femto: Quadrillionth - # pico: Trillionth - # nano: Billionth - # micro: Millionth - # mili: Thousandth - # centi: Hundredth - # deci: Tenth - unit: "" - # ten: - # one: Ten - # other: Tens - # hundred: Hundred - thousand: Thousand - million: Million - billion: Billion - trillion: Trillion - quadrillion: Quadrillion diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/log_subscriber.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/log_subscriber.rb deleted file mode 100644 index 42a5621..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/log_subscriber.rb +++ /dev/null @@ -1,188 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/module/attribute_accessors" -require "active_support/core_ext/class/attribute" -require "active_support/core_ext/enumerable" -require "active_support/subscriber" -require "active_support/deprecation/proxy_wrappers" - -module ActiveSupport - # = Active Support Log \Subscriber - # - # +ActiveSupport::LogSubscriber+ is an object set to consume - # ActiveSupport::Notifications with the sole purpose of logging them. - # The log subscriber dispatches notifications to a registered object based - # on its given namespace. - # - # An example would be Active Record log subscriber responsible for logging - # queries: - # - # module ActiveRecord - # class LogSubscriber < ActiveSupport::LogSubscriber - # attach_to :active_record - # - # def sql(event) - # info "#{event.payload[:name]} (#{event.duration}) #{event.payload[:sql]}" - # end - # end - # end - # - # ActiveRecord::LogSubscriber.logger must be set as well, but it is assigned - # automatically in a \Rails environment. - # - # After configured, whenever a "sql.active_record" notification is - # published, it will properly dispatch the event - # (ActiveSupport::Notifications::Event) to the +sql+ method. - # - # Being an ActiveSupport::Notifications consumer, - # +ActiveSupport::LogSubscriber+ exposes a simple interface to check if - # instrumented code raises an exception. It is common to log a different - # message in case of an error, and this can be achieved by extending - # the previous example: - # - # module ActiveRecord - # class LogSubscriber < ActiveSupport::LogSubscriber - # def sql(event) - # exception = event.payload[:exception] - # - # if exception - # exception_object = event.payload[:exception_object] - # - # error "[ERROR] #{event.payload[:name]}: #{exception.join(', ')} " \ - # "(#{exception_object.backtrace.first})" - # else - # # standard logger code - # end - # end - # end - # end - # - # +ActiveSupport::LogSubscriber+ also has some helpers to deal with - # logging. For example, ActiveSupport::LogSubscriber.flush_all! will ensure - # that all logs are flushed, and it is called in Rails::Rack::Logger after a - # request finishes. - class LogSubscriber < Subscriber - # ANSI sequence modes - MODES = { - clear: 0, - bold: 1, - italic: 3, - underline: 4, - } - - # ANSI sequence colors - BLACK = "\e[30m" - RED = "\e[31m" - GREEN = "\e[32m" - YELLOW = "\e[33m" - BLUE = "\e[34m" - MAGENTA = "\e[35m" - CYAN = "\e[36m" - WHITE = "\e[37m" - - mattr_accessor :colorize_logging, default: true - class_attribute :log_levels, instance_accessor: false, default: {} # :nodoc: - - LEVEL_CHECKS = { - debug: -> (logger) { !logger.debug? }, - info: -> (logger) { !logger.info? }, - error: -> (logger) { !logger.error? }, - } - - class << self - def logger - @logger ||= if defined?(Rails) && Rails.respond_to?(:logger) - Rails.logger - end - end - - def attach_to(...) # :nodoc: - result = super - set_event_levels - result - end - - attr_writer :logger - - def log_subscribers - subscribers - end - - # Flush all log_subscribers' logger. - def flush_all! - logger.flush if logger.respond_to?(:flush) - end - - private - def fetch_public_methods(subscriber, inherit_all) - subscriber.public_methods(inherit_all) - LogSubscriber.public_instance_methods(true) - end - - def set_event_levels - if subscriber - subscriber.event_levels = log_levels.transform_keys { |k| "#{k}.#{namespace}" } - end - end - - def subscribe_log_level(method, level) - self.log_levels = log_levels.merge(method => LEVEL_CHECKS.fetch(level)) - set_event_levels - end - end - - def initialize - super - @event_levels = {} - end - - def logger - LogSubscriber.logger - end - - def silenced?(event) - logger.nil? || @event_levels[event]&.call(logger) - end - - def call(event) - super if logger - rescue => e - log_exception(event.name, e) - end - - attr_writer :event_levels # :nodoc: - - private - %w(info debug warn error fatal unknown).each do |level| - class_eval <<-METHOD, __FILE__, __LINE__ + 1 - def #{level}(progname = nil, &block) - logger.#{level}(progname, &block) if logger - end - METHOD - end - - # Set color by using a symbol or one of the defined constants. Set modes - # by specifying bold, italic, or underline options. Inspired by Highline, - # this method will automatically clear formatting at the end of the returned String. - def color(text, color, mode_options = {}) # :doc: - return text unless colorize_logging - color = self.class.const_get(color.upcase) if color.is_a?(Symbol) - mode = mode_from(mode_options) - clear = "\e[#{MODES[:clear]}m" - "#{mode}#{color}#{text}#{clear}" - end - - def mode_from(options) - modes = MODES.values_at(*options.compact_blank.keys) - - "\e[#{modes.join(";")}m" if modes.any? - end - - def log_exception(name, e) - ActiveSupport.error_reporter.report(e, source: name) - - if logger - logger.error "Could not log #{name.inspect} event. #{e.class}: #{e.message} #{e.backtrace}" - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/log_subscriber/test_helper.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/log_subscriber/test_helper.rb deleted file mode 100644 index b528a7f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/log_subscriber/test_helper.rb +++ /dev/null @@ -1,106 +0,0 @@ -# frozen_string_literal: true - -require "active_support/log_subscriber" -require "active_support/logger" -require "active_support/notifications" - -module ActiveSupport - class LogSubscriber - # Provides some helpers to deal with testing log subscribers by setting up - # notifications. Take for instance Active Record subscriber tests: - # - # class SyncLogSubscriberTest < ActiveSupport::TestCase - # include ActiveSupport::LogSubscriber::TestHelper - # - # setup do - # ActiveRecord::LogSubscriber.attach_to(:active_record) - # end - # - # def test_basic_query_logging - # Developer.all.to_a - # wait - # assert_equal 1, @logger.logged(:debug).size - # assert_match(/Developer Load/, @logger.logged(:debug).last) - # assert_match(/SELECT \* FROM "developers"/, @logger.logged(:debug).last) - # end - # end - # - # All you need to do is to ensure that your log subscriber is added to - # Rails::Subscriber, as in the second line of the code above. The test - # helpers are responsible for setting up the queue and subscriptions, and - # turning colors in logs off. - # - # The messages are available in the @logger instance, which is a logger with - # limited powers (it actually does not send anything to your output), and - # you can collect them doing @logger.logged(level), where level is the level - # used in logging, like info, debug, warn, and so on. - module TestHelper - def setup # :nodoc: - @logger = MockLogger.new - @notifier = ActiveSupport::Notifications::Fanout.new - - ActiveSupport::LogSubscriber.colorize_logging = false - - @old_notifier = ActiveSupport::Notifications.notifier - set_logger(@logger) - ActiveSupport::Notifications.notifier = @notifier - end - - def teardown # :nodoc: - set_logger(nil) - ActiveSupport::Notifications.notifier = @old_notifier - end - - class MockLogger - include ActiveSupport::Logger::Severity - - attr_reader :flush_count - attr_accessor :level - - def initialize(level = DEBUG) - @flush_count = 0 - @level = level - @logged = Hash.new { |h, k| h[k] = [] } - end - - def method_missing(level, message = nil) - if block_given? - @logged[level] << yield - else - @logged[level] << message - end - end - - def logged(level) - @logged[level].compact.map { |l| l.to_s.strip } - end - - def flush - @flush_count += 1 - end - - ActiveSupport::Logger::Severity.constants.each do |severity| - class_eval <<-EOT, __FILE__, __LINE__ + 1 - def #{severity.downcase}? - #{severity} >= @level - end - EOT - end - end - - # Wait notifications to be published. - def wait - @notifier.wait - end - - # Overwrite if you use another logger in your log subscriber. - # - # def logger - # ActiveRecord::Base.logger = @logger - # end - def set_logger(logger) - ActiveSupport::LogSubscriber.logger = logger - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/logger.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/logger.rb deleted file mode 100644 index 09ea81f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/logger.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -require "active_support/logger_silence" -require "active_support/logger_thread_safe_level" -require "logger" - -module ActiveSupport - class Logger < ::Logger - include LoggerSilence - - # Returns true if the logger destination matches one of the sources - # - # logger = Logger.new(STDOUT) - # ActiveSupport::Logger.logger_outputs_to?(logger, STDOUT) - # # => true - # - # logger = Logger.new('/var/log/rails.log') - # ActiveSupport::Logger.logger_outputs_to?(logger, '/var/log/rails.log') - # # => true - def self.logger_outputs_to?(logger, *sources) - loggers = if logger.is_a?(BroadcastLogger) - logger.broadcasts - else - [logger] - end - - logdevs = loggers.map { |logger| logger.instance_variable_get(:@logdev) } - logger_sources = logdevs.filter_map { |logdev| logdev.try(:filename) || logdev.try(:dev) } - - normalize_sources(sources).intersect?(normalize_sources(logger_sources)) - end - - def initialize(*args, **kwargs) - super - @formatter ||= SimpleFormatter.new - end - - # Simple formatter which only displays the message. - class SimpleFormatter < ::Logger::Formatter - # This method is invoked when a log event occurs - def call(severity, timestamp, progname, msg) - "#{String === msg ? msg : msg.inspect}\n" - end - end - - private - def self.normalize_sources(sources) - sources.map do |source| - source = source.path if source.respond_to?(:path) - source = File.realpath(source) if source.is_a?(String) && File.exist?(source) - source - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/logger_silence.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/logger_silence.rb deleted file mode 100644 index 8567eff..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/logger_silence.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -require "active_support/concern" -require "active_support/core_ext/module/attribute_accessors" -require "active_support/logger_thread_safe_level" - -module ActiveSupport - module LoggerSilence - extend ActiveSupport::Concern - - included do - cattr_accessor :silencer, default: true - include ActiveSupport::LoggerThreadSafeLevel - end - - # Silences the logger for the duration of the block. - def silence(severity = Logger::ERROR) - silencer ? log_at(severity) { yield self } : yield(self) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/logger_thread_safe_level.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/logger_thread_safe_level.rb deleted file mode 100644 index 71d32d5..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/logger_thread_safe_level.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -require "active_support/concern" -require "logger" - -module ActiveSupport - module LoggerThreadSafeLevel # :nodoc: - extend ActiveSupport::Concern - - def initialize(...) - super - @local_level_key = :"logger_thread_safe_level_#{object_id}" - end - - def local_level - IsolatedExecutionState[local_level_key] - end - - def local_level=(level) - case level - when Integer - when Symbol - level = Logger::Severity.const_get(level.to_s.upcase) - when nil - else - raise ArgumentError, "Invalid log level: #{level.inspect}" - end - if level.nil? - IsolatedExecutionState.delete(local_level_key) - else - IsolatedExecutionState[local_level_key] = level - end - end - - def level - local_level || super - end - - # Change the thread-local level for the duration of the given block. - def log_at(level) - old_local_level, self.local_level = local_level, level - yield - ensure - self.local_level = old_local_level - end - - private - attr_reader :local_level_key - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_encryptor.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_encryptor.rb deleted file mode 100644 index af0b20e..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_encryptor.rb +++ /dev/null @@ -1,374 +0,0 @@ -# frozen_string_literal: true - -require "openssl" -require "base64" -require "active_support/core_ext/module/attribute_accessors" -require "active_support/messages/codec" -require "active_support/messages/rotator" -require "active_support/message_verifier" - -module ActiveSupport - # = Active Support Message Encryptor - # - # MessageEncryptor is a simple way to encrypt values which get stored - # somewhere you don't trust. - # - # The cipher text and initialization vector are base64 encoded and returned - # to you. - # - # This can be used in situations similar to the MessageVerifier, but - # where you don't want users to be able to determine the value of the payload. - # - # len = ActiveSupport::MessageEncryptor.key_len - # salt = SecureRandom.random_bytes(len) - # key = ActiveSupport::KeyGenerator.new('password').generate_key(salt, len) # => "\x89\xE0\x156\xAC..." - # crypt = ActiveSupport::MessageEncryptor.new(key) # => # - # encrypted_data = crypt.encrypt_and_sign('my secret data') # => "NlFBTTMwOUV5UlA1QlNEN2xkY2d6eThYWWh..." - # crypt.decrypt_and_verify(encrypted_data) # => "my secret data" - # - # The +decrypt_and_verify+ method will raise an - # +ActiveSupport::MessageEncryptor::InvalidMessage+ exception if the data - # provided cannot be decrypted or verified. - # - # crypt.decrypt_and_verify('not encrypted data') # => ActiveSupport::MessageEncryptor::InvalidMessage - # - # === Confining messages to a specific purpose - # - # By default any message can be used throughout your app. But they can also be - # confined to a specific +:purpose+. - # - # token = crypt.encrypt_and_sign("this is the chair", purpose: :login) - # - # Then that same purpose must be passed when verifying to get the data back out: - # - # crypt.decrypt_and_verify(token, purpose: :login) # => "this is the chair" - # crypt.decrypt_and_verify(token, purpose: :shipping) # => nil - # crypt.decrypt_and_verify(token) # => nil - # - # Likewise, if a message has no purpose it won't be returned when verifying with - # a specific purpose. - # - # token = crypt.encrypt_and_sign("the conversation is lively") - # crypt.decrypt_and_verify(token, purpose: :scare_tactics) # => nil - # crypt.decrypt_and_verify(token) # => "the conversation is lively" - # - # === Making messages expire - # - # By default messages last forever and verifying one year from now will still - # return the original value. But messages can be set to expire at a given - # time with +:expires_in+ or +:expires_at+. - # - # crypt.encrypt_and_sign(parcel, expires_in: 1.month) - # crypt.encrypt_and_sign(doowad, expires_at: Time.now.end_of_year) - # - # Then the messages can be verified and returned up to the expire time. - # Thereafter, verifying returns +nil+. - # - # === Rotating keys - # - # MessageEncryptor also supports rotating out old configurations by falling - # back to a stack of encryptors. Call +rotate+ to build and add an encryptor - # so +decrypt_and_verify+ will also try the fallback. - # - # By default any rotated encryptors use the values of the primary - # encryptor unless specified otherwise. - # - # You'd give your encryptor the new defaults: - # - # crypt = ActiveSupport::MessageEncryptor.new(@secret, cipher: "aes-256-gcm") - # - # Then gradually rotate the old values out by adding them as fallbacks. Any message - # generated with the old values will then work until the rotation is removed. - # - # crypt.rotate old_secret # Fallback to an old secret instead of @secret. - # crypt.rotate cipher: "aes-256-cbc" # Fallback to an old cipher instead of aes-256-gcm. - # - # Though if both the secret and the cipher was changed at the same time, - # the above should be combined into: - # - # crypt.rotate old_secret, cipher: "aes-256-cbc" - class MessageEncryptor < Messages::Codec - prepend Messages::Rotator - - cattr_accessor :use_authenticated_message_encryption, instance_accessor: false, default: false - - class << self - def default_cipher # :nodoc: - if use_authenticated_message_encryption - "aes-256-gcm" - else - "aes-256-cbc" - end - end - end - - module NullSerializer # :nodoc: - def self.load(value) - value - end - - def self.dump(value) - value - end - end - - class InvalidMessage < StandardError; end - OpenSSLCipherError = OpenSSL::Cipher::CipherError - - AUTH_TAG_LENGTH = 16 # :nodoc: - SEPARATOR = "--" # :nodoc: - - # Initialize a new MessageEncryptor. +secret+ must be at least as long as - # the cipher key size. For the default 'aes-256-gcm' cipher, this is 256 - # bits. If you are using a user-entered secret, you can generate a suitable - # key by using ActiveSupport::KeyGenerator or a similar key - # derivation function. - # - # The first additional parameter is used as the signature key for - # MessageVerifier. This allows you to specify keys to encrypt and sign - # data. Ignored when using an AEAD cipher like 'aes-256-gcm'. - # - # ActiveSupport::MessageEncryptor.new('secret', 'signature_secret') - # - # ==== Options - # - # [+:cipher+] - # Cipher to use. Can be any cipher returned by +OpenSSL::Cipher.ciphers+. - # Default is 'aes-256-gcm'. - # - # [+:digest+] - # Digest used for signing. Ignored when using an AEAD cipher like - # 'aes-256-gcm'. - # - # [+:serializer+] - # The serializer used to serialize message data. You can specify any - # object that responds to +dump+ and +load+, or you can choose from - # several preconfigured serializers: +:marshal+, +:json_allow_marshal+, - # +:json+, +:message_pack_allow_marshal+, +:message_pack+. - # - # The preconfigured serializers include a fallback mechanism to support - # multiple deserialization formats. For example, the +:marshal+ serializer - # will serialize using +Marshal+, but can deserialize using +Marshal+, - # ActiveSupport::JSON, or ActiveSupport::MessagePack. This makes it easy - # to migrate between serializers. - # - # The +:marshal+, +:json_allow_marshal+, and +:message_pack_allow_marshal+ - # serializers support deserializing using +Marshal+, but the others do - # not. Beware that +Marshal+ is a potential vector for deserialization - # attacks in cases where a message signing secret has been leaked. If - # possible, choose a serializer that does not support +Marshal+. - # - # The +:message_pack+ and +:message_pack_allow_marshal+ serializers use - # ActiveSupport::MessagePack, which can roundtrip some Ruby types that are - # not supported by JSON, and may provide improved performance. However, - # these require the +msgpack+ gem. - # - # When using \Rails, the default depends on +config.active_support.message_serializer+. - # Otherwise, the default is +:marshal+. - # - # [+:url_safe+] - # By default, MessageEncryptor generates RFC 4648 compliant strings - # which are not URL-safe. In other words, they can contain "+" and "/". - # If you want to generate URL-safe strings (in compliance with "Base 64 - # Encoding with URL and Filename Safe Alphabet" in RFC 4648), you can - # pass +true+. - # - # [+:force_legacy_metadata_serializer+] - # Whether to use the legacy metadata serializer, which serializes the - # message first, then wraps it in an envelope which is also serialized. This - # was the default in \Rails 7.0 and below. - # - # If you don't pass a truthy value, the default is set using - # +config.active_support.use_message_serializer_for_metadata+. - def initialize(secret, sign_secret = nil, **options) - super(**options) - @secret = secret - @cipher = options[:cipher] || self.class.default_cipher - @aead_mode = new_cipher.authenticated? - @verifier = if !@aead_mode - MessageVerifier.new(sign_secret || secret, **options, serializer: NullSerializer) - end - end - - # Encrypt and sign a message. We need to sign the message in order to avoid - # padding attacks. Reference: https://www.limited-entropy.com/padding-oracle-attacks/. - # - # ==== Options - # - # [+:expires_at+] - # The datetime at which the message expires. After this datetime, - # verification of the message will fail. - # - # message = encryptor.encrypt_and_sign("hello", expires_at: Time.now.tomorrow) - # encryptor.decrypt_and_verify(message) # => "hello" - # # 24 hours later... - # encryptor.decrypt_and_verify(message) # => nil - # - # [+:expires_in+] - # The duration for which the message is valid. After this duration has - # elapsed, verification of the message will fail. - # - # message = encryptor.encrypt_and_sign("hello", expires_in: 24.hours) - # encryptor.decrypt_and_verify(message) # => "hello" - # # 24 hours later... - # encryptor.decrypt_and_verify(message) # => nil - # - # [+:purpose+] - # The purpose of the message. If specified, the same purpose must be - # specified when verifying the message; otherwise, verification will fail. - # (See #decrypt_and_verify.) - def encrypt_and_sign(value, **options) - create_message(value, **options) - end - - # Decrypt and verify a message. We need to verify the message in order to - # avoid padding attacks. Reference: https://www.limited-entropy.com/padding-oracle-attacks/. - # - # ==== Options - # - # [+:purpose+] - # The purpose that the message was generated with. If the purpose does not - # match, +decrypt_and_verify+ will return +nil+. - # - # message = encryptor.encrypt_and_sign("hello", purpose: "greeting") - # encryptor.decrypt_and_verify(message, purpose: "greeting") # => "hello" - # encryptor.decrypt_and_verify(message) # => nil - # - # message = encryptor.encrypt_and_sign("bye") - # encryptor.decrypt_and_verify(message) # => "bye" - # encryptor.decrypt_and_verify(message, purpose: "greeting") # => nil - # - def decrypt_and_verify(message, **options) - catch_and_raise :invalid_message_format, as: InvalidMessage do - catch_and_raise :invalid_message_serialization, as: InvalidMessage do - catch_and_ignore :invalid_message_content do - read_message(message, **options) - end - end - end - end - - # Given a cipher, returns the key length of the cipher to help generate the key of desired size - def self.key_len(cipher = default_cipher) - OpenSSL::Cipher.new(cipher).key_len - end - - def create_message(value, **options) # :nodoc: - sign(encrypt(serialize_with_metadata(value, **options))) - end - - def read_message(message, **options) # :nodoc: - deserialize_with_metadata(decrypt(verify(message)), **options) - end - - def inspect # :nodoc: - "#<#{self.class.name}:#{'%#016x' % (object_id << 1)}>" - end - - private - def sign(data) - @verifier ? @verifier.create_message(data) : data - end - - def verify(data) - @verifier ? @verifier.read_message(data) : data - end - - def encrypt(data) - cipher = new_cipher - cipher.encrypt - cipher.key = @secret - - # Rely on OpenSSL for the initialization vector - iv = cipher.random_iv - cipher.auth_data = "" if aead_mode? - - encrypted_data = cipher.update(data) - encrypted_data << cipher.final - - parts = [encrypted_data, iv] - parts << cipher.auth_tag(AUTH_TAG_LENGTH) if aead_mode? - - join_parts(parts) - end - - def decrypt(encrypted_message) - cipher = new_cipher - encrypted_data, iv, auth_tag = extract_parts(encrypted_message) - - # Currently the OpenSSL bindings do not raise an error if auth_tag is - # truncated, which would allow an attacker to easily forge it. See - # https://github.com/ruby/openssl/issues/63 - if aead_mode? && auth_tag.bytesize != AUTH_TAG_LENGTH - throw :invalid_message_format, "truncated auth_tag" - end - - cipher.decrypt - cipher.key = @secret - cipher.iv = iv - if aead_mode? - cipher.auth_tag = auth_tag - cipher.auth_data = "" - end - - decrypted_data = cipher.update(encrypted_data) - decrypted_data << cipher.final - rescue OpenSSLCipherError => error - throw :invalid_message_format, error - end - - def length_after_encode(length_before_encode) - if @url_safe - (4 * length_before_encode / 3.0).ceil # length without padding - else - 4 * (length_before_encode / 3.0).ceil # length with padding - end - end - - def length_of_encoded_iv - @length_of_encoded_iv ||= length_after_encode(new_cipher.iv_len) - end - - def length_of_encoded_auth_tag - @length_of_encoded_auth_tag ||= length_after_encode(AUTH_TAG_LENGTH) - end - - def join_parts(parts) - parts.map! { |part| encode(part) }.join(SEPARATOR) - end - - def extract_part(encrypted_message, rindex, length) - index = rindex - length - - if encrypted_message[index - SEPARATOR.length, SEPARATOR.length] == SEPARATOR - encrypted_message[index, length] - else - throw :invalid_message_format, "missing separator" - end - end - - def extract_parts(encrypted_message) - parts = [] - rindex = encrypted_message.length - - if aead_mode? - parts << extract_part(encrypted_message, rindex, length_of_encoded_auth_tag) - rindex -= SEPARATOR.length + length_of_encoded_auth_tag - end - - parts << extract_part(encrypted_message, rindex, length_of_encoded_iv) - rindex -= SEPARATOR.length + length_of_encoded_iv - - parts << encrypted_message[0, rindex] - - parts.reverse!.map! { |part| decode(part) } - end - - def new_cipher - OpenSSL::Cipher.new(@cipher) - end - - attr_reader :aead_mode - alias :aead_mode? :aead_mode - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_encryptors.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_encryptors.rb deleted file mode 100644 index 813b17e..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_encryptors.rb +++ /dev/null @@ -1,193 +0,0 @@ -# frozen_string_literal: true - -require "active_support/messages/rotation_coordinator" - -module ActiveSupport - class MessageEncryptors < Messages::RotationCoordinator - ## - # :attr_accessor: transitional - # - # If true, the first two rotation option sets are swapped when building - # message encryptors. For example, with the following configuration, message - # encryptors will encrypt messages using serializer: Marshal, url_safe: true, - # and will able to decrypt messages that were encrypted using any of the - # three option sets: - # - # encryptors = ActiveSupport::MessageEncryptors.new { ... } - # encryptors.rotate(serializer: JSON, url_safe: true) - # encryptors.rotate(serializer: Marshal, url_safe: true) - # encryptors.rotate(serializer: Marshal, url_safe: false) - # encryptors.transitional = true - # - # This can be useful when performing a rolling deploy of an application, - # wherein servers that have not yet been updated must still be able to - # decrypt messages from updated servers. In such a scenario, first perform a - # rolling deploy with the new rotation (e.g. serializer: JSON, url_safe: true) - # as the first rotation and transitional = true. Then, after all - # servers have been updated, perform a second rolling deploy with - # transitional = false. - # - #-- - # Implemented by ActiveSupport::Messages::RotationCoordinator#transitional - - ## - # :singleton-method: new - # :call-seq: new(&secret_generator) - # - # Initializes a new instance. +secret_generator+ must accept a salt and a - # +secret_length+ kwarg, and return a suitable secret (string) or secrets - # (array of strings). +secret_generator+ may also accept other arbitrary - # kwargs. If #rotate is called with any options matching those kwargs, those - # options will be passed to +secret_generator+ instead of to the message - # encryptor. - # - # encryptors = ActiveSupport::MessageEncryptors.new do |salt, secret_length:, base:| - # MySecretGenerator.new(base).generate(salt, secret_length) - # end - # - # encryptors.rotate(base: "...") - # - #-- - # Implemented by ActiveSupport::Messages::RotationCoordinator#initialize - - ## - # :method: [] - # :call-seq: [](salt) - # - # Returns a MessageEncryptor configured with a secret derived from the - # given +salt+, and options from #rotate. MessageEncryptor instances will - # be memoized, so the same +salt+ will return the same instance. - # - #-- - # Implemented by ActiveSupport::Messages::RotationCoordinator#[] - - ## - # :method: []= - # :call-seq: []=(salt, encryptor) - # - # Overrides a MessageEncryptor instance associated with a given +salt+. - # - #-- - # Implemented by ActiveSupport::Messages::RotationCoordinator#[]= - - ## - # :method: rotate - # :call-seq: - # rotate(**options) - # rotate(&block) - # - # Adds +options+ to the list of option sets. Messages will be encrypted - # using the first set in the list. When decrypting, however, each set will - # be tried, in order, until one succeeds. - # - # Notably, the +:secret_generator+ option can specify a different secret - # generator than the one initially specified. The secret generator must - # respond to +call+, accept a salt and a +secret_length+ kwarg, and return - # a suitable secret (string) or secrets (array of strings). The secret - # generator may also accept other arbitrary kwargs. - # - # If any options match the kwargs of the operative secret generator, those - # options will be passed to the secret generator instead of to the message - # encryptor. - # - # For fine-grained per-salt rotations, a block form is supported. The block - # will receive the salt, and should return an appropriate options Hash. The - # block may also return +nil+ to indicate that the rotation does not apply - # to the given salt. For example: - # - # encryptors = ActiveSupport::MessageEncryptors.new { ... } - # - # encryptors.rotate do |salt| - # case salt - # when :foo - # { serializer: JSON, url_safe: true } - # when :bar - # { serializer: Marshal, url_safe: true } - # end - # end - # - # encryptors.rotate(serializer: Marshal, url_safe: false) - # - # # Uses `serializer: JSON, url_safe: true`. - # # Falls back to `serializer: Marshal, url_safe: false`. - # encryptors[:foo] - # - # # Uses `serializer: Marshal, url_safe: true`. - # # Falls back to `serializer: Marshal, url_safe: false`. - # encryptors[:bar] - # - # # Uses `serializer: Marshal, url_safe: false`. - # encryptors[:baz] - # - #-- - # Implemented by ActiveSupport::Messages::RotationCoordinator#rotate - - ## - # :method: prepend - # :call-seq: - # prepend(**options) - # prepend(&block) - # - # Just like #rotate, but prepends the given options or block to the list of - # option sets. - # - # This can be useful when you have an already-configured +MessageEncryptors+ - # instance, but you want to override the way messages are encrypted. - # - # module ThirdParty - # ENCRYPTORS = ActiveSupport::MessageEncryptors.new { ... }. - # rotate(serializer: Marshal, url_safe: true). - # rotate(serializer: Marshal, url_safe: false) - # end - # - # ThirdParty.ENCRYPTORS.prepend(serializer: JSON, url_safe: true) - # - # # Uses `serializer: JSON, url_safe: true`. - # # Falls back to `serializer: Marshal, url_safe: true` or - # # `serializer: Marshal, url_safe: false`. - # ThirdParty.ENCRYPTORS[:foo] - # - #-- - # Implemented by ActiveSupport::Messages::RotationCoordinator#prepend - - ## - # :method: rotate_defaults - # :call-seq: rotate_defaults - # - # Invokes #rotate with the default options. - # - #-- - # Implemented by ActiveSupport::Messages::RotationCoordinator#rotate_defaults - - ## - # :method: clear_rotations - # :call-seq: clear_rotations - # - # Clears the list of option sets. - # - #-- - # Implemented by ActiveSupport::Messages::RotationCoordinator#clear_rotations - - ## - # :method: on_rotation - # :call-seq: on_rotation(&callback) - # - # Sets a callback to invoke when a message is decrypted using an option set - # other than the first. - # - # For example, this callback could log each time it is called, and thus - # indicate whether old option sets are still in use or can be removed from - # rotation. - # - #-- - # Implemented by ActiveSupport::Messages::RotationCoordinator#on_rotation - - ## - private - def build(salt, secret_generator:, secret_generator_options:, **options) - secret_length = MessageEncryptor.key_len(*options[:cipher]) - secret = secret_generator.call(salt, secret_length: secret_length, **secret_generator_options) - MessageEncryptor.new(*Array(secret), **options) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_pack.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_pack.rb deleted file mode 100644 index 3ce2c07..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_pack.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -begin - gem "msgpack", ">= 1.7.0" - require "msgpack" -rescue LoadError => error - warn "ActiveSupport::MessagePack requires the msgpack gem, version 1.7.0 or later. " \ - "Please add it to your Gemfile: `gem \"msgpack\", \">= 1.7.0\"`" - raise error -end - -require_relative "message_pack/cache_serializer" -require_relative "message_pack/serializer" - -module ActiveSupport - module MessagePack - extend Serializer - - ## - # :singleton-method: dump - # :call-seq: dump(object) - # - # Dumps an object. Raises ActiveSupport::MessagePack::UnserializableObjectError - # if the object type is not supported. - # - #-- - # Implemented by Serializer#dump. - - ## - # :singleton-method: load - # :call-seq: load(dumped) - # - # Loads an object dump created by ::dump. - # - #-- - # Implemented by Serializer#load. - - ## - # :singleton-method: signature? - # :call-seq: signature?(dumped) - # - # Returns true if the given dump begins with an +ActiveSupport::MessagePack+ - # signature. - # - #-- - # Implemented by Serializer#signature?. - - ActiveSupport.run_load_hooks(:message_pack, self) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_pack/cache_serializer.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_pack/cache_serializer.rb deleted file mode 100644 index a7f4958..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_pack/cache_serializer.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -require_relative "serializer" - -module ActiveSupport - module MessagePack - module CacheSerializer - include Serializer - extend self - - def load(dumped) - super - rescue ActiveSupport::MessagePack::MissingClassError - # Treat missing class as cache miss => return nil - end - - private - def install_unregistered_type_handler - Extensions.install_unregistered_type_fallback(message_pack_factory) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_pack/extensions.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_pack/extensions.rb deleted file mode 100644 index eb83de9..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_pack/extensions.rb +++ /dev/null @@ -1,327 +0,0 @@ -# frozen_string_literal: true - -require "bigdecimal" -require "date" -require "ipaddr" -require "pathname" -require "uri" -require "msgpack/bigint" -require "active_support/hash_with_indifferent_access" -require "active_support/core_ext/string/output_safety" -require "active_support/time" - -module ActiveSupport - module MessagePack - class UnserializableObjectError < StandardError; end - class MissingClassError < StandardError; end # :nodoc: - - module Extensions # :nodoc: - extend self - - def install(registry) - registry.register_type 0, Symbol, - packer: :to_msgpack_ext, - unpacker: :from_msgpack_ext, - optimized_symbols_parsing: true - - registry.register_type 1, Integer, - packer: ::MessagePack::Bigint.method(:to_msgpack_ext), - unpacker: ::MessagePack::Bigint.method(:from_msgpack_ext), - oversized_integer_extension: true - - registry.register_type 2, BigDecimal, - packer: :_dump, - unpacker: :_load - - registry.register_type 3, Rational, - packer: method(:write_rational), - unpacker: method(:read_rational), - recursive: true - - registry.register_type 4, Complex, - packer: method(:write_complex), - unpacker: method(:read_complex), - recursive: true - - registry.register_type 5, DateTime, - packer: method(:write_datetime), - unpacker: method(:read_datetime), - recursive: true - - registry.register_type 6, Date, - packer: method(:write_date), - unpacker: method(:read_date), - recursive: true - - registry.register_type 7, Time, - packer: method(:write_time), - unpacker: method(:read_time), - recursive: true - - registry.register_type 8, ActiveSupport::TimeWithZone, - packer: method(:write_time_with_zone), - unpacker: method(:read_time_with_zone), - recursive: true - - registry.register_type 9, ActiveSupport::TimeZone, - packer: method(:dump_time_zone), - unpacker: method(:load_time_zone) - - registry.register_type 10, ActiveSupport::Duration, - packer: method(:write_duration), - unpacker: method(:read_duration), - recursive: true - - registry.register_type 11, Range, - packer: method(:write_range), - unpacker: method(:read_range), - recursive: true - - registry.register_type 12, Set, - packer: method(:write_set), - unpacker: method(:read_set), - recursive: true - - registry.register_type 13, URI::Generic, - packer: :to_s, - unpacker: URI.method(:parse) - - registry.register_type 14, IPAddr, - packer: method(:write_ipaddr), - unpacker: method(:read_ipaddr), - recursive: true - - registry.register_type 15, Pathname, - packer: :to_s, - unpacker: :new - - registry.register_type 16, Regexp, - packer: :to_s, - unpacker: :new - - registry.register_type 17, ActiveSupport::HashWithIndifferentAccess, - packer: method(:write_hash_with_indifferent_access), - unpacker: method(:read_hash_with_indifferent_access), - recursive: true - - registry.register_type 18, ActiveSupport::SafeBuffer, - packer: method(:write_safe_buffer), - unpacker: method(:read_safe_buffer), - recursive: true - end - - def install_unregistered_type_error(registry) - registry.register_type 127, Object, - packer: method(:raise_unserializable), - unpacker: method(:raise_invalid_format) - end - - def install_unregistered_type_fallback(registry) - registry.register_type 127, Object, - packer: method(:write_object), - unpacker: method(:read_object), - recursive: true - end - - def write_rational(rational, packer) - packer.write(rational.numerator) - packer.write(rational.denominator) unless rational.numerator.zero? - end - - def read_rational(unpacker) - numerator = unpacker.read - Rational(numerator, numerator.zero? ? 1 : unpacker.read) - end - - def write_complex(complex, packer) - packer.write(complex.real) - packer.write(complex.imaginary) - end - - def read_complex(unpacker) - Complex(unpacker.read, unpacker.read) - end - - def write_datetime(datetime, packer) - packer.write(datetime.jd) - packer.write(datetime.hour) - packer.write(datetime.min) - packer.write(datetime.sec) - write_rational(datetime.sec_fraction, packer) - write_rational(datetime.offset, packer) - end - - def read_datetime(unpacker) - DateTime.jd(unpacker.read, unpacker.read, unpacker.read, unpacker.read + read_rational(unpacker), read_rational(unpacker)) - end - - def write_date(date, packer) - packer.write(date.jd) - end - - def read_date(unpacker) - Date.jd(unpacker.read) - end - - def write_time(time, packer) - packer.write(time.tv_sec) - packer.write(time.tv_nsec) - packer.write(time.utc_offset) - end - - def read_time(unpacker) - Time.at_without_coercion(unpacker.read, unpacker.read, :nanosecond, in: unpacker.read) - end - - def write_time_with_zone(twz, packer) - write_time(twz.utc, packer) - write_time_zone(twz.time_zone, packer) - end - - def read_time_with_zone(unpacker) - ActiveSupport::TimeWithZone.new(read_time(unpacker), read_time_zone(unpacker)) - end - - def dump_time_zone(time_zone) - time_zone.name - end - - def load_time_zone(name) - ActiveSupport::TimeZone[name] - end - - def write_time_zone(time_zone, packer) - packer.write(dump_time_zone(time_zone)) - end - - def read_time_zone(unpacker) - load_time_zone(unpacker.read) - end - - def write_duration(duration, packer) - packer.write(duration.value) - packer.write(duration._parts.values_at(*ActiveSupport::Duration::PARTS)) - end - - def read_duration(unpacker) - value = unpacker.read - parts = ActiveSupport::Duration::PARTS.zip(unpacker.read).to_h - parts.compact! - ActiveSupport::Duration.new(value, parts) - end - - def write_range(range, packer) - packer.write(range.begin) - packer.write(range.end) - packer.write(range.exclude_end?) - end - - def read_range(unpacker) - Range.new(unpacker.read, unpacker.read, unpacker.read) - end - - def write_set(set, packer) - packer.write(set.to_a) - end - - def read_set(unpacker) - Set.new(unpacker.read) - end - - def write_ipaddr(ipaddr, packer) - if ipaddr.prefix < 32 || (ipaddr.ipv6? && ipaddr.prefix < 128) - packer.write("#{ipaddr}/#{ipaddr.prefix}") - else - packer.write(ipaddr.to_s) - end - end - - def read_ipaddr(unpacker) - IPAddr.new(unpacker.read) - end - - def write_hash_with_indifferent_access(hwia, packer) - packer.write(hwia.to_h) - end - - def read_hash_with_indifferent_access(unpacker) - ActiveSupport::HashWithIndifferentAccess.new(unpacker.read) - end - - def write_safe_buffer(buffer, packer) - unless buffer.html_safe? - packer.write(false) - end - packer.write(buffer.to_str) - end - - def read_safe_buffer(unpacker) - string_or_safe = unpacker.read - if string_or_safe - ActiveSupport::SafeBuffer.new(string_or_safe) - else - unpacker.read - end - end - - def raise_unserializable(object, *) - raise UnserializableObjectError, "Unsupported type #{object.class} for object #{object.inspect}" - end - - def raise_invalid_format(*) - raise "Invalid format" - end - - def dump_class(klass) - raise UnserializableObjectError, "Cannot serialize anonymous class" unless klass.name - klass.name - end - - def load_class(name) - Object.const_get(name) - rescue NameError => error - if error.name.to_s == name - raise MissingClassError, "Missing class: #{name}" - else - raise - end - end - - def write_class(klass, packer) - packer.write(dump_class(klass)) - end - - def read_class(unpacker) - load_class(unpacker.read) - end - - LOAD_WITH_MSGPACK_EXT = 0 - LOAD_WITH_JSON_CREATE = 1 - - def write_object(object, packer) - if object.class.respond_to?(:from_msgpack_ext) - packer.write(LOAD_WITH_MSGPACK_EXT) - write_class(object.class, packer) - packer.write(object.to_msgpack_ext) - elsif object.class.respond_to?(:json_create) - packer.write(LOAD_WITH_JSON_CREATE) - write_class(object.class, packer) - packer.write(object.as_json) - else - raise_unserializable(object) - end - end - - def read_object(unpacker) - case unpacker.read - when LOAD_WITH_MSGPACK_EXT - read_class(unpacker).from_msgpack_ext(unpacker.read) - when LOAD_WITH_JSON_CREATE - read_class(unpacker).json_create(unpacker.read) - else - raise_invalid_format - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_pack/serializer.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_pack/serializer.rb deleted file mode 100644 index c5ce8e1..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_pack/serializer.rb +++ /dev/null @@ -1,63 +0,0 @@ -# frozen_string_literal: true - -require_relative "extensions" - -module ActiveSupport - module MessagePack - module Serializer # :nodoc: - SIGNATURE = "\xCC\x80".b.freeze # == 128.to_msgpack - SIGNATURE_INT = 128 - - def dump(object) - message_pack_pool.packer do |packer| - packer.write(SIGNATURE_INT) - packer.write(object) - packer.full_pack - end - end - - def load(dumped) - message_pack_pool.unpacker do |unpacker| - unpacker.feed_reference(dumped) - raise "Invalid serialization format" unless unpacker.read == SIGNATURE_INT - unpacker.full_unpack - end - end - - def signature?(dumped) - dumped.getbyte(0) == SIGNATURE.getbyte(0) && dumped.getbyte(1) == SIGNATURE.getbyte(1) - end - - def message_pack_factory - @message_pack_factory ||= ::MessagePack::Factory.new - end - - def message_pack_factory=(factory) - @message_pack_pool = nil - @message_pack_factory = factory - end - - delegate :register_type, to: :message_pack_factory - - def warmup - message_pack_pool # eagerly compute - end - - private - def message_pack_pool - @message_pack_pool ||= begin - unless message_pack_factory.frozen? - Extensions.install(message_pack_factory) - install_unregistered_type_handler - message_pack_factory.freeze - end - message_pack_factory.pool(ENV.fetch("RAILS_MAX_THREADS", 5).to_i) - end - end - - def install_unregistered_type_handler - Extensions.install_unregistered_type_error(message_pack_factory) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_verifier.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_verifier.rb deleted file mode 100644 index b89ed55..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_verifier.rb +++ /dev/null @@ -1,377 +0,0 @@ -# frozen_string_literal: true - -require "openssl" -require "base64" -require "active_support/core_ext/object/blank" -require "active_support/security_utils" -require "active_support/messages/codec" -require "active_support/messages/rotator" - -module ActiveSupport - # = Active Support Message Verifier - # - # +MessageVerifier+ makes it easy to generate and verify messages which are - # signed to prevent tampering. - # - # In a \Rails application, you can use +Rails.application.message_verifier+ - # to manage unique instances of verifiers for each use case. - # {Learn more}[link:classes/Rails/Application.html#method-i-message_verifier]. - # - # This is useful for cases like remember-me tokens and auto-unsubscribe links - # where the session store isn't suitable or available. - # - # First, generate a signed message: - # cookies[:remember_me] = Rails.application.message_verifier(:remember_me).generate([@user.id, 2.weeks.from_now]) - # - # Later verify that message: - # - # id, time = Rails.application.message_verifier(:remember_me).verify(cookies[:remember_me]) - # if time.future? - # self.current_user = User.find(id) - # end - # - # === Signing is not encryption - # - # The signed messages are not encrypted. The payload is merely encoded (Base64 by default) and can be decoded by - # anyone. The signature is just assuring that the message wasn't tampered with. For example: - # - # message = Rails.application.message_verifier('my_purpose').generate('never put secrets here') - # # => "BAhJIhtuZXZlciBwdXQgc2VjcmV0cyBoZXJlBjoGRVQ=--a0c1c0827919da5e949e989c971249355735e140" - # Base64.decode64(message.split("--").first) # no key needed - # # => 'never put secrets here' - # - # If you also need to encrypt the contents, you must use ActiveSupport::MessageEncryptor instead. - # - # === Confine messages to a specific purpose - # - # It's not recommended to use the same verifier for different purposes in your application. - # Doing so could allow a malicious actor to re-use a signed message to perform an unauthorized - # action. - # You can reduce this risk by confining signed messages to a specific +:purpose+. - # - # token = @verifier.generate("signed message", purpose: :login) - # - # Then that same purpose must be passed when verifying to get the data back out: - # - # @verifier.verified(token, purpose: :login) # => "signed message" - # @verifier.verified(token, purpose: :shipping) # => nil - # @verifier.verified(token) # => nil - # - # @verifier.verify(token, purpose: :login) # => "signed message" - # @verifier.verify(token, purpose: :shipping) # => raises ActiveSupport::MessageVerifier::InvalidSignature - # @verifier.verify(token) # => raises ActiveSupport::MessageVerifier::InvalidSignature - # - # Likewise, if a message has no purpose it won't be returned when verifying with - # a specific purpose. - # - # token = @verifier.generate("signed message") - # @verifier.verified(token, purpose: :redirect) # => nil - # @verifier.verified(token) # => "signed message" - # - # @verifier.verify(token, purpose: :redirect) # => raises ActiveSupport::MessageVerifier::InvalidSignature - # @verifier.verify(token) # => "signed message" - # - # === Expiring messages - # - # By default messages last forever and verifying one year from now will still - # return the original value. But messages can be set to expire at a given - # time with +:expires_in+ or +:expires_at+. - # - # @verifier.generate("signed message", expires_in: 1.month) - # @verifier.generate("signed message", expires_at: Time.now.end_of_year) - # - # Messages can then be verified and returned until expiry. - # Thereafter, the +verified+ method returns +nil+ while +verify+ raises - # +ActiveSupport::MessageVerifier::InvalidSignature+. - # - # === Rotating keys - # - # MessageVerifier also supports rotating out old configurations by falling - # back to a stack of verifiers. Call +rotate+ to build and add a verifier so - # either +verified+ or +verify+ will also try verifying with the fallback. - # - # By default any rotated verifiers use the values of the primary - # verifier unless specified otherwise. - # - # You'd give your verifier the new defaults: - # - # verifier = ActiveSupport::MessageVerifier.new(@secret, digest: "SHA512", serializer: JSON) - # - # Then gradually rotate the old values out by adding them as fallbacks. Any message - # generated with the old values will then work until the rotation is removed. - # - # verifier.rotate(old_secret) # Fallback to an old secret instead of @secret. - # verifier.rotate(digest: "SHA256") # Fallback to an old digest instead of SHA512. - # verifier.rotate(serializer: Marshal) # Fallback to an old serializer instead of JSON. - # - # Though the above would most likely be combined into one rotation: - # - # verifier.rotate(old_secret, digest: "SHA256", serializer: Marshal) - class MessageVerifier < Messages::Codec - prepend Messages::Rotator - - class InvalidSignature < StandardError; end - - SEPARATOR = "--" # :nodoc: - SEPARATOR_LENGTH = SEPARATOR.length # :nodoc: - - # Initialize a new MessageVerifier with a secret for the signature. - # - # ==== Options - # - # [+:digest+] - # Digest used for signing. The default is "SHA1". See - # +OpenSSL::Digest+ for alternatives. - # - # [+:serializer+] - # The serializer used to serialize message data. You can specify any - # object that responds to +dump+ and +load+, or you can choose from - # several preconfigured serializers: +:marshal+, +:json_allow_marshal+, - # +:json+, +:message_pack_allow_marshal+, +:message_pack+. - # - # The preconfigured serializers include a fallback mechanism to support - # multiple deserialization formats. For example, the +:marshal+ serializer - # will serialize using +Marshal+, but can deserialize using +Marshal+, - # ActiveSupport::JSON, or ActiveSupport::MessagePack. This makes it easy - # to migrate between serializers. - # - # The +:marshal+, +:json_allow_marshal+, and +:message_pack_allow_marshal+ - # serializers support deserializing using +Marshal+, but the others do - # not. Beware that +Marshal+ is a potential vector for deserialization - # attacks in cases where a message signing secret has been leaked. If - # possible, choose a serializer that does not support +Marshal+. - # - # The +:message_pack+ and +:message_pack_allow_marshal+ serializers use - # ActiveSupport::MessagePack, which can roundtrip some Ruby types that are - # not supported by JSON, and may provide improved performance. However, - # these require the +msgpack+ gem. - # - # When using \Rails, the default depends on +config.active_support.message_serializer+. - # Otherwise, the default is +:marshal+. - # - # [+:url_safe+] - # By default, MessageVerifier generates RFC 4648 compliant strings which are - # not URL-safe. In other words, they can contain "+" and "/". If you want to - # generate URL-safe strings (in compliance with "Base 64 Encoding with URL - # and Filename Safe Alphabet" in RFC 4648), you can pass +true+. - # Note that MessageVerifier will always accept both URL-safe and URL-unsafe - # encoded messages, to allow a smooth transition between the two settings. - # - # [+:force_legacy_metadata_serializer+] - # Whether to use the legacy metadata serializer, which serializes the - # message first, then wraps it in an envelope which is also serialized. This - # was the default in \Rails 7.0 and below. - # - # If you don't pass a truthy value, the default is set using - # +config.active_support.use_message_serializer_for_metadata+. - def initialize(secret, **options) - raise ArgumentError, "Secret should not be nil." unless secret - super(**options) - @secret = secret - @digest = options[:digest]&.to_s || "SHA1" - end - - # Checks if a signed message could have been generated by signing an object - # with the +MessageVerifier+'s secret. - # - # verifier = ActiveSupport::MessageVerifier.new("secret") - # signed_message = verifier.generate("signed message") - # verifier.valid_message?(signed_message) # => true - # - # tampered_message = signed_message.chop # editing the message invalidates the signature - # verifier.valid_message?(tampered_message) # => false - def valid_message?(message) - !!catch_and_ignore(:invalid_message_format) { extract_encoded(message) } - end - - # Decodes the signed message using the +MessageVerifier+'s secret. - # - # verifier = ActiveSupport::MessageVerifier.new("secret") - # - # signed_message = verifier.generate("signed message") - # verifier.verified(signed_message) # => "signed message" - # - # Returns +nil+ if the message was not signed with the same secret. - # - # other_verifier = ActiveSupport::MessageVerifier.new("different_secret") - # other_verifier.verified(signed_message) # => nil - # - # Returns +nil+ if the message is not Base64-encoded. - # - # invalid_message = "f--46a0120593880c733a53b6dad75b42ddc1c8996d" - # verifier.verified(invalid_message) # => nil - # - # Raises any error raised while decoding the signed message. - # - # incompatible_message = "test--dad7b06c94abba8d46a15fafaef56c327665d5ff" - # verifier.verified(incompatible_message) # => TypeError: incompatible marshal file format - # - # ==== Options - # - # [+:purpose+] - # The purpose that the message was generated with. If the purpose does not - # match, +verified+ will return +nil+. - # - # message = verifier.generate("hello", purpose: "greeting") - # verifier.verified(message, purpose: "greeting") # => "hello" - # verifier.verified(message, purpose: "chatting") # => nil - # verifier.verified(message) # => nil - # - # message = verifier.generate("bye") - # verifier.verified(message) # => "bye" - # verifier.verified(message, purpose: "greeting") # => nil - # - def verified(message, **options) - catch_and_ignore :invalid_message_format do - catch_and_raise :invalid_message_serialization do - catch_and_ignore :invalid_message_content do - read_message(message, **options) - end - end - end - end - - # Decodes the signed message using the +MessageVerifier+'s secret. - # - # verifier = ActiveSupport::MessageVerifier.new("secret") - # signed_message = verifier.generate("signed message") - # - # verifier.verify(signed_message) # => "signed message" - # - # Raises +InvalidSignature+ if the message was not signed with the same - # secret or was not Base64-encoded. - # - # other_verifier = ActiveSupport::MessageVerifier.new("different_secret") - # other_verifier.verify(signed_message) # => ActiveSupport::MessageVerifier::InvalidSignature - # - # ==== Options - # - # [+:purpose+] - # The purpose that the message was generated with. If the purpose does not - # match, +verify+ will raise ActiveSupport::MessageVerifier::InvalidSignature. - # - # message = verifier.generate("hello", purpose: "greeting") - # verifier.verify(message, purpose: "greeting") # => "hello" - # verifier.verify(message, purpose: "chatting") # => raises InvalidSignature - # verifier.verify(message) # => raises InvalidSignature - # - # message = verifier.generate("bye") - # verifier.verify(message) # => "bye" - # verifier.verify(message, purpose: "greeting") # => raises InvalidSignature - # - def verify(message, **options) - catch_and_raise :invalid_message_format, as: InvalidSignature do - catch_and_raise :invalid_message_serialization do - catch_and_raise :invalid_message_content, as: InvalidSignature do - read_message(message, **options) - end - end - end - end - - # Generates a signed message for the provided value. - # - # The message is signed with the +MessageVerifier+'s secret. - # Returns Base64-encoded message joined with the generated signature. - # - # verifier = ActiveSupport::MessageVerifier.new("secret") - # verifier.generate("signed message") # => "BAhJIhNzaWduZWQgbWVzc2FnZQY6BkVU--f67d5f27c3ee0b8483cebf2103757455e947493b" - # - # ==== Options - # - # [+:expires_at+] - # The datetime at which the message expires. After this datetime, - # verification of the message will fail. - # - # message = verifier.generate("hello", expires_at: Time.now.tomorrow) - # verifier.verified(message) # => "hello" - # # 24 hours later... - # verifier.verified(message) # => nil - # verifier.verify(message) # => raises ActiveSupport::MessageVerifier::InvalidSignature - # - # [+:expires_in+] - # The duration for which the message is valid. After this duration has - # elapsed, verification of the message will fail. - # - # message = verifier.generate("hello", expires_in: 24.hours) - # verifier.verified(message) # => "hello" - # # 24 hours later... - # verifier.verified(message) # => nil - # verifier.verify(message) # => raises ActiveSupport::MessageVerifier::InvalidSignature - # - # [+:purpose+] - # The purpose of the message. If specified, the same purpose must be - # specified when verifying the message; otherwise, verification will fail. - # (See #verified and #verify.) - def generate(value, **options) - create_message(value, **options) - end - - def create_message(value, **options) # :nodoc: - sign_encoded(encode(serialize_with_metadata(value, **options))) - end - - def read_message(message, **options) # :nodoc: - deserialize_with_metadata(decode(extract_encoded(message)), **options) - end - - def inspect # :nodoc: - "#<#{self.class.name}:#{'%#016x' % (object_id << 1)}>" - end - - private - def decode(encoded, url_safe: @url_safe) - catch :invalid_message_format do - return super - end - super(encoded, url_safe: !url_safe) - end - - def sign_encoded(encoded) - digest = generate_digest(encoded) - encoded << SEPARATOR << digest - end - - def extract_encoded(signed) - if signed.nil? || !signed.valid_encoding? - throw :invalid_message_format, "invalid message string" - end - - if separator_index = separator_index_for(signed) - encoded = signed[0, separator_index] - digest = signed[separator_index + SEPARATOR_LENGTH, digest_length_in_hex] - end - - unless digest_matches_data?(digest, encoded) - throw :invalid_message_format, "mismatched digest" - end - - encoded - end - - def generate_digest(data) - OpenSSL::HMAC.hexdigest(@digest, @secret, data) - end - - def digest_length_in_hex - # In hexadecimal (AKA base16) it takes 4 bits to represent a character, - # hence we multiply the digest's length (in bytes) by 8 to get it in - # bits and divide by 4 to get its number of characters it hex. Well, 8 - # divided by 4 is 2. - @digest_length_in_hex ||= OpenSSL::Digest.new(@digest).digest_length * 2 - end - - def separator_at?(signed_message, index) - signed_message[index, SEPARATOR_LENGTH] == SEPARATOR - end - - def separator_index_for(signed_message) - index = signed_message.length - digest_length_in_hex - SEPARATOR_LENGTH - index unless index.negative? || !separator_at?(signed_message, index) - end - - def digest_matches_data?(digest, data) - data.present? && digest.present? && ActiveSupport::SecurityUtils.secure_compare(digest, generate_digest(data)) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_verifiers.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_verifiers.rb deleted file mode 100644 index 398a797..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/message_verifiers.rb +++ /dev/null @@ -1,189 +0,0 @@ -# frozen_string_literal: true - -require "active_support/messages/rotation_coordinator" - -module ActiveSupport - class MessageVerifiers < Messages::RotationCoordinator - ## - # :attr_accessor: transitional - # - # If true, the first two rotation option sets are swapped when building - # message verifiers. For example, with the following configuration, message - # verifiers will generate messages using serializer: Marshal, url_safe: true, - # and will able to verify messages that were generated using any of the - # three option sets: - # - # verifiers = ActiveSupport::MessageVerifiers.new { ... } - # verifiers.rotate(serializer: JSON, url_safe: true) - # verifiers.rotate(serializer: Marshal, url_safe: true) - # verifiers.rotate(serializer: Marshal, url_safe: false) - # verifiers.transitional = true - # - # This can be useful when performing a rolling deploy of an application, - # wherein servers that have not yet been updated must still be able to - # verify messages from updated servers. In such a scenario, first perform a - # rolling deploy with the new rotation (e.g. serializer: JSON, url_safe: true) - # as the first rotation and transitional = true. Then, after all - # servers have been updated, perform a second rolling deploy with - # transitional = false. - # - #-- - # Implemented by ActiveSupport::Messages::RotationCoordinator#transitional - - ## - # :singleton-method: new - # :call-seq: new(&secret_generator) - # - # Initializes a new instance. +secret_generator+ must accept a salt, and - # return a suitable secret (string). +secret_generator+ may also accept - # arbitrary kwargs. If #rotate is called with any options matching those - # kwargs, those options will be passed to +secret_generator+ instead of to - # the message verifier. - # - # verifiers = ActiveSupport::MessageVerifiers.new do |salt, base:| - # MySecretGenerator.new(base).generate(salt) - # end - # - # verifiers.rotate(base: "...") - # - #-- - # Implemented by ActiveSupport::Messages::RotationCoordinator#initialize - - ## - # :method: [] - # :call-seq: [](salt) - # - # Returns a MessageVerifier configured with a secret derived from the - # given +salt+, and options from #rotate. MessageVerifier instances will - # be memoized, so the same +salt+ will return the same instance. - # - #-- - # Implemented by ActiveSupport::Messages::RotationCoordinator#[] - - ## - # :method: []= - # :call-seq: []=(salt, verifier) - # - # Overrides a MessageVerifier instance associated with a given +salt+. - # - #-- - # Implemented by ActiveSupport::Messages::RotationCoordinator#[]= - - ## - # :method: rotate - # :call-seq: - # rotate(**options) - # rotate(&block) - # - # Adds +options+ to the list of option sets. Messages will be signed using - # the first set in the list. When verifying, however, each set will be - # tried, in order, until one succeeds. - # - # Notably, the +:secret_generator+ option can specify a different secret - # generator than the one initially specified. The secret generator must - # respond to +call+, accept a salt, and return a suitable secret (string). - # The secret generator may also accept arbitrary kwargs. - # - # If any options match the kwargs of the operative secret generator, those - # options will be passed to the secret generator instead of to the message - # verifier. - # - # For fine-grained per-salt rotations, a block form is supported. The block - # will receive the salt, and should return an appropriate options Hash. The - # block may also return +nil+ to indicate that the rotation does not apply - # to the given salt. For example: - # - # verifiers = ActiveSupport::MessageVerifiers.new { ... } - # - # verifiers.rotate do |salt| - # case salt - # when :foo - # { serializer: JSON, url_safe: true } - # when :bar - # { serializer: Marshal, url_safe: true } - # end - # end - # - # verifiers.rotate(serializer: Marshal, url_safe: false) - # - # # Uses `serializer: JSON, url_safe: true`. - # # Falls back to `serializer: Marshal, url_safe: false`. - # verifiers[:foo] - # - # # Uses `serializer: Marshal, url_safe: true`. - # # Falls back to `serializer: Marshal, url_safe: false`. - # verifiers[:bar] - # - # # Uses `serializer: Marshal, url_safe: false`. - # verifiers[:baz] - # - #-- - # Implemented by ActiveSupport::Messages::RotationCoordinator#rotate - - ## - # :method: prepend - # :call-seq: - # prepend(**options) - # prepend(&block) - # - # Just like #rotate, but prepends the given options or block to the list of - # option sets. - # - # This can be useful when you have an already-configured +MessageVerifiers+ - # instance, but you want to override the way messages are signed. - # - # module ThirdParty - # VERIFIERS = ActiveSupport::MessageVerifiers.new { ... }. - # rotate(serializer: Marshal, url_safe: true). - # rotate(serializer: Marshal, url_safe: false) - # end - # - # ThirdParty.VERIFIERS.prepend(serializer: JSON, url_safe: true) - # - # # Uses `serializer: JSON, url_safe: true`. - # # Falls back to `serializer: Marshal, url_safe: true` or - # # `serializer: Marshal, url_safe: false`. - # ThirdParty.VERIFIERS[:foo] - # - #-- - # Implemented by ActiveSupport::Messages::RotationCoordinator#prepend - - ## - # :method: rotate_defaults - # :call-seq: rotate_defaults - # - # Invokes #rotate with the default options. - # - #-- - # Implemented by ActiveSupport::Messages::RotationCoordinator#rotate_defaults - - ## - # :method: clear_rotations - # :call-seq: clear_rotations - # - # Clears the list of option sets. - # - #-- - # Implemented by ActiveSupport::Messages::RotationCoordinator#clear_rotations - - ## - # :method: on_rotation - # :call-seq: on_rotation(&callback) - # - # Sets a callback to invoke when a message is verified using an option set - # other than the first. - # - # For example, this callback could log each time it is called, and thus - # indicate whether old option sets are still in use or can be removed from - # rotation. - # - #-- - # Implemented by ActiveSupport::Messages::RotationCoordinator#on_rotation - - ## - private - def build(salt, secret_generator:, secret_generator_options:, **options) - MessageVerifier.new(secret_generator.call(salt, **secret_generator_options), **options) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/messages/codec.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/messages/codec.rb deleted file mode 100644 index 5d2c755..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/messages/codec.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/class/attribute" -require_relative "metadata" -require_relative "serializer_with_fallback" - -module ActiveSupport - module Messages # :nodoc: - class Codec # :nodoc: - include Metadata - - class_attribute :default_serializer, default: :marshal, - instance_accessor: false, instance_predicate: false - - def initialize(**options) - @serializer = options[:serializer] || self.class.default_serializer - @serializer = SerializerWithFallback[@serializer] if @serializer.is_a?(Symbol) - @url_safe = options[:url_safe] - @force_legacy_metadata_serializer = options[:force_legacy_metadata_serializer] - end - - private - attr_reader :serializer - - def encode(data, url_safe: @url_safe) - url_safe ? ::Base64.urlsafe_encode64(data, padding: false) : ::Base64.strict_encode64(data) - end - - def decode(encoded, url_safe: @url_safe) - url_safe ? ::Base64.urlsafe_decode64(encoded) : ::Base64.strict_decode64(encoded) - rescue StandardError => error - throw :invalid_message_format, error - end - - def serialize(data) - serializer.dump(data) - end - - def deserialize(serialized) - serializer.load(serialized) - rescue StandardError => error - throw :invalid_message_serialization, error - end - - def catch_and_ignore(throwable, &block) - catch throwable do - return block.call - end - nil - end - - def catch_and_raise(throwable, as: nil, &block) - error = catch throwable do - return block.call - end - error = as.new(error.to_s) if as - raise error - end - - def use_message_serializer_for_metadata? - !@force_legacy_metadata_serializer && super - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/messages/metadata.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/messages/metadata.rb deleted file mode 100644 index 33b81aa..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/messages/metadata.rb +++ /dev/null @@ -1,146 +0,0 @@ -# frozen_string_literal: true - -require "time" -require "active_support/json" -require_relative "serializer_with_fallback" - -module ActiveSupport - module Messages # :nodoc: - module Metadata # :nodoc: - singleton_class.attr_accessor :use_message_serializer_for_metadata - - ENVELOPE_SERIALIZERS = [ - *SerializerWithFallback::SERIALIZERS.values, - ActiveSupport::JSON, - ::JSON, - Marshal, - ] - - TIMESTAMP_SERIALIZERS = [ - SerializerWithFallback::SERIALIZERS.fetch(:message_pack), - SerializerWithFallback::SERIALIZERS.fetch(:message_pack_allow_marshal), - ] - - ActiveSupport.on_load(:message_pack) do - ENVELOPE_SERIALIZERS << ActiveSupport::MessagePack - TIMESTAMP_SERIALIZERS << ActiveSupport::MessagePack - end - - private - def serialize_with_metadata(data, **metadata) - has_metadata = metadata.any? { |k, v| v } - - if has_metadata && !use_message_serializer_for_metadata? - data_string = serialize_to_json_safe_string(data) - envelope = wrap_in_metadata_legacy_envelope({ "message" => data_string }, **metadata) - serialize_to_json(envelope) - else - data = wrap_in_metadata_envelope({ "data" => data }, **metadata) if has_metadata - serialize(data) - end - end - - def deserialize_with_metadata(message, **expected_metadata) - if dual_serialized_metadata_envelope_json?(message) - envelope = deserialize_from_json(message) - extracted = extract_from_metadata_envelope(envelope, **expected_metadata) - deserialize_from_json_safe_string(extracted["message"]) - else - deserialized = deserialize(message) - if metadata_envelope?(deserialized) - extract_from_metadata_envelope(deserialized, **expected_metadata)["data"] - elsif expected_metadata.none? { |k, v| v } - deserialized - else - throw :invalid_message_content, "missing metadata" - end - end - end - - def use_message_serializer_for_metadata? - Metadata.use_message_serializer_for_metadata && Metadata::ENVELOPE_SERIALIZERS.include?(serializer) - end - - def wrap_in_metadata_envelope(hash, expires_at: nil, expires_in: nil, purpose: nil) - expiry = pick_expiry(expires_at, expires_in) - hash["exp"] = expiry if expiry - hash["pur"] = purpose.to_s if purpose - { "_rails" => hash } - end - - def wrap_in_metadata_legacy_envelope(hash, expires_at: nil, expires_in: nil, purpose: nil) - expiry = pick_expiry(expires_at, expires_in) - hash["exp"] = expiry - hash["pur"] = purpose - { "_rails" => hash } - end - - def extract_from_metadata_envelope(envelope, purpose: nil) - hash = envelope["_rails"] - - if hash["exp"] && Time.now.utc >= parse_expiry(hash["exp"]) - throw :invalid_message_content, "expired" - end - - if hash["pur"].to_s != purpose.to_s - throw :invalid_message_content, "mismatched purpose" - end - - hash - end - - def metadata_envelope?(object) - object.is_a?(Hash) && object.key?("_rails") - end - - def dual_serialized_metadata_envelope_json?(string) - string.start_with?('{"_rails":{"message":') - end - - def pick_expiry(expires_at, expires_in) - expiry = if expires_at - expires_at.utc - elsif expires_in - Time.now.utc.advance(seconds: expires_in) - end - - unless Metadata::TIMESTAMP_SERIALIZERS.include?(serializer) - expiry = expiry&.iso8601(3) - end - - expiry - end - - def parse_expiry(expires_at) - if !expires_at.is_a?(String) - expires_at - elsif ActiveSupport.use_standard_json_time_format - Time.iso8601(expires_at) - else - Time.parse(expires_at) - end - end - - def serialize_to_json(data) - ActiveSupport::JSON.encode(data) - end - - def deserialize_from_json(serialized) - ActiveSupport::JSON.decode(serialized) - rescue ::JSON::ParserError => error - # Throw :invalid_message_format instead of :invalid_message_serialization - # because here a parse error is due to a bad message rather than an - # incompatible `self.serializer`. - throw :invalid_message_format, error - end - - def serialize_to_json_safe_string(data) - encode(serialize(data), url_safe: false) - end - - def deserialize_from_json_safe_string(string) - deserialize(decode(string, url_safe: false)) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/messages/rotation_configuration.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/messages/rotation_configuration.rb deleted file mode 100644 index eef05fe..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/messages/rotation_configuration.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module Messages - class RotationConfiguration # :nodoc: - attr_reader :signed, :encrypted - - def initialize - @signed, @encrypted = [], [] - end - - def rotate(kind, *args, **options) - args << options unless options.empty? - case kind - when :signed - @signed << args - when :encrypted - @encrypted << args - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/messages/rotation_coordinator.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/messages/rotation_coordinator.rb deleted file mode 100644 index 92f0dbe..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/messages/rotation_coordinator.rb +++ /dev/null @@ -1,102 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/hash/slice" - -module ActiveSupport - module Messages - class RotationCoordinator # :nodoc: - attr_accessor :transitional - - def initialize(&secret_generator) - raise ArgumentError, "A secret generator block is required" unless secret_generator - @secret_generator = secret_generator - @rotate_options = [] - @on_rotation = nil - @codecs = {} - end - - def [](salt) - @codecs[salt] ||= build_with_rotations(salt) - end - - def []=(salt, codec) - @codecs[salt] = codec - end - - def rotate(**options, &block) - raise ArgumentError, "Options cannot be specified when using a block" if block && !options.empty? - changing_configuration! - - @rotate_options << (block || options) - - self - end - - def prepend(**options, &block) - raise ArgumentError, "Options cannot be specified when using a block" if block && !options.empty? - changing_configuration! - - @rotate_options.unshift(block || options) - - self - end - - def rotate_defaults - rotate() - end - - def clear_rotations - changing_configuration! - @rotate_options.clear - self - end - - def on_rotation(&callback) - changing_configuration! - @on_rotation = callback - end - - private - def changing_configuration! - if @codecs.any? - raise <<~MESSAGE - Cannot change #{self.class} configuration after it has already been applied. - - The configuration has been applied with the following salts: - #{@codecs.keys.map { |salt| "- #{salt.inspect}" }.join("\n")} - MESSAGE - end - end - - def normalize_options(options) - options = options.dup - - options[:secret_generator] ||= @secret_generator - - secret_generator_kwargs = options[:secret_generator].parameters. - filter_map { |type, name| name if type == :key || type == :keyreq } - options[:secret_generator_options] = options.extract!(*secret_generator_kwargs) - - options[:on_rotation] = @on_rotation - - options - end - - def build_with_rotations(salt) - rotate_options = @rotate_options.map { |options| options.is_a?(Proc) ? options.(salt) : options } - transitional = self.transitional && rotate_options.first - rotate_options.compact! - rotate_options[0..1] = rotate_options[0..1].reverse if transitional - rotate_options = rotate_options.map { |options| normalize_options(options) }.uniq - - raise "No options have been configured for #{salt}" if rotate_options.empty? - - rotate_options.map { |options| build(salt.to_s, **options) }.reduce(&:fall_back_to) - end - - def build(salt, secret_generator:, secret_generator_options:, **options) - raise NotImplementedError - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/messages/rotator.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/messages/rotator.rb deleted file mode 100644 index 31cfad9..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/messages/rotator.rb +++ /dev/null @@ -1,69 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module Messages - module Rotator # :nodoc: - def initialize(*args, on_rotation: nil, **options) - super(*args, **options) - @args = args - @options = options - @rotations = [] - @on_rotation = on_rotation - end - - def rotate(*args, **options) - fall_back_to build_rotation(*args, **options) - end - - def on_rotation(&on_rotation) - @on_rotation = on_rotation - self - end - - def fall_back_to(fallback) - @rotations << fallback - self - end - - def read_message(message, on_rotation: @on_rotation, **options) - if @rotations.empty? - super(message, **options) - else - thrown, error = catch_rotation_error do - return super(message, **options) - end - - @rotations.each do |rotation| - catch_rotation_error do - value = rotation.read_message(message, **options) - on_rotation&.call - return value - end - end - - throw thrown, error - end - end - - def initialize_dup(*) - super - @rotations = @rotations.dup - end - - private - def build_rotation(*args, **options) - self.class.new(*args, *@args.drop(args.length), **@options, **options) - end - - def catch_rotation_error(&block) - error = catch :invalid_message_format do - error = catch :invalid_message_serialization do - return [nil, block.call] - end - return [:invalid_message_serialization, error] - end - [:invalid_message_format, error] - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/messages/serializer_with_fallback.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/messages/serializer_with_fallback.rb deleted file mode 100644 index af37778..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/messages/serializer_with_fallback.rb +++ /dev/null @@ -1,158 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/kernel/reporting" -require "active_support/notifications" - -module ActiveSupport - module Messages # :nodoc: - module SerializerWithFallback # :nodoc: - def self.[](format) - if format.to_s.include?("message_pack") && !defined?(ActiveSupport::MessagePack) - require "active_support/message_pack" - end - - SERIALIZERS.fetch(format) - end - - def load(dumped) - format = detect_format(dumped) - - if format == self.format - _load(dumped) - elsif format && fallback?(format) - payload = { serializer: SERIALIZERS.key(self), fallback: format, serialized: dumped } - ActiveSupport::Notifications.instrument("message_serializer_fallback.active_support", payload) do - payload[:deserialized] = SERIALIZERS[format]._load(dumped) - end - else - raise "Unsupported serialization format" - end - end - - private - def detect_format(dumped) - case - when MessagePackWithFallback.dumped?(dumped) - :message_pack - when MarshalWithFallback.dumped?(dumped) - :marshal - when JsonWithFallback.dumped?(dumped) - :json - end - end - - def fallback?(format) - format != :marshal - end - - module AllowMarshal - private - def fallback?(format) - super || format == :marshal - end - end - - module MarshalWithFallback - include SerializerWithFallback - extend self - - def format - :marshal - end - - def dump(object) - Marshal.dump(object) - end - - def _load(dumped) - Marshal.load(dumped) - end - - MARSHAL_SIGNATURE = "\x04\x08" - - def dumped?(dumped) - dumped.start_with?(MARSHAL_SIGNATURE) - end - end - - module JsonWithFallback - include SerializerWithFallback - extend self - - def format - :json - end - - def dump(object) - ActiveSupport::JSON.encode(object) - end - - def _load(dumped) - ActiveSupport::JSON.decode(dumped, allow_comments: true) - end - - JSON_START_WITH = /\A(?:[{\["]|-?\d|true|false|null)/ - - def dumped?(dumped) - JSON_START_WITH.match?(dumped) - end - - private - def detect_format(dumped) - # Assume JSON format if format could not be determined. - super || :json - end - end - - module JsonWithFallbackAllowMarshal - include JsonWithFallback - include AllowMarshal - extend self - end - - module MessagePackWithFallback - include SerializerWithFallback - extend self - - def format - :message_pack - end - - def dump(object) - ActiveSupport::MessagePack.dump(object) - end - - def _load(dumped) - ActiveSupport::MessagePack.load(dumped) - end - - def dumped?(dumped) - available? && ActiveSupport::MessagePack.signature?(dumped) - end - - private - def available? - return @available if defined?(@available) - silence_warnings { require "active_support/message_pack" } - @available = true - rescue LoadError - @available = false - end - end - - module MessagePackWithFallbackAllowMarshal - include MessagePackWithFallback - include AllowMarshal - extend self - end - - SERIALIZERS = { - marshal: MarshalWithFallback, - json: JsonWithFallback, - json_allow_marshal: JsonWithFallbackAllowMarshal, - message_pack: MessagePackWithFallback, - message_pack_allow_marshal: MessagePackWithFallbackAllowMarshal, - } - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/multibyte.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/multibyte.rb deleted file mode 100644 index a7a281f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/multibyte.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport # :nodoc: - module Multibyte - autoload :Chars, "active_support/multibyte/chars" - autoload :Unicode, "active_support/multibyte/unicode" - - # The proxy class returned when calling mb_chars. You can use this accessor - # to configure your own proxy class so you can support other encodings. See - # the ActiveSupport::Multibyte::Chars implementation for an example how to - # do this. - # - # ActiveSupport::Multibyte.proxy_class = CharsForUTF32 - def self.proxy_class=(klass) - ActiveSupport.deprecator.warn( - "ActiveSupport::Multibyte.proxy_class= is deprecated and will be removed in Rails 8.2. " \ - "Use normal string methods instead." - ) - @proxy_class = klass - end - - # Returns the current proxy class. - def self.proxy_class - @proxy_class ||= ActiveSupport::Multibyte::Chars - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/multibyte/chars.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/multibyte/chars.rb deleted file mode 100644 index eb57a40..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/multibyte/chars.rb +++ /dev/null @@ -1,188 +0,0 @@ -# frozen_string_literal: true - -require "active_support/json" -require "active_support/core_ext/string/access" -require "active_support/core_ext/string/behavior" -require "active_support/core_ext/module/delegation" - -module ActiveSupport # :nodoc: - module Multibyte # :nodoc: - # = Active Support \Multibyte \Chars - # - # Chars enables you to work transparently with UTF-8 encoding in the Ruby - # String class without having extensive knowledge about the encoding. A - # Chars object accepts a string upon initialization and proxies String - # methods in an encoding safe manner. All the normal String methods are also - # implemented on the proxy. - # - # String methods are proxied through the Chars object, and can be accessed - # through the +mb_chars+ method. Methods which would normally return a - # String object now return a Chars object so methods can be chained. - # - # 'The Perfect String '.mb_chars.downcase.strip - # # => # - # - # Chars objects are perfectly interchangeable with String objects as long as - # no explicit class checks are made. If certain methods do explicitly check - # the class, call +to_s+ before you pass chars objects to them. - # - # bad.explicit_checking_method 'T'.mb_chars.downcase.to_s - # - # The default Chars implementation assumes that the encoding of the string - # is UTF-8, if you want to handle different encodings you can write your own - # multibyte string handler and configure it through - # ActiveSupport::Multibyte.proxy_class. - # - # class CharsForUTF32 - # def size - # @wrapped_string.size / 4 - # end - # - # def self.accepts?(string) - # string.length % 4 == 0 - # end - # end - # - # ActiveSupport::Multibyte.proxy_class = CharsForUTF32 - class Chars - include Comparable - attr_reader :wrapped_string - alias to_s wrapped_string - alias to_str wrapped_string - - delegate :<=>, :=~, :match?, :acts_like_string?, to: :wrapped_string - - # Creates a new Chars instance by wrapping _string_. - def initialize(string, deprecation: true) - if deprecation - ActiveSupport.deprecator.warn( - "ActiveSupport::Multibyte::Chars is deprecated and will be removed in Rails 8.2. " \ - "Use normal string methods instead." - ) - end - - @wrapped_string = string - if string.encoding != Encoding::UTF_8 - @wrapped_string = @wrapped_string.dup - @wrapped_string.force_encoding(Encoding::UTF_8) - end - end - - # Forward all undefined methods to the wrapped string. - def method_missing(method, ...) - result = @wrapped_string.__send__(method, ...) - if method.end_with?("!") - self if result - else - result.kind_of?(String) ? chars(result) : result - end - end - - # Returns +true+ if _obj_ responds to the given method. Private methods - # are included in the search only if the optional second parameter - # evaluates to +true+. - def respond_to_missing?(method, include_private) - @wrapped_string.respond_to?(method, include_private) - end - - # Works just like String#split, with the exception that the items - # in the resulting list are Chars instances instead of String. This makes - # chaining methods easier. - # - # 'Café périferôl'.mb_chars.split(/é/).map { |part| part.upcase.to_s } # => ["CAF", " P", "RIFERÔL"] - def split(*args) - @wrapped_string.split(*args).map { |i| self.class.new(i) } - end - - # Works like String#slice!, but returns an instance of - # Chars, or +nil+ if the string was not modified. The string will not be - # modified if the range given is out of bounds - # - # string = 'Welcome' - # string.mb_chars.slice!(3) # => # - # string # => 'Welome' - # string.mb_chars.slice!(0..3) # => # - # string # => 'me' - def slice!(*args) - string_sliced = @wrapped_string.slice!(*args) - if string_sliced - chars(string_sliced) - end - end - - # Reverses all characters in the string. - # - # 'Café'.mb_chars.reverse.to_s # => 'éfaC' - def reverse - chars(@wrapped_string.grapheme_clusters.reverse.join) - end - - # Limits the byte size of the string to a number of bytes without breaking - # characters. Usable when the storage for a string is limited for some - # reason. - # - # 'こんにちは'.mb_chars.limit(7).to_s # => "こん" - def limit(limit) - chars(@wrapped_string.truncate_bytes(limit, omission: nil)) - end - - # Capitalizes the first letter of every word, when possible. - # - # "ÉL QUE SE ENTERÓ".mb_chars.titleize.to_s # => "Él Que Se Enteró" - # "日本語".mb_chars.titleize.to_s # => "日本語" - def titleize - chars(downcase.to_s.gsub(/\b('?\S)/u) { $1.upcase }) - end - alias_method :titlecase, :titleize - - # Performs canonical decomposition on all the characters. - # - # 'é'.length # => 1 - # 'é'.mb_chars.decompose.to_s.length # => 2 - def decompose - chars(Unicode.decompose(:canonical, @wrapped_string.codepoints.to_a).pack("U*")) - end - - # Performs composition on all the characters. - # - # 'é'.length # => 1 - # 'é'.mb_chars.compose.to_s.length # => 1 - def compose - chars(Unicode.compose(@wrapped_string.codepoints.to_a).pack("U*")) - end - - # Returns the number of grapheme clusters in the string. - # - # 'क्षि'.mb_chars.length # => 4 - # 'क्षि'.mb_chars.grapheme_length # => 2 - def grapheme_length - @wrapped_string.grapheme_clusters.length - end - - # Replaces all ISO-8859-1 or CP1252 characters by their UTF-8 equivalent - # resulting in a valid UTF-8 string. - # - # Passing +true+ will forcibly tidy all bytes, assuming that the string's - # encoding is entirely CP1252 or ISO-8859-1. - def tidy_bytes(force = false) - chars(Unicode.tidy_bytes(@wrapped_string, force)) - end - - def as_json(options = nil) # :nodoc: - to_s.as_json(options) - end - - %w(reverse tidy_bytes).each do |method| - define_method("#{method}!") do |*args| - @wrapped_string = public_send(method, *args).to_s - self - end - end - - private - def chars(string) - self.class.new(string) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/multibyte/unicode.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/multibyte/unicode.rb deleted file mode 100644 index c4cb642..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/multibyte/unicode.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module Multibyte - module Unicode - extend self - - # The Unicode version that is supported by the implementation - UNICODE_VERSION = RbConfig::CONFIG["UNICODE_VERSION"] - - # Decompose composed characters to the decomposed form. - def decompose(type, codepoints) - if type == :compatibility - codepoints.pack("U*").unicode_normalize(:nfkd).codepoints - else - codepoints.pack("U*").unicode_normalize(:nfd).codepoints - end - end - - # Compose decomposed characters to the composed form. - def compose(codepoints) - codepoints.pack("U*").unicode_normalize(:nfc).codepoints - end - - # Replaces all ISO-8859-1 or CP1252 characters by their UTF-8 equivalent - # resulting in a valid UTF-8 string. - # - # Passing +true+ will forcibly tidy all bytes, assuming that the string's - # encoding is entirely CP1252 or ISO-8859-1. - def tidy_bytes(string, force = false) - return string if string.empty? || string.ascii_only? - return recode_windows1252_chars(string) if force - string.scrub { |bad| recode_windows1252_chars(bad) } - end - - private - def recode_windows1252_chars(string) - string.encode(Encoding::UTF_8, Encoding::Windows_1252, invalid: :replace, undef: :replace) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/notifications.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/notifications.rb deleted file mode 100644 index 1aaaed1..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/notifications.rb +++ /dev/null @@ -1,281 +0,0 @@ -# frozen_string_literal: true - -require "active_support/notifications/instrumenter" -require "active_support/notifications/fanout" - -module ActiveSupport - # = \Notifications - # - # +ActiveSupport::Notifications+ provides an instrumentation API for - # Ruby. - # - # == Instrumenters - # - # To instrument an event you just need to do: - # - # ActiveSupport::Notifications.instrument('render', extra: :information) do - # render plain: 'Foo' - # end - # - # That first executes the block and then notifies all subscribers once done. - # - # In the example above +render+ is the name of the event, and the rest is called - # the _payload_. The payload is a mechanism that allows instrumenters to pass - # extra information to subscribers. Payloads consist of a hash whose contents - # are arbitrary and generally depend on the event. - # - # == Subscribers - # - # You can consume those events and the information they provide by registering - # a subscriber. - # - # ActiveSupport::Notifications.subscribe('render') do |event| - # event.name # => "render" - # event.duration # => 10 (in milliseconds) - # event.payload # => { extra: :information } - # event.allocations # => 1826 (objects) - # end - # - # +Event+ objects record CPU time and allocations. If you don't need this - # it's also possible to pass a block that accepts five arguments: - # - # ActiveSupport::Notifications.subscribe('render') do |name, start, finish, id, payload| - # name # => String, name of the event (such as 'render' from above) - # start # => Time, when the instrumented block started execution - # finish # => Time, when the instrumented block ended execution - # id # => String, unique ID for the instrumenter that fired the event - # payload # => Hash, the payload - # end - # - # Here, the +start+ and +finish+ values represent wall-clock time. If you are - # concerned about accuracy, you can register a monotonic subscriber. - # - # ActiveSupport::Notifications.monotonic_subscribe('render') do |name, start, finish, id, payload| - # name # => String, name of the event (such as 'render' from above) - # start # => Float, monotonic time when the instrumented block started execution - # finish # => Float, monotonic time when the instrumented block ended execution - # id # => String, unique ID for the instrumenter that fired the event - # payload # => Hash, the payload - # end - # - # For instance, let's store all "render" events in an array: - # - # events = [] - # - # ActiveSupport::Notifications.subscribe('render') do |event| - # events << event - # end - # - # That code returns right away, you are just subscribing to "render" events. - # The block is saved and will be called whenever someone instruments "render": - # - # ActiveSupport::Notifications.instrument('render', extra: :information) do - # render plain: 'Foo' - # end - # - # event = events.first - # event.name # => "render" - # event.duration # => 10 (in milliseconds) - # event.payload # => { extra: :information } - # event.allocations # => 1826 (objects) - # - # If an exception happens during that particular instrumentation the payload will - # have a key :exception with an array of two elements as value: a string with - # the name of the exception class, and the exception message. - # The :exception_object key of the payload will have the exception - # itself as the value: - # - # event.payload[:exception] # => ["ArgumentError", "Invalid value"] - # event.payload[:exception_object] # => # - # - # As the earlier example depicts, the class ActiveSupport::Notifications::Event - # is able to take the arguments as they come and provide an object-oriented - # interface to that data. - # - # It is also possible to pass an object which responds to call method - # as the second parameter to the subscribe method instead of a block: - # - # module ActionController - # class PageRequest - # def call(name, started, finished, unique_id, payload) - # Rails.logger.debug ['notification:', name, started, finished, unique_id, payload].join(' ') - # end - # end - # end - # - # ActiveSupport::Notifications.subscribe('process_action.action_controller', ActionController::PageRequest.new) - # - # resulting in the following output within the logs including a hash with the payload: - # - # notification: process_action.action_controller 2012-04-13 01:08:35 +0300 2012-04-13 01:08:35 +0300 af358ed7fab884532ec7 { - # controller: "Devise::SessionsController", - # action: "new", - # params: {"action"=>"new", "controller"=>"devise/sessions"}, - # format: :html, - # method: "GET", - # path: "/login/sign_in", - # status: 200, - # view_runtime: 279.3080806732178, - # db_runtime: 40.053 - # } - # - # You can also subscribe to all events whose name matches a certain regexp: - # - # ActiveSupport::Notifications.subscribe(/render/) do |*args| - # ... - # end - # - # and even pass no argument to subscribe, in which case you are subscribing - # to all events. - # - # == Temporary Subscriptions - # - # Sometimes you do not want to subscribe to an event for the entire life of - # the application. There are two ways to unsubscribe. - # - # WARNING: The instrumentation framework is designed for long-running subscribers, - # use this feature sparingly because it wipes some internal caches and that has - # a negative impact on performance. - # - # === Subscribe While a Block Runs - # - # You can subscribe to some event temporarily while some block runs. For - # example, in - # - # callback = lambda {|event| ... } - # ActiveSupport::Notifications.subscribed(callback, "sql.active_record") do - # ... - # end - # - # the callback will be called for all "sql.active_record" events instrumented - # during the execution of the block. The callback is unsubscribed automatically - # after that. - # - # To record +started+ and +finished+ values with monotonic time, - # specify the optional :monotonic option to the - # subscribed method. The :monotonic option is set - # to +false+ by default. - # - # callback = lambda {|name, started, finished, unique_id, payload| ... } - # ActiveSupport::Notifications.subscribed(callback, "sql.active_record", monotonic: true) do - # ... - # end - # - # === Manual Unsubscription - # - # The +subscribe+ method returns a subscriber object: - # - # subscriber = ActiveSupport::Notifications.subscribe("render") do |event| - # ... - # end - # - # To prevent that block from being called anymore, just unsubscribe passing - # that reference: - # - # ActiveSupport::Notifications.unsubscribe(subscriber) - # - # You can also unsubscribe by passing the name of the subscriber object. Note - # that this will unsubscribe all subscriptions with the given name: - # - # ActiveSupport::Notifications.unsubscribe("render") - # - # Subscribers using a regexp or other pattern-matching object will remain subscribed - # to all events that match their original pattern, unless those events match a string - # passed to +unsubscribe+: - # - # subscriber = ActiveSupport::Notifications.subscribe(/render/) { } - # ActiveSupport::Notifications.unsubscribe('render_template.action_view') - # subscriber.subscribed_to?('render_template.action_view') # => false - # subscriber.subscribed_to?('render_partial.action_view') # => true - # - # == Default Queue - # - # Notifications ships with a queue implementation that consumes and publishes events - # to all log subscribers. You can use any queue implementation you want. - # - module Notifications - class << self - attr_accessor :notifier - - def publish(name, *args) - notifier.publish(name, *args) - end - - def publish_event(event) # :nodoc: - notifier.publish_event(event) - end - - def instrument(name, payload = {}) - if notifier.listening?(name) - instrumenter.instrument(name, payload) { yield payload if block_given? } - else - yield payload if block_given? - end - end - - # Subscribe to a given event name with the passed +block+. - # - # You can subscribe to events by passing a String to match exact event - # names, or by passing a Regexp to match all events that match a pattern. - # - # If the block passed to the method only takes one argument, - # it will yield an +Event+ object to the block: - # - # ActiveSupport::Notifications.subscribe(/render/) do |event| - # @event = event - # end - # - # Otherwise the +block+ will receive five arguments with information - # about the event: - # - # ActiveSupport::Notifications.subscribe('render') do |name, start, finish, id, payload| - # name # => String, name of the event (such as 'render' from above) - # start # => Time, when the instrumented block started execution - # finish # => Time, when the instrumented block ended execution - # id # => String, unique ID for the instrumenter that fired the event - # payload # => Hash, the payload - # end - # - # Raises an error if invalid event name type is passed: - # - # ActiveSupport::Notifications.subscribe(:render) {|event| ...} - # #=> ArgumentError (pattern must be specified as a String, Regexp or empty) - # - def subscribe(pattern = nil, callback = nil, &block) - notifier.subscribe(pattern, callback, monotonic: false, &block) - end - - # Performs the same functionality as #subscribe, but the +start+ and - # +finish+ block arguments are in monotonic time instead of wall-clock - # time. Monotonic time will not jump forward or backward (due to NTP or - # Daylights Savings). Use +monotonic_subscribe+ when accuracy of time - # duration is important. For example, computing elapsed time between - # two events. - def monotonic_subscribe(pattern = nil, callback = nil, &block) - notifier.subscribe(pattern, callback, monotonic: true, &block) - end - - def subscribed(callback, pattern = nil, monotonic: false, &block) - subscriber = notifier.subscribe(pattern, callback, monotonic: monotonic) - yield - ensure - unsubscribe(subscriber) - end - - def unsubscribe(subscriber_or_name) - notifier.unsubscribe(subscriber_or_name) - end - - def instrumenter - registry[notifier] ||= Instrumenter.new(notifier) - end - - private - def registry - ActiveSupport::IsolatedExecutionState[:active_support_notifications_registry] ||= {} - end - end - - self.notifier = Fanout.new - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/notifications/fanout.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/notifications/fanout.rb deleted file mode 100644 index 4df9671..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/notifications/fanout.rb +++ /dev/null @@ -1,467 +0,0 @@ -# frozen_string_literal: true - -require "concurrent/map" -require "active_support/core_ext/object/try" - -module ActiveSupport - module Notifications - class InstrumentationSubscriberError < RuntimeError - attr_reader :exceptions - - def initialize(exceptions) - @exceptions = exceptions - exception_class_names = exceptions.map { |e| e.class.name } - super "Exception(s) occurred within instrumentation subscribers: #{exception_class_names.join(', ')}" - end - end - - module FanoutIteration # :nodoc: - private - def iterate_guarding_exceptions(collection, &block) - case collection.size - when 0 - when 1 - collection.each(&block) - else - exceptions = nil - - collection.each do |s| - yield s - rescue Exception => e - exceptions ||= [] - exceptions << e - end - - if exceptions - exceptions = exceptions.flat_map do |exception| - exception.is_a?(InstrumentationSubscriberError) ? exception.exceptions : [exception] - end - if exceptions.size == 1 - raise exceptions.first - else - raise InstrumentationSubscriberError.new(exceptions), cause: exceptions.first - end - end - end - - collection - end - end - - # This is a default queue implementation that ships with Notifications. - # It just pushes events to all registered log subscribers. - # - # This class is thread safe. All methods are reentrant. - class Fanout - def initialize - @mutex = Mutex.new - @string_subscribers = Concurrent::Map.new { |h, k| h.compute_if_absent(k) { [] } } - @other_subscribers = [] - @all_listeners_for = Concurrent::Map.new - @groups_for = Concurrent::Map.new - end - - def inspect # :nodoc: - total_patterns = @string_subscribers.size + @other_subscribers.size - "#<#{self.class} (#{total_patterns} patterns)>" - end - - def subscribe(pattern = nil, callable = nil, monotonic: false, &block) - subscriber = Subscribers.new(pattern, callable || block, monotonic) - @mutex.synchronize do - case pattern - when String - @string_subscribers[pattern] << subscriber - clear_cache(pattern) - when NilClass, Regexp - @other_subscribers << subscriber - clear_cache - else - raise ArgumentError, "pattern must be specified as a String, Regexp or empty" - end - end - subscriber - end - - def unsubscribe(subscriber_or_name) - @mutex.synchronize do - case subscriber_or_name - when String - @string_subscribers[subscriber_or_name].clear - clear_cache(subscriber_or_name) - @other_subscribers.each { |sub| sub.unsubscribe!(subscriber_or_name) } - else - pattern = subscriber_or_name.try(:pattern) - if String === pattern - @string_subscribers[pattern].delete(subscriber_or_name) - clear_cache(pattern) - else - @other_subscribers.delete(subscriber_or_name) - clear_cache - end - end - end - end - - def clear_cache(key = nil) # :nodoc: - if key - @all_listeners_for.delete(key) - @groups_for.delete(key) - else - @all_listeners_for.clear - @groups_for.clear - end - end - - class BaseGroup # :nodoc: - include FanoutIteration - - def initialize(listeners, name, id, payload) - @listeners = listeners - end - - def each(&block) - iterate_guarding_exceptions(@listeners, &block) - end - end - - class BaseTimeGroup < BaseGroup # :nodoc: - def start(name, id, payload) - @start_time = now - end - - def finish(name, id, payload) - stop_time = now - each do |listener| - listener.call(name, @start_time, stop_time, id, payload) - end - end - end - - class MonotonicTimedGroup < BaseTimeGroup # :nodoc: - private - def now - Process.clock_gettime(Process::CLOCK_MONOTONIC) - end - end - - class TimedGroup < BaseTimeGroup # :nodoc: - private - def now - Time.now - end - end - - class EventedGroup < BaseGroup # :nodoc: - def start(name, id, payload) - each do |s| - s.start(name, id, payload) - end - end - - def finish(name, id, payload) - each do |s| - s.finish(name, id, payload) - end - end - end - - class EventObjectGroup < BaseGroup # :nodoc: - def start(name, id, payload) - @event = build_event(name, id, payload) - @event.start! - end - - def finish(name, id, payload) - @event.payload = payload - @event.finish! - - each do |s| - s.call(@event) - end - end - - private - def build_event(name, id, payload) - ActiveSupport::Notifications::Event.new name, nil, nil, id, payload - end - end - - def group_listeners(listeners) # :nodoc: - listeners.group_by(&:group_class).transform_values do |s| - s.map(&:delegate).freeze - end.freeze - end - - def groups_for(name) # :nodoc: - silenceable_groups, groups = @groups_for.compute_if_absent(name) do - listeners = all_listeners_for(name) - listeners.partition(&:silenceable).map { |l| group_listeners(l) } - end - - unless silenceable_groups.empty? - silenceable_groups.each do |group_class, subscriptions| - active_subscriptions = subscriptions.reject { |s| s.silenced?(name) } - unless active_subscriptions.empty? - groups = groups.dup if groups.frozen? - base_groups = groups[group_class] - groups[group_class] = base_groups ? base_groups + active_subscriptions : active_subscriptions - end - end - end - - groups - end - - # A +Handle+ is used to record the start and finish time of event. - # - # Both #start and #finish must each be called exactly once. - # - # Where possible, it's best to use the block form: ActiveSupport::Notifications.instrument. - # +Handle+ is a low-level API intended for cases where the block form can't be used. - # - # handle = ActiveSupport::Notifications.instrumenter.build_handle("my.event", {}) - # begin - # handle.start - # # work to be instrumented - # ensure - # handle.finish - # end - class Handle - include FanoutIteration - - def initialize(notifier, name, id, groups, payload) # :nodoc: - @name = name - @id = id - @payload = payload - @groups = groups - @state = :initialized - end - - def start - ensure_state! :initialized - @state = :started - - iterate_guarding_exceptions(@groups) do |group| - group.start(@name, @id, @payload) - end - end - - def finish - finish_with_values(@name, @id, @payload) - end - - def finish_with_values(name, id, payload) # :nodoc: - ensure_state! :started - @state = :finished - - iterate_guarding_exceptions(@groups) do |group| - group.finish(name, id, payload) - end - end - - private - def ensure_state!(expected) - if @state != expected - raise ArgumentError, "expected state to be #{expected.inspect} but was #{@state.inspect}" - end - end - end - - module NullHandle # :nodoc: - extend self - - def start - end - - def finish - end - - def finish_with_values(_name, _id, _payload) - end - end - - include FanoutIteration - - def build_handle(name, id, payload) - groups = groups_for(name).map do |group_klass, grouped_listeners| - group_klass.new(grouped_listeners, name, id, payload) - end - - if groups.empty? - NullHandle - else - Handle.new(self, name, id, groups, payload) - end - end - - def start(name, id, payload) - handle_stack = (IsolatedExecutionState[:_fanout_handle_stack] ||= []) - handle = build_handle(name, id, payload) - handle_stack << handle - handle.start - end - - def finish(name, id, payload, listeners = nil) - handle_stack = IsolatedExecutionState[:_fanout_handle_stack] - handle = handle_stack.pop - handle.finish_with_values(name, id, payload) - end - - def publish(name, ...) - iterate_guarding_exceptions(listeners_for(name)) { |s| s.publish(name, ...) } - end - - def publish_event(event) - iterate_guarding_exceptions(listeners_for(event.name)) { |s| s.publish_event(event) } - end - - def all_listeners_for(name) - # this is correctly done double-checked locking (Concurrent::Map's lookups have volatile semantics) - @all_listeners_for[name] || @mutex.synchronize do - # use synchronisation when accessing @subscribers - @all_listeners_for[name] ||= - @string_subscribers[name] + @other_subscribers.select { |s| s.subscribed_to?(name) } - end - end - - def listeners_for(name) - all_listeners_for(name).reject { |s| s.silenced?(name) } - end - - def listening?(name) - all_listeners_for(name).any? { |s| !s.silenced?(name) } - end - - # This is a sync queue, so there is no waiting. - def wait - end - - module Subscribers # :nodoc: - def self.new(pattern, listener, monotonic) - subscriber_class = monotonic ? MonotonicTimed : Timed - - if listener.respond_to?(:start) && listener.respond_to?(:finish) - subscriber_class = Evented - else - # Doing this to detect a single argument block or callable - # like `proc { |x| }` vs `proc { |*x| }`, `proc { |**x| }`, - # or `proc { |x, **y| }` - procish = listener.respond_to?(:parameters) ? listener : listener.method(:call) - - if procish.arity == 1 && procish.parameters.length == 1 - subscriber_class = EventObject - end - end - - subscriber_class.new(pattern, listener) - end - - class Matcher # :nodoc: - attr_reader :pattern, :exclusions - - def self.wrap(pattern) - if String === pattern - pattern - elsif pattern.nil? - AllMessages.new - else - new(pattern) - end - end - - def initialize(pattern) - @pattern = pattern - @exclusions = Set.new - end - - def unsubscribe!(name) - exclusions << -name if pattern === name - end - - def ===(name) - pattern === name && !exclusions.include?(name) - end - - class AllMessages - def ===(name) - true - end - - def unsubscribe!(*) - false - end - end - end - - class Evented # :nodoc: - attr_reader :pattern, :delegate, :silenceable - - def initialize(pattern, delegate) - @pattern = Matcher.wrap(pattern) - @delegate = delegate - @silenceable = delegate.respond_to?(:silenced?) - @can_publish = delegate.respond_to?(:publish) - @can_publish_event = delegate.respond_to?(:publish_event) - end - - def group_class - EventedGroup - end - - def publish(...) - if @can_publish - @delegate.publish(...) - end - end - - def publish_event(event) - if @can_publish_event - @delegate.publish_event event - else - publish(event.name, event.time, event.end, event.transaction_id, event.payload) - end - end - - def silenced?(name) - @silenceable && @delegate.silenced?(name) - end - - def subscribed_to?(name) - pattern === name - end - - def unsubscribe!(name) - pattern.unsubscribe!(name) - end - end - - class Timed < Evented # :nodoc: - def group_class - TimedGroup - end - - def publish(...) - @delegate.call(...) - end - end - - class MonotonicTimed < Timed # :nodoc: - def group_class - MonotonicTimedGroup - end - end - - class EventObject < Evented - def group_class - EventObjectGroup - end - - def publish_event(event) - @delegate.call event - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/notifications/instrumenter.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/notifications/instrumenter.rb deleted file mode 100644 index 140685c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/notifications/instrumenter.rb +++ /dev/null @@ -1,240 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/module/delegation" -require "securerandom" - -module ActiveSupport - module Notifications - # Instrumenters are stored in a thread local. - class Instrumenter - attr_reader :id - - def initialize(notifier) - unless notifier.respond_to?(:build_handle) - notifier = LegacyHandle::Wrapper.new(notifier) - end - - @id = unique_id - @notifier = notifier - end - - class LegacyHandle # :nodoc: - class Wrapper # :nodoc: - def initialize(notifier) - @notifier = notifier - end - - def build_handle(name, id, payload) - LegacyHandle.new(@notifier, name, id, payload) - end - - delegate :start, :finish, to: :@notifier - end - - def initialize(notifier, name, id, payload) - @notifier = notifier - @name = name - @id = id - @payload = payload - end - - def start - @listener_state = @notifier.start @name, @id, @payload - end - - def finish - @notifier.finish(@name, @id, @payload, @listener_state) - end - end - - # Given a block, instrument it by measuring the time taken to execute - # and publish it. Without a block, simply send a message via the - # notifier. Notice that events get sent even if an error occurs in the - # passed-in block. - def instrument(name, payload = {}) - handle = build_handle(name, payload) - handle.start - begin - yield payload if block_given? - rescue Exception => e - payload[:exception] = [e.class.name, e.message] - payload[:exception_object] = e - raise e - ensure - handle.finish - end - end - - # Returns a "handle" for an event with the given +name+ and +payload+. - # - # #start and #finish must each be called exactly once on the returned object. - # - # Where possible, it's best to use #instrument, which will record the - # start and finish of the event and correctly handle any exceptions. - # +build_handle+ is a low-level API intended for cases where using - # +instrument+ isn't possible. - # - # See ActiveSupport::Notifications::Fanout::Handle. - def build_handle(name, payload) - @notifier.build_handle(name, @id, payload) - end - - def new_event(name, payload = {}) # :nodoc: - Event.new(name, nil, nil, @id, payload) - end - - # Send a start notification with +name+ and +payload+. - def start(name, payload) - @notifier.start name, @id, payload - end - - # Send a finish notification with +name+ and +payload+. - def finish(name, payload) - @notifier.finish name, @id, payload - end - - def finish_with_state(listeners_state, name, payload) - @notifier.finish name, @id, payload, listeners_state - end - - private - def unique_id - SecureRandom.hex(10) - end - end - - class Event - attr_reader :name, :transaction_id - attr_accessor :payload - - def initialize(name, start, ending, transaction_id, payload) - @name = name - @payload = payload.dup - @time = start ? start.to_f * 1_000.0 : start - @transaction_id = transaction_id - @end = ending ? ending.to_f * 1_000.0 : ending - @cpu_time_start = 0.0 - @cpu_time_finish = 0.0 - @allocation_count_start = 0 - @allocation_count_finish = 0 - @gc_time_start = 0 - @gc_time_finish = 0 - end - - def time - @time / 1000.0 if @time - end - - def end - @end / 1000.0 if @end - end - - def record # :nodoc: - start! - begin - yield payload if block_given? - rescue Exception => e - payload[:exception] = [e.class.name, e.message] - payload[:exception_object] = e - raise e - ensure - finish! - end - end - - # Record information at the time this event starts - def start! - @time = now - @cpu_time_start = now_cpu - @gc_time_start = now_gc - @allocation_count_start = now_allocations - end - - # Record information at the time this event finishes - def finish! - @cpu_time_finish = now_cpu - @gc_time_finish = now_gc - @end = now - @allocation_count_finish = now_allocations - end - - # Returns the CPU time (in milliseconds) passed between the call to - # #start! and the call to #finish!. - def cpu_time - @cpu_time_finish - @cpu_time_start - end - - # Returns the idle time (in milliseconds) passed between the call to - # #start! and the call to #finish!. - def idle_time - diff = duration - cpu_time - diff > 0.0 ? diff : 0.0 - end - - # Returns the number of allocations made between the call to #start! and - # the call to #finish!. - def allocations - @allocation_count_finish - @allocation_count_start - end - - # Returns the time spent in GC (in milliseconds) between the call to #start! - # and the call to #finish! - def gc_time - (@gc_time_finish - @gc_time_start) / 1_000_000.0 - end - - # Returns the difference in milliseconds between when the execution of the - # event started and when it ended. - # - # ActiveSupport::Notifications.subscribe('wait') do |event| - # @event = event - # end - # - # ActiveSupport::Notifications.instrument('wait') do - # sleep 1 - # end - # - # @event.duration # => 1000.138 - def duration - @end - @time - end - - private - def now - Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond) - end - - begin - Process.clock_gettime(Process::CLOCK_THREAD_CPUTIME_ID, :float_millisecond) - - def now_cpu - Process.clock_gettime(Process::CLOCK_THREAD_CPUTIME_ID, :float_millisecond) - end - rescue - def now_cpu - 0.0 - end - end - - if GC.respond_to?(:total_time) - def now_gc - GC.total_time - end - else - def now_gc - 0 - end - end - - if GC.stat.key?(:total_allocated_objects) - def now_allocations - GC.stat(:total_allocated_objects) - end - else # Likely on JRuby, TruffleRuby - def now_allocations - 0 - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper.rb deleted file mode 100644 index 0c51306..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper.rb +++ /dev/null @@ -1,479 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # = Number Helper - # - # Provides methods for formatting numbers into currencies, percentages, - # phone numbers, and more. - # - # Example usage in a class: - # class Topic - # include ActiveSupport::NumberHelper - # - # def price - # number_to_currency(@price) - # end - # end - # - # Example usage in a module: - # require "active_support/number_helper" - # - # module NumberFormatting - # def format_price(price) - # ActiveSupport::NumberHelper.number_to_currency(price) - # end - # end - module NumberHelper - extend ActiveSupport::Autoload - - eager_autoload do - autoload :NumberConverter - autoload :RoundingHelper - autoload :NumberToRoundedConverter - autoload :NumberToDelimitedConverter - autoload :NumberToHumanConverter - autoload :NumberToHumanSizeConverter - autoload :NumberToPhoneConverter - autoload :NumberToCurrencyConverter - autoload :NumberToPercentageConverter - end - - extend self - - # Formats +number+ into a phone number. - # - # number_to_phone(5551234) # => "555-1234" - # number_to_phone("5551234") # => "555-1234" - # number_to_phone(1235551234) # => "123-555-1234" - # number_to_phone("12x34") # => "12x34" - # - # number_to_phone(1235551234, delimiter: ".", country_code: 1, extension: 1343) - # # => "+1.123.555.1234 x 1343" - # - # ==== Options - # - # [+:area_code+] - # Whether to use parentheses for the area code. Defaults to false. - # - # number_to_phone(1235551234, area_code: true) - # # => "(123) 555-1234" - # - # [+:delimiter+] - # The digit group delimiter to use. Defaults to "-". - # - # number_to_phone(1235551234, delimiter: " ") - # # => "123 555 1234" - # - # [+:country_code+] - # A country code to prepend. - # - # number_to_phone(1235551234, country_code: 1) - # # => "+1-123-555-1234" - # - # [+:extension+] - # An extension to append. - # - # number_to_phone(1235551234, extension: 555) - # # => "123-555-1234 x 555" - # - # [+:pattern+] - # A regexp that specifies how the digits should be grouped. The first - # three captures from the regexp are treated as digit groups. - # - # number_to_phone(13312345678, pattern: /(\d{3})(\d{4})(\d{4})$/) - # # => "133-1234-5678" - # number_to_phone(75561234567, pattern: /(\d{1,4})(\d{4})(\d{4})$/, area_code: true) - # # => "(755) 6123-4567" - # - def number_to_phone(number, options = {}) - NumberToPhoneConverter.convert(number, options) - end - - # Formats a +number+ into a currency string. - # - # number_to_currency(1234567890.50) # => "$1,234,567,890.50" - # number_to_currency(1234567890.506) # => "$1,234,567,890.51" - # number_to_currency("12x34") # => "$12x34" - # - # number_to_currency(1234567890.50, unit: "£", separator: ",", delimiter: "") - # # => "£1234567890,50" - # - # The currency unit and number formatting of the current locale will be used - # unless otherwise specified via options. No currency conversion is - # performed. If the user is given a way to change their locale, they will - # also be able to change the relative value of the currency displayed with - # this helper. If your application will ever support multiple locales, you - # may want to specify a constant +:locale+ option or consider using a - # library capable of currency conversion. - # - # ==== Options - # - # [+:locale+] - # The locale to use for formatting. Defaults to the current locale. - # - # number_to_currency(1234567890.506, locale: :fr) - # # => "1 234 567 890,51 €" - # - # [+:precision+] - # The level of precision. Defaults to 2. - # - # number_to_currency(1234567890.123, precision: 3) # => "$1,234,567,890.123" - # number_to_currency(0.456789, precision: 0) # => "$0" - # - # [+:round_mode+] - # Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to - # +:default+. - # - # number_to_currency(1234567890.01, precision: 0, round_mode: :up) - # # => "$1,234,567,891" - # - # [+:unit+] - # The denomination of the currency. Defaults to "$". - # - # [+:separator+] - # The decimal separator. Defaults to ".". - # - # [+:delimiter+] - # The thousands delimiter. Defaults to ",". - # - # [+:format+] - # The format for non-negative numbers. %u represents the currency, - # and %n represents the number. Defaults to "%u%n". - # - # number_to_currency(1234567890.50, format: "%n %u") - # # => "1,234,567,890.50 $" - # - # [+:negative_format+] - # The format for negative numbers. %u and %n behave the - # same as in +:format+, but %n represents the absolute value of - # the number. Defaults to the value of +:format+ prepended with -. - # - # number_to_currency(-1234567890.50, negative_format: "(%u%n)") - # # => "($1,234,567,890.50)" - # - # [+:strip_insignificant_zeros+] - # Whether to remove insignificant zeros after the decimal separator. - # Defaults to false. - # - # number_to_currency(1234567890.50, strip_insignificant_zeros: true) - # # => "$1,234,567,890.5" - # - def number_to_currency(number, options = {}) - NumberToCurrencyConverter.convert(number, options) - end - - # Formats +number+ as a percentage string. - # - # number_to_percentage(100) # => "100.000%" - # number_to_percentage("99") # => "99.000%" - # number_to_percentage("99x") # => "99x%" - # - # number_to_percentage(12345.6789, delimiter: ".", separator: ",", precision: 2) - # # => "12.345,68%" - # - # ==== Options - # - # [+:locale+] - # The locale to use for formatting. Defaults to the current locale. - # - # number_to_percentage(1000, locale: :fr) - # # => "1000,000%" - # - # [+:precision+] - # The level of precision, or +nil+ to preserve +number+'s precision. - # Defaults to 2. - # - # number_to_percentage(12.3456789, precision: 4) # => "12.3457%" - # number_to_percentage(99.999, precision: 0) # => "100%" - # number_to_percentage(99.999, precision: nil) # => "99.999%" - # - # [+:round_mode+] - # Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to - # +:default+. - # - # number_to_percentage(12.3456789, precision: 4, round_mode: :down) - # # => "12.3456%" - # - # [+:significant+] - # Whether +:precision+ should be applied to significant digits instead of - # fractional digits. Defaults to false. - # - # number_to_percentage(12345.6789) # => "12345.679%" - # number_to_percentage(12345.6789, significant: true) # => "12300%" - # number_to_percentage(12345.6789, precision: 2) # => "12345.68%" - # number_to_percentage(12345.6789, precision: 2, significant: true) # => "12000%" - # - # [+:separator+] - # The decimal separator. Defaults to ".". - # - # [+:delimiter+] - # The thousands delimiter. Defaults to ",". - # - # [+:strip_insignificant_zeros+] - # Whether to remove insignificant zeros after the decimal separator. - # Defaults to false. - # - # [+:format+] - # The format of the output. %n represents the number. Defaults to - # "%n%". - # - # number_to_percentage(100, format: "%n %") - # # => "100.000 %" - # - def number_to_percentage(number, options = {}) - NumberToPercentageConverter.convert(number, options) - end - - # Formats +number+ by grouping thousands with a delimiter. - # - # number_to_delimited(12345678) # => "12,345,678" - # number_to_delimited("123456") # => "123,456" - # number_to_delimited(12345678.9876) # => "12,345,678.9876" - # number_to_delimited("12x34") # => "12x34" - # - # number_to_delimited(12345678.9876, delimiter: ".", separator: ",") - # # => "12.345.678,9876" - # - # ==== Options - # - # [+:locale+] - # The locale to use for formatting. Defaults to the current locale. - # - # number_to_delimited(12345678.05, locale: :fr) - # # => "12 345 678,05" - # - # [+:delimiter+] - # The thousands delimiter. Defaults to ",". - # - # number_to_delimited(12345678, delimiter: ".") - # # => "12.345.678" - # - # [+:separator+] - # The decimal separator. Defaults to ".". - # - # number_to_delimited(12345678.05, separator: " ") - # # => "12,345,678 05" - # - # [+:delimiter_pattern+] - # A regexp to determine the placement of delimiters. Helpful when using - # currency formats like INR. - # - # number_to_delimited("123456.78", delimiter_pattern: /(\d+?)(?=(\d\d)+(\d)(?!\d))/) - # # => "1,23,456.78" - # - def number_to_delimited(number, options = {}) - NumberToDelimitedConverter.convert(number, options) - end - - # Formats +number+ to a specific level of precision. - # - # number_to_rounded(12345.6789) # => "12345.679" - # number_to_rounded(12345.6789, precision: 2) # => "12345.68" - # number_to_rounded(12345.6789, precision: 0) # => "12345" - # number_to_rounded(12345, precision: 5) # => "12345.00000" - # - # ==== Options - # - # [+:locale+] - # The locale to use for formatting. Defaults to the current locale. - # - # number_to_rounded(111.234, locale: :fr) - # # => "111,234" - # - # [+:precision+] - # The level of precision, or +nil+ to preserve +number+'s precision. - # Defaults to 3. - # - # number_to_rounded(12345.6789, precision: nil) - # # => "12345.6789" - # - # [+:round_mode+] - # Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to - # +:default+. - # - # number_to_rounded(12.34, precision: 0, round_mode: :up) - # # => "13" - # - # [+:significant+] - # Whether +:precision+ should be applied to significant digits instead of - # fractional digits. Defaults to false. - # - # number_to_rounded(12345.6789) # => "12345.679" - # number_to_rounded(12345.6789, significant: true) # => "12300" - # number_to_rounded(12345.6789, precision: 2) # => "12345.68" - # number_to_rounded(12345.6789, precision: 2, significant: true) # => "12000" - # - # [+:separator+] - # The decimal separator. Defaults to ".". - # - # [+:delimiter+] - # The thousands delimiter. Defaults to ",". - # - # [+:strip_insignificant_zeros+] - # Whether to remove insignificant zeros after the decimal separator. - # Defaults to false. - # - # number_to_rounded(12.34, strip_insignificant_zeros: false) # => "12.340" - # number_to_rounded(12.34, strip_insignificant_zeros: true) # => "12.34" - # number_to_rounded(12.3456, strip_insignificant_zeros: true) # => "12.346" - # - def number_to_rounded(number, options = {}) - NumberToRoundedConverter.convert(number, options) - end - - # Formats +number+ as bytes into a more human-friendly representation. - # Useful for reporting file sizes to users. - # - # number_to_human_size(123) # => "123 Bytes" - # number_to_human_size(1234) # => "1.21 KB" - # number_to_human_size(12345) # => "12.1 KB" - # number_to_human_size(1234567) # => "1.18 MB" - # number_to_human_size(1234567890) # => "1.15 GB" - # number_to_human_size(1234567890123) # => "1.12 TB" - # number_to_human_size(1234567890123456) # => "1.1 PB" - # number_to_human_size(1234567890123456789) # => "1.07 EB" - # - # See #number_to_human if you want to pretty-print a generic number. - # - # ==== Options - # - # [+:locale+] - # The locale to use for formatting. Defaults to the current locale. - # - # [+:precision+] - # The level of precision. Defaults to 3. - # - # number_to_human_size(123456, precision: 2) # => "120 KB" - # number_to_human_size(1234567, precision: 2) # => "1.2 MB" - # - # [+:round_mode+] - # Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to - # +:default+. - # - # number_to_human_size(123456, precision: 2, round_mode: :up) - # # => "130 KB" - # - # [+:significant+] - # Whether +:precision+ should be applied to significant digits instead of - # fractional digits. Defaults to true. - # - # [+:separator+] - # The decimal separator. Defaults to ".". - # - # number_to_human_size(1234567, separator: ",") - # # => "1,18 MB" - # - # [+:delimiter+] - # The thousands delimiter. Defaults to ",". - # - # [+:strip_insignificant_zeros+] - # Whether to remove insignificant zeros after the decimal separator. - # Defaults to true. - # - def number_to_human_size(number, options = {}) - NumberToHumanSizeConverter.convert(number, options) - end - - # Formats +number+ into a more human-friendly representation. Useful for - # numbers that can become very large and too hard to read. - # - # number_to_human(123) # => "123" - # number_to_human(1234) # => "1.23 Thousand" - # number_to_human(12345) # => "12.3 Thousand" - # number_to_human(1234567) # => "1.23 Million" - # number_to_human(1234567890) # => "1.23 Billion" - # number_to_human(1234567890123) # => "1.23 Trillion" - # number_to_human(1234567890123456) # => "1.23 Quadrillion" - # number_to_human(1234567890123456789) # => "1230 Quadrillion" - # - # See #number_to_human_size if you want to pretty-print a file size. - # - # ==== Options - # - # [+:locale+] - # The locale to use for formatting. Defaults to the current locale. - # - # [+:precision+] - # The level of precision. Defaults to 3. - # - # number_to_human(123456, precision: 2) # => "120 Thousand" - # number_to_human(123456, precision: 4) # => "123.5 Thousand" - # - # [+:round_mode+] - # Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to - # +:default+. - # - # number_to_human(123456, precision: 2, round_mode: :up) - # # => "130 Thousand" - # - # [+:significant+] - # Whether +:precision+ should be applied to significant digits instead of - # fractional digits. Defaults to true. - # - # [+:separator+] - # The decimal separator. Defaults to ".". - # - # number_to_human(123456, precision: 4, separator: ",") - # # => "123,5 Thousand" - # - # [+:delimiter+] - # The thousands delimiter. Defaults to ",". - # - # [+:strip_insignificant_zeros+] - # Whether to remove insignificant zeros after the decimal separator. - # Defaults to true. - # - # number_to_human(1000000) # => "1 Million" - # number_to_human(1000000, strip_insignificant_zeros: false) # => "1.00 Million" - # number_to_human(10.01) # => "10" - # number_to_human(10.01, strip_insignificant_zeros: false) # => "10.0" - # - # [+:format+] - # The format of the output. %n represents the number, and - # %u represents the quantifier (e.g., "Thousand"). Defaults to - # "%n %u". - # - # [+:units+] - # A Hash of custom unit quantifier names. - # - # number_to_human(1, units: { unit: "m", thousand: "km" }) # => "1 m" - # number_to_human(100, units: { unit: "m", thousand: "km" }) # => "100 m" - # number_to_human(1000, units: { unit: "m", thousand: "km" }) # => "1 km" - # number_to_human(100000, units: { unit: "m", thousand: "km" }) # => "100 km" - # number_to_human(10000000, units: { unit: "m", thousand: "km" }) # => "10000 km" - # - # The following keys are supported for integer units: +:unit+, +:ten+, - # +:hundred+, +:thousand+, +:million+, +:billion+, +:trillion+, - # +:quadrillion+. Additionally, the following keys are supported for - # fractional units: +:deci+, +:centi+, +:mili+, +:micro+, +:nano+, - # +:pico+, +:femto+. - # - # The Hash can also be defined as a scope in an I18n locale. For example: - # - # en: - # distance: - # centi: - # one: "centimeter" - # other: "centimeters" - # unit: - # one: "meter" - # other: "meters" - # thousand: - # one: "kilometer" - # other: "kilometers" - # - # Then it can be specified by name: - # - # number_to_human(1, units: :distance) # => "1 meter" - # number_to_human(100, units: :distance) # => "100 meters" - # number_to_human(1000, units: :distance) # => "1 kilometer" - # number_to_human(100000, units: :distance) # => "100 kilometers" - # number_to_human(10000000, units: :distance) # => "10000 kilometers" - # number_to_human(0.1, units: :distance) # => "10 centimeters" - # number_to_human(0.01, units: :distance) # => "1 centimeter" - # - def number_to_human(number, options = {}) - NumberToHumanConverter.convert(number, options) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_converter.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_converter.rb deleted file mode 100644 index 8cb0ab3..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_converter.rb +++ /dev/null @@ -1,193 +0,0 @@ -# frozen_string_literal: true - -require "bigdecimal" -require "bigdecimal/util" -require "active_support/core_ext/big_decimal/conversions" -require "active_support/core_ext/hash/keys" -require "active_support/i18n" -require "active_support/core_ext/class/attribute" - -module ActiveSupport - module NumberHelper - class NumberConverter # :nodoc: - # Default and i18n option namespace per class - class_attribute :namespace - - # Does the object need a number that is a valid float? - class_attribute :validate_float - - attr_reader :number, :opts - - DEFAULTS = { - # Used in number_to_delimited - # These are also the defaults for 'currency', 'percentage', 'precision', and 'human' - format: { - # Sets the separator between the units, for more precision (e.g. 1.0 / 2.0 == 0.5) - separator: ".", - # Delimits thousands (e.g. 1,000,000 is a million) (always in groups of three) - delimiter: ",", - # Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00) - precision: 3, - # If set to true, precision will mean the number of significant digits instead - # of the number of decimal digits (1234 with precision 2 becomes 1200, 1.23543 becomes 1.2) - significant: false, - # If set, the zeros after the decimal separator will always be stripped (e.g.: 1.200 will be 1.2) - strip_insignificant_zeros: false - }, - - # Used in number_to_currency - currency: { - format: { - format: "%u%n", - negative_format: "-%u%n", - unit: "$", - # These five are to override number.format and are optional - separator: ".", - delimiter: ",", - precision: 2, - significant: false, - strip_insignificant_zeros: false - } - }, - - # Used in number_to_percentage - percentage: { - format: { - delimiter: "", - format: "%n%" - } - }, - - # Used in number_to_rounded - precision: { - format: { - delimiter: "" - } - }, - - # Used in number_to_human_size and number_to_human - human: { - format: { - # These five are to override number.format and are optional - delimiter: "", - precision: 3, - significant: true, - strip_insignificant_zeros: true - }, - # Used in number_to_human_size - storage_units: { - # Storage units output formatting. - # %u is the storage unit, %n is the number (default: 2 MB) - format: "%n %u", - units: { - byte: "Bytes", - kb: "KB", - mb: "MB", - gb: "GB", - tb: "TB", - pb: "PB", - eb: "EB", - zb: "ZB" - } - }, - # Used in number_to_human - decimal_units: { - format: "%n %u", - # Decimal units output formatting - # By default we will only quantify some of the exponents - # but the commented ones might be defined or overridden - # by the user. - units: { - # femto: Quadrillionth - # pico: Trillionth - # nano: Billionth - # micro: Millionth - # mili: Thousandth - # centi: Hundredth - # deci: Tenth - unit: "", - # ten: - # one: Ten - # other: Tens - # hundred: Hundred - thousand: "Thousand", - million: "Million", - billion: "Billion", - trillion: "Trillion", - quadrillion: "Quadrillion" - } - } - } - } - - def self.convert(number, options) - new(number, options).execute - end - - def initialize(number, options) - @number = number - @opts = options.symbolize_keys - @options = nil - end - - def execute - if !number - nil - elsif validate_float? && !valid_bigdecimal - number - else - convert - end - end - - private - def options - @options ||= format_options.merge(opts) - end - - def format_options - default_format_options.merge!(i18n_format_options) - end - - def default_format_options - options = DEFAULTS[:format].dup - options.merge!(DEFAULTS[namespace][:format]) if namespace - options - end - - def i18n_format_options - locale = opts[:locale] - options = I18n.translate(:'number.format', locale: locale, default: {}).dup - - if namespace - options.merge!(I18n.translate(:"number.#{namespace}.format", locale: locale, default: {})) - end - - options - end - - def translate_number_value_with_default(key, **i18n_options) - I18n.translate(key, default: default_value(key), scope: :number, **i18n_options) - end - - def translate_in_locale(key, **i18n_options) - translate_number_value_with_default(key, locale: options[:locale], **i18n_options) - end - - def default_value(key) - key.split(".").reduce(DEFAULTS) { |defaults, k| defaults[k.to_sym] } - end - - def valid_bigdecimal - case number - when Float, Rational - number.to_d(0) - when String - BigDecimal(number, exception: false) unless number.to_s.match?(/[de]/i) - else - number.to_d rescue nil - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_currency_converter.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_currency_converter.rb deleted file mode 100644 index 17c8cde..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_currency_converter.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -require "active_support/number_helper/number_converter" - -module ActiveSupport - module NumberHelper - class NumberToCurrencyConverter < NumberConverter # :nodoc: - self.namespace = :currency - - def convert - format = options[:format] - - number_d = valid_bigdecimal - if number_d - if number_d.negative? - number_d = number_d.abs - format = options[:negative_format] if options[:precision].nil? || (number_d * 10**options[:precision]) >= 0.5 - end - number_s = NumberToRoundedConverter.convert(number_d, options) - else - number_s = number.to_s.strip - format = options[:negative_format] if number_s.sub!(/^-/, "") - end - - format.gsub("%n", number_s).gsub("%u", options[:unit]) - end - - private - def options - @options ||= begin - defaults = default_format_options.merge(i18n_opts) - # Override negative format if format options are given - defaults[:negative_format] = "-#{opts[:format]}" if opts[:format] - defaults.merge!(opts) - end - end - - def i18n_opts - # Set International negative format if it does not exist - i18n = i18n_format_options - i18n[:negative_format] ||= "-#{i18n[:format]}" if i18n[:format] - i18n - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_delimited_converter.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_delimited_converter.rb deleted file mode 100644 index 3f1799c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_delimited_converter.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -require "active_support/number_helper/number_converter" - -module ActiveSupport - module NumberHelper - class NumberToDelimitedConverter < NumberConverter # :nodoc: - self.validate_float = true - - def convert - parts.join(options[:separator]) - end - - private - def parts - left, right = number.to_s.split(".") - if delimiter_pattern - left.gsub!(delimiter_pattern) do |digit_to_delimit| - "#{digit_to_delimit}#{options[:delimiter]}" - end - else - left_parts = [] - sign = left.slice!(0) if left.start_with?("-", "+") - offset = left.size % 3 - if offset > 0 - left_parts << left[0, offset] - end - - (left.size / 3).times do |i| - left_parts << left[offset + (i * 3), 3] - end - - left = "#{sign}#{left_parts.join(options[:delimiter])}" - end - - [left, right].compact - end - - def delimiter_pattern - options[:delimiter_pattern] - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_human_converter.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_human_converter.rb deleted file mode 100644 index 3f92628..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_human_converter.rb +++ /dev/null @@ -1,69 +0,0 @@ -# frozen_string_literal: true - -require "active_support/number_helper/number_converter" - -module ActiveSupport - module NumberHelper - class NumberToHumanConverter < NumberConverter # :nodoc: - DECIMAL_UNITS = { 0 => :unit, 1 => :ten, 2 => :hundred, 3 => :thousand, 6 => :million, 9 => :billion, 12 => :trillion, 15 => :quadrillion, - -1 => :deci, -2 => :centi, -3 => :mili, -6 => :micro, -9 => :nano, -12 => :pico, -15 => :femto } - INVERTED_DECIMAL_UNITS = DECIMAL_UNITS.invert - - self.namespace = :human - self.validate_float = true - - def convert # :nodoc: - @number = RoundingHelper.new(options).round(number) - @number = Float(number) - - # For backwards compatibility with those that didn't add strip_insignificant_zeros to their locale files. - unless options.key?(:strip_insignificant_zeros) - options[:strip_insignificant_zeros] = true - end - - units = opts[:units] - exponent = calculate_exponent(units) - @number = number / (10**exponent) - - rounded_number = NumberToRoundedConverter.convert(number, options) - unit = determine_unit(units, exponent) - format.gsub("%n", rounded_number).gsub("%u", unit).strip - end - - private - def format - options[:format] || translate_in_locale("human.decimal_units.format") - end - - def determine_unit(units, exponent) - exp = DECIMAL_UNITS[exponent] - case units - when Hash - units[exp] || "" - when String, Symbol - I18n.translate("#{units}.#{exp}", locale: options[:locale], count: number.to_i) - else - translate_in_locale("human.decimal_units.units.#{exp}", count: number.to_i) - end - end - - def calculate_exponent(units) - exponent = number != 0 ? Math.log10(number.abs).floor : 0 - unit_exponents(units).find { |e| exponent >= e } || 0 - end - - def unit_exponents(units) - case units - when Hash - units - when String, Symbol - I18n.translate(units.to_s, locale: options[:locale], raise: true) - when nil - translate_in_locale("human.decimal_units.units", raise: true) - else - raise ArgumentError, ":units must be a Hash or String translation scope." - end.keys.map { |e_name| INVERTED_DECIMAL_UNITS[e_name] }.sort_by(&:-@) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_human_size_converter.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_human_size_converter.rb deleted file mode 100644 index 66688a4..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_human_size_converter.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true - -require "active_support/number_helper/number_converter" - -module ActiveSupport - module NumberHelper - class NumberToHumanSizeConverter < NumberConverter # :nodoc: - STORAGE_UNITS = [:byte, :kb, :mb, :gb, :tb, :pb, :eb, :zb] - - self.namespace = :human - self.validate_float = true - - def convert - @number = Float(number) - - # For backwards compatibility with those that didn't add strip_insignificant_zeros to their locale files. - unless options.key?(:strip_insignificant_zeros) - options[:strip_insignificant_zeros] = true - end - - if smaller_than_base? - number_to_format = number.to_i.to_s - else - human_size = number / (base**exponent) - number_to_format = NumberToRoundedConverter.convert(human_size, options) - end - conversion_format.gsub("%n", number_to_format).gsub("%u", unit) - end - - private - def conversion_format - translate_number_value_with_default("human.storage_units.format", locale: options[:locale], raise: true) - end - - def unit - translate_number_value_with_default(storage_unit_key, locale: options[:locale], count: number.to_i, raise: true) - end - - def storage_unit_key - key_end = smaller_than_base? ? "byte" : STORAGE_UNITS[exponent] - "human.storage_units.units.#{key_end}" - end - - def exponent - max = STORAGE_UNITS.size - 1 - exp = (Math.log(number.abs) / Math.log(base)).to_i - exp = max if exp > max # avoid overflow for the highest unit - exp - end - - def smaller_than_base? - number.to_i.abs < base - end - - def base - 1024 - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_percentage_converter.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_percentage_converter.rb deleted file mode 100644 index 0c2e190..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_percentage_converter.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -require "active_support/number_helper/number_converter" - -module ActiveSupport - module NumberHelper - class NumberToPercentageConverter < NumberConverter # :nodoc: - self.namespace = :percentage - - def convert - rounded_number = NumberToRoundedConverter.convert(number, options) - options[:format].gsub("%n", rounded_number) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_phone_converter.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_phone_converter.rb deleted file mode 100644 index 52b9544..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_phone_converter.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/blank" -require "active_support/number_helper/number_converter" - -module ActiveSupport - module NumberHelper - class NumberToPhoneConverter < NumberConverter # :nodoc: - def convert - str = country_code(opts[:country_code]).dup - str << convert_to_phone_number(number.to_s.strip) - str << phone_ext(opts[:extension]) - end - - private - def convert_to_phone_number(number) - if opts[:area_code] - convert_with_area_code(number) - else - convert_without_area_code(number) - end - end - - def convert_with_area_code(number) - default_pattern = /(\d{1,3})(\d{3})(\d{4}$)/ - number.gsub!(regexp_pattern(default_pattern), - "(\\1) \\2#{delimiter}\\3") - number - end - - def convert_without_area_code(number) - default_pattern = /(\d{0,3})(\d{3})(\d{4})$/ - number.gsub!(regexp_pattern(default_pattern)) do - $1.empty? ? "#{$2}#{delimiter}#{$3}" : "#{$1}#{delimiter}#{$2}#{delimiter}#{$3}" - end - number - end - - def delimiter - opts[:delimiter] || "-" - end - - def country_code(code) - code.blank? ? "" : "+#{code}#{delimiter}" - end - - def phone_ext(ext) - ext.blank? ? "" : " x #{ext}" - end - - def regexp_pattern(default_pattern) - opts.fetch :pattern, default_pattern - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_rounded_converter.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_rounded_converter.rb deleted file mode 100644 index f48a515..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/number_to_rounded_converter.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -require "active_support/number_helper/number_converter" - -module ActiveSupport - module NumberHelper - class NumberToRoundedConverter < NumberConverter # :nodoc: - self.namespace = :precision - self.validate_float = true - - def convert - helper = RoundingHelper.new(options) - rounded_number = helper.round(number) - - if precision = options[:precision] - if options[:significant] && precision > 0 - digits = helper.digit_count(rounded_number) - precision -= digits - precision = 0 if precision < 0 # don't let it be negative - end - - formatted_string = - if rounded_number.finite? - s = rounded_number.to_s("F") - a, b = s.split(".", 2) - if precision != 0 - b << "0" * precision - a << "." - a << b[0, precision] - end - a - else - # Infinity/NaN - "%f" % rounded_number - end - else - formatted_string = rounded_number - end - - delimited_number = NumberToDelimitedConverter.convert(formatted_string, options) - format_number(delimited_number) - end - - private - def strip_insignificant_zeros - options[:strip_insignificant_zeros] - end - - def format_number(number) - if strip_insignificant_zeros - escaped_separator = Regexp.escape(options[:separator]) - number.sub(/(#{escaped_separator})(\d*[1-9])?0+\z/, '\1\2').sub(/#{escaped_separator}\z/, "") - else - number - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/rounding_helper.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/rounding_helper.rb deleted file mode 100644 index b269cc7..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/number_helper/rounding_helper.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module NumberHelper - class RoundingHelper # :nodoc: - attr_reader :options - - def initialize(options) - @options = options - end - - def round(number) - precision = absolute_precision(number) - return number unless precision - - rounded_number = convert_to_decimal(number).round(precision, options.fetch(:round_mode, :default).to_sym) - rounded_number.zero? ? rounded_number.abs : rounded_number # prevent showing negative zeros - end - - def digit_count(number) - return 1 if number.zero? - (Math.log10(number.abs) + 1).floor - end - - private - def convert_to_decimal(number) - case number - when Float, String - BigDecimal(number.to_s) - when Rational - BigDecimal(number, digit_count(number.to_i) + options[:precision]) - else - number.to_d - end - end - - def absolute_precision(number) - if options[:significant] && options[:precision] && options[:precision] > 0 - options[:precision] - digit_count(convert_to_decimal(number)) - else - options[:precision] - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/option_merger.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/option_merger.rb deleted file mode 100644 index 36d99a6..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/option_merger.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/hash/deep_merge" - -module ActiveSupport - class OptionMerger # :nodoc: - instance_methods.each do |method| - undef_method(method) unless method.start_with?("__", "instance_eval", "class", "object_id") - end - - def initialize(context, options) - @context, @options = context, options - end - - private - def method_missing(method, *arguments, &block) - options = nil - if arguments.size == 1 && arguments.first.is_a?(Proc) - proc = arguments.shift - arguments << lambda { |*args| @options.deep_merge(proc.call(*args)) } - elsif arguments.last.respond_to?(:to_hash) - options = @options.deep_merge(arguments.pop) - else - options = @options - end - - if options - @context.__send__(method, *arguments, **options, &block) - else - @context.__send__(method, *arguments, &block) - end - end - - def respond_to_missing?(...) - @context.respond_to?(...) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/ordered_hash.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/ordered_hash.rb deleted file mode 100644 index 07cde36..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/ordered_hash.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -require "yaml" - -YAML.add_builtin_type("omap") do |type, val| - ActiveSupport::OrderedHash[val.map { |v| v.to_a.first }] -end - -module ActiveSupport - # DEPRECATED: +ActiveSupport::OrderedHash+ implements a hash that preserves - # insertion order. - # - # oh = ActiveSupport::OrderedHash.new - # oh[:a] = 1 - # oh[:b] = 2 - # oh.keys # => [:a, :b], this order is guaranteed - # - # Also, maps the +omap+ feature for YAML files - # (See https://yaml.org/type/omap.html) to support ordered items - # when loading from YAML. - # - # +ActiveSupport::OrderedHash+ is namespaced to prevent conflicts - # with other implementations. - class OrderedHash < ::Hash # :nodoc: - def to_yaml_type - "!tag:yaml.org,2002:omap" - end - - def encode_with(coder) - coder.represent_seq "!omap", map { |k, v| { k => v } } - end - - def select(*args, &block) - dup.tap { |hash| hash.select!(*args, &block) } - end - - def reject(*args, &block) - dup.tap { |hash| hash.reject!(*args, &block) } - end - - def nested_under_indifferent_access - self - end - - # Returns true to make sure that this hash is extractable via Array#extract_options! - def extractable_options? - true - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/ordered_options.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/ordered_options.rb deleted file mode 100644 index d65f201..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/ordered_options.rb +++ /dev/null @@ -1,147 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/blank" - -module ActiveSupport - # = Ordered Options - # - # +OrderedOptions+ inherits from +Hash+ and provides dynamic accessor methods. - # - # With a +Hash+, key-value pairs are typically managed like this: - # - # h = {} - # h[:boy] = 'John' - # h[:girl] = 'Mary' - # h[:boy] # => 'John' - # h[:girl] # => 'Mary' - # h[:dog] # => nil - # - # Using +OrderedOptions+, the above code can be written as: - # - # h = ActiveSupport::OrderedOptions.new - # h.boy = 'John' - # h.girl = 'Mary' - # h.boy # => 'John' - # h.girl # => 'Mary' - # h.dog # => nil - # - # To raise an exception when the value is blank, append a - # bang to the key name, like: - # - # h.dog! # => raises KeyError: :dog is blank - # - class OrderedOptions < Hash - alias_method :_get, :[] # preserve the original #[] method - protected :_get # make it protected - - def []=(key, value) - super(key.to_sym, value) - end - - def [](key) - super(key.to_sym) - end - - def dig(key, *identifiers) - super(key.to_sym, *identifiers) - end - - def method_missing(method, *args) - if method.end_with?("=") - self[method.name.chomp("=")] = args.first - elsif method.end_with?("!") - name_string = method.name.chomp("!") - self[name_string].presence || raise(KeyError.new(":#{name_string} is blank")) - else - self[method.name] - end - end - - def respond_to_missing?(name, include_private) - true - end - - def extractable_options? - true - end - - def inspect - "#<#{self.class.name} #{super}>" - end - end - - # = Inheritable Options - # - # +InheritableOptions+ provides a constructor to build an OrderedOptions - # hash inherited from another hash. - # - # Use this if you already have some hash and you want to create a new one based on it. - # - # h = ActiveSupport::InheritableOptions.new({ girl: 'Mary', boy: 'John' }) - # h.girl # => 'Mary' - # h.boy # => 'John' - # - # If the existing hash has string keys, call Hash#symbolize_keys on it. - # - # h = ActiveSupport::InheritableOptions.new({ 'girl' => 'Mary', 'boy' => 'John' }.symbolize_keys) - # h.girl # => 'Mary' - # h.boy # => 'John' - class InheritableOptions < OrderedOptions - def initialize(parent = nil) - @parent = parent - if @parent.kind_of?(OrderedOptions) - # use the faster _get when dealing with OrderedOptions - super() { |h, k| @parent._get(k) } - elsif @parent - super() { |h, k| @parent[k] } - else - super() - @parent = {} - end - end - - def to_h - @parent.to_h.merge(self) - end - - def ==(other) - other.is_a?(Hash) && to_h == other.to_h - end - - def inspect - "#<#{self.class.name} #{to_h.inspect}>" - end - - def to_s - to_h.to_s - end - - def pretty_print(pp) - pp.pp_hash(to_h) - end - - alias_method :own_key?, :key? - private :own_key? - - def key?(key) - super || @parent.key?(key) - end - - def overridden?(key) - !!(@parent && @parent.key?(key) && own_key?(key.to_sym)) - end - - def inheritable_copy - self.class.new(self) - end - - def to_a - entries - end - - def each(&block) - to_h.each(&block) - self - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/parameter_filter.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/parameter_filter.rb deleted file mode 100644 index 7eeae6b..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/parameter_filter.rb +++ /dev/null @@ -1,157 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/duplicable" -require "active_support/core_ext/array/extract" - -module ActiveSupport - # = Active Support Parameter Filter - # - # +ParameterFilter+ replaces values in a Hash-like object if their - # keys match one of the specified filters. - # - # Matching based on nested keys is possible by using dot notation, e.g. - # "credit_card.number". - # - # If a proc is given as a filter, each key and value of the Hash-like - # and of any nested Hashes will be passed to it. The value or key can - # then be mutated as desired using methods such as String#replace. - # - # # Replaces values with "[FILTERED]" for keys that match /password/i. - # ActiveSupport::ParameterFilter.new([:password]) - # - # # Replaces values with "[FILTERED]" for keys that match /foo|bar/i. - # ActiveSupport::ParameterFilter.new([:foo, "bar"]) - # - # # Replaces values for the exact key "pin" and for keys that begin with - # # "pin_". Does not match keys that otherwise include "pin" as a - # # substring, such as "shipping_id". - # ActiveSupport::ParameterFilter.new([/\Apin\z/, /\Apin_/]) - # - # # Replaces the value for :code in `{ credit_card: { code: "xxxx" } }`. - # # Does not change `{ file: { code: "xxxx" } }`. - # ActiveSupport::ParameterFilter.new(["credit_card.code"]) - # - # # Reverses values for keys that match /secret/i. - # ActiveSupport::ParameterFilter.new([-> (k, v) do - # v.reverse! if /secret/i.match?(k) - # end]) - # - class ParameterFilter - FILTERED = "[FILTERED]" # :nodoc: - - # Precompiles an array of filters that otherwise would be passed directly to - # #initialize. Depending on the quantity and types of filters, - # precompilation can improve filtering performance, especially in the case - # where the ParameterFilter instance itself cannot be retained (but the - # precompiled filters can be retained). - # - # filters = [/foo/, :bar, "nested.baz", /nested\.qux/] - # - # precompiled = ActiveSupport::ParameterFilter.precompile_filters(filters) - # # => [/(?-mix:foo)|(?i:bar)/, /(?i:nested\.baz)|(?-mix:nested\.qux)/] - # - # ActiveSupport::ParameterFilter.new(precompiled) - # - def self.precompile_filters(filters) - filters, patterns = filters.partition { |filter| filter.is_a?(Proc) } - - patterns.map! do |pattern| - pattern.is_a?(Regexp) ? pattern : "(?i:#{Regexp.escape pattern.to_s})" - end - - deep_patterns = patterns.extract! { |pattern| pattern.to_s.include?("\\.") } - - filters << Regexp.new(patterns.join("|")) if patterns.any? - filters << Regexp.new(deep_patterns.join("|")) if deep_patterns.any? - - filters - end - - # Create instance with given filters. Supported type of filters are +String+, +Regexp+, and +Proc+. - # Other types of filters are treated as +String+ using +to_s+. - # For +Proc+ filters, key, value, and optional original hash is passed to block arguments. - # - # ==== Options - # - # * :mask - A replaced object when filtered. Defaults to "[FILTERED]". - def initialize(filters = [], mask: FILTERED) - @mask = mask - compile_filters!(filters) - end - - # Mask value of +params+ if key matches one of filters. - def filter(params) - @no_filters ? params.dup : call(params) - end - - # Returns filtered value for given key. For +Proc+ filters, third block argument is not populated. - def filter_param(key, value) - @no_filters ? value : value_for_key(key, value) - end - - private - def compile_filters!(filters) - @no_filters = filters.empty? - return if @no_filters - - @regexps, strings = [], [] - @deep_regexps, deep_strings = nil, nil - @blocks = nil - - filters.each do |item| - case item - when Proc - (@blocks ||= []) << item - when Regexp - if item.to_s.include?("\\.") - (@deep_regexps ||= []) << item - else - @regexps << item - end - else - s = Regexp.escape(item.to_s) - if s.include?("\\.") - (deep_strings ||= []) << s - else - strings << s - end - end - end - - @regexps << Regexp.new(strings.join("|"), true) unless strings.empty? - (@deep_regexps ||= []) << Regexp.new(deep_strings.join("|"), true) if deep_strings - end - - def call(params, full_parent_key = nil, original_params = params) - filtered_params = params.class.new - - params.each do |key, value| - filtered_params[key] = value_for_key(key, value, full_parent_key, original_params) - end - - filtered_params - end - - def value_for_key(key, value, full_parent_key = nil, original_params = nil) - if @deep_regexps - full_key = full_parent_key ? "#{full_parent_key}.#{key}" : key.to_s - end - - if @regexps.any? { |r| r.match?(key.to_s) } - value = @mask - elsif @deep_regexps&.any? { |r| r.match?(full_key) } - value = @mask - elsif value.is_a?(Hash) - value = call(value, full_key, original_params) - elsif value.is_a?(Array) - value = value.map { |v| value_for_key(key, v, full_parent_key, original_params) } - elsif @blocks - key = key.dup if key.duplicable? - value = value.dup if value.duplicable? - @blocks.each { |b| b.arity == 2 ? b.call(key, value) : b.call(key, value, original_params) } - end - - value - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/rails.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/rails.rb deleted file mode 100644 index 75676a2..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/rails.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -# This is a private interface. -# -# Rails components cherry pick from Active Support as needed, but there are a -# few features that are used for sure in some way or another and it is not worth -# putting individual requires absolutely everywhere. Think blank? for example. -# -# This file is loaded by every Rails component except Active Support itself, -# but it does not belong to the Rails public interface. It is internal to -# Rails and can change anytime. - -# Defines Object#blank? and Object#present?. -require "active_support/core_ext/object/blank" - -# Support for ClassMethods and the included macro. -require "active_support/concern" - -# Defines Class#class_attribute. -require "active_support/core_ext/class/attribute" - -# Defines Module#delegate. -require "active_support/core_ext/module/delegation" - -# Defines ActiveSupport::Deprecation. -require "active_support/deprecation" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/railtie.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/railtie.rb deleted file mode 100644 index 7b68dbb..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/railtie.rb +++ /dev/null @@ -1,180 +0,0 @@ -# frozen_string_literal: true - -require "active_support" -require "active_support/i18n_railtie" - -module ActiveSupport - class Railtie < Rails::Railtie # :nodoc: - config.active_support = ActiveSupport::OrderedOptions.new - - config.eager_load_namespaces << ActiveSupport - - initializer "active_support.deprecator", before: :load_environment_config do |app| - app.deprecators[:active_support] = ActiveSupport.deprecator - end - - initializer "active_support.isolation_level" do |app| - config.after_initialize do - if level = app.config.active_support.isolation_level - ActiveSupport::IsolatedExecutionState.isolation_level = level - end - end - end - - initializer "active_support.raise_on_invalid_cache_expiration_time" do |app| - config.after_initialize do - if app.config.active_support.raise_on_invalid_cache_expiration_time - ActiveSupport::Cache::Store.raise_on_invalid_cache_expiration_time = true - end - end - end - - initializer "active_support.set_authenticated_message_encryption" do |app| - config.after_initialize do - unless app.config.active_support.use_authenticated_message_encryption.nil? - ActiveSupport::MessageEncryptor.use_authenticated_message_encryption = - app.config.active_support.use_authenticated_message_encryption - end - end - end - - initializer "active_support.set_event_reporter_context_store" do |app| - config.after_initialize do - if klass = app.config.active_support.event_reporter_context_store - ActiveSupport::EventReporter.context_store = klass - end - end - end - - initializer "active_support.reset_execution_context" do |app| - app.reloader.before_class_unload do - ActiveSupport::CurrentAttributes.clear_all - ActiveSupport::ExecutionContext.flush - ActiveSupport.event_reporter.clear_context - end - - app.executor.to_run do - ActiveSupport::ExecutionContext.push - end - - app.executor.to_complete do - ActiveSupport::CurrentAttributes.clear_all - ActiveSupport::ExecutionContext.pop - ActiveSupport.event_reporter.clear_context - end - - ActiveSupport.on_load(:active_support_test_case) do - if app.config.active_support.executor_around_test_case - ActiveSupport::ExecutionContext.nestable = true - - require "active_support/executor/test_helper" - include ActiveSupport::Executor::TestHelper - else - require "active_support/current_attributes/test_helper" - include ActiveSupport::CurrentAttributes::TestHelper - - require "active_support/execution_context/test_helper" - include ActiveSupport::ExecutionContext::TestHelper - end - end - end - - initializer "active_support.set_filter_parameters" do |app| - config.after_initialize do - ActiveSupport.filter_parameters += Rails.application.config.filter_parameters - ActiveSupport.event_reporter.reload_payload_filter - end - end - - initializer "active_support.deprecation_behavior" do |app| - if app.config.active_support.report_deprecations == false - app.deprecators.silenced = true - app.deprecators.behavior = :silence - app.deprecators.disallowed_behavior = :silence - else - if deprecation = app.config.active_support.deprecation - app.deprecators.behavior = deprecation - end - - if disallowed_deprecation = app.config.active_support.disallowed_deprecation - app.deprecators.disallowed_behavior = disallowed_deprecation - end - - if disallowed_warnings = app.config.active_support.disallowed_deprecation_warnings - app.deprecators.disallowed_warnings = disallowed_warnings - end - end - end - - # Sets the default value for Time.zone - # If assigned value cannot be matched to a TimeZone, an exception will be raised. - initializer "active_support.initialize_time_zone" do |app| - begin - TZInfo::DataSource.get - rescue TZInfo::DataSourceNotFound => e - raise e.exception('tzinfo-data is not present. Please add gem "tzinfo-data" to your Gemfile and run bundle install') - end - require "active_support/core_ext/time/zones" - Time.zone_default = Time.find_zone!(app.config.time_zone) - config.eager_load_namespaces << TZInfo - end - - # Sets the default week start - # If assigned value is not a valid day symbol (e.g. :sunday, :monday, ...), an exception will be raised. - initializer "active_support.initialize_beginning_of_week" do |app| - require "active_support/core_ext/date/calculations" - beginning_of_week_default = Date.find_beginning_of_week!(app.config.beginning_of_week) - - Date.beginning_of_week_default = beginning_of_week_default - end - - initializer "active_support.require_master_key" do |app| - if app.config.respond_to?(:require_master_key) && app.config.require_master_key - begin - app.credentials.key - rescue ActiveSupport::EncryptedFile::MissingKeyError => error - $stderr.puts error.message - exit 1 - end - end - end - - initializer "active_support.set_configs" do |app| - app.config.active_support.each do |k, v| - k = "#{k}=" - ActiveSupport.public_send(k, v) if ActiveSupport.respond_to? k - end - end - - initializer "active_support.set_hash_digest_class" do |app| - config.after_initialize do - if klass = app.config.active_support.hash_digest_class - ActiveSupport::Digest.hash_digest_class = klass - end - end - end - - initializer "active_support.set_key_generator_hash_digest_class" do |app| - config.after_initialize do - if klass = app.config.active_support.key_generator_hash_digest_class - ActiveSupport::KeyGenerator.hash_digest_class = klass - end - end - end - - initializer "active_support.set_default_message_serializer" do |app| - config.after_initialize do - if message_serializer = app.config.active_support.message_serializer - ActiveSupport::Messages::Codec.default_serializer = message_serializer - end - end - end - - initializer "active_support.set_use_message_serializer_for_metadata" do |app| - config.after_initialize do - ActiveSupport::Messages::Metadata.use_message_serializer_for_metadata = - app.config.active_support.use_message_serializer_for_metadata - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/reloader.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/reloader.rb deleted file mode 100644 index 33257ed..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/reloader.rb +++ /dev/null @@ -1,138 +0,0 @@ -# frozen_string_literal: true - -require "active_support/execution_wrapper" -require "active_support/executor" - -module ActiveSupport - # = Active Support \Reloader - # - # This class defines several callbacks: - # - # to_prepare -- Run once at application startup, and also from - # +to_run+. - # - # to_run -- Run before a work run that is reloading. If - # +reload_classes_only_on_change+ is true (the default), the class - # unload will have already occurred. - # - # to_complete -- Run after a work run that has reloaded. If - # +reload_classes_only_on_change+ is false, the class unload will - # have occurred after the work run, but before this callback. - # - # before_class_unload -- Run immediately before the classes are - # unloaded. - # - # after_class_unload -- Run immediately after the classes are - # unloaded. - # - class Reloader < ExecutionWrapper - define_callbacks :prepare - - define_callbacks :class_unload - - # Registers a callback that will run once at application startup and every time the code is reloaded. - def self.to_prepare(*args, &block) - set_callback(:prepare, *args, &block) - end - - # Registers a callback that will run immediately before the classes are unloaded. - def self.before_class_unload(*args, &block) - set_callback(:class_unload, *args, &block) - end - - # Registers a callback that will run immediately after the classes are unloaded. - def self.after_class_unload(*args, &block) - set_callback(:class_unload, :after, *args, &block) - end - - to_run(:after) { self.class.prepare! } - - # Initiate a manual reload - def self.reload! - executor.wrap do - new.tap do |instance| - instance.run! - ensure - instance.complete! - end - end - prepare! - end - - def self.run!(reset: false) # :nodoc: - if check! - super - else - Null - end - end - - # Run the supplied block as a work unit, reloading code as needed - def self.wrap(**kwargs) - return yield if active? - - executor.wrap(**kwargs) do - instance = run! - begin - yield - ensure - instance.complete! - end - end - end - - class_attribute :executor, default: Executor - class_attribute :check, default: lambda { false } - - def self.check! # :nodoc: - @should_reload ||= check.call - end - - def self.reloaded! # :nodoc: - @should_reload = false - end - - def self.prepare! # :nodoc: - new.run_callbacks(:prepare) - end - - def initialize - super - @locked = false - end - - # Acquire the ActiveSupport::Dependencies::Interlock unload lock, - # ensuring it will be released automatically - def require_unload_lock! - unless @locked - ActiveSupport::Dependencies.interlock.start_unloading - @locked = true - end - end - - # Release the unload lock if it has been previously obtained - def release_unload_lock! - if @locked - @locked = false - ActiveSupport::Dependencies.interlock.done_unloading - end - end - - def run! # :nodoc: - super - release_unload_lock! - end - - def class_unload!(&block) # :nodoc: - require_unload_lock! - run_callbacks(:class_unload, &block) - end - - def complete! # :nodoc: - super - self.class.reloaded! - ensure - release_unload_lock! - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/rescuable.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/rescuable.rb deleted file mode 100644 index 470f01d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/rescuable.rb +++ /dev/null @@ -1,176 +0,0 @@ -# frozen_string_literal: true - -require "active_support/concern" -require "active_support/core_ext/class/attribute" -require "active_support/core_ext/string/inflections" - -module ActiveSupport - # = Active Support \Rescuable - # - # Rescuable module adds support for easier exception handling. - module Rescuable - extend Concern - - included do - class_attribute :rescue_handlers, default: [] - end - - module ClassMethods - # Registers exception classes with a handler to be called by rescue_with_handler. - # - # rescue_from receives a series of exception classes or class - # names, and an exception handler specified by a trailing :with - # option containing the name of a method or a Proc object. Alternatively, a block - # can be given as the handler. - # - # Handlers that take one argument will be called with the exception, so - # that the exception can be inspected when dealing with it. - # - # Handlers are inherited. They are searched from right to left, from - # bottom to top, and up the hierarchy. The handler of the first class for - # which exception.is_a?(klass) holds true is the one invoked, if - # any. - # - # class ApplicationController < ActionController::Base - # rescue_from User::NotAuthorized, with: :deny_access - # rescue_from ActiveRecord::RecordInvalid, with: :show_record_errors - # - # rescue_from "MyApp::BaseError" do |exception| - # redirect_to root_url, alert: exception.message - # end - # - # private - # def deny_access - # head :forbidden - # end - # - # def show_record_errors(exception) - # redirect_back_or_to root_url, alert: exception.record.errors.full_messages.to_sentence - # end - # end - # - # Exceptions raised inside exception handlers are not propagated up. - def rescue_from(*klasses, with: nil, &block) - unless with - if block_given? - with = block - else - raise ArgumentError, "Need a handler. Pass the with: keyword argument or provide a block." - end - end - - klasses.each do |klass| - key = if klass.is_a?(Module) && klass.respond_to?(:===) - klass.name - elsif klass.is_a?(String) - klass - else - raise ArgumentError, "#{klass.inspect} must be an Exception class or a String referencing an Exception class" - end - - # Put the new handler at the end because the list is read in reverse. - self.rescue_handlers += [[key, with]] - end - end - - # Matches an exception to a handler based on the exception class. - # - # If no handler matches the exception, check for a handler matching the - # (optional) +exception.cause+. If no handler matches the exception or its - # cause, this returns +nil+, so you can deal with unhandled exceptions. - # Be sure to re-raise unhandled exceptions if this is what you expect. - # - # begin - # # ... - # rescue => exception - # rescue_with_handler(exception) || raise - # end - # - # Returns the exception if it was handled and +nil+ if it was not. - def rescue_with_handler(exception, object: self, visited_exceptions: []) - visited_exceptions << exception - - if handler = handler_for_rescue(exception, object: object) - handler.call exception - exception - elsif exception - if visited_exceptions.include?(exception.cause) - nil - else - rescue_with_handler(exception.cause, object: object, visited_exceptions: visited_exceptions) - end - end - end - - def handler_for_rescue(exception, object: self) # :nodoc: - case rescuer = find_rescue_handler(exception) - when Symbol - method = object.method(rescuer) - if method.arity == 0 - -> e { method.call } - else - method - end - when Proc - if rescuer.arity == 0 - -> e { object.instance_exec(&rescuer) } - else - -> e { object.instance_exec(e, &rescuer) } - end - end - end - - private - def find_rescue_handler(exception) - if exception - # Handlers are in order of declaration but the most recently declared - # is the highest priority match, so we search for matching handlers - # in reverse. - _, handler = rescue_handlers.reverse_each.detect do |class_or_name, _| - if klass = constantize_rescue_handler_class(class_or_name) - klass === exception - end - end - - handler - end - end - - def constantize_rescue_handler_class(class_or_name) - case class_or_name - when String, Symbol - begin - # Try a lexical lookup first since we support - # - # class Super - # rescue_from 'Error', with: … - # end - # - # class Sub - # class Error < StandardError; end - # end - # - # so an Error raised in Sub will hit the 'Error' handler. - const_get class_or_name - rescue NameError - class_or_name.safe_constantize - end - else - class_or_name - end - end - end - - # Delegates to the class method, but uses the instance as the subject for - # rescue_from handlers (method calls, +instance_exec+ blocks). - def rescue_with_handler(exception) - self.class.rescue_with_handler exception, object: self - end - - # Internal handler lookup. Delegates to class method. Some libraries call - # this directly, so keeping it around for compatibility. - def handler_for_rescue(exception) # :nodoc: - self.class.handler_for_rescue exception, object: self - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/secure_compare_rotator.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/secure_compare_rotator.rb deleted file mode 100644 index 1c20389..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/secure_compare_rotator.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true - -require "active_support/security_utils" -require "active_support/messages/rotator" - -module ActiveSupport - # = Secure Compare Rotator - # - # The ActiveSupport::SecureCompareRotator is a wrapper around ActiveSupport::SecurityUtils.secure_compare - # and allows you to rotate a previously defined value to a new one. - # - # It can be used as follow: - # - # rotator = ActiveSupport::SecureCompareRotator.new('new_production_value') - # rotator.rotate('previous_production_value') - # rotator.secure_compare!('previous_production_value') - # - # One real use case example would be to rotate a basic auth credentials: - # - # class MyController < ApplicationController - # def authenticate_request - # rotator = ActiveSupport::SecureCompareRotator.new('new_password') - # rotator.rotate('old_password') - # - # authenticate_or_request_with_http_basic do |username, password| - # rotator.secure_compare!(password) - # rescue ActiveSupport::SecureCompareRotator::InvalidMatch - # false - # end - # end - # end - class SecureCompareRotator - include SecurityUtils - - InvalidMatch = Class.new(StandardError) - - def initialize(value, on_rotation: nil) - @value = value - @rotate_values = [] - @on_rotation = on_rotation - end - - def rotate(previous_value) - @rotate_values << previous_value - end - - def secure_compare!(other_value, on_rotation: @on_rotation) - if secure_compare(@value, other_value) - true - elsif @rotate_values.any? { |value| secure_compare(value, other_value) } - on_rotation&.call - true - else - raise InvalidMatch - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/security_utils.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/security_utils.rb deleted file mode 100644 index fb0f0e5..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/security_utils.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module SecurityUtils - if defined?(OpenSSL.fixed_length_secure_compare) - # Constant time string comparison, for fixed length strings. - # - # The values compared should be of fixed length, such as strings - # that have already been processed by HMAC. Raises in case of length mismatch. - def fixed_length_secure_compare(a, b) - OpenSSL.fixed_length_secure_compare(a, b) - end - else - def fixed_length_secure_compare(a, b) - raise ArgumentError, "string length mismatch." unless a.bytesize == b.bytesize - - l = a.unpack "C#{a.bytesize}" - - res = 0 - b.each_byte { |byte| res |= byte ^ l.shift } - res == 0 - end - end - module_function :fixed_length_secure_compare - - # Secure string comparison for strings of variable length. - # - # While a timing attack would not be able to discern the content of - # a secret compared via secure_compare, it is possible to determine - # the secret length. This should be considered when using secure_compare - # to compare weak, short secrets to user input. - def secure_compare(a, b) - a.bytesize == b.bytesize && fixed_length_secure_compare(a, b) - end - module_function :secure_compare - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/string_inquirer.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/string_inquirer.rb deleted file mode 100644 index 9b82df1..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/string_inquirer.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # = \String Inquirer - # - # Wrapping a string in this class gives you a prettier way to test - # for equality. The value returned by Rails.env is wrapped - # in a StringInquirer object, so instead of calling this: - # - # Rails.env == 'production' - # - # you can call this: - # - # Rails.env.production? - # - # == Instantiating a new \StringInquirer - # - # vehicle = ActiveSupport::StringInquirer.new('car') - # vehicle.car? # => true - # vehicle.bike? # => false - class StringInquirer < String - private - def respond_to_missing?(method_name, include_private = false) - method_name.end_with?("?") || super - end - - def method_missing(method_name, ...) - if method_name.end_with?("?") - self == method_name[0..-2] - else - super - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/structured_event_subscriber.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/structured_event_subscriber.rb deleted file mode 100644 index 3518b4f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/structured_event_subscriber.rb +++ /dev/null @@ -1,99 +0,0 @@ -# frozen_string_literal: true - -require "active_support/subscriber" - -module ActiveSupport - # = Active Support Structured Event \Subscriber - # - # +ActiveSupport::StructuredEventSubscriber+ consumes ActiveSupport::Notifications - # in order to emit structured events via +Rails.event+. - # - # An example would be the Action Controller structured event subscriber, responsible for - # emitting request processing events: - # - # module ActionController - # class StructuredEventSubscriber < ActiveSupport::StructuredEventSubscriber - # attach_to :action_controller - # - # def start_processing(event) - # emit_event("controller.request_started", - # controller: event.payload[:controller], - # action: event.payload[:action], - # format: event.payload[:format] - # ) - # end - # end - # end - # - # After configured, whenever a "start_processing.action_controller" notification is published, - # it will properly dispatch the event (+ActiveSupport::Notifications::Event+) to the +start_processing+ method. - # The subscriber can then emit a structured event via the +emit_event+ method. - class StructuredEventSubscriber < Subscriber - class_attribute :debug_methods, instance_accessor: false, default: [] # :nodoc: - - DEBUG_CHECK = proc { !ActiveSupport.event_reporter.debug_mode? } - - class << self - def attach_to(...) # :nodoc: - result = super - set_silenced_events - result - end - - private - def set_silenced_events - if subscriber - subscriber.silenced_events = debug_methods.to_h { |method| ["#{method}.#{namespace}", DEBUG_CHECK] } - end - end - - def debug_only(method) - self.debug_methods += [method] - set_silenced_events - end - end - - def initialize - super - @silenced_events = {} - end - - def silenced?(event) - ActiveSupport.event_reporter.subscribers.none? || @silenced_events[event]&.call - end - - attr_writer :silenced_events # :nodoc: - - # Emit a structured event via Rails.event.notify. - # - # ==== Arguments - # - # * +name+ - The event name as a string or symbol - # * +payload+ - The event payload as a hash or object - # * +caller_depth+ - Stack depth for source location (default: 1) - # * +kwargs+ - Additional payload data merged with the payload hash - def emit_event(name, payload = nil, caller_depth: 1, **kwargs) - ActiveSupport.event_reporter.notify(name, payload, caller_depth: caller_depth + 1, **kwargs) - rescue => e - handle_event_error(name, e) - end - - # Like +emit_event+, but only emits when the event reporter is in debug mode - def emit_debug_event(name, payload = nil, caller_depth: 1, **kwargs) - ActiveSupport.event_reporter.debug(name, payload, caller_depth: caller_depth + 1, **kwargs) - rescue => e - handle_event_error(name, e) - end - - def call(event) - super - rescue => e - handle_event_error(event.name, e) - end - - private - def handle_event_error(name, error) - ActiveSupport.error_reporter.report(error, source: name) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/subscriber.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/subscriber.rb deleted file mode 100644 index cf0ed61..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/subscriber.rb +++ /dev/null @@ -1,141 +0,0 @@ -# frozen_string_literal: true - -require "active_support/notifications" - -module ActiveSupport - # = Active Support \Subscriber - # - # +ActiveSupport::Subscriber+ is an object set to consume - # ActiveSupport::Notifications. The subscriber dispatches notifications to - # a registered object based on its given namespace. - # - # An example would be an Active Record subscriber responsible for collecting - # statistics about queries: - # - # module ActiveRecord - # class StatsSubscriber < ActiveSupport::Subscriber - # attach_to :active_record - # - # def sql(event) - # Statsd.timing("sql.#{event.payload[:name]}", event.duration) - # end - # end - # end - # - # After configured, whenever a "sql.active_record" notification is - # published, it will properly dispatch the event - # (ActiveSupport::Notifications::Event) to the +sql+ method. - # - # We can detach a subscriber as well: - # - # ActiveRecord::StatsSubscriber.detach_from(:active_record) - class Subscriber - class << self - # Attach the subscriber to a namespace. - def attach_to(namespace, subscriber = new, notifier = ActiveSupport::Notifications, inherit_all: false) - @namespace = namespace - @subscriber = subscriber - @notifier = notifier - @inherit_all = inherit_all - - subscribers << subscriber - - # Add event subscribers for all existing methods on the class. - fetch_public_methods(subscriber, inherit_all).each do |event| - add_event_subscriber(event) - end - end - - # Detach the subscriber from a namespace. - def detach_from(namespace, notifier = ActiveSupport::Notifications) - @namespace = namespace - @subscriber = find_attached_subscriber - @notifier = notifier - - return unless subscriber - - subscribers.delete(subscriber) - - # Remove event subscribers of all existing methods on the class. - fetch_public_methods(subscriber, true).each do |event| - remove_event_subscriber(event) - end - - # Reset notifier so that event subscribers will not add for new methods added to the class. - @notifier = nil - end - - # Adds event subscribers for all new methods added to the class. - def method_added(event) - super - # Only public methods are added as subscribers, and only if a notifier - # has been set up. This means that subscribers will only be set up for - # classes that call #attach_to. - if public_method_defined?(event) && notifier - add_event_subscriber(event) - end - end - - def subscribers - @@subscribers ||= [] - end - - private - attr_reader :subscriber, :notifier, :namespace - - def add_event_subscriber(event) # :doc: - return if invalid_event?(event) - - pattern = prepare_pattern(event) - - # Don't add multiple subscribers (e.g. if methods are redefined). - return if pattern_subscribed?(pattern) - - subscriber.patterns[pattern] = notifier.subscribe(pattern, subscriber) - end - - def remove_event_subscriber(event) # :doc: - return if invalid_event?(event) - - pattern = prepare_pattern(event) - - return unless pattern_subscribed?(pattern) - - notifier.unsubscribe(subscriber.patterns[pattern]) - subscriber.patterns.delete(pattern) - end - - def find_attached_subscriber - subscribers.find { |attached_subscriber| attached_subscriber.instance_of?(self) } - end - - def invalid_event?(event) - %i{ start finish }.include?(event.to_sym) - end - - def prepare_pattern(event) - "#{event}.#{namespace}" - end - - def pattern_subscribed?(pattern) - subscriber.patterns.key?(pattern) - end - - def fetch_public_methods(subscriber, inherit_all) - subscriber.public_methods(inherit_all) - Subscriber.public_instance_methods(true) - end - end - - attr_reader :patterns # :nodoc: - - def initialize - @patterns = {} - super - end - - def call(event) - method = event.name[0, event.name.index(".")] - send(method, event) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/syntax_error_proxy.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/syntax_error_proxy.rb deleted file mode 100644 index 76179e6..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/syntax_error_proxy.rb +++ /dev/null @@ -1,68 +0,0 @@ -# frozen_string_literal: true - -require "delegate" - -module ActiveSupport - # This is a class for wrapping syntax errors. The purpose of this class - # is to enhance the backtraces on SyntaxError exceptions to include the - # source location of the syntax error. That way we can display the error - # source on error pages in development. - class SyntaxErrorProxy < DelegateClass(SyntaxError) # :nodoc: - def backtrace - parse_message_for_trace + super - end - - class BacktraceLocation < Struct.new(:path, :lineno, :to_s) # :nodoc: - def spot(_) - end - - def label - end - - def base_label - end - - def absolute_path - path - end - end - - class BacktraceLocationProxy < DelegateClass(Thread::Backtrace::Location) # :nodoc: - def initialize(loc, ex) - super(loc) - @ex = ex - end - - def spot(_) - super(@ex.__getobj__) - end - end - - def backtrace_locations - return nil if super.nil? - - parse_message_for_trace.map { |trace| - file, line = trace.match(/^(.+?):(\d+).*$/, &:captures) || trace - BacktraceLocation.new(file, line.to_i, trace) - # We have to wrap these backtrace locations because we need the - # spot information to come from the originating exception, not the - # proxy object that's generating these - } + super.map { |loc| BacktraceLocationProxy.new(loc, self) } - end - - private - def parse_message_for_trace - if __getobj__.to_s.start_with?("(eval") - # If the exception is coming from a call to eval, we need to keep - # the path of the file in which eval was called to ensure we can - # return the right source fragment to show the location of the - # error - location = __getobj__.backtrace_locations[0] - ["#{location.path}:#{location.lineno}: #{__getobj__}"] - else - # Only message lines with a file location on them are trace entries - __getobj__.to_s.split("\n").grep(/:\d+/) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/tagged_logging.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/tagged_logging.rb deleted file mode 100644 index 594ea30..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/tagged_logging.rb +++ /dev/null @@ -1,157 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/module/delegation" -require "active_support/core_ext/object/blank" -require "active_support/logger" - -module ActiveSupport - # = Active Support Tagged Logging - # - # Wraps any standard Logger object to provide tagging capabilities. - # - # May be called with a block: - # - # logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT)) - # logger.tagged('BCX') { logger.info 'Stuff' } # Logs "[BCX] Stuff" - # logger.tagged('BCX', "Jason") { |tagged_logger| tagged_logger.info 'Stuff' } # Logs "[BCX] [Jason] Stuff" - # logger.tagged('BCX') { logger.tagged('Jason') { logger.info 'Stuff' } } # Logs "[BCX] [Jason] Stuff" - # - # If called without a block, a new logger will be returned with applied tags: - # - # logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT)) - # logger.tagged("BCX").info "Stuff" # Logs "[BCX] Stuff" - # logger.tagged("BCX", "Jason").info "Stuff" # Logs "[BCX] [Jason] Stuff" - # logger.tagged("BCX").tagged("Jason").info "Stuff" # Logs "[BCX] [Jason] Stuff" - # - # This is used by the default Rails.logger as configured by Railties to make - # it easy to stamp log lines with subdomains, request ids, and anything else - # to aid debugging of multi-user production applications. - module TaggedLogging - module Formatter # :nodoc: - # This method is invoked when a log event occurs. - def call(severity, timestamp, progname, msg) - super(severity, timestamp, progname, tag_stack.format_message(msg)) - end - - def tagged(*tags) - pushed_count = tag_stack.push_tags(tags).size - yield self - ensure - pop_tags(pushed_count) - end - - def push_tags(*tags) - tag_stack.push_tags(tags) - end - - def pop_tags(count = 1) - tag_stack.pop_tags(count) - end - - def clear_tags! - tag_stack.clear - end - - def tag_stack - # We use our object ID here to avoid conflicting with other instances - @thread_key ||= "activesupport_tagged_logging_tags:#{object_id}" - IsolatedExecutionState[@thread_key] ||= TagStack.new - end - - def current_tags - tag_stack.tags - end - - def tags_text - tag_stack.format_message("") - end - end - - class TagStack # :nodoc: - attr_reader :tags - - def initialize - @tags = [] - @tags_string = nil - end - - def push_tags(tags) - @tags_string = nil - tags.flatten! - tags.reject!(&:blank?) - @tags.concat(tags) - tags - end - - def pop_tags(count) - @tags_string = nil - @tags.pop(count) - end - - def clear - @tags_string = nil - @tags.clear - end - - def format_message(message) - if @tags.empty? - message - elsif @tags.size == 1 - "[#{@tags[0]}] #{message}" - else - @tags_string ||= "[#{@tags.join("] [")}] " - "#{@tags_string}#{message}" - end - end - end - - module LocalTagStorage # :nodoc: - attr_accessor :tag_stack - - def self.extended(base) - base.tag_stack = TagStack.new - end - end - - # Returns an `ActiveSupport::Logger` that has already been wrapped with tagged logging concern. - def self.logger(*args, **kwargs) - new ActiveSupport::Logger.new(*args, **kwargs) - end - - def self.new(logger) - logger = logger.clone - - if logger.formatter - logger.formatter = logger.formatter.clone - - # Workaround for https://bugs.ruby-lang.org/issues/20250 - # Can be removed when Ruby 3.4 is the least supported version. - logger.formatter.object_id if logger.formatter.is_a?(Proc) - else - # Ensure we set a default formatter so we aren't extending nil! - logger.formatter = ActiveSupport::Logger::SimpleFormatter.new - end - - logger.formatter.extend Formatter - logger.extend(self) - end - - delegate :push_tags, :pop_tags, :clear_tags!, to: :formatter - - def tagged(*tags) - if block_given? - formatter.tagged(*tags) { yield self } - else - logger = ActiveSupport::TaggedLogging.new(self) - logger.formatter.extend LocalTagStorage - logger.push_tags(*formatter.current_tags, *tags) - logger - end - end - - def flush - clear_tags! - super if defined?(super) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/test_case.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/test_case.rb deleted file mode 100644 index 460ccfc..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/test_case.rb +++ /dev/null @@ -1,365 +0,0 @@ -# frozen_string_literal: true - -require "minitest" -require "active_support/testing/tagged_logging" -require "active_support/testing/setup_and_teardown" -require "active_support/testing/tests_without_assertions" -require "active_support/testing/assertions" -require "active_support/testing/error_reporter_assertions" -require "active_support/testing/event_reporter_assertions" -require "active_support/testing/deprecation" -require "active_support/testing/declarative" -require "active_support/testing/isolation" -require "active_support/testing/constant_lookup" -require "active_support/testing/time_helpers" -require "active_support/testing/constant_stubbing" -require "active_support/testing/file_fixtures" -require "active_support/testing/parallelization" -require "active_support/testing/parallelize_executor" -require "active_support/testing/notification_assertions" -require "concurrent/utility/processor_counter" - -module ActiveSupport - class TestCase < ::Minitest::Test - Assertion = Minitest::Assertion - - # Class variable to store the parallel worker ID - @@parallel_worker_id = nil - - class << self - # Returns the current parallel worker ID if tests are running in parallel, - # nil otherwise. - # - # ActiveSupport::TestCase.parallel_worker_id # => 2 - def parallel_worker_id - @@parallel_worker_id - end - - def parallel_worker_id=(value) # :nodoc: - @@parallel_worker_id = value - end - - # Sets the order in which test cases are run. - # - # ActiveSupport::TestCase.test_order = :random # => :random - # - # Valid values are: - # * +:random+ (to run tests in random order) - # * +:parallel+ (to run tests in parallel) - # * +:sorted+ (to run tests alphabetically by method name) - # * +:alpha+ (equivalent to +:sorted+) - def test_order=(new_order) - ActiveSupport.test_order = new_order - end - - # Returns the order in which test cases are run. - # - # ActiveSupport::TestCase.test_order # => :random - # - # Possible values are +:random+, +:parallel+, +:alpha+, +:sorted+. - # Defaults to +:random+. - def test_order - ActiveSupport.test_order ||= :random - end - - if Minitest::Runnable.respond_to? :run_order # MT6 API change - def run_order # :nodoc: - test_order - end - end - - # Parallelizes the test suite. - # - # Takes a +workers+ argument that controls how many times the process - # is forked. For each process a new database will be created suffixed - # with the worker number. - # - # test-database_0 - # test-database_1 - # - # If ENV["PARALLEL_WORKERS"] is set the workers argument will be ignored - # and the environment variable will be used instead. This is useful for CI - # environments, or other environments where you may need more workers than - # you do for local testing. - # - # If the number of workers is set to +1+ or fewer, the tests will not be - # parallelized. - # - # If +workers+ is set to +:number_of_processors+, the number of workers will be - # set to the actual core count on the machine you are on. - # - # The default parallelization method is to fork processes. If you'd like to - # use threads instead you can pass with: :threads to the +parallelize+ - # method. Note the threaded parallelization does not create multiple - # databases and will not work with system tests. - # - # parallelize(workers: :number_of_processors, with: :threads) - # - # The threaded parallelization uses minitest's parallel executor directly. - # The processes parallelization uses a Ruby DRb server. - # - # Because parallelization presents an overhead, it is only enabled when the - # number of tests to run is above the +threshold+ param. The default value is - # 50, and it's configurable via +config.active_support.test_parallelization_threshold+. - # - # If you want to skip Rails default creation of one database per process in favor of - # writing your own implementation, you can set +parallelize_databases+, or configure it - # via +config.active_support.parallelize_test_databases+. - # - # parallelize(workers: :number_of_processors, parallelize_databases: false) - # - # Note that your test suite may deadlock if you attempt to use only one database - # with multiple processes. - def parallelize(workers: :number_of_processors, with: :processes, threshold: ActiveSupport.test_parallelization_threshold, parallelize_databases: ActiveSupport.parallelize_test_databases) - case - when ENV["PARALLEL_WORKERS"] - workers = ENV["PARALLEL_WORKERS"].to_i - when workers == :number_of_processors - workers = (Concurrent.available_processor_count || Concurrent.processor_count).floor - end - - if with == :processes - ActiveSupport.parallelize_test_databases = parallelize_databases - end - - Minitest.parallel_executor = ActiveSupport::Testing::ParallelizeExecutor.new(size: workers, with: with, threshold: threshold) - end - - # Before fork hook for parallel testing. This can be used to run anything - # before the processes are forked. - # - # In your +test_helper.rb+ add the following: - # - # class ActiveSupport::TestCase - # parallelize_before_fork do - # # run this before fork - # end - # end - def parallelize_before_fork(&block) - ActiveSupport::Testing::Parallelization.before_fork_hook(&block) - end - - # Setup hook for parallel testing. This can be used if you have multiple - # databases or any behavior that needs to be run after the process is forked - # but before the tests run. - # - # Note: this feature is not available with the threaded parallelization. - # - # In your +test_helper.rb+ add the following: - # - # class ActiveSupport::TestCase - # parallelize_setup do - # # create databases - # end - # end - def parallelize_setup(&block) - ActiveSupport::Testing::Parallelization.after_fork_hook(&block) - end - - # Clean up hook for parallel testing. This can be used to drop databases - # if your app uses multiple write/read databases or other clean up before - # the tests finish. This runs before the forked process is closed. - # - # Note: this feature is not available with the threaded parallelization. - # - # In your +test_helper.rb+ add the following: - # - # class ActiveSupport::TestCase - # parallelize_teardown do - # # drop databases - # end - # end - def parallelize_teardown(&block) - ActiveSupport::Testing::Parallelization.run_cleanup_hook(&block) - end - - # :singleton-method: fixture_paths - # - # Returns the ActiveRecord::FixtureSet collection. - # - # In your +test_helper.rb+ you must have require "rails/test_help". - - # :singleton-method: fixture_paths= - # - # :call-seq: - # fixture_paths=(fixture_paths) - # - # Sets the given path to the fixture set. - # - # Can also append multiple paths. - # - # ActiveSupport::TestCase.fixture_paths << "component1/test/fixtures" - # - # In your +test_helper.rb+ you must have require "rails/test_help". - end - - alias_method :method_name, :name - - # Returns the current parallel worker ID if tests are running in parallel - def parallel_worker_id - self.class.parallel_worker_id - end - - include ActiveSupport::Testing::TaggedLogging - prepend ActiveSupport::Testing::SetupAndTeardown - prepend ActiveSupport::Testing::TestsWithoutAssertions - include ActiveSupport::Testing::Assertions - include ActiveSupport::Testing::ErrorReporterAssertions - include ActiveSupport::Testing::EventReporterAssertions - include ActiveSupport::Testing::NotificationAssertions - include ActiveSupport::Testing::Deprecation - include ActiveSupport::Testing::ConstantStubbing - include ActiveSupport::Testing::TimeHelpers - include ActiveSupport::Testing::FileFixtures - extend ActiveSupport::Testing::Declarative - - ## - # :method: assert_not_empty - # - # :call-seq: - # assert_not_empty(obj, msg = nil) - # - # Alias for: refute_empty[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_empty] - - # - alias :assert_not_empty :refute_empty - - ## - # :method: assert_not_equal - # - # :call-seq: - # assert_not_equal(exp, act, msg = nil) - # - # Alias for: refute_equal[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_equal] - - # - alias :assert_not_equal :refute_equal - - ## - # :method: assert_not_in_delta - # - # :call-seq: - # assert_not_in_delta(exp, act, delta = 0.001, msg = nil) - # - # Alias for: refute_in_delta[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_in_delta] - - # - alias :assert_not_in_delta :refute_in_delta - - ## - # :method: assert_not_in_epsilon - # - # :call-seq: - # assert_not_in_epsilon(a, b, epsilon = 0.001, msg = nil) - # - # Alias for: refute_in_epsilon[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_in_epsilon] - - # - alias :assert_not_in_epsilon :refute_in_epsilon - - ## - # :method: assert_not_includes - # - # :call-seq: - # assert_not_includes(collection, obj, msg = nil) - # - # Alias for: refute_includes[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_includes] - - # - alias :assert_not_includes :refute_includes - - ## - # :method: assert_not_instance_of - # - # :call-seq: - # assert_not_instance_of(cls, obj, msg = nil) - # - # Alias for: refute_instance_of[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_instance_of] - - # - alias :assert_not_instance_of :refute_instance_of - - ## - # :method: assert_not_kind_of - # - # :call-seq: - # assert_not_kind_of(cls, obj, msg = nil) - # - # Alias for: refute_kind_of[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_kind_of] - - # - alias :assert_not_kind_of :refute_kind_of - - ## - # :method: assert_no_match - # - # :call-seq: - # assert_no_match(matcher, obj, msg = nil) - # - # Alias for: refute_match[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_match] - - # - alias :assert_no_match :refute_match - - ## - # :method: assert_not_nil - # - # :call-seq: - # assert_not_nil(obj, msg = nil) - # - # Alias for: refute_nil[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_nil] - - # - alias :assert_not_nil :refute_nil - - ## - # :method: assert_not_operator - # - # :call-seq: - # assert_not_operator(o1, op, o2 = UNDEFINED, msg = nil) - # - # Alias for: refute_operator[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_operator] - - # - alias :assert_not_operator :refute_operator - - ## - # :method: assert_not_predicate - # - # :call-seq: - # assert_not_predicate(o1, op, msg = nil) - # - # Alias for: refute_predicate[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_predicate] - - # - alias :assert_not_predicate :refute_predicate - - ## - # :method: assert_not_respond_to - # - # :call-seq: - # assert_not_respond_to(obj, meth, msg = nil) - # - # Alias for: refute_respond_to[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_respond_to] - - # - alias :assert_not_respond_to :refute_respond_to - - ## - # :method: assert_not_same - # - # :call-seq: - # assert_not_same(exp, act, msg = nil) - # - # Alias for: refute_same[https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-refute_same] - - # - alias :assert_not_same :refute_same - - ActiveSupport.run_load_hooks(:active_support_test_case, self) - - def inspect # :nodoc: - Object.instance_method(:to_s).bind_call(self) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/assertions.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/assertions.rb deleted file mode 100644 index 13a84bb..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/assertions.rb +++ /dev/null @@ -1,372 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/enumerable" - -module ActiveSupport - module Testing - module Assertions - UNTRACKED = Object.new # :nodoc: - - # Asserts that an expression is not truthy. Passes if +object+ is +nil+ or - # +false+. "Truthy" means "considered true in a conditional" like if - # foo. - # - # assert_not nil # => true - # assert_not false # => true - # assert_not 'foo' # => Expected "foo" to be nil or false - # - # An error message can be specified. - # - # assert_not foo, 'foo should be false' - def assert_not(object, message = nil) - message ||= -> { "Expected #{mu_pp(object)} to be nil or false" } - assert !object, message - end - - # Asserts that a block raises one of +exp+. This is an enhancement of the - # standard Minitest assertion method with the ability to test error - # messages. - # - # assert_raises(ArgumentError, match: /incorrect param/i) do - # perform_service(param: 'exception') - # end - # - def assert_raises(*exp, match: nil, &block) - error = super(*exp, &block) - assert_match(match, error.message) if match - error - end - alias :assert_raise :assert_raises - - # Assertion that the block should not raise an exception. - # - # Passes if evaluated code in the yielded block raises no exception. - # - # assert_nothing_raised do - # perform_service(param: 'no_exception') - # end - def assert_nothing_raised - yield.tap { assert(true) } - rescue => error - raise Minitest::UnexpectedError.new(error) - end - - # Test numeric difference between the return value of an expression as a - # result of what is evaluated in the yielded block. - # - # assert_difference 'Article.count' do - # post :create, params: { article: {...} } - # end - # - # An arbitrary expression is passed in and evaluated. - # - # assert_difference 'Article.last.comments(:reload).size' do - # post :create, params: { comment: {...} } - # end - # - # An arbitrary positive or negative difference can be specified. - # The default is +1+. - # - # assert_difference 'Article.count', -1 do - # post :delete, params: { id: ... } - # end - # - # An array of expressions can be passed in and evaluated. - # - # assert_difference [ 'Article.count', 'Post.count' ], 2 do - # post :create, params: { article: {...} } - # end - # - # A hash of expressions/numeric differences can be passed in and evaluated. - # - # assert_difference({ 'Article.count' => 1, 'Notification.count' => 2 }) do - # post :create, params: { article: {...} } - # end - # - # A lambda, a list of lambdas or a hash of lambdas/numeric differences can be passed in and evaluated: - # - # assert_difference ->{ Article.count }, 2 do - # post :create, params: { article: {...} } - # end - # - # assert_difference [->{ Article.count }, ->{ Post.count }], 2 do - # post :create, params: { article: {...} } - # end - # - # assert_difference ->{ Article.count } => 1, ->{ Notification.count } => 2 do - # post :create, params: { article: {...} } - # end - # - # An error message can be specified. - # - # assert_difference 'Article.count', -1, 'An Article should be destroyed' do - # post :delete, params: { id: ... } - # end - def assert_difference(expression, *args, &block) - expressions = - if expression.is_a?(Hash) - message = args[0] - expression - else - difference = args[0] || 1 - message = args[1] - Array(expression).index_with(difference) - end - - exps = expressions.keys.map { |e| - e.respond_to?(:call) ? e : lambda { eval(e, block.binding) } - } - before = exps.map(&:call) - - retval = _assert_nothing_raised_or_warn("assert_difference", &block) - - expressions.zip(exps, before) do |(code, diff), exp, before_value| - actual = exp.call - rich_message = -> do - code_string = code.respond_to?(:call) ? _callable_to_source_string(code) : code - error = "`#{code_string}` didn't change by #{diff}, but by #{actual - before_value}." - error = "#{error}\n#{diff before_value + diff, actual}" if Minitest::VERSION > "6" - error = "#{message}.\n#{error}" if message - error - end - assert_equal(before_value + diff, actual, rich_message) - end - - retval - end - - # Assertion that the numeric result of evaluating an expression is not - # changed before and after invoking the passed in block. - # - # assert_no_difference 'Article.count' do - # post :create, params: { article: invalid_attributes } - # end - # - # A lambda can be passed in and evaluated. - # - # assert_no_difference -> { Article.count } do - # post :create, params: { article: invalid_attributes } - # end - # - # An error message can be specified. - # - # assert_no_difference 'Article.count', 'An Article should not be created' do - # post :create, params: { article: invalid_attributes } - # end - # - # An array of expressions can also be passed in and evaluated. - # - # assert_no_difference [ 'Article.count', -> { Post.count } ] do - # post :create, params: { article: invalid_attributes } - # end - def assert_no_difference(expression, message = nil, &block) - assert_difference expression, 0, message, &block - end - - # Assertion that the result of evaluating an expression is changed before - # and after invoking the passed in block. - # - # assert_changes 'Status.all_good?' do - # post :create, params: { status: { ok: false } } - # end - # - # You can pass the block as a string to be evaluated in the context of - # the block. A lambda can be passed for the block as well. - # - # assert_changes -> { Status.all_good? } do - # post :create, params: { status: { ok: false } } - # end - # - # The assertion is useful to test side effects. The passed block can be - # anything that can be converted to string with #to_s. - # - # assert_changes :@object do - # @object = 42 - # end - # - # The keyword arguments +:from+ and +:to+ can be given to specify the - # expected initial value and the expected value after the block was - # executed. The comparison is done using case equality (===), which means - # you can specify patterns or classes: - # - # # Exact value match - # assert_changes :@object, from: nil, to: :foo do - # @object = :foo - # end - # - # # Case equality - # assert_changes -> { user.token }, to: /\w{32}/ do - # user.generate_token - # end - # - # # Type check - # assert_changes -> { current_error }, from: nil, to: RuntimeError do - # raise "Oops" - # end - # - # An error message can be specified. - # - # assert_changes -> { Status.all_good? }, 'Expected the status to be bad' do - # post :create, params: { status: { incident: true } } - # end - def assert_changes(expression, message = nil, from: UNTRACKED, to: UNTRACKED, &block) - exp = expression.respond_to?(:call) ? expression : -> { eval(expression.to_s, block.binding) } - - before = exp.call - retval = _assert_nothing_raised_or_warn("assert_changes", &block) - - unless from == UNTRACKED - rich_message = -> do - error = "Expected change from #{from.inspect}, got #{before.inspect}" - error = "#{message}.\n#{error}" if message - error - end - assert from === before, rich_message - end - - after = exp.call - - rich_message = -> do - code_string = expression.respond_to?(:call) ? _callable_to_source_string(expression) : expression - error = "`#{code_string}` didn't change" - error = "#{error}. It was already #{to.inspect}." if before == to - error = "#{message}.\n#{error}" if message - error - end - refute_equal before, after, rich_message - - unless to == UNTRACKED - rich_message = -> do - error = "Expected change to #{to.inspect}, got #{after.inspect}\n" - error = "#{message}.\n#{error}" if message - error - end - assert to === after, rich_message - end - - retval - end - - # Assertion that the result of evaluating an expression is not changed before - # and after invoking the passed in block. - # - # assert_no_changes 'Status.all_good?' do - # post :create, params: { status: { ok: true } } - # end - # - # Provide the optional keyword argument +:from+ to specify the expected - # initial value. The comparison is done using case equality (===), which means - # you can specify patterns or classes: - # - # # Exact value match - # assert_no_changes -> { Status.all_good? }, from: true do - # post :create, params: { status: { ok: true } } - # end - # - # # Case equality - # assert_no_changes -> { user.token }, from: /\w{32}/ do - # user.touch - # end - # - # # Type check - # assert_no_changes -> { current_error }, from: RuntimeError do - # retry_operation - # end - # - # An error message can be specified. - # - # assert_no_changes -> { Status.all_good? }, 'Expected the status to be good' do - # post :create, params: { status: { ok: false } } - # end - def assert_no_changes(expression, message = nil, from: UNTRACKED, &block) - exp = expression.respond_to?(:call) ? expression : -> { eval(expression.to_s, block.binding) } - - before = exp.call - retval = _assert_nothing_raised_or_warn("assert_no_changes", &block) - - unless from == UNTRACKED - rich_message = -> do - error = "Expected initial value of #{from.inspect}, got #{before.inspect}" - error = "#{message}.\n#{error}" if message - error - end - assert from === before, rich_message - end - - after = exp.call - - rich_message = -> do - code_string = expression.respond_to?(:call) ? _callable_to_source_string(expression) : expression - error = "`#{code_string}` changed." - error = "#{message}.\n#{error}" if message - error = "#{error}\n#{diff before, after}" if Minitest::VERSION > "6" - error - end - - if before.nil? - assert_nil after, rich_message - else - assert_equal before, after, rich_message - end - - retval - end - - private - def _assert_nothing_raised_or_warn(assertion, &block) - assert_nothing_raised(&block) - rescue Minitest::UnexpectedError => e - if tagged_logger && tagged_logger.warn? - warning = <<~MSG - #{self.class} - #{name}: #{e.error.class} raised. - If you expected this exception, use `assert_raises` as near to the code that raises as possible. - Other block based assertions (e.g. `#{assertion}`) can be used, as long as `assert_raises` is inside their block. - MSG - tagged_logger.warn warning - end - - raise - end - - def _callable_to_source_string(callable) - if defined?(RubyVM::InstructionSequence) && callable.is_a?(Proc) - iseq = RubyVM::InstructionSequence.of(callable) - source = - if iseq.script_lines - iseq.script_lines.join("\n") - elsif File.readable?(iseq.absolute_path) - File.read(iseq.absolute_path) - end - - return callable unless source - - location = iseq.to_a[4][:code_location] - return callable unless location - - lines = source.lines[(location[0] - 1)..(location[2] - 1)] - lines[-1] = lines[-1].byteslice(...location[3]) - lines[0] = lines[0].byteslice(location[1]...) - source = lines.join.strip - - # Strip stabby lambda from Ruby 4.1+ - source = source.sub(/^->\s*/, "") - - # We ignore procs defined with do/end as they are likely multi-line anyway. - if source.start_with?("{") - source.delete_suffix!("}") - source.delete_prefix!("{") - source.strip! - # It won't read nice if the callable contains multiple - # lines, and it should be a rare occurrence anyway. - # Same if it takes arguments. - if !source.include?("\n") && !source.start_with?("|") - return source - end - end - end - - callable - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/autorun.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/autorun.rb deleted file mode 100644 index a7dd581..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/autorun.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -require "minitest" - -# This respond_to check handles tests running sub-processes in an -# unbundled environment, which triggers MT5 usage. This conditional may -# be removable after the version bump, though it currently safeguards -# against issues in environments with multiple versions installed. -Minitest.load :rails if Minitest.respond_to? :load -Minitest.autorun diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/constant_lookup.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/constant_lookup.rb deleted file mode 100644 index 51167e9..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/constant_lookup.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -require "active_support/concern" -require "active_support/inflector" - -module ActiveSupport - module Testing - # Resolves a constant from a minitest spec name. - # - # Given the following spec-style test: - # - # describe WidgetsController, :index do - # describe "authenticated user" do - # describe "returns widgets" do - # it "has a controller that exists" do - # assert_kind_of WidgetsController, @controller - # end - # end - # end - # end - # - # The test will have the following name: - # - # "WidgetsController::index::authenticated user::returns widgets" - # - # The constant WidgetsController can be resolved from the name. - # The following code will resolve the constant: - # - # controller = determine_constant_from_test_name(name) do |constant| - # Class === constant && constant < ::ActionController::Metal - # end - module ConstantLookup - extend ::ActiveSupport::Concern - - module ClassMethods # :nodoc: - def determine_constant_from_test_name(test_name) - names = test_name.split "::" - while names.size > 0 do - names.last.sub!(/Test$/, "") - begin - constant = names.join("::").safe_constantize - break(constant) if yield(constant) - ensure - names.pop - end - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/constant_stubbing.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/constant_stubbing.rb deleted file mode 100644 index e0bc6dc..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/constant_stubbing.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module Testing - module ConstantStubbing - # Changes the value of a constant for the duration of a block. Example: - # - # # World::List::Import::LARGE_IMPORT_THRESHOLD = 5000 - # stub_const(World::List::Import, :LARGE_IMPORT_THRESHOLD, 1) do - # assert_equal 1, World::List::Import::LARGE_IMPORT_THRESHOLD - # end - # - # assert_equal 5000, World::List::Import::LARGE_IMPORT_THRESHOLD - # - # Using this method rather than forcing World::List::Import::LARGE_IMPORT_THRESHOLD = 5000 prevents - # warnings from being thrown, and ensures that the old value is returned after the test has completed. - # - # If the constant doesn't already exists, but you need it set for the duration of the block - # you can do so by passing `exists: false`. - # - # stub_const(object, :SOME_CONST, 1, exists: false) do - # assert_equal 1, SOME_CONST - # end - # - # Note: Stubbing a const will stub it across all threads. So if you have concurrent threads - # (like separate test suites running in parallel) that all depend on the same constant, it's possible - # divergent stubbing will trample on each other. - def stub_const(mod, constant, new_value, exists: true) - if exists - begin - old_value = mod.const_get(constant, false) - mod.send(:remove_const, constant) - mod.const_set(constant, new_value) - yield - ensure - mod.send(:remove_const, constant) - mod.const_set(constant, old_value) - end - else - if mod.const_defined?(constant) - raise NameError, "already defined constant #{constant} in #{mod.name}" - end - - begin - mod.const_set(constant, new_value) - yield - ensure - mod.send(:remove_const, constant) - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/declarative.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/declarative.rb deleted file mode 100644 index 7c34036..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/declarative.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module Testing - module Declarative - unless defined?(Spec) - # Helper to define a test method using a String. Under the hood, it replaces - # spaces with underscores and defines the test method. - # - # test "verify something" do - # ... - # end - def test(name, &block) - test_name = "test_#{name.gsub(/\s+/, '_')}".to_sym - defined = method_defined? test_name - raise "#{test_name} is already defined in #{self}" if defined - if block_given? - define_method(test_name, &block) - else - define_method(test_name) do - flunk "No implementation provided for #{name}" - end - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/deprecation.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/deprecation.rb deleted file mode 100644 index ea307a0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/deprecation.rb +++ /dev/null @@ -1,82 +0,0 @@ -# frozen_string_literal: true - -require "active_support/deprecation" - -module ActiveSupport - module Testing - module Deprecation - ## - # :call-seq: - # assert_deprecated(deprecator, &block) - # assert_deprecated(match, deprecator, &block) - # - # Asserts that a matching deprecation warning was emitted by the given deprecator during the execution of the yielded block. - # - # assert_deprecated(/foo/, CustomDeprecator) do - # CustomDeprecator.warn "foo should no longer be used" - # end - # - # The +match+ object may be a +Regexp+, or +String+ appearing in the message. - # - # assert_deprecated('foo', CustomDeprecator) do - # CustomDeprecator.warn "foo should no longer be used" - # end - # - # If the +match+ is omitted (or explicitly +nil+), any deprecation warning will match. - # - # assert_deprecated(CustomDeprecator) do - # CustomDeprecator.warn "foo should no longer be used" - # end - def assert_deprecated(match = nil, deprecator = nil, &block) - match, deprecator = nil, match if match.is_a?(ActiveSupport::Deprecation) - - unless deprecator - raise ArgumentError, "No deprecator given" - end - - result, warnings = collect_deprecations(deprecator, &block) - assert !warnings.empty?, "Expected a deprecation warning within the block but received none" - if match - match = Regexp.new(Regexp.escape(match)) unless match.is_a?(Regexp) - assert warnings.any? { |w| match.match?(w) }, "No deprecation warning matched #{match}: #{warnings.join(', ')}" - end - result - end - - # Asserts that no deprecation warnings are emitted by the given deprecator during the execution of the yielded block. - # - # assert_not_deprecated(CustomDeprecator) do - # CustomDeprecator.warn "message" # fails assertion - # end - # - # assert_not_deprecated(ActiveSupport::Deprecation.new) do - # CustomDeprecator.warn "message" # passes assertion, different deprecator - # end - def assert_not_deprecated(deprecator, &block) - result, deprecations = collect_deprecations(deprecator, &block) - assert deprecations.empty?, "Expected no deprecation warning within the block but received #{deprecations.size}: \n #{deprecations * "\n "}" - result - end - - # Returns the return value of the block and an array of all the deprecation warnings emitted by the given - # +deprecator+ during the execution of the yielded block. - # - # collect_deprecations(CustomDeprecator) do - # CustomDeprecator.warn "message" - # ActiveSupport::Deprecation.new.warn "other message" - # :result - # end # => [:result, ["message"]] - def collect_deprecations(deprecator) - old_behavior = deprecator.behavior - deprecations = [] - deprecator.behavior = Proc.new do |message, callstack| - deprecations << message - end - result = yield - [result, deprecations] - ensure - deprecator.behavior = old_behavior - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/error_reporter_assertions.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/error_reporter_assertions.rb deleted file mode 100644 index 2f8a5fd..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/error_reporter_assertions.rb +++ /dev/null @@ -1,124 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module Testing - module ErrorReporterAssertions - module ErrorCollector # :nodoc: - @subscribed = false - @mutex = Mutex.new - - Report = Struct.new(:error, :handled, :severity, :context, :source, keyword_init: true) - class Report - alias_method :handled?, :handled - end - - class << self - def record - subscribe - recorders = ActiveSupport::IsolatedExecutionState[:active_support_error_reporter_assertions] ||= [] - reports = [] - recorders << reports - begin - yield - reports - ensure - recorders.delete_if { |r| reports.equal?(r) } - end - end - - def report(error, **kwargs) - report = Report.new(error: error, **kwargs) - ActiveSupport::IsolatedExecutionState[:active_support_error_reporter_assertions]&.each do |reports| - reports << report - end - true - end - - private - def subscribe - return if @subscribed - @mutex.synchronize do - return if @subscribed - - if ActiveSupport.error_reporter - ActiveSupport.error_reporter.subscribe(self) - @subscribed = true - else - raise Minitest::Assertion, "No error reporter is configured" - end - end - end - end - end - - # Assertion that the block should not cause an exception to be reported - # to +Rails.error+. - # - # Passes if evaluated code in the yielded block reports no exception. - # - # assert_no_error_reported do - # perform_service(param: 'no_exception') - # end - def assert_no_error_reported(&block) - reports = ErrorCollector.record do - _assert_nothing_raised_or_warn("assert_no_error_reported", &block) - end - assert_predicate(reports, :empty?) - end - - # Assertion that the block should cause at least one exception to be reported - # to +Rails.error+. - # - # Passes if the evaluated code in the yielded block reports a matching exception. - # - # assert_error_reported(IOError) do - # Rails.error.report(IOError.new("Oops")) - # end - # - # To test further details about the reported exception, you can use the return - # value. - # - # report = assert_error_reported(IOError) do - # # ... - # end - # assert_equal "Oops", report.error.message - # assert_equal "admin", report.context[:section] - # assert_equal :warning, report.severity - # assert_predicate report, :handled? - def assert_error_reported(error_class = StandardError, &block) - reports = ErrorCollector.record do - _assert_nothing_raised_or_warn("assert_error_reported", &block) - end - - if reports.empty? - assert(false, "Expected a #{error_class.name} to be reported, but there were no errors reported.") - elsif (report = reports.find { |r| error_class === r.error }) - self.assertions += 1 - report - else - message = "Expected a #{error_class.name} to be reported, but none of the " \ - "#{reports.size} reported errors matched: \n" \ - "#{reports.map { |r| r.error.class.name }.join("\n ")}" - assert(false, message) - end - end - - # Captures reported errors from within the block that match the given - # error class. - # - # reports = capture_error_reports(IOError) do - # Rails.error.report(IOError.new("Oops")) - # Rails.error.report(IOError.new("Oh no")) - # Rails.error.report(StandardError.new) - # end - # - # assert_equal 2, reports.size - # assert_equal "Oops", reports.first.error.message - # assert_equal "Oh no", reports.last.error.message - def capture_error_reports(error_class = StandardError, &block) - reports = ErrorCollector.record(&block) - reports.select { |r| error_class === r.error } - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/event_reporter_assertions.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/event_reporter_assertions.rb deleted file mode 100644 index 65e6976..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/event_reporter_assertions.rb +++ /dev/null @@ -1,227 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module Testing - # Provides test helpers for asserting on ActiveSupport::EventReporter events. - module EventReporterAssertions - module EventCollector # :nodoc: - @subscribed = false - @mutex = Mutex.new - - class Event # :nodoc: - attr_reader :event_data - - def initialize(event_data) - @event_data = event_data - end - - def inspect - "#{event_data[:name]} (payload: #{event_data[:payload].inspect}, tags: #{event_data[:tags].inspect})" - end - - def matches?(name, payload, tags) - return false unless name.to_s == event_data[:name] - - if payload && payload.is_a?(Hash) - return false unless matches_hash?(payload, :payload) - end - - return false unless matches_hash?(tags, :tags) - true - end - - private - def matches_hash?(expected_hash, event_key) - expected_hash.all? do |k, v| - if v.is_a?(Regexp) - event_data.dig(event_key, k).to_s.match?(v) - else - event_data.dig(event_key, k) == v - end - end - end - end - - class << self - def emit(event) - event_recorders&.each do |events| - events << Event.new(event) - end - true - end - - def record - subscribe - events = [] - event_recorders << events - begin - yield - events - ensure - event_recorders.delete_if { |r| events.equal?(r) } - end - end - - private - def subscribe - return if @subscribed - - @mutex.synchronize do - unless @subscribed - if ActiveSupport.event_reporter - ActiveSupport.event_reporter.subscribe(self) - @subscribed = true - else - raise Minitest::Assertion, "No event reporter is configured" - end - end - end - end - - def event_recorders - ActiveSupport::IsolatedExecutionState[:active_support_event_reporter_assertions] ||= [] - end - end - end - - # Asserts that the block does not cause an event to be reported to +Rails.event+. - # - # If no name is provided, passes if evaluated code in the yielded block reports no events. - # - # assert_no_event_reported do - # service_that_does_not_report_events.perform - # end - # - # If a name is provided, passes if evaluated code in the yielded block reports no events - # with that name. - # - # assert_no_event_reported("user.created") do - # service_that_does_not_report_events.perform - # end - def assert_no_event_reported(name = nil, payload: {}, tags: {}, &block) - events = EventCollector.record(&block) - - if name.nil? - assert_predicate(events, :empty?) - else - matching_event = events.find { |event| event.matches?(name, payload, tags) } - if matching_event - message = "Expected no '#{name}' event to be reported, but found:\n " \ - "#{matching_event.inspect}" - flunk(message) - end - assert(true) - end - end - - # Asserts that the block causes an event with the given name to be reported - # to +Rails.event+. - # - # Passes if the evaluated code in the yielded block reports a matching event. - # - # assert_event_reported("user.created") do - # Rails.event.notify("user.created", { id: 123 }) - # end - # - # To test further details about the reported event, you can specify payload and tag matchers. - # - # assert_event_reported("user.created", - # payload: { id: 123, name: "John Doe" }, - # tags: { request_id: /[0-9]+/ } - # ) do - # Rails.event.tagged(request_id: "123") do - # Rails.event.notify("user.created", { id: 123, name: "John Doe" }) - # end - # end - # - # The matchers support partial matching - only the specified keys need to match. - # - # assert_event_reported("user.created", payload: { id: 123 }) do - # Rails.event.notify("user.created", { id: 123, name: "John Doe" }) - # end - def assert_event_reported(name, payload: nil, tags: {}, &block) - events = EventCollector.record(&block) - - if events.empty? - flunk("Expected an event to be reported, but there were no events reported.") - elsif (event = events.find { |event| event.matches?(name, payload, tags) }) - assert(true) - event.event_data - else - message = "Expected an event to be reported matching:\n " \ - "name: #{name.inspect}\n " \ - "payload: #{payload.inspect}\n " \ - "tags: #{tags.inspect}\n" \ - "but none of the #{events.size} reported events matched:\n " \ - "#{events.map(&:inspect).join("\n ")}" - flunk(message) - end - end - - # Asserts that the provided events were reported, regardless of order. - # - # assert_events_reported([ - # { name: "user.created", payload: { id: 123 } }, - # { name: "email.sent", payload: { to: "user@example.com" } } - # ]) do - # create_user_and_send_welcome_email - # end - # - # Supports the same payload and tag matching as +assert_event_reported+. - # - # assert_events_reported([ - # { - # name: "process.started", - # payload: { id: 123 }, - # tags: { request_id: /[0-9]+/ } - # }, - # { name: "process.completed" } - # ]) do - # Rails.event.tagged(request_id: "456") do - # start_and_complete_process(123) - # end - # end - def assert_events_reported(expected_events, &block) - events = EventCollector.record(&block) - - if events.empty? && expected_events.size > 0 - flunk("Expected #{expected_events.size} events to be reported, but there were no events reported.") - end - - events_copy = events.dup - - expected_events.each do |expected_event| - name = expected_event[:name] - payload = expected_event[:payload] || {} - tags = expected_event[:tags] || {} - - matching_event_index = events_copy.find_index { |event| event.matches?(name, payload, tags) } - - if matching_event_index - events_copy.delete_at(matching_event_index) - else - message = "Expected an event to be reported matching:\n " \ - "name: #{name.inspect}\n " \ - "payload: #{payload.inspect}\n " \ - "tags: #{tags.inspect}\n" \ - "but none of the #{events.size} reported events matched:\n " \ - "#{events.map(&:inspect).join("\n ")}" - flunk(message) - end - end - - assert(true) - end - - # Allows debug events to be reported to +Rails.event+ for the duration of a given block. - # - # with_debug_event_reporting do - # service_that_reports_debug_events.perform - # end - # - def with_debug_event_reporting(&block) - ActiveSupport.event_reporter.with_debug(&block) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/file_fixtures.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/file_fixtures.rb deleted file mode 100644 index 4eb7a88..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/file_fixtures.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -require "active_support/concern" - -module ActiveSupport - module Testing - # Adds simple access to sample files called file fixtures. - # File fixtures are normal files stored in - # ActiveSupport::TestCase.file_fixture_path. - # - # File fixtures are represented as +Pathname+ objects. - # This makes it easy to extract specific information: - # - # file_fixture("example.txt").read # get the file's content - # file_fixture("example.mp3").size # get the file size - module FileFixtures - extend ActiveSupport::Concern - - included do - class_attribute :file_fixture_path, instance_writer: false - end - - # Returns a +Pathname+ to the fixture file named +fixture_name+. - # - # Raises +ArgumentError+ if +fixture_name+ can't be found. - def file_fixture(fixture_name) - path = Pathname.new(File.join(file_fixture_path, fixture_name)) - - if path.exist? - path - else - msg = "the directory '%s' does not contain a file named '%s'" - raise ArgumentError, msg % [file_fixture_path, fixture_name] - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/isolation.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/isolation.rb deleted file mode 100644 index ccba6eb..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/isolation.rb +++ /dev/null @@ -1,121 +0,0 @@ -# frozen_string_literal: true - -require "active_support/testing/parallelize_executor" - -module ActiveSupport - module Testing - module Isolation - SubprocessCrashed = Class.new(StandardError) - - def self.included(klass) # :nodoc: - klass.class_eval do - parallelize_me! unless Minitest.parallel_executor.is_a?(ActiveSupport::Testing::ParallelizeExecutor) - end - end - - def self.forking_env? - !ENV["NO_FORK"] && Process.respond_to?(:fork) - end - - def run - status, serialized = run_in_isolation do - super - end - - unless status&.success? - error = SubprocessCrashed.new("Subprocess exited with an error: #{status.inspect}\noutput: #{serialized.inspect}") - error.set_backtrace(caller) - self.failures << Minitest::UnexpectedError.new(error) - return defined?(Minitest::Result) ? Minitest::Result.from(self) : dup - end - - Marshal.load(serialized) - end - - module Forking - def run_in_isolation(&blk) - IO.pipe do |read, write| - read.binmode - write.binmode - - pid = fork do - read.close - yield - begin - if error? - failures.map! { |e| - begin - Marshal.dump e - e - rescue TypeError - ex = Exception.new e.message - ex.set_backtrace e.backtrace - Minitest::UnexpectedError.new ex - end - } - end - test_result = defined?(Minitest::Result) ? Minitest::Result.from(self) : dup - result = Marshal.dump(test_result) - end - - write.puts [result].pack("m") - exit!(0) - end - - write.close - result = read.read - _, status = Process.wait2(pid) - return status, result.unpack1("m") - end - end - end - - module Subprocess - ORIG_ARGV = ARGV.dup unless defined?(ORIG_ARGV) - - # Complicated H4X to get this working in Windows / JRuby with - # no forking. - def run_in_isolation(&blk) - require "tempfile" - - if ENV["ISOLATION_TEST"] - yield - test_result = defined?(Minitest::Result) ? Minitest::Result.from(self) : dup - File.open(ENV["ISOLATION_OUTPUT"], "w") do |file| - file.puts [Marshal.dump(test_result)].pack("m") - end - exit!(0) - else - Tempfile.open("isolation") do |tmpfile| - env = { - "ISOLATION_TEST" => self.class.name, - "ISOLATION_OUTPUT" => tmpfile.path - } - - test_opts = "-n#{self.class.name}##{name}" - - load_path_args = [] - $-I.each do |p| - load_path_args << "-I" - load_path_args << File.expand_path(p) - end - - child = IO.popen([env, Gem.ruby, *load_path_args, $0, *ORIG_ARGV, test_opts]) - - status = nil - begin - _, status = Process.wait2(child.pid) - rescue Errno::ECHILD # The child process may exit before we wait - nil - end - - return status, tmpfile.read.unpack1("m") - end - end - end - end - - include forking_env? ? Forking : Subprocess - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/method_call_assertions.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/method_call_assertions.rb deleted file mode 100644 index 2992164..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/method_call_assertions.rb +++ /dev/null @@ -1,69 +0,0 @@ -# frozen_string_literal: true - -require "minitest/mock" - -module ActiveSupport - module Testing - module MethodCallAssertions # :nodoc: - private - def assert_called(object, method_name, message = nil, times: 1, returns: nil, &block) - times_called = 0 - - object.stub(method_name, proc { times_called += 1; returns }, &block) - - error = "Expected #{method_name} to be called #{times} times, " \ - "but was called #{times_called} times" - error = "#{message}.\n#{error}" if message - assert_equal times, times_called, error - end - - def assert_called_with(object, method_name, args, returns: false, **kwargs, &block) - mock = Minitest::Mock.new - expect_called_with(mock, args, returns: returns, **kwargs) - - object.stub(method_name, mock, &block) - - assert_mock(mock) - end - - def assert_not_called(object, method_name, message = nil, &block) - assert_called(object, method_name, message, times: 0, &block) - end - - def expect_called_with(mock, args, returns: false, **kwargs) - mock.expect(:call, returns, args, **kwargs) - end - - def assert_called_on_instance_of(klass, method_name, message = nil, times: 1, returns: nil) - times_called = 0 - klass.define_method("stubbed_#{method_name}") do |*| - times_called += 1 - - returns - end - - klass.alias_method "original_#{method_name}", method_name - klass.alias_method method_name, "stubbed_#{method_name}" - - yield - - error = "Expected #{method_name} to be called #{times} times, but was called #{times_called} times" - error = "#{message}.\n#{error}" if message - - assert_equal times, times_called, error - ensure - klass.alias_method method_name, "original_#{method_name}" - klass.undef_method "original_#{method_name}" - klass.undef_method "stubbed_#{method_name}" - end - - def assert_not_called_on_instance_of(klass, method_name, message = nil, &block) - assert_called_on_instance_of(klass, method_name, message, times: 0, &block) - end - - def stub_any_instance(klass, instance: klass.new) - klass.stub(:new, instance) { yield instance } - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/notification_assertions.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/notification_assertions.rb deleted file mode 100644 index 67dda74..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/notification_assertions.rb +++ /dev/null @@ -1,92 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module Testing - module NotificationAssertions - # Assert a notification was emitted with a given +pattern+ and optional +payload+. - # - # You can assert that a notification was emitted by passing a pattern, which accepts - # either a string or regexp, an optional payload, and a block. While the block - # is executed, if a matching notification is emitted, the assertion will pass - # and the notification will be returned. - # - # Note that the payload is matched as a subset, meaning that the notification must - # contain at least the specified keys and values, but may contain additional ones. - # - # assert_notification("post.submitted", title: "Cool Post") do - # post.submit(title: "Cool Post", body: "Cool Body") # => emits matching notification - # end - # - # Using the returned notification, you can make more customized assertions. - # - # notification = assert_notification("post.submitted", title: "Cool Post") do - # ActiveSupport::Notifications.instrument("post.submitted", title: "Cool Post", body: Body.new("Cool Body")) - # end - # - # assert_instance_of(Body, notification.payload[:body]) - # - def assert_notification(pattern, payload = nil, &block) - notifications = capture_notifications(pattern, &block) - assert_not_empty(notifications, "No #{pattern} notifications were found") - - return notifications.first if payload.nil? - - notification = notifications.find { |notification| notification.payload.slice(*payload.keys) == payload } - assert_not_nil(notification, "No #{pattern} notification with payload #{payload} was found") - - notification - end - - # Assert the number of notifications emitted with a given +pattern+. - # - # You can assert the number of notifications emitted by passing a pattern, which accepts - # either a string or regexp, a count, and a block. While the block is executed, - # the number of matching notifications emitted will be counted. After the block's - # execution completes, the assertion will pass if the count matches. - # - # assert_notifications_count("post.submitted", 1) do - # post.submit(title: "Cool Post") # => emits matching notification - # end - # - def assert_notifications_count(pattern, count, &block) - actual_count = capture_notifications(pattern, &block).count - assert_equal(count, actual_count, "Expected #{count} instead of #{actual_count} notifications for #{pattern}") - end - - # Assert no notifications were emitted for a given +pattern+. - # - # You can assert no notifications were emitted by passing a pattern, which accepts - # either a string or regexp, and a block. While the block is executed, if no - # matching notifications are emitted, the assertion will pass. - # - # assert_no_notifications("post.submitted") do - # post.destroy # => emits non-matching notification - # end - # - def assert_no_notifications(pattern = nil, &block) - notifications = capture_notifications(pattern, &block) - error_message = if pattern - "Expected no notifications for #{pattern} but found #{notifications.size}" - else - "Expected no notifications but found #{notifications.size}" - end - assert_empty(notifications, error_message) - end - - # Capture emitted notifications, optionally filtered by a +pattern+. - # - # You can capture emitted notifications, optionally filtered by a pattern, - # which accepts either a string or regexp, and a block. - # - # notifications = capture_notifications("post.submitted") do - # post.submit(title: "Cool Post") # => emits matching notification - # end - # - def capture_notifications(pattern = nil, &block) - notifications = [] - ActiveSupport::Notifications.subscribed(->(n) { notifications << n }, pattern, &block) - notifications - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/parallelization.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/parallelization.rb deleted file mode 100644 index 58d26be..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/parallelization.rb +++ /dev/null @@ -1,83 +0,0 @@ -# frozen_string_literal: true - -require "drb" -require "drb/unix" unless Gem.win_platform? -require "active_support/core_ext/module/attribute_accessors" -require "active_support/testing/parallelization/server" -require "active_support/testing/parallelization/worker" - -module ActiveSupport - module Testing - class Parallelization # :nodoc: - @@before_fork_hooks = [] - - def self.before_fork_hook(&blk) - @@before_fork_hooks << blk - end - - cattr_reader :before_fork_hooks - - @@after_fork_hooks = [] - - def self.after_fork_hook(&blk) - @@after_fork_hooks << blk - end - - cattr_reader :after_fork_hooks - - @@run_cleanup_hooks = [] - - def self.run_cleanup_hook(&blk) - @@run_cleanup_hooks << blk - end - - cattr_reader :run_cleanup_hooks - - def initialize(worker_count) - @worker_count = worker_count - @queue_server = Server.new - @worker_pool = [] - @url = DRb.start_service("drbunix:", @queue_server).uri - end - - def before_fork - Parallelization.before_fork_hooks.each(&:call) - end - - def start - before_fork - @worker_pool = @worker_count.times.map do |worker| - Worker.new(worker, @url).start - end - end - - def <<(work) - @queue_server << work - end - - def size - @worker_count - end - - def shutdown - dead_worker_pids = @worker_pool.filter_map do |pid| - Process.waitpid(pid, Process::WNOHANG) - rescue Errno::ECHILD - pid - end - @queue_server.remove_dead_workers(dead_worker_pids) - - @queue_server.shutdown - @worker_pool.each do |pid| - Process.waitpid(pid) - rescue Errno::ECHILD - nil - end - - DRb.stop_service - - Parallelization.run_cleanup_hooks.each(&:call) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/parallelization/server.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/parallelization/server.rb deleted file mode 100644 index 1f4af7d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/parallelization/server.rb +++ /dev/null @@ -1,98 +0,0 @@ -# frozen_string_literal: true - -require "drb" -require "drb/unix" unless Gem.win_platform? - -module ActiveSupport - module Testing - class Parallelization # :nodoc: - PrerecordResultClass = Struct.new(:name) - - class Server - include DRb::DRbUndumped - - def initialize - @queue = Queue.new - @active_workers = Concurrent::Map.new - @worker_pids = Concurrent::Map.new - @in_flight = Concurrent::Map.new - end - - def record(reporter, result) - raise DRb::DRbConnError if result.is_a?(DRb::DRbUnknown) - - @in_flight.delete([result.klass, result.name]) - - reporter.synchronize do - reporter.prerecord(PrerecordResultClass.new(result.klass), result.name) - reporter.record(result) - end - end - - def <<(o) - o[2] = DRbObject.new(o[2]) if o - @queue << o - end - - def pop - if test = @queue.pop - @in_flight[[test[0].to_s, test[1]]] = test - test - end - end - - def start_worker(worker_id, worker_pid) - @active_workers[worker_id] = true - @worker_pids[worker_id] = worker_pid - end - - def stop_worker(worker_id, worker_pid) - @active_workers.delete(worker_id) - @worker_pids.delete(worker_id) - end - - def remove_dead_workers(dead_pids) - dead_pids.each do |dead_pid| - worker_id = @worker_pids.key(dead_pid) - if worker_id - @active_workers.delete(worker_id) - @worker_pids.delete(worker_id) - end - end - end - - def active_workers? - @active_workers.size > 0 - end - - def interrupt - @queue.clear - end - - def shutdown - # Wait for initial queue to drain - while @queue.length != 0 - sleep 0.1 - end - - @queue.close - - # Wait until all workers have finished - while active_workers? - sleep 0.1 - end - - @in_flight.values.each do |(klass, name, reporter)| - result = Minitest::Result.from(klass.new(name)) - error = RuntimeError.new("result not reported") - error.set_backtrace([""]) - result.failures << Minitest::UnexpectedError.new(error) - reporter.synchronize do - reporter.record(result) - end - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/parallelization/worker.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/parallelization/worker.rb deleted file mode 100644 index a78a399..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/parallelization/worker.rb +++ /dev/null @@ -1,109 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module Testing - class Parallelization # :nodoc: - class Worker - def initialize(number, url) - @id = SecureRandom.uuid - @number = number - @url = url - @setup_exception = nil - end - - def start - fork do - set_process_title("(starting)") - - DRb.stop_service - - @queue = DRbObject.new_with_uri(@url) - @queue.start_worker(@id, Process.pid) - - begin - after_fork - rescue => @setup_exception; end - - work_from_queue - ensure - set_process_title("(stopping)") - - run_cleanup - @queue.stop_worker(@id, Process.pid) - end - end - - def work_from_queue - while job = @queue.pop - perform_job(job) - end - end - - def perform_job(job) - klass = job[0] - method = job[1] - reporter = job[2] - - set_process_title("#{klass}##{method}") - - result = klass.with_info_handler reporter do - if Minitest.respond_to? :run_one_method - Minitest.run_one_method klass, method - else - klass.new(method).run - end - end - - safe_record(reporter, result) - end - - def safe_record(reporter, result) - add_setup_exception(result) if @setup_exception - - begin - @queue.record(reporter, result) - rescue DRb::DRbConnError - result.failures.map! do |failure| - if failure.respond_to?(:error) - # minitest >5.14.0 - error = DRb::DRbRemoteError.new(failure.error) - else - error = DRb::DRbRemoteError.new(failure.exception) - end - Minitest::UnexpectedError.new(error) - end - @queue.record(reporter, result) - rescue Interrupt - @queue.interrupt - raise - end - - set_process_title("(idle)") - end - - def after_fork - ActiveSupport::TestCase.parallel_worker_id = @number - - Parallelization.after_fork_hooks.each do |cb| - cb.call(@number) - end - end - - def run_cleanup - Parallelization.run_cleanup_hooks.each do |cb| - cb.call(@number) - end - end - - private - def add_setup_exception(result) - result.failures.prepend Minitest::UnexpectedError.new(@setup_exception) - end - - def set_process_title(status) - Process.setproctitle("Rails test worker #{@number} - #{status}") - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/parallelize_executor.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/parallelize_executor.rb deleted file mode 100644 index 127f26f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/parallelize_executor.rb +++ /dev/null @@ -1,81 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module Testing - class ParallelizeExecutor # :nodoc: - attr_reader :size, :parallelize_with, :threshold - - def initialize(size:, with:, threshold: ActiveSupport.test_parallelization_threshold) - @size = size - @parallelize_with = with - @threshold = threshold - @parallelized = false - end - - def start - parallelize if should_parallelize? - show_execution_info - - parallel_executor.start if parallelized? - end - - def <<(work) - parallel_executor << work if parallelized? - end - - def shutdown - parallel_executor.shutdown if parallelized? - end - - private - def parallel_executor - @parallel_executor ||= build_parallel_executor - end - - def build_parallel_executor - case parallelize_with - when :processes - Testing::Parallelization.new(size) - when :threads - ActiveSupport::TestCase.lock_threads = false if defined?(ActiveSupport::TestCase.lock_threads) - Minitest::Parallel::Executor.new(size) - else - raise ArgumentError, "#{parallelize_with} is not a supported parallelization executor." - end - end - - def parallelize - @parallelized = true - Minitest::Test.parallelize_me! - end - - def parallelized? - @parallelized - end - - def should_parallelize? - (ENV["PARALLEL_WORKERS"] || tests_count > threshold) && many_workers? - end - - def many_workers? - size > 1 - end - - def tests_count - @tests_count ||= Minitest::Runnable.runnables.sum { |runnable| runnable.runnable_methods.size } - end - - def show_execution_info - puts execution_info - end - - def execution_info - if parallelized? - "Running #{tests_count} tests in parallel using #{parallel_executor.size} #{parallelize_with}" - elsif many_workers? - "Running #{tests_count} tests in a single process (parallelization threshold is #{threshold})" - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/setup_and_teardown.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/setup_and_teardown.rb deleted file mode 100644 index 9c12dc2..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/setup_and_teardown.rb +++ /dev/null @@ -1,57 +0,0 @@ -# frozen_string_literal: true - -require "active_support/callbacks" - -module ActiveSupport - module Testing - # Adds support for +setup+ and +teardown+ callbacks. - # These callbacks serve as a replacement to overwriting the - # #setup and #teardown methods of your TestCase. - # - # class ExampleTest < ActiveSupport::TestCase - # setup do - # # ... - # end - # - # teardown do - # # ... - # end - # end - module SetupAndTeardown - def self.prepended(klass) - klass.include ActiveSupport::Callbacks - klass.define_callbacks :setup, :teardown - klass.extend ClassMethods - end - - module ClassMethods - # Add a callback, which runs before TestCase#setup. - def setup(*args, &block) - set_callback(:setup, :before, *args, &block) - end - - # Add a callback, which runs after TestCase#teardown. - def teardown(*args, &block) - set_callback(:teardown, :after, *args, &block) - end - end - - def before_setup # :nodoc: - super - run_callbacks :setup - end - - def after_teardown # :nodoc: - begin - run_callbacks :teardown - rescue => e - self.failures << Minitest::UnexpectedError.new(e) - rescue Minitest::Assertion => e - self.failures << e - end - - super - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/stream.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/stream.rb deleted file mode 100644 index 0b8e029..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/stream.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module Testing - module Stream # :nodoc: - private - def silence_stream(stream) - old_stream = stream.dup - stream.reopen(IO::NULL) - stream.sync = true - yield - ensure - stream.reopen(old_stream) - old_stream.close - end - - def quietly(&block) - silence_stream(STDOUT) do - silence_stream(STDERR, &block) - end - end - - def capture(stream) - stream = stream.to_s - captured_stream = Tempfile.new(stream) - stream_io = eval("$#{stream}", binding, __FILE__, __LINE__) - origin_stream = stream_io.dup - stream_io.reopen(captured_stream) - - yield - - stream_io.rewind - captured_stream.read - ensure - captured_stream.close - captured_stream.unlink - stream_io.reopen(origin_stream) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/tagged_logging.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/tagged_logging.rb deleted file mode 100644 index 7d38268..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/tagged_logging.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module Testing - # Logs a "PostsControllerTest: test name" heading before each test to - # make test.log easier to search and follow along with. - module TaggedLogging # :nodoc: - attr_writer :tagged_logger - - def before_setup - if tagged_logger && tagged_logger.info? - heading = "#{self.class}: #{name}" - divider = "-" * heading.size - tagged_logger.info divider - tagged_logger.info heading - tagged_logger.info divider - end - super - end - - private - def tagged_logger - @tagged_logger ||= (defined?(Rails.logger) && Rails.logger) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/tests_without_assertions.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/tests_without_assertions.rb deleted file mode 100644 index eaab5d0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/tests_without_assertions.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module Testing - # Warns when a test case does not perform any assertions. - # - # This is helpful in detecting broken tests that do not perform intended assertions. - module TestsWithoutAssertions # :nodoc: - def after_teardown - super - - if assertions.zero? && !skipped? && !error? - file, line = method(name).source_location - warn "Test is missing assertions: `#{name}` #{File.expand_path(file)}:#{line}" - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/time_helpers.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/time_helpers.rb deleted file mode 100644 index b80f843..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/testing/time_helpers.rb +++ /dev/null @@ -1,273 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/module/redefine_method" -require "active_support/core_ext/time/calculations" - -module ActiveSupport - module Testing - # Manages stubs for TimeHelpers - class SimpleStubs # :nodoc: - Stub = Struct.new(:object, :method_name, :original_method) - - def initialize - @stubs = Hash.new { |h, k| h[k] = {} } - end - - # Stubs object.method_name with the given block - # If the method is already stubbed, remove that stub - # so that removing this stub will restore the original implementation. - # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 - # target = Time.zone.local(2004, 11, 24, 1, 4, 44) - # simple_stubs.stub_object(Time, :now) { at(target.to_i) } - # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 - def stub_object(object, method_name, &block) - if stub = stubbing(object, method_name) - unstub_object(stub) - end - - new_name = "__simple_stub__#{method_name}__#{object_id}" - - @stubs[object.object_id][method_name] = Stub.new(object, method_name, new_name) - - object.singleton_class.alias_method new_name, method_name - object.define_singleton_method(method_name, &block) - end - - # Remove all object-method stubs held by this instance - def unstub_all! - @stubs.each_value do |object_stubs| - object_stubs.each_value do |stub| - unstub_object(stub) - end - end - @stubs.clear - end - - # Returns the Stub for object#method_name - # (nil if it is not stubbed) - def stubbing(object, method_name) - @stubs[object.object_id][method_name] - end - - # Returns true if any stubs are set, false if there are none - def stubbed? - !@stubs.empty? - end - - private - # Restores the original object.method described by the Stub - def unstub_object(stub) - singleton_class = stub.object.singleton_class - singleton_class.silence_redefinition_of_method stub.method_name - singleton_class.alias_method stub.method_name, stub.original_method - singleton_class.undef_method stub.original_method - end - end - - # Contains helpers that help you test passage of time. - module TimeHelpers - def after_teardown - travel_back - super - end - - # Changes current time to the time in the future or in the past by a given time difference by - # stubbing +Time.now+, +Date.today+, and +DateTime.now+. The stubs are automatically removed - # at the end of the test. - # - # Note that the usec for the resulting time will be set to 0 to prevent rounding - # errors with external services, like MySQL (which will round instead of floor, - # leading to off-by-one-second errors), unless the with_usec argument - # is set to true. - # - # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 - # travel 1.day - # Time.current # => Sun, 10 Nov 2013 15:34:49 EST -05:00 - # Date.current # => Sun, 10 Nov 2013 - # DateTime.current # => Sun, 10 Nov 2013 15:34:49 -0500 - # - # This method also accepts a block, which will return the current time back to its original - # state at the end of the block: - # - # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 - # travel 1.day do - # User.create.created_at # => Sun, 10 Nov 2013 15:34:49 EST -05:00 - # end - # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 - def travel(duration, with_usec: false, &block) - travel_to Time.now + duration, with_usec: with_usec, &block - end - - # Changes current time to the given time by stubbing +Time.now+, +Time.new+, - # +Date.today+, and +DateTime.now+ to return the time or date passed into this method. - # The stubs are automatically removed at the end of the test. - # - # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 - # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44) - # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 - # Date.current # => Wed, 24 Nov 2004 - # DateTime.current # => Wed, 24 Nov 2004 01:04:44 -0500 - # - # Dates are taken as their timestamp at the beginning of the day in the - # application time zone. Time.current returns said timestamp, - # and Time.now its equivalent in the system time zone. Similarly, - # Date.current returns a date equal to the argument, and - # Date.today the date according to Time.now, which may - # be different. (Note that you rarely want to deal with Time.now, - # or Date.today, in order to honor the application time zone - # please always use Time.current and Date.current.) - # - # Note that the usec for the time passed will be set to 0 to prevent rounding - # errors with external services, like MySQL (which will round instead of floor, - # leading to off-by-one-second errors), unless the with_usec argument - # is set to true. - # - # This method also accepts a block, which will return the current time back to its original - # state at the end of the block: - # - # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 - # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44) do - # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 - # end - # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 - def travel_to(date_or_time, with_usec: false) - if block_given? && in_block - travel_to_nested_block_call = <<~MSG - - Calling `travel_to` with a block, when we have previously already made a call to `travel_to`, can lead to confusing time stubbing. - - Instead of: - - travel_to 2.days.from_now do - # 2 days from today - travel_to 3.days.from_now do - # 5 days from today - end - end - - preferred way to achieve above is: - - travel 2.days do - # 2 days from today - end - - travel 5.days do - # 5 days from today - end - - MSG - raise travel_to_nested_block_call - end - - if date_or_time.is_a?(Date) && !date_or_time.is_a?(DateTime) - now = date_or_time.midnight.to_time - elsif date_or_time.is_a?(String) - now = Time.zone.parse(date_or_time) - else - now = date_or_time - now = now.to_time unless now.is_a?(Time) - end - - now = now.change(usec: 0) unless with_usec - - # +now+ must be in local system timezone, because +Time.at(now)+ - # and +now.to_date+ (see stubs below) will use +now+'s timezone too! - now = now.getlocal - - stubs = simple_stubs - stubbed_time = Time.now if stubs.stubbing(Time, :now) - stubs.stub_object(Time, :now) { at(now) } - - stubs.stub_object(Time, :new) do |*args, **options| - if args.empty? && options.empty? - at(now) - else - stub = stubs.stubbing(Time, :new) - Time.send(stub.original_method, *args, **options) - end - end - - stubs.stub_object(Date, :today) { jd(now.to_date.jd) } - stubs.stub_object(DateTime, :now) { jd(now.to_date.jd, now.hour, now.min, now.sec, Rational(now.utc_offset, 86400)) } - - if block_given? - begin - self.in_block = true - yield - ensure - if stubbed_time - travel_to stubbed_time - else - travel_back - end - self.in_block = false - end - end - end - - # Returns the current time back to its original state, by removing the stubs added by - # +travel+, +travel_to+, and +freeze_time+. - # - # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 - # - # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44) - # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 - # - # travel_back - # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 - # - # This method also accepts a block, which brings the stubs back at the end of the block: - # - # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 - # - # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44) - # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 - # - # travel_back do - # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 - # end - # - # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 - def travel_back - stubbed_time = Time.current if block_given? && simple_stubs.stubbed? - - simple_stubs.unstub_all! - yield if block_given? - ensure - travel_to stubbed_time if stubbed_time - end - alias_method :unfreeze_time, :travel_back - - # Calls +travel_to+ with +date_or_time+, which defaults to +Time.now+. - # Forwards optional with_usec argument. - # - # Time.current # => Sun, 09 Jul 2017 15:34:49 EST -05:00 - # freeze_time - # sleep(1) - # Time.current # => Sun, 09 Jul 2017 15:34:49 EST -05:00 - # freeze_time Time.current + 1.day - # sleep(1) - # Time.current # => Mon, 10 Jul 2017 15:34:49 EST -05:00 - # - # This method also accepts a block, which will return the current time back to its original - # state at the end of the block: - # - # Time.current # => Sun, 09 Jul 2017 15:34:49 EST -05:00 - # freeze_time do - # sleep(1) - # User.create.created_at # => Sun, 09 Jul 2017 15:34:49 EST -05:00 - # end - # Time.current # => Sun, 09 Jul 2017 15:34:50 EST -05:00 - def freeze_time(date_or_time = Time.now, with_usec: false, &block) - travel_to date_or_time, with_usec: with_usec, &block - end - - private - def simple_stubs - @simple_stubs ||= SimpleStubs.new - end - - attr_accessor :in_block - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/time.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/time.rb deleted file mode 100644 index 5185467..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/time.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - autoload :Duration, "active_support/duration" - autoload :TimeWithZone, "active_support/time_with_zone" - autoload :TimeZone, "active_support/values/time_zone" -end - -require "date" -require "time" - -require "active_support/core_ext/time" -require "active_support/core_ext/date" -require "active_support/core_ext/date_time" - -require "active_support/core_ext/integer/time" -require "active_support/core_ext/numeric/time" - -require "active_support/core_ext/string/conversions" -require "active_support/core_ext/string/zones" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/time_with_zone.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/time_with_zone.rb deleted file mode 100644 index 410d916..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/time_with_zone.rb +++ /dev/null @@ -1,613 +0,0 @@ -# frozen_string_literal: true - -require "yaml" - -require "active_support/duration" -require "active_support/values/time_zone" -require "active_support/core_ext/object/acts_like" -require "active_support/core_ext/date_and_time/compatibility" - -module ActiveSupport - # = Active Support \Time With Zone - # - # A Time-like class that can represent a time in any time zone. Necessary - # because standard Ruby Time instances are limited to UTC and the - # system's ENV['TZ'] zone. - # - # You shouldn't ever need to create a TimeWithZone instance directly via +new+. - # Instead use methods +local+, +parse+, +at+, and +now+ on TimeZone instances, - # and +in_time_zone+ on Time and DateTime instances. - # - # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' - # Time.zone.local(2007, 2, 10, 15, 30, 45) # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00 - # Time.zone.parse('2007-02-10 15:30:45') # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00 - # Time.zone.at(1171139445) # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00 - # Time.zone.now # => Sun, 18 May 2008 13:07:55.754107581 EDT -04:00 - # Time.utc(2007, 2, 10, 20, 30, 45).in_time_zone # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00 - # - # See Time and TimeZone for further documentation of these methods. - # - # TimeWithZone instances implement the same API as Ruby Time instances, so - # that Time and TimeWithZone instances are interchangeable. - # - # t = Time.zone.now # => Sun, 18 May 2008 13:27:25.031505668 EDT -04:00 - # t.hour # => 13 - # t.dst? # => true - # t.utc_offset # => -14400 - # t.zone # => "EDT" - # t.to_fs(:rfc822) # => "Sun, 18 May 2008 13:27:25 -0400" - # t + 1.day # => Mon, 19 May 2008 13:27:25.031505668 EDT -04:00 - # t.beginning_of_year # => Tue, 01 Jan 2008 00:00:00.000000000 EST -05:00 - # t > Time.utc(1999) # => true - # t.is_a?(Time) # => true - # t.is_a?(ActiveSupport::TimeWithZone) # => true - class TimeWithZone - PRECISIONS = Hash.new { |h, n| h[n] = "%FT%T.%#{n}N" } - PRECISIONS[0] = "%FT%T" - - include Comparable, DateAndTime::Compatibility - attr_reader :time_zone - - def initialize(utc_time, time_zone, local_time = nil, period = nil) - @time_zone, @time = time_zone, local_time - if utc_time - @utc = transfer_time_values_to_utc_constructor(utc_time) - @period = period - else - @utc = nil - @period = get_period_and_ensure_valid_local_time(period) - end - @is_utc = zone == "UTC" || zone == "UCT" - end - - # Returns a Time instance that represents the time in +time_zone+. - def time - @time ||= incorporate_utc_offset(@utc, utc_offset) - end - - # Returns a Time instance of the simultaneous time in the UTC timezone. - def utc - @utc ||= incorporate_utc_offset(@time, -utc_offset) - end - alias_method :comparable_time, :utc - alias_method :getgm, :utc - alias_method :getutc, :utc - alias_method :gmtime, :utc - - # Returns the underlying +TZInfo::TimezonePeriod+. - def period - @period ||= time_zone.period_for_utc(@utc) - end - - # Returns the simultaneous time in Time.zone, or the specified zone. - def in_time_zone(new_zone = ::Time.zone) - return self if time_zone == new_zone - utc.in_time_zone(new_zone) - end - - # Returns a Time instance of the simultaneous time in the system timezone. - def localtime(utc_offset = nil) - utc.getlocal(utc_offset) - end - alias_method :getlocal, :localtime - - # Returns true if the current time is within Daylight Savings \Time for the - # specified time zone. - # - # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' - # Time.zone.parse("2012-5-30").dst? # => true - # Time.zone.parse("2012-11-30").dst? # => false - def dst? - period.dst? - end - alias_method :isdst, :dst? - - # Returns true if the current time zone is set to UTC. - # - # Time.zone = 'UTC' # => 'UTC' - # Time.zone.now.utc? # => true - # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' - # Time.zone.now.utc? # => false - def utc? - @is_utc - end - alias_method :gmt?, :utc? - - # Returns the offset from current time to UTC time in seconds. - def utc_offset - period.observed_utc_offset - end - alias_method :gmt_offset, :utc_offset - alias_method :gmtoff, :utc_offset - - # Returns a formatted string of the offset from UTC, or an alternative - # string if the time zone is already UTC. - # - # Time.zone = 'Eastern Time (US & Canada)' # => "Eastern Time (US & Canada)" - # Time.zone.now.formatted_offset(true) # => "-05:00" - # Time.zone.now.formatted_offset(false) # => "-0500" - # Time.zone = 'UTC' # => "UTC" - # Time.zone.now.formatted_offset(true, "0") # => "0" - def formatted_offset(colon = true, alternate_utc_string = nil) - utc? && alternate_utc_string || TimeZone.seconds_to_utc_offset(utc_offset, colon) - end - - # Returns the time zone abbreviation. - # - # Time.zone = 'Eastern Time (US & Canada)' # => "Eastern Time (US & Canada)" - # Time.zone.now.zone # => "EST" - def zone - period.abbreviation - end - - # Returns a string of the object's date, time, zone, and offset from UTC. - # - # Time.zone.now.inspect # => "2024-11-13 07:00:10.528054960 UTC +00:00" - def inspect - "#{time.strftime('%F %H:%M:%S.%9N')} #{zone} #{formatted_offset}" - end - - # Returns a string of the object's date and time in the ISO 8601 standard - # format. - # - # Time.zone.now.xmlschema # => "2014-12-04T11:02:37-05:00" - def xmlschema(fraction_digits = 0) - precision = fraction_digits || 0 - - if @is_utc - utc.iso8601(precision) - else - str = time.iso8601(precision) - offset = formatted_offset(true, "Z") - - str.sub!(/(Z|[+-]\d{2}:\d{2})\z/, offset) - str - end - end - alias_method :iso8601, :xmlschema - alias_method :rfc3339, :xmlschema - - # Coerces time to a string for JSON encoding. The default format is ISO 8601. - # You can get %Y/%m/%d %H:%M:%S +offset style by setting - # ActiveSupport::JSON::Encoding.use_standard_json_time_format - # to +false+. - # - # # With ActiveSupport::JSON::Encoding.use_standard_json_time_format = true - # Time.utc(2005,2,1,15,15,10).in_time_zone("Hawaii").as_json - # # => "2005-02-01T05:15:10.000-10:00" - # - # # With ActiveSupport::JSON::Encoding.use_standard_json_time_format = false - # Time.utc(2005,2,1,15,15,10).in_time_zone("Hawaii").as_json - # # => "2005/02/01 05:15:10 -1000" - def as_json(options = nil) - if ActiveSupport::JSON::Encoding.use_standard_json_time_format - xmlschema(ActiveSupport::JSON::Encoding.time_precision).force_encoding(Encoding::UTF_8) - else - %(#{time.strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)}) - end - end - - def init_with(coder) # :nodoc: - initialize(coder["utc"], coder["zone"], coder["time"]) - end - - def encode_with(coder) # :nodoc: - coder.map = { "utc" => utc, "zone" => time_zone, "time" => time } - end - - # Returns a string of the object's date and time in the format used by - # HTTP requests. - # - # Time.zone.now.httpdate # => "Tue, 01 Jan 2013 04:39:43 GMT" - def httpdate - utc.httpdate - end - - # Returns a string of the object's date and time in the RFC 2822 standard - # format. - # - # Time.zone.now.rfc2822 # => "Tue, 01 Jan 2013 04:51:39 +0000" - def rfc2822 - to_fs(:rfc822) - end - alias_method :rfc822, :rfc2822 - - # Returns a string of the object's date and time. - def to_s - "#{time.strftime("%Y-%m-%d %H:%M:%S")} #{formatted_offset(false, 'UTC')}" # mimicking Ruby Time#to_s format - end - - # Returns a string of the object's date and time. - # - # This method is aliased to to_formatted_s. - # - # Accepts an optional format: - # * :default - default value, mimics Ruby Time#to_s format. - # * :db - format outputs time in UTC :db time. See Time#to_fs(:db). - # * Any key in +Time::DATE_FORMATS+ can be used. See active_support/core_ext/time/conversions.rb. - def to_fs(format = :default) - if format == :db - utc.to_fs(format) - elsif formatter = ::Time::DATE_FORMATS[format] - formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter) - else - to_s - end - end - alias_method :to_formatted_s, :to_fs - - # Replaces %Z directive with +zone before passing to Time#strftime, - # so that zone information is correct. - def strftime(format) - format = format.gsub(/((?:\A|[^%])(?:%%)*)%Z/, "\\1#{zone}") - getlocal(utc_offset).strftime(format) - end - - # Use the time in UTC for comparisons. - def <=>(other) - utc <=> other - end - alias_method :before?, :< - alias_method :after?, :> - - # Returns true if the current object's time is within the specified - # +min+ and +max+ time. - def between?(min, max) - utc.between?(min, max) - end - - # Returns true if the current object's time is in the past. - def past? - utc.past? - end - - # Returns true if the current object's time falls within - # the current day. - def today? - time.today? - end - - # Returns true if the current object's time falls within - # the next day (tomorrow). - def tomorrow? - time.tomorrow? - end - alias :next_day? :tomorrow? - - # Returns true if the current object's time falls within - # the previous day (yesterday). - def yesterday? - time.yesterday? - end - alias :prev_day? :yesterday? - - # Returns true if the current object's time is in the future. - def future? - utc.future? - end - - # Returns +true+ if +other+ is equal to current object. - def eql?(other) - other.eql?(utc) - end - - def hash - utc.hash - end - - # Adds an interval of time to the current object's time and returns that - # value as a new TimeWithZone object. - # - # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' - # now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00 - # now + 1000 # => Sun, 02 Nov 2014 01:43:08.725182881 EDT -04:00 - # - # If we're adding a Duration of variable length (i.e., years, months, days), - # move forward from #time, otherwise move forward from #utc, for accuracy - # when moving across DST boundaries. - # - # For instance, a time + 24.hours will advance exactly 24 hours, while a - # time + 1.day will advance 23-25 hours, depending on the day. - # - # now + 24.hours # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00 - # now + 1.day # => Mon, 03 Nov 2014 01:26:28.725182881 EST -05:00 - def +(other) - if duration_of_variable_length?(other) - method_missing(:+, other) - else - result = utc + other - - result.in_time_zone(time_zone) - end - end - alias_method :since, :+ - alias_method :in, :+ - - # Subtracts an interval of time and returns a new TimeWithZone object unless - # the other value +acts_like?+ time. In which case, it will subtract the - # other time and return the difference in seconds as a Float. - # - # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' - # now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00 - # now - 1000 # => Mon, 03 Nov 2014 00:09:48.725182881 EST -05:00 - # - # If subtracting a Duration of variable length (i.e., years, months, days), - # move backward from #time, otherwise move backward from #utc, for accuracy - # when moving across DST boundaries. - # - # For instance, a time - 24.hours will go subtract exactly 24 hours, while a - # time - 1.day will subtract 23-25 hours, depending on the day. - # - # now - 24.hours # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00 - # now - 1.day # => Sun, 02 Nov 2014 00:26:28.725182881 EDT -04:00 - # - # If both the TimeWithZone object and the other value act like Time, a Float - # will be returned. - # - # Time.zone.now - 1.day.ago # => 86399.999967 - # - def -(other) - if other.acts_like?(:time) - getutc - other.getutc - elsif duration_of_variable_length?(other) - method_missing(:-, other) - else - result = utc - other - result.in_time_zone(time_zone) - end - end - - # Subtracts an interval of time from the current object's time and returns - # the result as a new TimeWithZone object. - # - # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' - # now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00 - # now.ago(1000) # => Mon, 03 Nov 2014 00:09:48.725182881 EST -05:00 - # - # If we're subtracting a Duration of variable length (i.e., years, months, - # days), move backward from #time, otherwise move backward from #utc, for - # accuracy when moving across DST boundaries. - # - # For instance, time.ago(24.hours) will move back exactly 24 hours, - # while time.ago(1.day) will move back 23-25 hours, depending on - # the day. - # - # now.ago(24.hours) # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00 - # now.ago(1.day) # => Sun, 02 Nov 2014 00:26:28.725182881 EDT -04:00 - def ago(other) - since(-other) - end - - # Returns a new +ActiveSupport::TimeWithZone+ where one or more of the elements have - # been changed according to the +options+ parameter. The time options (:hour, - # :min, :sec, :usec, :nsec) reset cascadingly, - # so if only the hour is passed, then minute, sec, usec, and nsec is set to 0. If the - # hour and minute is passed, then sec, usec, and nsec is set to 0. The +options+ - # parameter takes a hash with any of these keys: :year, :month, - # :day, :hour, :min, :sec, :usec, - # :nsec, :offset, :zone. Pass either :usec - # or :nsec, not both. Similarly, pass either :zone or - # :offset, not both. - # - # t = Time.zone.now # => Fri, 14 Apr 2017 11:45:15.116992711 EST -05:00 - # t.change(year: 2020) # => Tue, 14 Apr 2020 11:45:15.116992711 EST -05:00 - # t.change(hour: 12) # => Fri, 14 Apr 2017 12:00:00.000000000 EST -05:00 - # t.change(min: 30) # => Fri, 14 Apr 2017 11:30:00.000000000 EST -05:00 - # t.change(offset: "-10:00") # => Fri, 14 Apr 2017 11:45:15.116992711 HST -10:00 - # t.change(zone: "Hawaii") # => Fri, 14 Apr 2017 11:45:15.116992711 HST -10:00 - def change(options) - if options[:zone] && options[:offset] - raise ArgumentError, "Can't change both :offset and :zone at the same time: #{options.inspect}" - end - - new_time = time.change(options) - - if options[:zone] - new_zone = ::Time.find_zone(options[:zone]) - elsif options[:offset] - new_zone = ::Time.find_zone(new_time.utc_offset) - end - - new_zone ||= time_zone - periods = new_zone.periods_for_local(new_time) - - self.class.new(nil, new_zone, new_time, periods.include?(period) ? period : nil) - end - - # Uses Date to provide precise Time calculations for years, months, and days - # according to the proleptic Gregorian calendar. The result is returned as a - # new TimeWithZone object. - # - # The +options+ parameter takes a hash with any of these keys: - # :years, :months, :weeks, :days, - # :hours, :minutes, :seconds. - # - # If advancing by a value of variable length (i.e., years, weeks, months, - # days), move forward from #time, otherwise move forward from #utc, for - # accuracy when moving across DST boundaries. - # - # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' - # now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.558049687 EDT -04:00 - # now.advance(seconds: 1) # => Sun, 02 Nov 2014 01:26:29.558049687 EDT -04:00 - # now.advance(minutes: 1) # => Sun, 02 Nov 2014 01:27:28.558049687 EDT -04:00 - # now.advance(hours: 1) # => Sun, 02 Nov 2014 01:26:28.558049687 EST -05:00 - # now.advance(days: 1) # => Mon, 03 Nov 2014 01:26:28.558049687 EST -05:00 - # now.advance(weeks: 1) # => Sun, 09 Nov 2014 01:26:28.558049687 EST -05:00 - # now.advance(months: 1) # => Tue, 02 Dec 2014 01:26:28.558049687 EST -05:00 - # now.advance(years: 1) # => Mon, 02 Nov 2015 01:26:28.558049687 EST -05:00 - def advance(options) - # If we're advancing a value of variable length (i.e., years, weeks, months, days), advance from #time, - # otherwise advance from #utc, for accuracy when moving across DST boundaries - if options.values_at(:years, :weeks, :months, :days).any? - method_missing(:advance, options) - else - utc.advance(options).in_time_zone(time_zone) - end - end - - %w(year mon month day mday wday yday hour min sec usec nsec to_date).each do |method_name| - class_eval <<-EOV, __FILE__, __LINE__ + 1 - def #{method_name} # def month - time.#{method_name} # time.month - end # end - EOV - end - - # Returns Array of parts of Time in sequence of - # [seconds, minutes, hours, day, month, year, weekday, yearday, dst?, zone]. - # - # now = Time.zone.now # => Tue, 18 Aug 2015 02:29:27.485278555 UTC +00:00 - # now.to_a # => [27, 29, 2, 18, 8, 2015, 2, 230, false, "UTC"] - def to_a - [time.sec, time.min, time.hour, time.day, time.mon, time.year, time.wday, time.yday, dst?, zone] - end - - # Returns the object's date and time as a floating-point number of seconds - # since the Epoch (January 1, 1970 00:00 UTC). - # - # Time.zone.now.to_f # => 1417709320.285418 - def to_f - utc.to_f - end - - # Returns the object's date and time as an integer number of seconds - # since the Epoch (January 1, 1970 00:00 UTC). - # - # Time.zone.now.to_i # => 1417709320 - def to_i - utc.to_i - end - alias_method :tv_sec, :to_i - - # Returns the object's date and time as a rational number of seconds - # since the Epoch (January 1, 1970 00:00 UTC). - # - # Time.zone.now.to_r # => (708854548642709/500000) - def to_r - utc.to_r - end - - # Returns an instance of DateTime with the timezone's UTC offset - # - # Time.zone.now.to_datetime # => Tue, 18 Aug 2015 02:32:20 +0000 - # Time.current.in_time_zone('Hawaii').to_datetime # => Mon, 17 Aug 2015 16:32:20 -1000 - def to_datetime - @to_datetime ||= utc.to_datetime.new_offset(Rational(utc_offset, 86_400)) - end - - # Returns an instance of +Time+, either with the same timezone as +self+, - # with the same UTC offset as +self+ or in the local system timezone - # depending on the setting of +ActiveSupport.to_time_preserves_timezone+. - def to_time - @to_time_with_timezone ||= getlocal(time_zone) - end - - # So that +self+ acts_like?(:time). - def acts_like_time? - true - end - - # Say we're a Time to thwart type checking. - def is_a?(klass) - klass == ::Time || super - end - alias_method :kind_of?, :is_a? - - # An instance of ActiveSupport::TimeWithZone is never blank - def blank? - false - end - - def present? # :nodoc: - true - end - - def freeze - # preload instance variables before freezing - period; utc; time; to_datetime; to_time - super - end - - def marshal_dump - [utc, time_zone.name, time] - end - - def marshal_load(variables) - initialize(variables[0].utc, ::Time.find_zone(variables[1]), variables[2].utc) - end - - # respond_to_missing? is not called in some cases, such as when type conversion is - # performed with Kernel#String - def respond_to?(sym, include_priv = false) - # ensure that we're not going to throw and rescue from NoMethodError in method_missing which is slow - return false if sym.to_sym == :to_str - super - end - - # Ensure proxy class responds to all methods that underlying time instance - # responds to. - def respond_to_missing?(sym, include_priv) - time.respond_to?(sym, include_priv) - end - - # Send the missing method to +time+ instance, and wrap result in a new - # TimeWithZone with the existing +time_zone+. - def method_missing(...) - wrap_with_time_zone time.__send__(...) - rescue NoMethodError => e - raise e, e.message.sub(time.inspect, inspect).sub("Time", "ActiveSupport::TimeWithZone"), e.backtrace - end - - private - SECONDS_PER_DAY = 86400 - - def incorporate_utc_offset(time, offset) - if offset.zero? - time - elsif time.kind_of?(Date) - time + Rational(offset, SECONDS_PER_DAY) - else - time + offset - end - end - - def get_period_and_ensure_valid_local_time(period) - # we don't want a Time.local instance enforcing its own DST rules as well, - # so transfer time values to a utc constructor if necessary - @time = transfer_time_values_to_utc_constructor(@time) unless @time.utc? - begin - period || @time_zone.period_for_local(@time) - rescue ::TZInfo::PeriodNotFound - # time is in the "spring forward" hour gap, so we're moving the time forward one hour and trying again - @time += 1.hour - retry - end - end - - def transfer_time_values_to_utc_constructor(time) - # avoid creating another Time object if possible - return time if time.instance_of?(::Time) && time.utc? - ::Time.utc(time.year, time.month, time.day, time.hour, time.min, time.sec + time.subsec) - end - - def duration_of_variable_length?(obj) - ActiveSupport::Duration === obj && obj.variable? - end - - def wrap_with_time_zone(time) - if time.acts_like?(:time) - periods = time_zone.periods_for_local(time) - self.class.new(nil, time_zone, time, periods.include?(period) ? period : nil) - elsif time.is_a?(Range) - wrap_with_time_zone(time.begin)..wrap_with_time_zone(time.end) - else - time - end - end - end -end - -# These prevent Psych from calling `ActiveSupport::TimeWithZone.name` -# and triggering the deprecation warning about the change in Rails 7.1. -YAML.load_tags["!ruby/object:ActiveSupport::TimeWithZone"] = "ActiveSupport::TimeWithZone" -YAML.dump_tags[ActiveSupport::TimeWithZone] = "!ruby/object:ActiveSupport::TimeWithZone" diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/values/time_zone.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/values/time_zone.rb deleted file mode 100644 index d703719..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/values/time_zone.rb +++ /dev/null @@ -1,621 +0,0 @@ -# frozen_string_literal: true - -require "tzinfo" -require "concurrent/map" - -module ActiveSupport - # = Active Support \Time Zone - # - # The TimeZone class serves as a wrapper around +TZInfo::Timezone+ instances. - # It allows us to do the following: - # - # * Limit the set of zones provided by TZInfo to a meaningful subset of 134 - # zones. - # * Retrieve and display zones with a friendlier name - # (e.g., "Eastern \Time (US & Canada)" instead of "America/New_York"). - # * Lazily load +TZInfo::Timezone+ instances only when they're needed. - # * Create ActiveSupport::TimeWithZone instances via TimeZone's +local+, - # +parse+, +at+, and +now+ methods. - # - # If you set config.time_zone in the \Rails Application, you can - # access this TimeZone object via Time.zone: - # - # # application.rb: - # class Application < Rails::Application - # config.time_zone = 'Eastern Time (US & Canada)' - # end - # - # Time.zone # => # - # Time.zone.name # => "Eastern Time (US & Canada)" - # Time.zone.now # => Sun, 18 May 2008 14:30:44 EDT -04:00 - class TimeZone - # Keys are \Rails TimeZone names, values are TZInfo identifiers. - MAPPING = { - "International Date Line West" => "Etc/GMT+12", - "Midway Island" => "Pacific/Midway", - "American Samoa" => "Pacific/Pago_Pago", - "Hawaii" => "Pacific/Honolulu", - "Alaska" => "America/Juneau", - "Pacific Time (US & Canada)" => "America/Los_Angeles", - "Tijuana" => "America/Tijuana", - "Mountain Time (US & Canada)" => "America/Denver", - "Arizona" => "America/Phoenix", - "Chihuahua" => "America/Chihuahua", - "Mazatlan" => "America/Mazatlan", - "Central Time (US & Canada)" => "America/Chicago", - "Saskatchewan" => "America/Regina", - "Guadalajara" => "America/Mexico_City", - "Mexico City" => "America/Mexico_City", - "Monterrey" => "America/Monterrey", - "Central America" => "America/Guatemala", - "Eastern Time (US & Canada)" => "America/New_York", - "Indiana (East)" => "America/Indiana/Indianapolis", - "Bogota" => "America/Bogota", - "Lima" => "America/Lima", - "Quito" => "America/Lima", - "Atlantic Time (Canada)" => "America/Halifax", - "Caracas" => "America/Caracas", - "La Paz" => "America/La_Paz", - "Santiago" => "America/Santiago", - "Asuncion" => "America/Asuncion", - "Newfoundland" => "America/St_Johns", - "Brasilia" => "America/Sao_Paulo", - "Buenos Aires" => "America/Argentina/Buenos_Aires", - "Montevideo" => "America/Montevideo", - "Georgetown" => "America/Guyana", - "Puerto Rico" => "America/Puerto_Rico", - "Greenland" => "America/Nuuk", - "Mid-Atlantic" => "Atlantic/South_Georgia", - "Azores" => "Atlantic/Azores", - "Cape Verde Is." => "Atlantic/Cape_Verde", - "Dublin" => "Europe/Dublin", - "Edinburgh" => "Europe/London", - "Lisbon" => "Europe/Lisbon", - "London" => "Europe/London", - "Casablanca" => "Africa/Casablanca", - "Monrovia" => "Africa/Monrovia", - "UTC" => "Etc/UTC", - "Belgrade" => "Europe/Belgrade", - "Bratislava" => "Europe/Bratislava", - "Budapest" => "Europe/Budapest", - "Ljubljana" => "Europe/Ljubljana", - "Prague" => "Europe/Prague", - "Sarajevo" => "Europe/Sarajevo", - "Skopje" => "Europe/Skopje", - "Warsaw" => "Europe/Warsaw", - "Zagreb" => "Europe/Zagreb", - "Brussels" => "Europe/Brussels", - "Copenhagen" => "Europe/Copenhagen", - "Madrid" => "Europe/Madrid", - "Paris" => "Europe/Paris", - "Amsterdam" => "Europe/Amsterdam", - "Berlin" => "Europe/Berlin", - "Bern" => "Europe/Zurich", - "Zurich" => "Europe/Zurich", - "Rome" => "Europe/Rome", - "Stockholm" => "Europe/Stockholm", - "Vienna" => "Europe/Vienna", - "West Central Africa" => "Africa/Algiers", - "Bucharest" => "Europe/Bucharest", - "Cairo" => "Africa/Cairo", - "Helsinki" => "Europe/Helsinki", - "Kyiv" => "Europe/Kyiv", - "Riga" => "Europe/Riga", - "Sofia" => "Europe/Sofia", - "Tallinn" => "Europe/Tallinn", - "Vilnius" => "Europe/Vilnius", - "Athens" => "Europe/Athens", - "Istanbul" => "Europe/Istanbul", - "Minsk" => "Europe/Minsk", - "Jerusalem" => "Asia/Jerusalem", - "Harare" => "Africa/Harare", - "Pretoria" => "Africa/Johannesburg", - "Kaliningrad" => "Europe/Kaliningrad", - "Moscow" => "Europe/Moscow", - "St. Petersburg" => "Europe/Moscow", - "Volgograd" => "Europe/Volgograd", - "Samara" => "Europe/Samara", - "Kuwait" => "Asia/Kuwait", - "Riyadh" => "Asia/Riyadh", - "Nairobi" => "Africa/Nairobi", - "Baghdad" => "Asia/Baghdad", - "Tehran" => "Asia/Tehran", - "Abu Dhabi" => "Asia/Muscat", - "Muscat" => "Asia/Muscat", - "Baku" => "Asia/Baku", - "Tbilisi" => "Asia/Tbilisi", - "Yerevan" => "Asia/Yerevan", - "Kabul" => "Asia/Kabul", - "Ekaterinburg" => "Asia/Yekaterinburg", - "Islamabad" => "Asia/Karachi", - "Karachi" => "Asia/Karachi", - "Tashkent" => "Asia/Tashkent", - "Chennai" => "Asia/Kolkata", - "Kolkata" => "Asia/Kolkata", - "Mumbai" => "Asia/Kolkata", - "New Delhi" => "Asia/Kolkata", - "Kathmandu" => "Asia/Kathmandu", - "Dhaka" => "Asia/Dhaka", - "Sri Jayawardenepura" => "Asia/Colombo", - "Almaty" => "Asia/Almaty", - "Astana" => "Asia/Almaty", - "Novosibirsk" => "Asia/Novosibirsk", - "Rangoon" => "Asia/Yangon", - "Bangkok" => "Asia/Bangkok", - "Hanoi" => "Asia/Bangkok", - "Jakarta" => "Asia/Jakarta", - "Krasnoyarsk" => "Asia/Krasnoyarsk", - "Beijing" => "Asia/Shanghai", - "Chongqing" => "Asia/Chongqing", - "Hong Kong" => "Asia/Hong_Kong", - "Urumqi" => "Asia/Urumqi", - "Kuala Lumpur" => "Asia/Kuala_Lumpur", - "Singapore" => "Asia/Singapore", - "Taipei" => "Asia/Taipei", - "Perth" => "Australia/Perth", - "Irkutsk" => "Asia/Irkutsk", - "Ulaanbaatar" => "Asia/Ulaanbaatar", - "Seoul" => "Asia/Seoul", - "Osaka" => "Asia/Tokyo", - "Sapporo" => "Asia/Tokyo", - "Tokyo" => "Asia/Tokyo", - "Yakutsk" => "Asia/Yakutsk", - "Darwin" => "Australia/Darwin", - "Adelaide" => "Australia/Adelaide", - "Canberra" => "Australia/Canberra", - "Melbourne" => "Australia/Melbourne", - "Sydney" => "Australia/Sydney", - "Brisbane" => "Australia/Brisbane", - "Hobart" => "Australia/Hobart", - "Vladivostok" => "Asia/Vladivostok", - "Guam" => "Pacific/Guam", - "Port Moresby" => "Pacific/Port_Moresby", - "Magadan" => "Asia/Magadan", - "Srednekolymsk" => "Asia/Srednekolymsk", - "Solomon Is." => "Pacific/Guadalcanal", - "New Caledonia" => "Pacific/Noumea", - "Fiji" => "Pacific/Fiji", - "Kamchatka" => "Asia/Kamchatka", - "Marshall Is." => "Pacific/Majuro", - "Auckland" => "Pacific/Auckland", - "Wellington" => "Pacific/Auckland", - "Nuku'alofa" => "Pacific/Tongatapu", - "Tokelau Is." => "Pacific/Fakaofo", - "Chatham Is." => "Pacific/Chatham", - "Samoa" => "Pacific/Apia" - } - - UTC_OFFSET_WITH_COLON = "%s%02d:%02d" # :nodoc: - UTC_OFFSET_WITHOUT_COLON = UTC_OFFSET_WITH_COLON.tr(":", "") # :nodoc: - private_constant :UTC_OFFSET_WITH_COLON, :UTC_OFFSET_WITHOUT_COLON - - @lazy_zones_map = Concurrent::Map.new - @country_zones = Concurrent::Map.new - - class << self - # Assumes self represents an offset from UTC in seconds (as returned from - # Time#utc_offset) and turns this into an +HH:MM formatted string. - # - # ActiveSupport::TimeZone.seconds_to_utc_offset(-21_600) # => "-06:00" - def seconds_to_utc_offset(seconds, colon = true) - format = colon ? UTC_OFFSET_WITH_COLON : UTC_OFFSET_WITHOUT_COLON - sign = (seconds < 0 ? "-" : "+") - hours = seconds.abs / 3600 - minutes = (seconds.abs % 3600) / 60 - format % [sign, hours, minutes] - end - - def find_tzinfo(name) - TZInfo::Timezone.get(MAPPING[name] || name) - end - - alias_method :create, :new # :nodoc: - - # Returns a TimeZone instance with the given name, or +nil+ if no - # such TimeZone instance exists. (This exists to support the use of - # this class with the +composed_of+ macro.) - def new(name) - self[name] - end - - # Returns an array of all TimeZone objects. There are multiple - # TimeZone objects per time zone, in many cases, to make it easier - # for users to find their own time zone. - def all - @zones ||= zones_map.values.sort - end - - # Locate a specific time zone object. If the argument is a string, it - # is interpreted to mean the name of the timezone to locate. If it is a - # numeric value it is either the hour offset, or the second offset, of the - # timezone to find. (The first one with that offset will be returned.) - # Returns +nil+ if no such time zone is known to the system. - def [](arg) - case arg - when self - arg - when String - begin - @lazy_zones_map[arg] ||= create(arg) - rescue TZInfo::InvalidTimezoneIdentifier - nil - end - when TZInfo::Timezone - @lazy_zones_map[arg.name] ||= create(arg.name, nil, arg) - when Numeric, ActiveSupport::Duration - arg *= 3600 if arg.abs <= 13 - all.find { |z| z.utc_offset == arg.to_i } - else - raise ArgumentError, "invalid argument to TimeZone[]: #{arg.inspect}" - end - end - - # A convenience method for returning a collection of TimeZone objects - # for time zones in the USA. - def us_zones - country_zones(:us) - end - - # A convenience method for returning a collection of TimeZone objects - # for time zones in the country specified by its ISO 3166-1 Alpha2 code. - def country_zones(country_code) - code = country_code.to_s.upcase - @country_zones[code] ||= load_country_zones(code) - end - - def clear # :nodoc: - @lazy_zones_map = Concurrent::Map.new - @country_zones = Concurrent::Map.new - @zones = nil - @zones_map = nil - end - - private - def load_country_zones(code) - country = TZInfo::Country.get(code) - country.zone_identifiers.flat_map do |tz_id| - if MAPPING.value?(tz_id) - MAPPING.inject([]) do |memo, (key, value)| - memo << self[key] if value == tz_id - memo - end - else - create(tz_id, nil, TZInfo::Timezone.get(tz_id)) - end - end.sort! - end - - def zones_map - @zones_map ||= MAPPING.each_with_object({}) do |(name, _), zones| - timezone = self[name] - zones[name] = timezone if timezone - end - end - end - - include Comparable - attr_reader :name - attr_reader :tzinfo - - ## - # :singleton-method: create - # :call-seq: create(name, utc_offset = nil, tzinfo = nil) - # - # Create a new TimeZone object with the given name and offset. The - # offset is the number of seconds that this time zone is offset from UTC - # (GMT). Seconds were chosen as the offset unit because that is the unit - # that Ruby uses to represent time zone offsets (see Time#utc_offset). - - # :stopdoc: - def initialize(name, utc_offset = nil, tzinfo = nil) - @name = name - @utc_offset = utc_offset - @tzinfo = tzinfo || TimeZone.find_tzinfo(name) - end - # :startdoc: - - # Returns a standard time zone name defined by IANA - # https://www.iana.org/time-zones - def standard_name - MAPPING[name] || name - end - - # Returns the offset of this time zone from UTC in seconds. - def utc_offset - @utc_offset || tzinfo&.current_period&.base_utc_offset - end - - # Returns a formatted string of the offset from UTC, or an alternative - # string if the time zone is already UTC. - # - # zone = ActiveSupport::TimeZone['Central Time (US & Canada)'] - # zone.formatted_offset # => "-06:00" - # zone.formatted_offset(false) # => "-0600" - def formatted_offset(colon = true, alternate_utc_string = nil) - utc_offset == 0 && alternate_utc_string || self.class.seconds_to_utc_offset(utc_offset, colon) - end - - # Compare this time zone to the parameter. The two are compared first on - # their offsets, and then by name. - def <=>(zone) - return unless zone.respond_to? :utc_offset - result = (utc_offset <=> zone.utc_offset) - result = (name <=> zone.name) if result == 0 - result - end - - # Compare #name and TZInfo identifier to a supplied regexp, returning +true+ - # if a match is found. - def =~(re) - re === name || re === MAPPING[name] - end - - # Compare #name and TZInfo identifier to a supplied regexp, returning +true+ - # if a match is found. - def match?(re) - (re == name) || (re == MAPPING[name]) || - ((Regexp === re) && (re.match?(name) || re.match?(MAPPING[name]))) - end - - # Returns a textual representation of this time zone. - def to_s - "(GMT#{formatted_offset}) #{name}" - end - - # \Method for creating new ActiveSupport::TimeWithZone instance in time zone - # of +self+ from given values. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.zone.local(2007, 2, 1, 15, 30, 45) # => Thu, 01 Feb 2007 15:30:45 HST -10:00 - def local(*args) - time = Time.utc(*args) - ActiveSupport::TimeWithZone.new(nil, self, time) - end - - # \Method for creating new ActiveSupport::TimeWithZone instance in time zone - # of +self+ from number of seconds since the Unix epoch. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.utc(2000).to_f # => 946684800.0 - # Time.zone.at(946684800.0) # => Fri, 31 Dec 1999 14:00:00 HST -10:00 - # - # A second argument can be supplied to specify sub-second precision. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.at(946684800, 123456.789).nsec # => 123456789 - def at(*args) - Time.at(*args).utc.in_time_zone(self) - end - - # \Method for creating new ActiveSupport::TimeWithZone instance in time zone - # of +self+ from an ISO 8601 string. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.zone.iso8601('1999-12-31T14:00:00') # => Fri, 31 Dec 1999 14:00:00 HST -10:00 - # - # If the time components are missing then they will be set to zero. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.zone.iso8601('1999-12-31') # => Fri, 31 Dec 1999 00:00:00 HST -10:00 - # - # If the string is invalid then an +ArgumentError+ will be raised unlike +parse+ - # which usually returns +nil+ when given an invalid date string. - def iso8601(str) - # Historically `Date._iso8601(nil)` returns `{}`, but in the `date` gem versions `3.2.1`, `3.1.2`, `3.0.2`, - # and `2.0.1`, `Date._iso8601(nil)` raises `TypeError` https://github.com/ruby/date/issues/39 - # Future `date` releases are expected to revert back to the original behavior. - raise ArgumentError, "invalid date" if str.nil? - - parts = Date._iso8601(str) - - year = parts.fetch(:year) - - if parts.key?(:yday) - ordinal_date = Date.ordinal(year, parts.fetch(:yday)) - month = ordinal_date.month - day = ordinal_date.day - else - month = parts.fetch(:mon) - day = parts.fetch(:mday) - end - - time = Time.new( - year, - month, - day, - parts.fetch(:hour, 0), - parts.fetch(:min, 0), - parts.fetch(:sec, 0) + parts.fetch(:sec_fraction, 0), - parts.fetch(:offset, 0) - ) - - if parts[:offset] - TimeWithZone.new(time.utc, self) - else - TimeWithZone.new(nil, self, time) - end - - rescue Date::Error, KeyError - raise ArgumentError, "invalid date" - end - - # \Method for creating new ActiveSupport::TimeWithZone instance in time zone - # of +self+ from parsed string. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.zone.parse('1999-12-31 14:00:00') # => Fri, 31 Dec 1999 14:00:00 HST -10:00 - # - # If upper components are missing from the string, they are supplied from - # TimeZone#now: - # - # Time.zone.now # => Fri, 31 Dec 1999 14:00:00 HST -10:00 - # Time.zone.parse('22:30:00') # => Fri, 31 Dec 1999 22:30:00 HST -10:00 - # - # However, if the date component is not provided, but any other upper - # components are supplied, then the day of the month defaults to 1: - # - # Time.zone.parse('Mar 2000') # => Wed, 01 Mar 2000 00:00:00 HST -10:00 - # - # If the string is invalid then an +ArgumentError+ could be raised. - def parse(str, now = now()) - parts_to_time(Date._parse(str, false), now) - end - - # \Method for creating new ActiveSupport::TimeWithZone instance in time zone - # of +self+ from an RFC 3339 string. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.zone.rfc3339('2000-01-01T00:00:00Z') # => Fri, 31 Dec 1999 14:00:00 HST -10:00 - # - # If the time or zone components are missing then an +ArgumentError+ will - # be raised. This is much stricter than either +parse+ or +iso8601+ which - # allow for missing components. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.zone.rfc3339('1999-12-31') # => ArgumentError: invalid date - def rfc3339(str) - parts = Date._rfc3339(str) - - raise ArgumentError, "invalid date" if parts.empty? - - time = Time.new( - parts.fetch(:year), - parts.fetch(:mon), - parts.fetch(:mday), - parts.fetch(:hour), - parts.fetch(:min), - parts.fetch(:sec) + parts.fetch(:sec_fraction, 0), - parts.fetch(:offset) - ) - - TimeWithZone.new(time.utc, self) - end - - # Parses +str+ according to +format+ and returns an ActiveSupport::TimeWithZone. - # - # Assumes that +str+ is a time in the time zone +self+, - # unless +format+ includes an explicit time zone. - # (This is the same behavior as +parse+.) - # In either case, the returned TimeWithZone has the timezone of +self+. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.zone.strptime('1999-12-31 14:00:00', '%Y-%m-%d %H:%M:%S') # => Fri, 31 Dec 1999 14:00:00 HST -10:00 - # - # If upper components are missing from the string, they are supplied from - # TimeZone#now: - # - # Time.zone.now # => Fri, 31 Dec 1999 14:00:00 HST -10:00 - # Time.zone.strptime('22:30:00', '%H:%M:%S') # => Fri, 31 Dec 1999 22:30:00 HST -10:00 - # - # However, if the date component is not provided, but any other upper - # components are supplied, then the day of the month defaults to 1: - # - # Time.zone.strptime('Mar 2000', '%b %Y') # => Wed, 01 Mar 2000 00:00:00 HST -10:00 - def strptime(str, format, now = now()) - parts_to_time(DateTime._strptime(str, format), now) - end - - # Returns an ActiveSupport::TimeWithZone instance representing the current - # time in the time zone represented by +self+. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.zone.now # => Wed, 23 Jan 2008 20:24:27 HST -10:00 - def now - time_now.utc.in_time_zone(self) - end - - # Returns the current date in this time zone. - def today - tzinfo.now.to_date - end - - # Returns the next date in this time zone. - def tomorrow - today + 1 - end - - # Returns the previous date in this time zone. - def yesterday - today - 1 - end - - # Adjust the given time to the simultaneous time in the time zone - # represented by +self+. Returns a local time with the appropriate offset - # -- if you want an ActiveSupport::TimeWithZone instance, use - # Time#in_time_zone() instead. - # - # As of tzinfo 2, utc_to_local returns a Time with a non-zero utc_offset. - # See the +utc_to_local_returns_utc_offset_times+ config for more info. - def utc_to_local(time) - tzinfo.utc_to_local(time).yield_self do |t| - ActiveSupport.utc_to_local_returns_utc_offset_times ? - t : Time.utc(t.year, t.month, t.day, t.hour, t.min, t.sec, t.sec_fraction * 1_000_000) - end - end - - # Adjust the given time to the simultaneous time in UTC. Returns a - # Time.utc() instance. - def local_to_utc(time, dst = true) - tzinfo.local_to_utc(time, dst) - end - - def period_for_utc(time) # :nodoc: - tzinfo.period_for_utc(time) - end - - def period_for_local(time, dst = true) # :nodoc: - tzinfo.period_for_local(time, dst) { |periods| periods.last } - end - - def periods_for_local(time) # :nodoc: - tzinfo.periods_for_local(time) - end - - def abbr(time) # :nodoc: - tzinfo.abbr(time) - end - - def dst?(time) # :nodoc: - tzinfo.dst?(time) - end - - def init_with(coder) # :nodoc: - initialize(coder["name"]) - end - - def encode_with(coder) # :nodoc: - coder.tag = "!ruby/object:#{self.class}" - coder.map = { "name" => tzinfo.name } - end - - private - def parts_to_time(parts, now) - raise ArgumentError, "invalid date" if parts.nil? - return if parts.empty? - - if parts[:seconds] - time = Time.at(parts[:seconds] + parts.fetch(:sec_fraction, 0)) - else - time = Time.new( - parts.fetch(:year, now.year), - parts.fetch(:mon, now.month), - parts.fetch(:mday, parts[:year] || parts[:mon] ? 1 : now.day), - parts.fetch(:hour, 0), - parts.fetch(:min, 0), - parts.fetch(:sec, 0) + parts.fetch(:sec_fraction, 0), - parts.fetch(:offset, 0) - ) - end - - if parts[:offset] || parts[:seconds] - TimeWithZone.new(time.utc, self) - else - TimeWithZone.new(nil, self, time) - end - end - - def time_now - Time.now - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/version.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/version.rb deleted file mode 100644 index 12f8337..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/version.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -require_relative "gem_version" - -module ActiveSupport - # Returns the currently loaded version of Active Support as a +Gem::Version+. - def self.version - gem_version - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini.rb deleted file mode 100644 index b15e7eb..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini.rb +++ /dev/null @@ -1,212 +0,0 @@ -# frozen_string_literal: true - -require "time" -require "base64" -require "bigdecimal" -require "bigdecimal/util" -require "active_support/core_ext/module/delegation" -require "active_support/core_ext/string/inflections" -require "active_support/core_ext/date_time/calculations" - -module ActiveSupport - # = \XmlMini - # - # To use the much faster libxml parser: - # gem "libxml-ruby" - # XmlMini.backend = 'LibXML' - module XmlMini - extend self - - # This module decorates files deserialized using Hash.from_xml with - # the original_filename and content_type methods. - module FileLike # :nodoc: - attr_writer :original_filename, :content_type - - def original_filename - @original_filename || "untitled" - end - - def content_type - @content_type || "application/octet-stream" - end - end - - DEFAULT_ENCODINGS = { - "binary" => "base64" - } unless defined?(DEFAULT_ENCODINGS) - - unless defined?(TYPE_NAMES) - TYPE_NAMES = { - "Symbol" => "symbol", - "Integer" => "integer", - "BigDecimal" => "decimal", - "Float" => "float", - "TrueClass" => "boolean", - "FalseClass" => "boolean", - "Date" => "date", - "DateTime" => "dateTime", - "Time" => "dateTime", - "ActiveSupport::Duration" => "duration", - "Array" => "array", - "Hash" => "hash" - } - end - TYPE_NAMES["ActiveSupport::TimeWithZone"] = TYPE_NAMES["Time"] - - FORMATTING = { - "symbol" => Proc.new { |symbol| symbol.to_s }, - "date" => Proc.new { |date| date.to_fs(:db) }, - "dateTime" => Proc.new { |time| time.xmlschema }, - "duration" => Proc.new { |duration| duration.iso8601 }, - "binary" => Proc.new { |binary| ::Base64.encode64(binary) }, - "yaml" => Proc.new { |yaml| yaml.to_yaml } - } unless defined?(FORMATTING) - - unless defined?(PARSING) - PARSING = { - "symbol" => Proc.new { |symbol| symbol.to_s.to_sym }, - "date" => Proc.new { |date| ::Date.strptime(date.to_s.strip, "%Y-%m-%d") }, - "datetime" => Proc.new { |time| Time.xmlschema(time).utc rescue ::DateTime.parse(time).utc }, - "duration" => Proc.new { |duration| Duration.parse(duration) }, - "integer" => Proc.new { |integer| integer.to_i }, - "float" => Proc.new { |float| float.to_f }, - "decimal" => Proc.new do |number| - if String === number - number.to_d - elsif Float === number - BigDecimal(number, 0) - else - BigDecimal(number) - end - end, - "boolean" => Proc.new { |boolean| %w(1 true).include?(boolean.to_s.strip) }, - "string" => Proc.new { |string| string.to_s }, - "yaml" => Proc.new { |yaml| YAML.load(yaml) rescue yaml }, - "base64Binary" => Proc.new { |bin| ::Base64.decode64(bin) }, - "hexBinary" => Proc.new { |bin| _parse_hex_binary(bin) }, - "binary" => Proc.new { |bin, entity| _parse_binary(bin, entity) }, - "file" => Proc.new { |file, entity| _parse_file(file, entity) } - } - - PARSING.update( - "double" => PARSING["float"], - "dateTime" => PARSING["datetime"] - ) - end - - attr_accessor :depth - self.depth = 100 - - delegate :parse, to: :backend - - def backend - current_thread_backend || @backend - end - - def backend=(name) - backend = name && cast_backend_name_to_module(name) - self.current_thread_backend = backend if current_thread_backend - @backend = backend - end - - def with_backend(name) - old_backend = current_thread_backend - self.current_thread_backend = name && cast_backend_name_to_module(name) - yield - ensure - self.current_thread_backend = old_backend - end - - def to_tag(key, value, options) - type_name = options.delete(:type) - merged_options = options.merge(root: key, skip_instruct: true) - - if value.is_a?(::Method) || value.is_a?(::Proc) - if value.arity == 1 - value.call(merged_options) - else - value.call(merged_options, key.to_s.singularize) - end - elsif value.respond_to?(:to_xml) - value.to_xml(merged_options) - else - type_name ||= TYPE_NAMES[value.class.name] - type_name ||= value.class.name if value && !value.respond_to?(:to_str) - type_name = type_name.to_s if type_name - type_name = "dateTime" if type_name == "datetime" - - key = rename_key(key.to_s, options) - - attributes = options[:skip_types] || type_name.nil? ? {} : { type: type_name } - attributes[:nil] = true if value.nil? - - encoding = options[:encoding] || DEFAULT_ENCODINGS[type_name] - attributes[:encoding] = encoding if encoding - - formatted_value = FORMATTING[type_name] && !value.nil? ? - FORMATTING[type_name].call(value) : value - - options[:builder].tag!(key, formatted_value, attributes) - end - end - - def rename_key(key, options = {}) - camelize = options[:camelize] - dasherize = !options.has_key?(:dasherize) || options[:dasherize] - if camelize - key = true == camelize ? key.camelize : key.camelize(camelize) - end - key = _dasherize(key) if dasherize - key - end - - private - def _dasherize(key) - # $2 must be a non-greedy regex for this to work - left, middle, right = /\A(_*)(.*?)(_*)\Z/.match(key.strip)[1, 3] - "#{left}#{middle.tr('_ ', '--')}#{right}" - end - - def _parse_binary(bin, entity) - case entity["encoding"] - when "base64" - ::Base64.decode64(bin) - when "hex", "hexBinary" - _parse_hex_binary(bin) - else - bin - end - end - - def _parse_file(file, entity) - f = StringIO.new(::Base64.decode64(file)) - f.extend(FileLike) - f.original_filename = entity["name"] - f.content_type = entity["content_type"] - f - end - - def _parse_hex_binary(bin) - [bin].pack("H*") - end - - def current_thread_backend - IsolatedExecutionState[:xml_mini_backend] - end - - def current_thread_backend=(name) - IsolatedExecutionState[:xml_mini_backend] = name && cast_backend_name_to_module(name) - end - - def cast_backend_name_to_module(name) - if name.is_a?(Module) - name - else - require "active_support/xml_mini/#{name.downcase}" - ActiveSupport.const_get("XmlMini_#{name}") - end - end - end - - XmlMini.backend = "REXML" -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini/jdom.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini/jdom.rb deleted file mode 100644 index f1bc0fe..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini/jdom.rb +++ /dev/null @@ -1,175 +0,0 @@ -# frozen_string_literal: true - -raise "JRuby is required to use the JDOM backend for XmlMini" unless RUBY_PLATFORM.include?("java") - -require "jruby" -include Java - -require "active_support/core_ext/object/blank" - -java_import javax.xml.parsers.DocumentBuilder unless defined? DocumentBuilder -java_import javax.xml.parsers.DocumentBuilderFactory unless defined? DocumentBuilderFactory -java_import java.io.StringReader unless defined? StringReader -java_import org.xml.sax.InputSource unless defined? InputSource -java_import org.xml.sax.Attributes unless defined? Attributes -java_import org.w3c.dom.Node unless defined? Node - -module ActiveSupport - module XmlMini_JDOM # :nodoc: - extend self - - CONTENT_KEY = "__content__" - - # Parse an XML Document string or IO into a simple hash using Java's jdom. - # data:: - # XML Document string or IO to parse - def parse(data) - if data.respond_to?(:read) - data = data.read - end - - if data.blank? - {} - else - @dbf = DocumentBuilderFactory.new_instance - # secure processing of java xml - # https://archive.is/9xcQQ - @dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false) - @dbf.setFeature("http://xml.org/sax/features/external-general-entities", false) - @dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false) - @dbf.setFeature(javax.xml.XMLConstants::FEATURE_SECURE_PROCESSING, true) - xml_string_reader = StringReader.new(data) - xml_input_source = InputSource.new(xml_string_reader) - doc = @dbf.new_document_builder.parse(xml_input_source) - merge_element!({ CONTENT_KEY => "" }, doc.document_element, XmlMini.depth) - end - end - - private - # Convert an XML element and merge into the hash - # - # hash:: - # Hash to merge the converted element into. - # element:: - # XML element to merge into hash - def merge_element!(hash, element, depth) - raise "Document too deep!" if depth == 0 - delete_empty(hash) - merge!(hash, element.tag_name, collapse(element, depth)) - end - - def delete_empty(hash) - hash.delete(CONTENT_KEY) if hash[CONTENT_KEY] == "" - end - - # Actually converts an XML document element into a data structure. - # - # element:: - # The document element to be collapsed. - def collapse(element, depth) - hash = get_attributes(element) - - child_nodes = element.child_nodes - if child_nodes.length > 0 - (0...child_nodes.length).each do |i| - child = child_nodes.item(i) - merge_element!(hash, child, depth - 1) unless child.node_type == Node::TEXT_NODE - end - merge_texts!(hash, element) unless empty_content?(element) - hash - else - merge_texts!(hash, element) - end - end - - # Merge all the texts of an element into the hash - # - # hash:: - # Hash to add the converted element to. - # element:: - # XML element whose texts are to me merged into the hash - def merge_texts!(hash, element) - delete_empty(hash) - text_children = texts(element) - if text_children.join.empty? - hash - else - # must use value to prevent double-escaping - merge!(hash, CONTENT_KEY, text_children.join) - end - end - - # Adds a new key/value pair to an existing Hash. If the key to be added - # already exists and the existing value associated with key is not - # an Array, it will be wrapped in an Array. Then the new value is - # appended to that Array. - # - # hash:: - # Hash to add key/value pair to. - # key:: - # Key to be added. - # value:: - # Value to be associated with key. - def merge!(hash, key, value) - if hash.has_key?(key) - if hash[key].instance_of?(Array) - hash[key] << value - else - hash[key] = [hash[key], value] - end - elsif value.instance_of?(Array) - hash[key] = [value] - else - hash[key] = value - end - hash - end - - # Converts the attributes array of an XML element into a hash. - # Returns an empty Hash if node has no attributes. - # - # element:: - # XML element to extract attributes from. - def get_attributes(element) - attribute_hash = {} - attributes = element.attributes - (0...attributes.length).each do |i| - attribute_hash[CONTENT_KEY] ||= "" - attribute_hash[attributes.item(i).name] = attributes.item(i).value - end - attribute_hash - end - - # Determines if a document element has text content - # - # element:: - # XML element to be checked. - def texts(element) - texts = [] - child_nodes = element.child_nodes - (0...child_nodes.length).each do |i| - item = child_nodes.item(i) - if item.node_type == Node::TEXT_NODE - texts << item.get_data - end - end - texts - end - - # Determines if a document element has text content - # - # element:: - # XML element to be checked. - def empty_content?(element) - text = +"" - child_nodes = element.child_nodes - (0...child_nodes.length).each do |i| - item = child_nodes.item(i) - if item.node_type == Node::TEXT_NODE - text << item.get_data.strip - end - end - text.strip.length == 0 - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini/libxml.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini/libxml.rb deleted file mode 100644 index 65976a2..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini/libxml.rb +++ /dev/null @@ -1,80 +0,0 @@ -# frozen_string_literal: true - -require "libxml" -require "active_support/core_ext/object/blank" -require "stringio" - -module ActiveSupport - module XmlMini_LibXML # :nodoc: - extend self - - # Parse an XML Document string or IO into a simple hash using libxml. - # data:: - # XML Document string or IO to parse - def parse(data) - if !data.respond_to?(:read) - data = StringIO.new(data || "") - end - - if data.eof? - {} - else - LibXML::XML::Parser.io(data).parse.to_hash - end - end - end -end - -module LibXML # :nodoc: - module Conversions # :nodoc: - module Document # :nodoc: - def to_hash - root.to_hash - end - end - - module Node # :nodoc: - CONTENT_ROOT = "__content__" - - # Convert XML document to hash. - # - # hash:: - # Hash to merge the converted element into. - def to_hash(hash = {}) - node_hash = {} - - # Insert node hash into parent hash correctly. - case hash[name] - when Array then hash[name] << node_hash - when Hash then hash[name] = [hash[name], node_hash] - when nil then hash[name] = node_hash - end - - # Handle child elements - each_child do |c| - if c.element? - c.to_hash(node_hash) - elsif c.text? || c.cdata? - node_hash[CONTENT_ROOT] ||= +"" - node_hash[CONTENT_ROOT] << c.content - end - end - - # Remove content node if it is blank - if node_hash.length > 1 && node_hash[CONTENT_ROOT].blank? - node_hash.delete(CONTENT_ROOT) - end - - # Handle attributes - each_attr { |a| node_hash[a.name] = a.value } - - hash - end - end - end -end - -# :enddoc: - -LibXML::XML::Document.include(LibXML::Conversions::Document) -LibXML::XML::Node.include(LibXML::Conversions::Node) diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini/libxmlsax.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini/libxmlsax.rb deleted file mode 100644 index 33d594c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini/libxmlsax.rb +++ /dev/null @@ -1,83 +0,0 @@ -# frozen_string_literal: true - -require "libxml" -require "active_support/core_ext/object/blank" -require "stringio" - -module ActiveSupport - module XmlMini_LibXMLSAX # :nodoc: - extend self - - # Class that will build the hash while the XML document - # is being parsed using SAX events. - class HashBuilder - include LibXML::XML::SaxParser::Callbacks - - CONTENT_KEY = "__content__" - HASH_SIZE_KEY = "__hash_size__" - - attr_reader :hash - - def current_hash - @hash_stack.last - end - - def on_start_document - @hash = { CONTENT_KEY => +"" } - @hash_stack = [@hash] - end - - def on_end_document - @hash = @hash_stack.pop - @hash.delete(CONTENT_KEY) - end - - def on_start_element(name, attrs = {}) - new_hash = { CONTENT_KEY => +"" }.merge!(attrs) - new_hash[HASH_SIZE_KEY] = new_hash.size + 1 - - case current_hash[name] - when Array then current_hash[name] << new_hash - when Hash then current_hash[name] = [current_hash[name], new_hash] - when nil then current_hash[name] = new_hash - end - - @hash_stack.push(new_hash) - end - - def on_end_element(name) - if current_hash.length > current_hash.delete(HASH_SIZE_KEY) && current_hash[CONTENT_KEY].blank? || current_hash[CONTENT_KEY] == "" - current_hash.delete(CONTENT_KEY) - end - @hash_stack.pop - end - - def on_characters(string) - current_hash[CONTENT_KEY] << string - end - - alias_method :on_cdata_block, :on_characters - end - - attr_accessor :document_class - self.document_class = HashBuilder - - def parse(data) - if !data.respond_to?(:read) - data = StringIO.new(data || "") - end - - if data.eof? - {} - else - LibXML::XML::Error.set_handler(&LibXML::XML::Error::QUIET_HANDLER) - parser = LibXML::XML::SaxParser.io(data) - document = document_class.new - - parser.callbacks = document - parser.parse - document.hash - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini/nokogiri.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini/nokogiri.rb deleted file mode 100644 index 3d9cf34..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini/nokogiri.rb +++ /dev/null @@ -1,83 +0,0 @@ -# frozen_string_literal: true - -begin - require "nokogiri" -rescue LoadError => e - warn "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install" - raise e -end -require "active_support/core_ext/object/blank" -require "stringio" - -module ActiveSupport - module XmlMini_Nokogiri # :nodoc: - extend self - - # Parse an XML Document string or IO into a simple hash using libxml / nokogiri. - # data:: - # XML Document string or IO to parse - def parse(data) - if !data.respond_to?(:read) - data = StringIO.new(data || "") - end - - if data.eof? - {} - else - doc = Nokogiri::XML(data) - raise doc.errors.first if doc.errors.length > 0 - doc.to_hash - end - end - - module Conversions # :nodoc: - module Document # :nodoc: - def to_hash - root.to_hash - end - end - - module Node # :nodoc: - CONTENT_ROOT = "__content__" - - # Convert XML document to hash. - # - # hash:: - # Hash to merge the converted element into. - def to_hash(hash = {}) - node_hash = {} - - # Insert node hash into parent hash correctly. - case hash[name] - when Array then hash[name] << node_hash - when Hash then hash[name] = [hash[name], node_hash] - when nil then hash[name] = node_hash - end - - # Handle child elements - children.each do |c| - if c.element? - c.to_hash(node_hash) - elsif c.text? || c.cdata? - node_hash[CONTENT_ROOT] ||= +"" - node_hash[CONTENT_ROOT] << c.content - end - end - - # Remove content node if it is blank and there are child tags - if node_hash.length > 1 && node_hash[CONTENT_ROOT].blank? - node_hash.delete(CONTENT_ROOT) - end - - # Handle attributes - attribute_nodes.each { |a| node_hash[a.node_name] = a.value } - - hash - end - end - end - - Nokogiri::XML::Document.include(Conversions::Document) - Nokogiri::XML::Node.include(Conversions::Node) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini/nokogirisax.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini/nokogirisax.rb deleted file mode 100644 index 9316f92..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini/nokogirisax.rb +++ /dev/null @@ -1,86 +0,0 @@ -# frozen_string_literal: true - -begin - require "nokogiri" -rescue LoadError => e - warn "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install" - raise e -end -require "active_support/core_ext/object/blank" -require "stringio" - -module ActiveSupport - module XmlMini_NokogiriSAX # :nodoc: - extend self - - # Class that will build the hash while the XML document - # is being parsed using SAX events. - class HashBuilder < Nokogiri::XML::SAX::Document - CONTENT_KEY = "__content__" - HASH_SIZE_KEY = "__hash_size__" - - attr_reader :hash - - def current_hash - @hash_stack.last - end - - def start_document - @hash = {} - @hash_stack = [@hash] - end - - def end_document - raise "Parse stack not empty!" if @hash_stack.size > 1 - end - - def error(error_message) - raise error_message - end - - def start_element(name, attrs = []) - new_hash = { CONTENT_KEY => +"" }.merge!(Hash[attrs]) - new_hash[HASH_SIZE_KEY] = new_hash.size + 1 - - case current_hash[name] - when Array then current_hash[name] << new_hash - when Hash then current_hash[name] = [current_hash[name], new_hash] - when nil then current_hash[name] = new_hash - end - - @hash_stack.push(new_hash) - end - - def end_element(name) - if current_hash.length > current_hash.delete(HASH_SIZE_KEY) && current_hash[CONTENT_KEY].blank? || current_hash[CONTENT_KEY] == "" - current_hash.delete(CONTENT_KEY) - end - @hash_stack.pop - end - - def characters(string) - current_hash[CONTENT_KEY] << string - end - - alias_method :cdata_block, :characters - end - - attr_accessor :document_class - self.document_class = HashBuilder - - def parse(data) - if !data.respond_to?(:read) - data = StringIO.new(data || "") - end - - if data.eof? - {} - else - document = document_class.new - parser = Nokogiri::XML::SAX::Parser.new(document) - parser.parse(data) - document.hash - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini/rexml.rb b/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini/rexml.rb deleted file mode 100644 index 393749a..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/activesupport-8.1.4.1/lib/active_support/xml_mini/rexml.rb +++ /dev/null @@ -1,137 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/kernel/reporting" -require "active_support/core_ext/object/blank" -require "stringio" - -module ActiveSupport - module XmlMini_REXML # :nodoc: - extend self - - CONTENT_KEY = "__content__" - - # Parse an XML Document string or IO into a simple hash. - # - # Same as XmlSimple::xml_in but doesn't shoot itself in the foot, - # and uses the defaults from Active Support. - # - # data:: - # XML Document string or IO to parse - def parse(data) - if !data.respond_to?(:read) - data = StringIO.new(data || "") - end - - if data.eof? - {} - else - require_rexml unless defined?(REXML::Document) - doc = REXML::Document.new(data) - - if doc.root - merge_element!({}, doc.root, XmlMini.depth) - else - raise REXML::ParseException, - "The document #{doc.to_s.inspect} does not have a valid root" - end - end - end - - private - def require_rexml - silence_warnings { require "rexml/document" } - rescue LoadError => e - warn "You don't have rexml installed in your application. Please add it to your Gemfile and run bundle install" - raise e - end - - # Convert an XML element and merge into the hash - # - # hash:: - # Hash to merge the converted element into. - # element:: - # XML element to merge into hash - def merge_element!(hash, element, depth) - raise REXML::ParseException, "The document is too deep" if depth == 0 - merge!(hash, element.name, collapse(element, depth)) - end - - # Actually converts an XML document element into a data structure. - # - # element:: - # The document element to be collapsed. - def collapse(element, depth) - hash = get_attributes(element) - - if element.has_elements? - element.each_element { |child| merge_element!(hash, child, depth - 1) } - merge_texts!(hash, element) unless empty_content?(element) - hash - else - merge_texts!(hash, element) - end - end - - # Merge all the texts of an element into the hash - # - # hash:: - # Hash to add the converted element to. - # element:: - # XML element whose texts are to me merged into the hash - def merge_texts!(hash, element) - unless element.has_text? - hash - else - # must use value to prevent double-escaping - texts = +"" - element.texts.each { |t| texts << t.value } - merge!(hash, CONTENT_KEY, texts) - end - end - - # Adds a new key/value pair to an existing Hash. If the key to be added - # already exists and the existing value associated with key is not - # an Array, it will be wrapped in an Array. Then the new value is - # appended to that Array. - # - # hash:: - # Hash to add key/value pair to. - # key:: - # Key to be added. - # value:: - # Value to be associated with key. - def merge!(hash, key, value) - if hash.has_key?(key) - if hash[key].instance_of?(Array) - hash[key] << value - else - hash[key] = [hash[key], value] - end - elsif value.instance_of?(Array) - hash[key] = [value] - else - hash[key] = value - end - hash - end - - # Converts the attributes array of an XML element into a hash. - # Returns an empty Hash if node has no attributes. - # - # element:: - # XML element to extract attributes from. - def get_attributes(element) - attributes = {} - element.attributes.each { |n, v| attributes[n] = v } - attributes - end - - # Determines if a document element has text content - # - # element:: - # XML element to be checked. - def empty_content?(element) - element.texts.join.blank? - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/CHANGELOG.md b/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/CHANGELOG.md deleted file mode 100644 index 110b71c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/CHANGELOG.md +++ /dev/null @@ -1,423 +0,0 @@ -# Changelog - -## Addressable 2.9.2 -- fixes `Addressable::URI` returning stale values after a component was - changed: e.g. after `host=`, `#site`, `#normalized_site`, - `#normalized_authority` and `#normalize` could still use the old host, and - after `scheme=`, `#normalized_port` could keep a port that's the new - scheme's default (#613) -- fixes `Addressable::URI#normalized_query` reusing the result of an earlier - call with different flags: e.g. after `normalized_query(:sorted)`, - `normalized_query` and `#normalize` gave a sorted query, and after - `normalized_query`, `normalized_query(:sorted)` gave an unsorted one (#608) -- fixes `Addressable::Template#expand` and `#partial_expand` changing the - arrays given as values: e.g. `[1, :a]` became `["1", "a"]`; a frozen array - raised `FrozenError`, and an object that responds to `to_ary` - raised `TypeError` (#605) -- fixes `Addressable::URI#clone` sharing component strings with the original: - e.g. appending to the clone's `#host` also changed the original's host, but - not its cached normalized values; `#dup` already made a separate copy (#617) -- fixes the pure-Ruby `Addressable::IDNA.to_unicode` raising `ZeroDivisionError` - on some malformed labels, e.g. `xn--rp3=`, which also made - `Addressable::URI#display_uri` raise, because the Punycode decoder - treated punctuation as digits; such labels are now returned unchanged (#614) -- speeds up the pure-Ruby `Addressable::IDNA.to_unicode`, which became up to - 25 times slower in 2.9.1 on long labels with many non-ASCII characters; - Punycode encoding no longer takes quadratic time (#645) -- fixes the "character class has duplicated range" warnings that 2.9.1 gave - when `Addressable::IDNA` was loaded with warnings enabled -- fixes the "instance variable @validation_deferred not initialized" warning - that 2.9.1 gave for every new `Addressable::URI` on Ruby before 3.0 with - warnings enabled, and a "shadowing outer local variable" warning from - `Addressable::Template` on Ruby 2.4 and 2.5 - -## Addressable 2.9.1 -- fixes denial of service in `Addressable::URI.normalize_path`, which took - quadratic time on paths with many dot segments; `URI#normalize`, `#join`, - `#==` and `#===` were affected (GHSA-qq38-m9mg-xjj5) -- fixes `Addressable::URI.normalize_path` keeping segments that a `..` should - have removed after a `..` above the root, e.g. - `/../../public/x/../../secret` normalized to `/public/x/secret` instead of - `/secret` (GHSA-8gmh-2hhj-2hv9) -- fixes `Addressable::URI.normalize_path` treating a raw line feed as a - segment boundary, e.g. joining `..\n/secret` onto `/public/` gave - `/\n/secret` -- deprecates `Addressable::URI::RULE_2A`, `RULE_2B_2C`, `RULE_2D` and - `RULE_PREFIXED_PARENT`, which are no longer used; they will be removed in - 2.10.0 -- fixes denial of service in `Addressable::Template#match` and `#extract`, - which still backtracked exponentially in 2.9.0 for exploded `/`, `.`, `;`, - `?` and `&` expressions (e.g. `{/path*}`) on regex engines without match - memoization, such as JRuby, TruffleRuby and MRI before 3.2; match results - are unchanged (GHSA-j82w-28jv-3pmj) -- fixes denial of service in `Addressable::Template#match` and `#extract`, - which backtracked polynomially or exponentially on the same regex engines - for expressions with several variables (e.g. `{/owner,repo,ref}`, or - `{+a,b,c}` with many variables), for `;` expressions, and for adjacent - expressions (e.g. `{+a}{+b}{+c}` or `{+a}{b}`); match results are unchanged - (GHSA-9f42-57jx-vpp3) -- fixes denial of service in `Addressable::Template#match` and `#extract`, - which backtracked polynomially for expressions with several exploded - variables (e.g. `{+a*,b*}`), including on MRI 3.2; match results are - unchanged (GHSA-4w5q-wg7v-w6gp) -- fixes `Addressable::IDNA.to_unicode` in the pure-Ruby backend decoding - Punycode labels that aren't valid A-labels: labels that decode to only - ASCII characters (e.g. `xn--google-` decoded to `google`) and labels that - don't convert back to themselves; such a label is now returned unchanged, - as with libidn, so `Addressable::URI#display_uri` no longer shows a host - that differs from `#normalized_host` (GHSA-9crm-g4mf-wc5j) -- fixes `Addressable::IDNA.to_unicode` decoding Punycode labels with - characters that change how a host displays without being visible - themselves, such as bidi overrides and isolates (e.g. U+202E and U+2066), - zero width characters and control characters; such a label is now - returned unchanged, so `Addressable::URI#display_uri` no longer shows - them. The pure-Ruby backend also no longer decodes labels with other - characters that nameprep prohibits, as with libidn (GHSA-539f-xcgw-2gjg) -- fixes `Addressable::URI#route_from` and `#route_to` raising - `InvalidURIError` when the route's first segment contains a colon - (e.g. `/a:b` from `/a`); the route is now `./a:b` ([#625]) -- fixes `Addressable::IDNA.to_unicode` raising in the pure-Ruby backend for - Punycode labels that are too long, overflow the decoder, or decode past - U+10FFFF; the label is now returned unchanged, as with libidn, so - `Addressable::URI#display_uri` no longer raises for such hosts ([#620]) -- fixes `Addressable::URI#display_uri` raising `InvalidURIError` for URIs - without a host, such as `abc` or `mailto:user@example.com`; relative URIs - are also no longer displayed with an empty authority (e.g. `/path/to` was - displayed as `///path/to`) ([#610]) -- fixes `Addressable::Template#match` and `#extract` raising - `Addressable::URI::InvalidURIError` for a string that isn't a valid URI; - they now return `nil`, as for any other URI that doesn't match ([#621]) -- fixes `Addressable::URI#origin=` raising `InvalidURIError` for an origin - with an empty port (e.g. `http://example.com:`), which is the same as no - port ([#627]) - -[#610]: https://github.com/sporkmonger/addressable/pull/610 -[#620]: https://github.com/sporkmonger/addressable/pull/620 -[#621]: https://github.com/sporkmonger/addressable/pull/621 -[#625]: https://github.com/sporkmonger/addressable/pull/625 -[#627]: https://github.com/sporkmonger/addressable/pull/627 - -## Addressable 2.9.0 -- fixes ReDoS vulnerability in Addressable::Template#match (fixes incomplete - remediation in 2.8.10) - -## Addressable 2.8.10 -- fixes ReDoS vulnerability in Addressable::Template#match - -## Addressable 2.8.9 -- Reduce gem size by excluding test files ([#569]) -- No need for bundler as development dependency ([#571], [5fc1d93](https://github.com/sporkmonger/addressable/commit/5fc1d93)) -- idna/pure: stop building the useless `COMPOSITION_TABLE` (removes the `Addressable::IDNA::COMPOSITION_TABLE` constant) ([#564]) - -[#569]: https://github.com/sporkmonger/addressable/pull/569 -[#571]: https://github.com/sporkmonger/addressable/pull/571 -[#564]: https://github.com/sporkmonger/addressable/pull/564 - -## Addressable 2.8.8 -- Replace the `unicode.data` blob by a ruby constant ([#561]) -- Allow `public_suffix` 7 ([#558]) - -[#561]: https://github.com/sporkmonger/addressable/pull/561 -[#558]: https://github.com/sporkmonger/addressable/pull/558 - -## Addressable 2.8.7 -- Allow `public_suffix` 6 ([#535]) - -[#535]: https://github.com/sporkmonger/addressable/pull/535 - -## Addressable 2.8.6 -- Memoize regexps for common character classes ([#524]) - -[#524]: https://github.com/sporkmonger/addressable/pull/524 - -## Addressable 2.8.5 -- Fix thread safety issue with encoding tables ([#515]) -- Define URI::NONE as a module to avoid serialization issues ([#509]) -- Fix YAML serialization ([#508]) - -[#508]: https://github.com/sporkmonger/addressable/pull/508 -[#509]: https://github.com/sporkmonger/addressable/pull/509 -[#515]: https://github.com/sporkmonger/addressable/pull/515 - -## Addressable 2.8.4 -- Restore `Addressable::IDNA.unicode_normalize_kc` as a deprecated method ([#504]) - -[#504]: https://github.com/sporkmonger/addressable/pull/504 - -## Addressable 2.8.3 -- Fix template expand level 2 hash support for non-string objects ([#499], [#498]) - -[#499]: https://github.com/sporkmonger/addressable/pull/499 -[#498]: https://github.com/sporkmonger/addressable/pull/498 - -## Addressable 2.8.2 -- Improve cache hits and JIT friendliness ([#486](https://github.com/sporkmonger/addressable/pull/486)) -- Improve code style and test coverage ([#482](https://github.com/sporkmonger/addressable/pull/482)) -- Ensure reset of deferred validation ([#481](https://github.com/sporkmonger/addressable/pull/481)) -- Resolve normalization differences between `IDNA::Native` and `IDNA::Pure` ([#408](https://github.com/sporkmonger/addressable/issues/408), [#492]) -- Remove redundant colon in `Addressable::URI::CharacterClasses::AUTHORITY` regex ([#438](https://github.com/sporkmonger/addressable/pull/438)) (accidentally reverted by [#449] merge but [added back](https://github.com/sporkmonger/addressable/pull/492#discussion_r1105125280) in [#492]) - -[#492]: https://github.com/sporkmonger/addressable/pull/492 - -## Addressable 2.8.1 -- refactor `Addressable::URI.normalize_path` to address linter offenses ([#430](https://github.com/sporkmonger/addressable/pull/430)) -- update gemspec to reflect supported Ruby versions ([#466], [#464], [#463]) -- compatibility w/ public_suffix 5.x ([#466], [#465], [#460]) -- fixes "invalid byte sequence in UTF-8" exception when unencoding URLs containing non UTF-8 characters ([#459](https://github.com/sporkmonger/addressable/pull/459)) -- `Ractor` compatibility ([#449]) -- use the whole string instead of a single line for template match ([#431](https://github.com/sporkmonger/addressable/pull/431)) -- force UTF-8 encoding only if needed ([#341](https://github.com/sporkmonger/addressable/pull/341)) - -[#449]: https://github.com/sporkmonger/addressable/pull/449 -[#460]: https://github.com/sporkmonger/addressable/pull/460 -[#463]: https://github.com/sporkmonger/addressable/pull/463 -[#464]: https://github.com/sporkmonger/addressable/pull/464 -[#465]: https://github.com/sporkmonger/addressable/pull/465 -[#466]: https://github.com/sporkmonger/addressable/pull/466 - -## Addressable 2.8.0 -- fixes ReDoS vulnerability in Addressable::Template#match -- no longer replaces `+` with spaces in queries for non-http(s) schemes -- fixed encoding ipv6 literals -- the `:compacted` flag for `normalized_query` now dedupes parameters -- fix broken `escape_component` alias -- dropping support for Ruby 2.0 and 2.1 -- adding Ruby 3.0 compatibility for development tasks -- drop support for `rack-mount` and remove Addressable::Template#generate -- performance improvements -- switch CI/CD to GitHub Actions - -## Addressable 2.7.0 -- added `:compacted` flag to `normalized_query` -- `heuristic_parse` handles `mailto:` more intuitively -- dropped explicit support for JRuby 9.0.5.0 -- compatibility w/ public_suffix 4.x -- performance improvements - -## Addressable 2.6.0 -- added `tld=` method to allow assignment to the public suffix -- most `heuristic_parse` patterns are now case-insensitive -- `heuristic_parse` handles more `file://` URI variations -- fixes bug in `heuristic_parse` when uri starts with digit -- fixes bug in `request_uri=` with query strings -- fixes template issues with `nil` and `?` operator -- `frozen_string_literal` pragmas added -- minor performance improvements in regexps -- fixes to eliminate warnings - -## Addressable 2.5.2 -- better support for frozen string literals -- fixed bug w/ uppercase characters in scheme -- IDNA errors w/ emoji URLs -- compatibility w/ public_suffix 3.x - -## Addressable 2.5.1 -- allow unicode normalization to be disabled for URI Template expansion -- removed duplicate test - -## Addressable 2.5.0 -- dropping support for Ruby 1.9 -- adding support for Ruby 2.4 preview -- add support for public suffixes and tld; first runtime dependency -- hostname escaping should match RFC; underscores in hostnames no longer escaped -- paths beginning with // and missing an authority are now considered invalid -- validation now also takes place after setting a path -- handle backslashes in authority more like a browser for `heuristic_parse` -- unescaped backslashes in host now raise an `InvalidURIError` -- `merge!`, `join!`, `omit!` and `normalize!` don't disable deferred validation -- `heuristic_parse` now trims whitespace before parsing -- host parts longer than 63 bytes will be ignored and not passed to libidn -- normalized values always encoded as UTF-8 - -## Addressable 2.4.0 -- support for 1.8.x dropped -- double quotes in a host now raises an error -- newlines in host will no longer get unescaped during normalization -- stricter handling of bogus scheme values -- stricter handling of encoded port values -- calling `require 'addressable'` will now load both the URI and Template files -- assigning to the `hostname` component with an `IPAddr` object is now supported -- assigning to the `origin` component is now supported -- fixed minor bug where an exception would be thrown for a missing ACE suffix -- better partial expansion of URI templates - -## Addressable 2.3.8 -- fix warnings -- update dependency gems -- support for 1.8.x officially deprecated - -## Addressable 2.3.7 -- fix scenario in which invalid URIs don't get an exception until inspected -- handle hostnames with two adjacent periods correctly -- upgrade of RSpec - -## Addressable 2.3.6 -- normalization drops empty query string -- better handling in template extract for missing values -- template modifier for `'?'` now treated as optional -- fixed issue where character class parameters were modified -- templates can now be tested for equality -- added `:sorted` option to normalization of query strings -- fixed issue with normalization of hosts given in `'example.com.'` form - -## Addressable 2.3.5 -- added Addressable::URI#empty? method -- Addressable::URI#hostname methods now strip square brackets from IPv6 hosts -- compatibility with Net::HTTP in Ruby 2.0.0 -- Addressable::URI#route_from should always give relative URIs - -## Addressable 2.3.4 -- fixed issue with encoding altering its inputs -- query string normalization now leaves ';' characters alone -- FakeFS is detected before attempting to load unicode tables -- additional testing to ensure frozen objects don't cause problems - -## Addressable 2.3.3 -- fixed issue with converting common primitives during template expansion -- fixed port encoding issue -- removed a few warnings -- normalize should now ignore %2B in query strings -- the IDNA logic should now be handled by libidn in Ruby 1.9 -- no template match should now result in nil instead of an empty MatchData -- added license information to gemspec - -## Addressable 2.3.2 -- added Addressable::URI#default_port method -- fixed issue with Marshalling Unicode data on Windows -- improved heuristic parsing to better handle IPv4 addresses - -## Addressable 2.3.1 -- fixed missing unicode data file - -## Addressable 2.3.0 -- updated Addressable::Template to use RFC 6570, level 4 -- fixed compatibility problems with some versions of Ruby -- moved unicode tables into a data file for performance reasons -- removing support for multiple query value notations - -## Addressable 2.2.8 -- fixed issues with dot segment removal code -- form encoding can now handle multiple values per key -- updated development environment - -## Addressable 2.2.7 -- fixed issues related to Addressable::URI#query_values= -- the Addressable::URI.parse method is now polymorphic - -## Addressable 2.2.6 -- changed the way ambiguous paths are handled -- fixed bug with frozen URIs -- https supported in heuristic parsing - -## Addressable 2.2.5 -- 'parsing' a pre-parsed URI object is now a dup operation -- introduced conditional support for libidn -- fixed normalization issue on ampersands in query strings -- added additional tests around handling of query strings - -## Addressable 2.2.4 -- added origin support from draft-ietf-websec-origin-00 -- resolved issue with attempting to navigate below root -- fixed bug with string splitting in query strings - -## Addressable 2.2.3 -- added :flat_array notation for query strings - -## Addressable 2.2.2 -- fixed issue with percent escaping of '+' character in query strings - -## Addressable 2.2.1 -- added support for application/x-www-form-urlencoded. - -## Addressable 2.2.0 -- added site methods -- improved documentation - -## Addressable 2.1.2 -- added HTTP request URI methods -- better handling of Windows file paths -- validation_deferred boolean replaced with defer_validation block -- normalization of percent-encoded paths should now be correct -- fixed issue with constructing URIs with relative paths -- fixed warnings - -## Addressable 2.1.1 -- more type checking changes -- fixed issue with unicode normalization -- added method to find template defaults -- symbolic keys are now allowed in template mappings -- numeric values and symbolic values are now allowed in template mappings - -## Addressable 2.1.0 -- refactored URI template support out into its own class -- removed extract method due to being useless and unreliable -- removed Addressable::URI.expand_template -- removed Addressable::URI#extract_mapping -- added partial template expansion -- fixed minor bugs in the parse and heuristic_parse methods -- fixed incompatibility with Ruby 1.9.1 -- fixed bottleneck in Addressable::URI#hash and Addressable::URI#to_s -- fixed unicode normalization exception -- updated query_values methods to better handle subscript notation -- worked around issue with freezing URIs -- improved specs - -## Addressable 2.0.2 -- fixed issue with URI template expansion -- fixed issue with percent escaping characters 0-15 - -## Addressable 2.0.1 -- fixed issue with query string assignment -- fixed issue with improperly encoded components - -## Addressable 2.0.0 -- the initialize method now takes an options hash as its only parameter -- added query_values method to URI class -- completely replaced IDNA implementation with pure Ruby -- renamed Addressable::ADDRESSABLE_VERSION to Addressable::VERSION -- completely reworked the Rakefile -- changed the behavior of the port method significantly -- Addressable::URI.encode_segment, Addressable::URI.unencode_segment renamed -- documentation is now in YARD format -- more rigorous type checking -- to_str method implemented, implicit conversion to Strings now allowed -- Addressable::URI#omit method added, Addressable::URI#merge method replaced -- updated URI Template code to match v 03 of the draft spec -- added a bunch of new specifications - -## Addressable 1.0.4 -- switched to using RSpec's pending system for specs that rely on IDN -- fixed issue with creating URIs with paths that are not prefixed with '/' - -## Addressable 1.0.3 -- implemented a hash method - -## Addressable 1.0.2 -- fixed minor bug with the extract_mapping method - -## Addressable 1.0.1 -- fixed minor bug with the extract_mapping method - -## Addressable 1.0.0 -- heuristic parse method added -- parsing is slightly more strict -- replaced to_h with to_hash -- fixed routing methods -- improved specifications -- improved heckle rake task -- no surviving heckle mutations - -## Addressable 0.1.2 -- improved normalization -- fixed bug in joining algorithm -- updated specifications - -## Addressable 0.1.1 -- updated documentation -- added URI Template variable extraction - -## Addressable 0.1.0 -- initial release -- implementation based on RFC 3986, 3987 -- support for IRIs via libidn -- support for the URI Template draft spec diff --git a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/LICENSE.txt b/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/LICENSE.txt deleted file mode 100644 index ef51da2..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/README.md b/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/README.md deleted file mode 100644 index d9fa04f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/README.md +++ /dev/null @@ -1,121 +0,0 @@ -# Addressable - -
-
Homepage
github.com/sporkmonger/addressable
-
Author
Bob Aman
-
Copyright
Copyright © Bob Aman
-
License
Apache 2.0
-
- -[![Gem Version](https://img.shields.io/gem/dt/addressable.svg)][gem] -[![Build Status](https://github.com/sporkmonger/addressable/workflows/CI/badge.svg)][actions] -[![Test Coverage Status](https://img.shields.io/coveralls/sporkmonger/addressable.svg)][coveralls] -[![Documentation Coverage Status](https://inch-ci.org/github/sporkmonger/addressable.svg?branch=master)][inch] - -[gem]: https://rubygems.org/gems/addressable -[actions]: https://github.com/sporkmonger/addressable/actions -[coveralls]: https://coveralls.io/r/sporkmonger/addressable -[inch]: https://inch-ci.org/github/sporkmonger/addressable - -## Description - -Addressable is an alternative implementation to the URI implementation -that is part of Ruby's standard library. It is flexible, offers heuristic -parsing, and additionally provides extensive support for IRIs and URI templates. - -Addressable closely conforms to RFC 3986, RFC 3987, and RFC 6570 (level 4). - -## Reference - -- {Addressable::URI} -- {Addressable::Template} - -## Example usage - -```ruby -require "addressable/uri" - -uri = Addressable::URI.parse("http://example.com/path/to/resource/") -uri.scheme -#=> "http" -uri.host -#=> "example.com" -uri.path -#=> "/path/to/resource/" - -uri = Addressable::URI.parse("http://www.詹姆斯.com/") -uri.normalize -#=> # -``` - - -## URI Templates - -For more details, see [RFC 6570](https://www.rfc-editor.org/rfc/rfc6570.txt). - - -```ruby - -require "addressable/template" - -template = Addressable::Template.new("http://example.com/{?query*}") -template.expand({ - "query" => { - 'foo' => 'bar', - 'color' => 'red' - } -}) -#=> # - -template = Addressable::Template.new("http://example.com/{?one,two,three}") -template.partial_expand({"one" => "1", "three" => 3}).pattern -#=> "http://example.com/?one=1{&two}&three=3" - -template = Addressable::Template.new( - "http://{host}{/segments*}/{?one,two,bogus}{#fragment}" -) -uri = Addressable::URI.parse( - "http://example.com/a/b/c/?one=1&two=2#foo" -) -template.extract(uri) -#=> -# { -# "host" => "example.com", -# "segments" => ["a", "b", "c"], -# "one" => "1", -# "two" => "2", -# "fragment" => "foo" -# } -``` - -## Install - -```console -$ gem install addressable -``` - -You may optionally turn on native IDN support by installing libidn and the -idn gem: - -```console -$ sudo apt-get install libidn11-dev # Debian/Ubuntu -$ brew install libidn # OS X -$ gem install idn-ruby -``` - -## Semantic Versioning - -This project uses [Semantic Versioning](https://semver.org/). You can (and should) specify your -dependency using a pessimistic version constraint covering the major and minor -values: - -```ruby -spec.add_dependency 'addressable', '~> 2.7' -``` - -If you need a specific bug fix, you can also specify minimum tiny versions -without preventing updates to the latest minor release: - -```ruby -spec.add_dependency 'addressable', '~> 2.3', '>= 2.3.7' -``` diff --git a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable.rb b/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable.rb deleted file mode 100644 index b4e98b6..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable.rb +++ /dev/null @@ -1,4 +0,0 @@ -# frozen_string_literal: true - -require 'addressable/uri' -require 'addressable/template' diff --git a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable/idna.rb b/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable/idna.rb deleted file mode 100644 index 2dbd393..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable/idna.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -#-- -# Copyright (C) Bob Aman -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#++ - - -begin - require "addressable/idna/native" -rescue LoadError - # libidn or the idn gem was not available, fall back on a pure-Ruby - # implementation... - require "addressable/idna/pure" -end diff --git a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable/idna/native.rb b/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable/idna/native.rb deleted file mode 100644 index d3d1744..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable/idna/native.rb +++ /dev/null @@ -1,76 +0,0 @@ -# frozen_string_literal: true - -#-- -# Copyright (C) Bob Aman -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#++ - - -require "idn" - -module Addressable - module IDNA - def self.punycode_encode(value) - IDN::Punycode.encode(value.to_s) - end - - def self.punycode_decode(value) - IDN::Punycode.decode(value.to_s) - end - - class << self - # @deprecated Use {String#unicode_normalize(:nfkc)} instead - def unicode_normalize_kc(value) - value.to_s.unicode_normalize(:nfkc) - end - - extend Gem::Deprecate - deprecate :unicode_normalize_kc, "String#unicode_normalize(:nfkc)", 2023, 4 - end - - def self.to_ascii(value) - value.to_s.split('.', -1).map do |segment| - if segment.size > 0 && segment.size < 64 - IDN::Idna.toASCII(segment, IDN::Idna::ALLOW_UNASSIGNED) - elsif segment.size >= 64 - segment - else - '' - end - end.join('.') - end - - # Characters that change how a label displays without being visible - # themselves: controls, format characters such as bidi overrides and - # isolates, and default ignorable code points. libidn rejects most of - # them, but not those added to Unicode after the version it checks - # against, such as U+2066 to U+2069. Format characters that are also - # default ignorable are left out of the second set, since Ruby warns about - # a duplicated range in a character class. - DISPLAY_CHANGING = /[\p{Cc}\p{Cf}[\p{Default_Ignorable_Code_Point}&&\P{Cf}]]/ - - def self.to_unicode(value) - value.to_s.split('.', -1).map do |segment| - if segment.size > 0 && segment.size < 64 - decoded = IDN::Idna.toUnicode(segment, IDN::Idna::ALLOW_UNASSIGNED) - decoded =~ DISPLAY_CHANGING ? segment : decoded - elsif segment.size >= 64 - segment - else - '' - end - end.join('.') - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable/idna/pure.rb b/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable/idna/pure.rb deleted file mode 100644 index d027739..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable/idna/pure.rb +++ /dev/null @@ -1,4759 +0,0 @@ -# frozen_string_literal: true - -#-- -# Copyright (C) Bob Aman -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#++ - - -module Addressable - module IDNA - # This module is loosely based on idn_actionmailer by Mick Staugaard, - # the unicode library by Yoshida Masato, and the punycode implementation - # by Kazuhiro Nishiyama. Most of the code was copied verbatim, but - # some reformatting was done, and some translation from C was done. - # - # Without their code to work from as a base, we'd all still be relying - # on the presence of libidn. Which nobody ever seems to have installed. - # - # Original sources: - # http://github.com/staugaard/idn_actionmailer - # http://www.yoshidam.net/Ruby.html#unicode - # http://rubyforge.org/frs/?group_id=2550 - - ACE_PREFIX = "xn--" - - UTF8_REGEX = /\A(?: - [\x09\x0A\x0D\x20-\x7E] # ASCII - | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte - | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs - | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte - | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates - | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 - | [\xF1-\xF3][\x80-\xBF]{3} # planes 4nil5 - | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 - )*\z/mnx - - UTF8_REGEX_MULTIBYTE = /(?: - [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte - | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs - | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte - | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates - | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 - | [\xF1-\xF3][\x80-\xBF]{3} # planes 4nil5 - | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 - )/mnx - - # Characters that nameprep doesn't allow in a label (Section 5 of - # RFC 3491), or that it maps to nothing, so they can't be in a label that - # toASCII produces. Some code points are in more than one table; they're - # listed only under the first, since Ruby warns about a duplicated range - # in a character class. - NAMEPREP_PROHIBITED = Regexp.new("[" + [ - # Table C.1.2, non-ASCII space characters - "\u00A0\u1680\u2000-\u200B\u202F\u205F\u3000", - # Table C.2.2, non-ASCII control characters - "\u0080-\u009F\u06DD\u070F\u180E\u200C\u200D\u2028\u2029" + - "\u2060-\u2063\u206A-\u206F\uFEFF\uFFF9-\uFFFC\u{1D173}-\u{1D17A}", - # Table C.3, private use - "\uE000-\uF8FF\u{F0000}-\u{FFFFD}\u{100000}-\u{10FFFD}", - # Table C.4, non-character code points - "\uFDD0-\uFDEF" + (0..16).map do |plane| - [plane * 0x10000 + 0xFFFE, 0x2D, plane * 0x10000 + 0xFFFF].pack("U*") - end.join, - # Table C.6, inappropriate for plain text (U+FFF9 to U+FFFC are in C.2.2) - "\uFFFD", - # Table C.7, inappropriate for canonical representation - "\u2FF0-\u2FFB", - # Table C.8, change display properties or are deprecated (U+206A to - # U+206F are in C.2.2) - "\u0340\u0341\u200E\u200F\u202A-\u202E", - # Table C.9, tagging characters - "\u{E0001}\u{E0020}-\u{E007F}", - # Table B.1, commonly mapped to nothing (U+200B is in C.1.2, and U+200C, - # U+200D, U+2060 and U+FEFF are in C.2.2) - "\u00AD\u034F\u1806\u180B-\u180D\uFE00-\uFE0F" - ].join + "]") - - # Characters that change how a label displays without being visible - # themselves: controls, format characters such as bidi overrides and - # isolates, and default ignorable code points, including those added to - # Unicode after the version nameprep is based on. Format characters that - # are also default ignorable are left out of the second set, since Ruby - # warns about a duplicated range in a character class. - DISPLAY_CHANGING = /[\p{Cc}\p{Cf}[\p{Default_Ignorable_Code_Point}&&\P{Cf}]]/ - - # :startdoc: - - # Converts from a Unicode internationalized domain name to an ASCII - # domain name as described in RFC 3490. - def self.to_ascii(input) - input = input.to_s unless input.is_a?(String) - input = input.dup.force_encoding(Encoding::UTF_8).unicode_normalize(:nfkc) - if input.respond_to?(:force_encoding) - input.force_encoding(Encoding::ASCII_8BIT) - end - if input =~ UTF8_REGEX && input =~ UTF8_REGEX_MULTIBYTE - parts = unicode_downcase(input).split('.') - parts.map! do |part| - if part.respond_to?(:force_encoding) - part.force_encoding(Encoding::ASCII_8BIT) - end - if part =~ UTF8_REGEX && part =~ UTF8_REGEX_MULTIBYTE - ACE_PREFIX + punycode_encode(part) - else - part - end - end - parts.join('.') - else - input - end - end - - # Converts from an ASCII domain name to a Unicode internationalized - # domain name as described in RFC 3490. - def self.to_unicode(input) - input = input.to_s unless input.is_a?(String) - parts = input.split('.') - parts.map! do |part| - if part =~ /^#{ACE_PREFIX}(.+)/ - begin - decoded = punycode_decode(part[/^#{ACE_PREFIX}(.+)/, 1]) - # A label that doesn't convert back to itself isn't a valid - # A-label (Section 4.2 of RFC 3490, steps 6 and 7). That includes - # a label that decodes to only ASCII characters. A label with a - # character that would change how it displays is returned - # unchanged too. - if to_ascii(decoded).downcase != part.downcase || - decoded =~ NAMEPREP_PROHIBITED || decoded =~ DISPLAY_CHANGING - part - else - decoded - end - rescue Addressable::IDNA::PunycodeBadInput, - Addressable::IDNA::PunycodeBigOutput, - Addressable::IDNA::PunycodeOverflow, - RangeError, ArgumentError - # toUnicode is explicitly defined as never-fails by the spec - part - end - else - part - end - end - output = parts.join('.') - if output.respond_to?(:force_encoding) - output.force_encoding(Encoding::UTF_8) - end - output - end - - class << self - # @deprecated Use {String#unicode_normalize(:nfkc)} instead - def unicode_normalize_kc(value) - value.to_s.unicode_normalize(:nfkc) - end - - extend Gem::Deprecate - deprecate :unicode_normalize_kc, "String#unicode_normalize(:nfkc)", 2023, 4 - end - - ## - # Unicode aware downcase method. - # - # @api private - # @param [String] input - # The input string. - # @return [String] The downcased result. - def self.unicode_downcase(input) - input = input.to_s unless input.is_a?(String) - unpacked = input.unpack("U*") - unpacked.map! { |codepoint| lookup_unicode_lowercase(codepoint) } - return unpacked.pack("U*") - end - private_class_method :unicode_downcase - - def self.lookup_unicode_lowercase(codepoint) - codepoint_data = UNICODE_DATA[codepoint] - (codepoint_data ? - (codepoint_data[UNICODE_DATA_LOWERCASE] || codepoint) : - codepoint) - end - private_class_method :lookup_unicode_lowercase - - UNICODE_DATA_COMBINING_CLASS = 0 - UNICODE_DATA_EXCLUSION = 1 - UNICODE_DATA_CANONICAL = 2 - UNICODE_DATA_COMPATIBILITY = 3 - UNICODE_DATA_UPPERCASE = 4 - UNICODE_DATA_LOWERCASE = 5 - UNICODE_DATA_TITLECASE = 6 - - UNICODE_DATA = { - 65 => [0, 0, nil, nil, nil, 97, nil], - 66 => [0, 0, nil, nil, nil, 98, nil], - 67 => [0, 0, nil, nil, nil, 99, nil], - 68 => [0, 0, nil, nil, nil, 100, nil], - 69 => [0, 0, nil, nil, nil, 101, nil], - 70 => [0, 0, nil, nil, nil, 102, nil], - 71 => [0, 0, nil, nil, nil, 103, nil], - 72 => [0, 0, nil, nil, nil, 104, nil], - 73 => [0, 0, nil, nil, nil, 105, nil], - 74 => [0, 0, nil, nil, nil, 106, nil], - 75 => [0, 0, nil, nil, nil, 107, nil], - 76 => [0, 0, nil, nil, nil, 108, nil], - 77 => [0, 0, nil, nil, nil, 109, nil], - 78 => [0, 0, nil, nil, nil, 110, nil], - 79 => [0, 0, nil, nil, nil, 111, nil], - 80 => [0, 0, nil, nil, nil, 112, nil], - 81 => [0, 0, nil, nil, nil, 113, nil], - 82 => [0, 0, nil, nil, nil, 114, nil], - 83 => [0, 0, nil, nil, nil, 115, nil], - 84 => [0, 0, nil, nil, nil, 116, nil], - 85 => [0, 0, nil, nil, nil, 117, nil], - 86 => [0, 0, nil, nil, nil, 118, nil], - 87 => [0, 0, nil, nil, nil, 119, nil], - 88 => [0, 0, nil, nil, nil, 120, nil], - 89 => [0, 0, nil, nil, nil, 121, nil], - 90 => [0, 0, nil, nil, nil, 122, nil], - 97 => [0, 0, nil, nil, 65, nil, 65], - 98 => [0, 0, nil, nil, 66, nil, 66], - 99 => [0, 0, nil, nil, 67, nil, 67], - 100 => [0, 0, nil, nil, 68, nil, 68], - 101 => [0, 0, nil, nil, 69, nil, 69], - 102 => [0, 0, nil, nil, 70, nil, 70], - 103 => [0, 0, nil, nil, 71, nil, 71], - 104 => [0, 0, nil, nil, 72, nil, 72], - 105 => [0, 0, nil, nil, 73, nil, 73], - 106 => [0, 0, nil, nil, 74, nil, 74], - 107 => [0, 0, nil, nil, 75, nil, 75], - 108 => [0, 0, nil, nil, 76, nil, 76], - 109 => [0, 0, nil, nil, 77, nil, 77], - 110 => [0, 0, nil, nil, 78, nil, 78], - 111 => [0, 0, nil, nil, 79, nil, 79], - 112 => [0, 0, nil, nil, 80, nil, 80], - 113 => [0, 0, nil, nil, 81, nil, 81], - 114 => [0, 0, nil, nil, 82, nil, 82], - 115 => [0, 0, nil, nil, 83, nil, 83], - 116 => [0, 0, nil, nil, 84, nil, 84], - 117 => [0, 0, nil, nil, 85, nil, 85], - 118 => [0, 0, nil, nil, 86, nil, 86], - 119 => [0, 0, nil, nil, 87, nil, 87], - 120 => [0, 0, nil, nil, 88, nil, 88], - 121 => [0, 0, nil, nil, 89, nil, 89], - 122 => [0, 0, nil, nil, 90, nil, 90], - 160 => [0, 0, nil, " ", nil, nil, nil], - 168 => [0, 0, nil, " ̈", nil, nil, nil], - 170 => [0, 0, nil, "a", nil, nil, nil], - 175 => [0, 0, nil, " ̄", nil, nil, nil], - 178 => [0, 0, nil, "2", nil, nil, nil], - 179 => [0, 0, nil, "3", nil, nil, nil], - 180 => [0, 0, nil, " ́", nil, nil, nil], - 181 => [0, 0, nil, "μ", 924, nil, 924], - 184 => [0, 0, nil, " ̧", nil, nil, nil], - 185 => [0, 0, nil, "1", nil, nil, nil], - 186 => [0, 0, nil, "o", nil, nil, nil], - 188 => [0, 0, nil, "1⁄4", nil, nil, nil], - 189 => [0, 0, nil, "1⁄2", nil, nil, nil], - 190 => [0, 0, nil, "3⁄4", nil, nil, nil], - 192 => [0, 0, "À", "À", nil, 224, nil], - 193 => [0, 0, "Á", "Á", nil, 225, nil], - 194 => [0, 0, "Â", "Â", nil, 226, nil], - 195 => [0, 0, "Ã", "Ã", nil, 227, nil], - 196 => [0, 0, "Ä", "Ä", nil, 228, nil], - 197 => [0, 0, "Å", "Å", nil, 229, nil], - 198 => [0, 0, nil, nil, nil, 230, nil], - 199 => [0, 0, "Ç", "Ç", nil, 231, nil], - 200 => [0, 0, "È", "È", nil, 232, nil], - 201 => [0, 0, "É", "É", nil, 233, nil], - 202 => [0, 0, "Ê", "Ê", nil, 234, nil], - 203 => [0, 0, "Ë", "Ë", nil, 235, nil], - 204 => [0, 0, "Ì", "Ì", nil, 236, nil], - 205 => [0, 0, "Í", "Í", nil, 237, nil], - 206 => [0, 0, "Î", "Î", nil, 238, nil], - 207 => [0, 0, "Ï", "Ï", nil, 239, nil], - 208 => [0, 0, nil, nil, nil, 240, nil], - 209 => [0, 0, "Ñ", "Ñ", nil, 241, nil], - 210 => [0, 0, "Ò", "Ò", nil, 242, nil], - 211 => [0, 0, "Ó", "Ó", nil, 243, nil], - 212 => [0, 0, "Ô", "Ô", nil, 244, nil], - 213 => [0, 0, "Õ", "Õ", nil, 245, nil], - 214 => [0, 0, "Ö", "Ö", nil, 246, nil], - 216 => [0, 0, nil, nil, nil, 248, nil], - 217 => [0, 0, "Ù", "Ù", nil, 249, nil], - 218 => [0, 0, "Ú", "Ú", nil, 250, nil], - 219 => [0, 0, "Û", "Û", nil, 251, nil], - 220 => [0, 0, "Ü", "Ü", nil, 252, nil], - 221 => [0, 0, "Ý", "Ý", nil, 253, nil], - 222 => [0, 0, nil, nil, nil, 254, nil], - 224 => [0, 0, "à", "à", 192, nil, 192], - 225 => [0, 0, "á", "á", 193, nil, 193], - 226 => [0, 0, "â", "â", 194, nil, 194], - 227 => [0, 0, "ã", "ã", 195, nil, 195], - 228 => [0, 0, "ä", "ä", 196, nil, 196], - 229 => [0, 0, "å", "å", 197, nil, 197], - 230 => [0, 0, nil, nil, 198, nil, 198], - 231 => [0, 0, "ç", "ç", 199, nil, 199], - 232 => [0, 0, "è", "è", 200, nil, 200], - 233 => [0, 0, "é", "é", 201, nil, 201], - 234 => [0, 0, "ê", "ê", 202, nil, 202], - 235 => [0, 0, "ë", "ë", 203, nil, 203], - 236 => [0, 0, "ì", "ì", 204, nil, 204], - 237 => [0, 0, "í", "í", 205, nil, 205], - 238 => [0, 0, "î", "î", 206, nil, 206], - 239 => [0, 0, "ï", "ï", 207, nil, 207], - 240 => [0, 0, nil, nil, 208, nil, 208], - 241 => [0, 0, "ñ", "ñ", 209, nil, 209], - 242 => [0, 0, "ò", "ò", 210, nil, 210], - 243 => [0, 0, "ó", "ó", 211, nil, 211], - 244 => [0, 0, "ô", "ô", 212, nil, 212], - 245 => [0, 0, "õ", "õ", 213, nil, 213], - 246 => [0, 0, "ö", "ö", 214, nil, 214], - 248 => [0, 0, nil, nil, 216, nil, 216], - 249 => [0, 0, "ù", "ù", 217, nil, 217], - 250 => [0, 0, "ú", "ú", 218, nil, 218], - 251 => [0, 0, "û", "û", 219, nil, 219], - 252 => [0, 0, "ü", "ü", 220, nil, 220], - 253 => [0, 0, "ý", "ý", 221, nil, 221], - 254 => [0, 0, nil, nil, 222, nil, 222], - 255 => [0, 0, "ÿ", "ÿ", 376, nil, 376], - 256 => [0, 0, "Ā", "Ā", nil, 257, nil], - 257 => [0, 0, "ā", "ā", 256, nil, 256], - 258 => [0, 0, "Ă", "Ă", nil, 259, nil], - 259 => [0, 0, "ă", "ă", 258, nil, 258], - 260 => [0, 0, "Ą", "Ą", nil, 261, nil], - 261 => [0, 0, "ą", "ą", 260, nil, 260], - 262 => [0, 0, "Ć", "Ć", nil, 263, nil], - 263 => [0, 0, "ć", "ć", 262, nil, 262], - 264 => [0, 0, "Ĉ", "Ĉ", nil, 265, nil], - 265 => [0, 0, "ĉ", "ĉ", 264, nil, 264], - 266 => [0, 0, "Ċ", "Ċ", nil, 267, nil], - 267 => [0, 0, "ċ", "ċ", 266, nil, 266], - 268 => [0, 0, "Č", "Č", nil, 269, nil], - 269 => [0, 0, "č", "č", 268, nil, 268], - 270 => [0, 0, "Ď", "Ď", nil, 271, nil], - 271 => [0, 0, "ď", "ď", 270, nil, 270], - 272 => [0, 0, nil, nil, nil, 273, nil], - 273 => [0, 0, nil, nil, 272, nil, 272], - 274 => [0, 0, "Ē", "Ē", nil, 275, nil], - 275 => [0, 0, "ē", "ē", 274, nil, 274], - 276 => [0, 0, "Ĕ", "Ĕ", nil, 277, nil], - 277 => [0, 0, "ĕ", "ĕ", 276, nil, 276], - 278 => [0, 0, "Ė", "Ė", nil, 279, nil], - 279 => [0, 0, "ė", "ė", 278, nil, 278], - 280 => [0, 0, "Ę", "Ę", nil, 281, nil], - 281 => [0, 0, "ę", "ę", 280, nil, 280], - 282 => [0, 0, "Ě", "Ě", nil, 283, nil], - 283 => [0, 0, "ě", "ě", 282, nil, 282], - 284 => [0, 0, "Ĝ", "Ĝ", nil, 285, nil], - 285 => [0, 0, "ĝ", "ĝ", 284, nil, 284], - 286 => [0, 0, "Ğ", "Ğ", nil, 287, nil], - 287 => [0, 0, "ğ", "ğ", 286, nil, 286], - 288 => [0, 0, "Ġ", "Ġ", nil, 289, nil], - 289 => [0, 0, "ġ", "ġ", 288, nil, 288], - 290 => [0, 0, "Ģ", "Ģ", nil, 291, nil], - 291 => [0, 0, "ģ", "ģ", 290, nil, 290], - 292 => [0, 0, "Ĥ", "Ĥ", nil, 293, nil], - 293 => [0, 0, "ĥ", "ĥ", 292, nil, 292], - 294 => [0, 0, nil, nil, nil, 295, nil], - 295 => [0, 0, nil, nil, 294, nil, 294], - 296 => [0, 0, "Ĩ", "Ĩ", nil, 297, nil], - 297 => [0, 0, "ĩ", "ĩ", 296, nil, 296], - 298 => [0, 0, "Ī", "Ī", nil, 299, nil], - 299 => [0, 0, "ī", "ī", 298, nil, 298], - 300 => [0, 0, "Ĭ", "Ĭ", nil, 301, nil], - 301 => [0, 0, "ĭ", "ĭ", 300, nil, 300], - 302 => [0, 0, "Į", "Į", nil, 303, nil], - 303 => [0, 0, "į", "į", 302, nil, 302], - 304 => [0, 0, "İ", "İ", nil, 105, nil], - 305 => [0, 0, nil, nil, 73, nil, 73], - 306 => [0, 0, nil, "IJ", nil, 307, nil], - 307 => [0, 0, nil, "ij", 306, nil, 306], - 308 => [0, 0, "Ĵ", "Ĵ", nil, 309, nil], - 309 => [0, 0, "ĵ", "ĵ", 308, nil, 308], - 310 => [0, 0, "Ķ", "Ķ", nil, 311, nil], - 311 => [0, 0, "ķ", "ķ", 310, nil, 310], - 313 => [0, 0, "Ĺ", "Ĺ", nil, 314, nil], - 314 => [0, 0, "ĺ", "ĺ", 313, nil, 313], - 315 => [0, 0, "Ļ", "Ļ", nil, 316, nil], - 316 => [0, 0, "ļ", "ļ", 315, nil, 315], - 317 => [0, 0, "Ľ", "Ľ", nil, 318, nil], - 318 => [0, 0, "ľ", "ľ", 317, nil, 317], - 319 => [0, 0, nil, "L·", nil, 320, nil], - 320 => [0, 0, nil, "l·", 319, nil, 319], - 321 => [0, 0, nil, nil, nil, 322, nil], - 322 => [0, 0, nil, nil, 321, nil, 321], - 323 => [0, 0, "Ń", "Ń", nil, 324, nil], - 324 => [0, 0, "ń", "ń", 323, nil, 323], - 325 => [0, 0, "Ņ", "Ņ", nil, 326, nil], - 326 => [0, 0, "ņ", "ņ", 325, nil, 325], - 327 => [0, 0, "Ň", "Ň", nil, 328, nil], - 328 => [0, 0, "ň", "ň", 327, nil, 327], - 329 => [0, 0, nil, "ʼn", nil, nil, nil], - 330 => [0, 0, nil, nil, nil, 331, nil], - 331 => [0, 0, nil, nil, 330, nil, 330], - 332 => [0, 0, "Ō", "Ō", nil, 333, nil], - 333 => [0, 0, "ō", "ō", 332, nil, 332], - 334 => [0, 0, "Ŏ", "Ŏ", nil, 335, nil], - 335 => [0, 0, "ŏ", "ŏ", 334, nil, 334], - 336 => [0, 0, "Ő", "Ő", nil, 337, nil], - 337 => [0, 0, "ő", "ő", 336, nil, 336], - 338 => [0, 0, nil, nil, nil, 339, nil], - 339 => [0, 0, nil, nil, 338, nil, 338], - 340 => [0, 0, "Ŕ", "Ŕ", nil, 341, nil], - 341 => [0, 0, "ŕ", "ŕ", 340, nil, 340], - 342 => [0, 0, "Ŗ", "Ŗ", nil, 343, nil], - 343 => [0, 0, "ŗ", "ŗ", 342, nil, 342], - 344 => [0, 0, "Ř", "Ř", nil, 345, nil], - 345 => [0, 0, "ř", "ř", 344, nil, 344], - 346 => [0, 0, "Ś", "Ś", nil, 347, nil], - 347 => [0, 0, "ś", "ś", 346, nil, 346], - 348 => [0, 0, "Ŝ", "Ŝ", nil, 349, nil], - 349 => [0, 0, "ŝ", "ŝ", 348, nil, 348], - 350 => [0, 0, "Ş", "Ş", nil, 351, nil], - 351 => [0, 0, "ş", "ş", 350, nil, 350], - 352 => [0, 0, "Š", "Š", nil, 353, nil], - 353 => [0, 0, "š", "š", 352, nil, 352], - 354 => [0, 0, "Ţ", "Ţ", nil, 355, nil], - 355 => [0, 0, "ţ", "ţ", 354, nil, 354], - 356 => [0, 0, "Ť", "Ť", nil, 357, nil], - 357 => [0, 0, "ť", "ť", 356, nil, 356], - 358 => [0, 0, nil, nil, nil, 359, nil], - 359 => [0, 0, nil, nil, 358, nil, 358], - 360 => [0, 0, "Ũ", "Ũ", nil, 361, nil], - 361 => [0, 0, "ũ", "ũ", 360, nil, 360], - 362 => [0, 0, "Ū", "Ū", nil, 363, nil], - 363 => [0, 0, "ū", "ū", 362, nil, 362], - 364 => [0, 0, "Ŭ", "Ŭ", nil, 365, nil], - 365 => [0, 0, "ŭ", "ŭ", 364, nil, 364], - 366 => [0, 0, "Ů", "Ů", nil, 367, nil], - 367 => [0, 0, "ů", "ů", 366, nil, 366], - 368 => [0, 0, "Ű", "Ű", nil, 369, nil], - 369 => [0, 0, "ű", "ű", 368, nil, 368], - 370 => [0, 0, "Ų", "Ų", nil, 371, nil], - 371 => [0, 0, "ų", "ų", 370, nil, 370], - 372 => [0, 0, "Ŵ", "Ŵ", nil, 373, nil], - 373 => [0, 0, "ŵ", "ŵ", 372, nil, 372], - 374 => [0, 0, "Ŷ", "Ŷ", nil, 375, nil], - 375 => [0, 0, "ŷ", "ŷ", 374, nil, 374], - 376 => [0, 0, "Ÿ", "Ÿ", nil, 255, nil], - 377 => [0, 0, "Ź", "Ź", nil, 378, nil], - 378 => [0, 0, "ź", "ź", 377, nil, 377], - 379 => [0, 0, "Ż", "Ż", nil, 380, nil], - 380 => [0, 0, "ż", "ż", 379, nil, 379], - 381 => [0, 0, "Ž", "Ž", nil, 382, nil], - 382 => [0, 0, "ž", "ž", 381, nil, 381], - 383 => [0, 0, nil, "s", 83, nil, 83], - 385 => [0, 0, nil, nil, nil, 595, nil], - 386 => [0, 0, nil, nil, nil, 387, nil], - 387 => [0, 0, nil, nil, 386, nil, 386], - 388 => [0, 0, nil, nil, nil, 389, nil], - 389 => [0, 0, nil, nil, 388, nil, 388], - 390 => [0, 0, nil, nil, nil, 596, nil], - 391 => [0, 0, nil, nil, nil, 392, nil], - 392 => [0, 0, nil, nil, 391, nil, 391], - 393 => [0, 0, nil, nil, nil, 598, nil], - 394 => [0, 0, nil, nil, nil, 599, nil], - 395 => [0, 0, nil, nil, nil, 396, nil], - 396 => [0, 0, nil, nil, 395, nil, 395], - 398 => [0, 0, nil, nil, nil, 477, nil], - 399 => [0, 0, nil, nil, nil, 601, nil], - 400 => [0, 0, nil, nil, nil, 603, nil], - 401 => [0, 0, nil, nil, nil, 402, nil], - 402 => [0, 0, nil, nil, 401, nil, 401], - 403 => [0, 0, nil, nil, nil, 608, nil], - 404 => [0, 0, nil, nil, nil, 611, nil], - 405 => [0, 0, nil, nil, 502, nil, 502], - 406 => [0, 0, nil, nil, nil, 617, nil], - 407 => [0, 0, nil, nil, nil, 616, nil], - 408 => [0, 0, nil, nil, nil, 409, nil], - 409 => [0, 0, nil, nil, 408, nil, 408], - 412 => [0, 0, nil, nil, nil, 623, nil], - 413 => [0, 0, nil, nil, nil, 626, nil], - 415 => [0, 0, nil, nil, nil, 629, nil], - 416 => [0, 0, "Ơ", "Ơ", nil, 417, nil], - 417 => [0, 0, "ơ", "ơ", 416, nil, 416], - 418 => [0, 0, nil, nil, nil, 419, nil], - 419 => [0, 0, nil, nil, 418, nil, 418], - 420 => [0, 0, nil, nil, nil, 421, nil], - 421 => [0, 0, nil, nil, 420, nil, 420], - 422 => [0, 0, nil, nil, nil, 640, nil], - 423 => [0, 0, nil, nil, nil, 424, nil], - 424 => [0, 0, nil, nil, 423, nil, 423], - 425 => [0, 0, nil, nil, nil, 643, nil], - 428 => [0, 0, nil, nil, nil, 429, nil], - 429 => [0, 0, nil, nil, 428, nil, 428], - 430 => [0, 0, nil, nil, nil, 648, nil], - 431 => [0, 0, "Ư", "Ư", nil, 432, nil], - 432 => [0, 0, "ư", "ư", 431, nil, 431], - 433 => [0, 0, nil, nil, nil, 650, nil], - 434 => [0, 0, nil, nil, nil, 651, nil], - 435 => [0, 0, nil, nil, nil, 436, nil], - 436 => [0, 0, nil, nil, 435, nil, 435], - 437 => [0, 0, nil, nil, nil, 438, nil], - 438 => [0, 0, nil, nil, 437, nil, 437], - 439 => [0, 0, nil, nil, nil, 658, nil], - 440 => [0, 0, nil, nil, nil, 441, nil], - 441 => [0, 0, nil, nil, 440, nil, 440], - 444 => [0, 0, nil, nil, nil, 445, nil], - 445 => [0, 0, nil, nil, 444, nil, 444], - 447 => [0, 0, nil, nil, 503, nil, 503], - 452 => [0, 0, nil, "DŽ", nil, 454, 453], - 453 => [0, 0, nil, "Dž", 452, 454, nil], - 454 => [0, 0, nil, "dž", 452, nil, 453], - 455 => [0, 0, nil, "LJ", nil, 457, 456], - 456 => [0, 0, nil, "Lj", 455, 457, nil], - 457 => [0, 0, nil, "lj", 455, nil, 456], - 458 => [0, 0, nil, "NJ", nil, 460, 459], - 459 => [0, 0, nil, "Nj", 458, 460, nil], - 460 => [0, 0, nil, "nj", 458, nil, 459], - 461 => [0, 0, "Ǎ", "Ǎ", nil, 462, nil], - 462 => [0, 0, "ǎ", "ǎ", 461, nil, 461], - 463 => [0, 0, "Ǐ", "Ǐ", nil, 464, nil], - 464 => [0, 0, "ǐ", "ǐ", 463, nil, 463], - 465 => [0, 0, "Ǒ", "Ǒ", nil, 466, nil], - 466 => [0, 0, "ǒ", "ǒ", 465, nil, 465], - 467 => [0, 0, "Ǔ", "Ǔ", nil, 468, nil], - 468 => [0, 0, "ǔ", "ǔ", 467, nil, 467], - 469 => [0, 0, "Ǖ", "Ǖ", nil, 470, nil], - 470 => [0, 0, "ǖ", "ǖ", 469, nil, 469], - 471 => [0, 0, "Ǘ", "Ǘ", nil, 472, nil], - 472 => [0, 0, "ǘ", "ǘ", 471, nil, 471], - 473 => [0, 0, "Ǚ", "Ǚ", nil, 474, nil], - 474 => [0, 0, "ǚ", "ǚ", 473, nil, 473], - 475 => [0, 0, "Ǜ", "Ǜ", nil, 476, nil], - 476 => [0, 0, "ǜ", "ǜ", 475, nil, 475], - 477 => [0, 0, nil, nil, 398, nil, 398], - 478 => [0, 0, "Ǟ", "Ǟ", nil, 479, nil], - 479 => [0, 0, "ǟ", "ǟ", 478, nil, 478], - 480 => [0, 0, "Ǡ", "Ǡ", nil, 481, nil], - 481 => [0, 0, "ǡ", "ǡ", 480, nil, 480], - 482 => [0, 0, "Ǣ", "Ǣ", nil, 483, nil], - 483 => [0, 0, "ǣ", "ǣ", 482, nil, 482], - 484 => [0, 0, nil, nil, nil, 485, nil], - 485 => [0, 0, nil, nil, 484, nil, 484], - 486 => [0, 0, "Ǧ", "Ǧ", nil, 487, nil], - 487 => [0, 0, "ǧ", "ǧ", 486, nil, 486], - 488 => [0, 0, "Ǩ", "Ǩ", nil, 489, nil], - 489 => [0, 0, "ǩ", "ǩ", 488, nil, 488], - 490 => [0, 0, "Ǫ", "Ǫ", nil, 491, nil], - 491 => [0, 0, "ǫ", "ǫ", 490, nil, 490], - 492 => [0, 0, "Ǭ", "Ǭ", nil, 493, nil], - 493 => [0, 0, "ǭ", "ǭ", 492, nil, 492], - 494 => [0, 0, "Ǯ", "Ǯ", nil, 495, nil], - 495 => [0, 0, "ǯ", "ǯ", 494, nil, 494], - 496 => [0, 0, "ǰ", "ǰ", nil, nil, nil], - 497 => [0, 0, nil, "DZ", nil, 499, 498], - 498 => [0, 0, nil, "Dz", 497, 499, nil], - 499 => [0, 0, nil, "dz", 497, nil, 498], - 500 => [0, 0, "Ǵ", "Ǵ", nil, 501, nil], - 501 => [0, 0, "ǵ", "ǵ", 500, nil, 500], - 502 => [0, 0, nil, nil, nil, 405, nil], - 503 => [0, 0, nil, nil, nil, 447, nil], - 504 => [0, 0, "Ǹ", "Ǹ", nil, 505, nil], - 505 => [0, 0, "ǹ", "ǹ", 504, nil, 504], - 506 => [0, 0, "Ǻ", "Ǻ", nil, 507, nil], - 507 => [0, 0, "ǻ", "ǻ", 506, nil, 506], - 508 => [0, 0, "Ǽ", "Ǽ", nil, 509, nil], - 509 => [0, 0, "ǽ", "ǽ", 508, nil, 508], - 510 => [0, 0, "Ǿ", "Ǿ", nil, 511, nil], - 511 => [0, 0, "ǿ", "ǿ", 510, nil, 510], - 512 => [0, 0, "Ȁ", "Ȁ", nil, 513, nil], - 513 => [0, 0, "ȁ", "ȁ", 512, nil, 512], - 514 => [0, 0, "Ȃ", "Ȃ", nil, 515, nil], - 515 => [0, 0, "ȃ", "ȃ", 514, nil, 514], - 516 => [0, 0, "Ȅ", "Ȅ", nil, 517, nil], - 517 => [0, 0, "ȅ", "ȅ", 516, nil, 516], - 518 => [0, 0, "Ȇ", "Ȇ", nil, 519, nil], - 519 => [0, 0, "ȇ", "ȇ", 518, nil, 518], - 520 => [0, 0, "Ȉ", "Ȉ", nil, 521, nil], - 521 => [0, 0, "ȉ", "ȉ", 520, nil, 520], - 522 => [0, 0, "Ȋ", "Ȋ", nil, 523, nil], - 523 => [0, 0, "ȋ", "ȋ", 522, nil, 522], - 524 => [0, 0, "Ȍ", "Ȍ", nil, 525, nil], - 525 => [0, 0, "ȍ", "ȍ", 524, nil, 524], - 526 => [0, 0, "Ȏ", "Ȏ", nil, 527, nil], - 527 => [0, 0, "ȏ", "ȏ", 526, nil, 526], - 528 => [0, 0, "Ȑ", "Ȑ", nil, 529, nil], - 529 => [0, 0, "ȑ", "ȑ", 528, nil, 528], - 530 => [0, 0, "Ȓ", "Ȓ", nil, 531, nil], - 531 => [0, 0, "ȓ", "ȓ", 530, nil, 530], - 532 => [0, 0, "Ȕ", "Ȕ", nil, 533, nil], - 533 => [0, 0, "ȕ", "ȕ", 532, nil, 532], - 534 => [0, 0, "Ȗ", "Ȗ", nil, 535, nil], - 535 => [0, 0, "ȗ", "ȗ", 534, nil, 534], - 536 => [0, 0, "Ș", "Ș", nil, 537, nil], - 537 => [0, 0, "ș", "ș", 536, nil, 536], - 538 => [0, 0, "Ț", "Ț", nil, 539, nil], - 539 => [0, 0, "ț", "ț", 538, nil, 538], - 540 => [0, 0, nil, nil, nil, 541, nil], - 541 => [0, 0, nil, nil, 540, nil, 540], - 542 => [0, 0, "Ȟ", "Ȟ", nil, 543, nil], - 543 => [0, 0, "ȟ", "ȟ", 542, nil, 542], - 546 => [0, 0, nil, nil, nil, 547, nil], - 547 => [0, 0, nil, nil, 546, nil, 546], - 548 => [0, 0, nil, nil, nil, 549, nil], - 549 => [0, 0, nil, nil, 548, nil, 548], - 550 => [0, 0, "Ȧ", "Ȧ", nil, 551, nil], - 551 => [0, 0, "ȧ", "ȧ", 550, nil, 550], - 552 => [0, 0, "Ȩ", "Ȩ", nil, 553, nil], - 553 => [0, 0, "ȩ", "ȩ", 552, nil, 552], - 554 => [0, 0, "Ȫ", "Ȫ", nil, 555, nil], - 555 => [0, 0, "ȫ", "ȫ", 554, nil, 554], - 556 => [0, 0, "Ȭ", "Ȭ", nil, 557, nil], - 557 => [0, 0, "ȭ", "ȭ", 556, nil, 556], - 558 => [0, 0, "Ȯ", "Ȯ", nil, 559, nil], - 559 => [0, 0, "ȯ", "ȯ", 558, nil, 558], - 560 => [0, 0, "Ȱ", "Ȱ", nil, 561, nil], - 561 => [0, 0, "ȱ", "ȱ", 560, nil, 560], - 562 => [0, 0, "Ȳ", "Ȳ", nil, 563, nil], - 563 => [0, 0, "ȳ", "ȳ", 562, nil, 562], - 595 => [0, 0, nil, nil, 385, nil, 385], - 596 => [0, 0, nil, nil, 390, nil, 390], - 598 => [0, 0, nil, nil, 393, nil, 393], - 599 => [0, 0, nil, nil, 394, nil, 394], - 601 => [0, 0, nil, nil, 399, nil, 399], - 603 => [0, 0, nil, nil, 400, nil, 400], - 608 => [0, 0, nil, nil, 403, nil, 403], - 611 => [0, 0, nil, nil, 404, nil, 404], - 616 => [0, 0, nil, nil, 407, nil, 407], - 617 => [0, 0, nil, nil, 406, nil, 406], - 623 => [0, 0, nil, nil, 412, nil, 412], - 626 => [0, 0, nil, nil, 413, nil, 413], - 629 => [0, 0, nil, nil, 415, nil, 415], - 640 => [0, 0, nil, nil, 422, nil, 422], - 643 => [0, 0, nil, nil, 425, nil, 425], - 648 => [0, 0, nil, nil, 430, nil, 430], - 650 => [0, 0, nil, nil, 433, nil, 433], - 651 => [0, 0, nil, nil, 434, nil, 434], - 658 => [0, 0, nil, nil, 439, nil, 439], - 688 => [0, 0, nil, "h", nil, nil, nil], - 689 => [0, 0, nil, "ɦ", nil, nil, nil], - 690 => [0, 0, nil, "j", nil, nil, nil], - 691 => [0, 0, nil, "r", nil, nil, nil], - 692 => [0, 0, nil, "ɹ", nil, nil, nil], - 693 => [0, 0, nil, "ɻ", nil, nil, nil], - 694 => [0, 0, nil, "ʁ", nil, nil, nil], - 695 => [0, 0, nil, "w", nil, nil, nil], - 696 => [0, 0, nil, "y", nil, nil, nil], - 728 => [0, 0, nil, " ̆", nil, nil, nil], - 729 => [0, 0, nil, " ̇", nil, nil, nil], - 730 => [0, 0, nil, " ̊", nil, nil, nil], - 731 => [0, 0, nil, " ̨", nil, nil, nil], - 732 => [0, 0, nil, " ̃", nil, nil, nil], - 733 => [0, 0, nil, " ̋", nil, nil, nil], - 736 => [0, 0, nil, "ɣ", nil, nil, nil], - 737 => [0, 0, nil, "l", nil, nil, nil], - 738 => [0, 0, nil, "s", nil, nil, nil], - 739 => [0, 0, nil, "x", nil, nil, nil], - 740 => [0, 0, nil, "ʕ", nil, nil, nil], - 768 => [230, 0, nil, nil, nil, nil, nil], - 769 => [230, 0, nil, nil, nil, nil, nil], - 770 => [230, 0, nil, nil, nil, nil, nil], - 771 => [230, 0, nil, nil, nil, nil, nil], - 772 => [230, 0, nil, nil, nil, nil, nil], - 773 => [230, 0, nil, nil, nil, nil, nil], - 774 => [230, 0, nil, nil, nil, nil, nil], - 775 => [230, 0, nil, nil, nil, nil, nil], - 776 => [230, 0, nil, nil, nil, nil, nil], - 777 => [230, 0, nil, nil, nil, nil, nil], - 778 => [230, 0, nil, nil, nil, nil, nil], - 779 => [230, 0, nil, nil, nil, nil, nil], - 780 => [230, 0, nil, nil, nil, nil, nil], - 781 => [230, 0, nil, nil, nil, nil, nil], - 782 => [230, 0, nil, nil, nil, nil, nil], - 783 => [230, 0, nil, nil, nil, nil, nil], - 784 => [230, 0, nil, nil, nil, nil, nil], - 785 => [230, 0, nil, nil, nil, nil, nil], - 786 => [230, 0, nil, nil, nil, nil, nil], - 787 => [230, 0, nil, nil, nil, nil, nil], - 788 => [230, 0, nil, nil, nil, nil, nil], - 789 => [232, 0, nil, nil, nil, nil, nil], - 790 => [220, 0, nil, nil, nil, nil, nil], - 791 => [220, 0, nil, nil, nil, nil, nil], - 792 => [220, 0, nil, nil, nil, nil, nil], - 793 => [220, 0, nil, nil, nil, nil, nil], - 794 => [232, 0, nil, nil, nil, nil, nil], - 795 => [216, 0, nil, nil, nil, nil, nil], - 796 => [220, 0, nil, nil, nil, nil, nil], - 797 => [220, 0, nil, nil, nil, nil, nil], - 798 => [220, 0, nil, nil, nil, nil, nil], - 799 => [220, 0, nil, nil, nil, nil, nil], - 800 => [220, 0, nil, nil, nil, nil, nil], - 801 => [202, 0, nil, nil, nil, nil, nil], - 802 => [202, 0, nil, nil, nil, nil, nil], - 803 => [220, 0, nil, nil, nil, nil, nil], - 804 => [220, 0, nil, nil, nil, nil, nil], - 805 => [220, 0, nil, nil, nil, nil, nil], - 806 => [220, 0, nil, nil, nil, nil, nil], - 807 => [202, 0, nil, nil, nil, nil, nil], - 808 => [202, 0, nil, nil, nil, nil, nil], - 809 => [220, 0, nil, nil, nil, nil, nil], - 810 => [220, 0, nil, nil, nil, nil, nil], - 811 => [220, 0, nil, nil, nil, nil, nil], - 812 => [220, 0, nil, nil, nil, nil, nil], - 813 => [220, 0, nil, nil, nil, nil, nil], - 814 => [220, 0, nil, nil, nil, nil, nil], - 815 => [220, 0, nil, nil, nil, nil, nil], - 816 => [220, 0, nil, nil, nil, nil, nil], - 817 => [220, 0, nil, nil, nil, nil, nil], - 818 => [220, 0, nil, nil, nil, nil, nil], - 819 => [220, 0, nil, nil, nil, nil, nil], - 820 => [1, 0, nil, nil, nil, nil, nil], - 821 => [1, 0, nil, nil, nil, nil, nil], - 822 => [1, 0, nil, nil, nil, nil, nil], - 823 => [1, 0, nil, nil, nil, nil, nil], - 824 => [1, 0, nil, nil, nil, nil, nil], - 825 => [220, 0, nil, nil, nil, nil, nil], - 826 => [220, 0, nil, nil, nil, nil, nil], - 827 => [220, 0, nil, nil, nil, nil, nil], - 828 => [220, 0, nil, nil, nil, nil, nil], - 829 => [230, 0, nil, nil, nil, nil, nil], - 830 => [230, 0, nil, nil, nil, nil, nil], - 831 => [230, 0, nil, nil, nil, nil, nil], - 832 => [230, 2, "̀", "̀", nil, nil, nil], - 833 => [230, 2, "́", "́", nil, nil, nil], - 834 => [230, 0, nil, nil, nil, nil, nil], - 835 => [230, 2, "̓", "̓", nil, nil, nil], - 836 => [230, 3, "̈́", "̈́", nil, nil, nil], - 837 => [240, 0, nil, nil, 921, nil, 921], - 838 => [230, 0, nil, nil, nil, nil, nil], - 839 => [220, 0, nil, nil, nil, nil, nil], - 840 => [220, 0, nil, nil, nil, nil, nil], - 841 => [220, 0, nil, nil, nil, nil, nil], - 842 => [230, 0, nil, nil, nil, nil, nil], - 843 => [230, 0, nil, nil, nil, nil, nil], - 844 => [230, 0, nil, nil, nil, nil, nil], - 845 => [220, 0, nil, nil, nil, nil, nil], - 846 => [220, 0, nil, nil, nil, nil, nil], - 864 => [234, 0, nil, nil, nil, nil, nil], - 865 => [234, 0, nil, nil, nil, nil, nil], - 866 => [233, 0, nil, nil, nil, nil, nil], - 884 => [0, 2, "ʹ", "ʹ", nil, nil, nil], - 890 => [0, 0, nil, " ͅ", nil, nil, nil], - 894 => [0, 2, ";", ";", nil, nil, nil], - 900 => [0, 0, nil, " ́", nil, nil, nil], - 901 => [0, 0, "΅", "΅", nil, nil, nil], - 902 => [0, 0, "Ά", "Ά", nil, 940, nil], - 903 => [0, 2, "·", "·", nil, nil, nil], - 904 => [0, 0, "Έ", "Έ", nil, 941, nil], - 905 => [0, 0, "Ή", "Ή", nil, 942, nil], - 906 => [0, 0, "Ί", "Ί", nil, 943, nil], - 908 => [0, 0, "Ό", "Ό", nil, 972, nil], - 910 => [0, 0, "Ύ", "Ύ", nil, 973, nil], - 911 => [0, 0, "Ώ", "Ώ", nil, 974, nil], - 912 => [0, 0, "ΐ", "ΐ", nil, nil, nil], - 913 => [0, 0, nil, nil, nil, 945, nil], - 914 => [0, 0, nil, nil, nil, 946, nil], - 915 => [0, 0, nil, nil, nil, 947, nil], - 916 => [0, 0, nil, nil, nil, 948, nil], - 917 => [0, 0, nil, nil, nil, 949, nil], - 918 => [0, 0, nil, nil, nil, 950, nil], - 919 => [0, 0, nil, nil, nil, 951, nil], - 920 => [0, 0, nil, nil, nil, 952, nil], - 921 => [0, 0, nil, nil, nil, 953, nil], - 922 => [0, 0, nil, nil, nil, 954, nil], - 923 => [0, 0, nil, nil, nil, 955, nil], - 924 => [0, 0, nil, nil, nil, 956, nil], - 925 => [0, 0, nil, nil, nil, 957, nil], - 926 => [0, 0, nil, nil, nil, 958, nil], - 927 => [0, 0, nil, nil, nil, 959, nil], - 928 => [0, 0, nil, nil, nil, 960, nil], - 929 => [0, 0, nil, nil, nil, 961, nil], - 931 => [0, 0, nil, nil, nil, 963, nil], - 932 => [0, 0, nil, nil, nil, 964, nil], - 933 => [0, 0, nil, nil, nil, 965, nil], - 934 => [0, 0, nil, nil, nil, 966, nil], - 935 => [0, 0, nil, nil, nil, 967, nil], - 936 => [0, 0, nil, nil, nil, 968, nil], - 937 => [0, 0, nil, nil, nil, 969, nil], - 938 => [0, 0, "Ϊ", "Ϊ", nil, 970, nil], - 939 => [0, 0, "Ϋ", "Ϋ", nil, 971, nil], - 940 => [0, 0, "ά", "ά", 902, nil, 902], - 941 => [0, 0, "έ", "έ", 904, nil, 904], - 942 => [0, 0, "ή", "ή", 905, nil, 905], - 943 => [0, 0, "ί", "ί", 906, nil, 906], - 944 => [0, 0, "ΰ", "ΰ", nil, nil, nil], - 945 => [0, 0, nil, nil, 913, nil, 913], - 946 => [0, 0, nil, nil, 914, nil, 914], - 947 => [0, 0, nil, nil, 915, nil, 915], - 948 => [0, 0, nil, nil, 916, nil, 916], - 949 => [0, 0, nil, nil, 917, nil, 917], - 950 => [0, 0, nil, nil, 918, nil, 918], - 951 => [0, 0, nil, nil, 919, nil, 919], - 952 => [0, 0, nil, nil, 920, nil, 920], - 953 => [0, 0, nil, nil, 921, nil, 921], - 954 => [0, 0, nil, nil, 922, nil, 922], - 955 => [0, 0, nil, nil, 923, nil, 923], - 956 => [0, 0, nil, nil, 924, nil, 924], - 957 => [0, 0, nil, nil, 925, nil, 925], - 958 => [0, 0, nil, nil, 926, nil, 926], - 959 => [0, 0, nil, nil, 927, nil, 927], - 960 => [0, 0, nil, nil, 928, nil, 928], - 961 => [0, 0, nil, nil, 929, nil, 929], - 962 => [0, 0, nil, nil, 931, nil, 931], - 963 => [0, 0, nil, nil, 931, nil, 931], - 964 => [0, 0, nil, nil, 932, nil, 932], - 965 => [0, 0, nil, nil, 933, nil, 933], - 966 => [0, 0, nil, nil, 934, nil, 934], - 967 => [0, 0, nil, nil, 935, nil, 935], - 968 => [0, 0, nil, nil, 936, nil, 936], - 969 => [0, 0, nil, nil, 937, nil, 937], - 970 => [0, 0, "ϊ", "ϊ", 938, nil, 938], - 971 => [0, 0, "ϋ", "ϋ", 939, nil, 939], - 972 => [0, 0, "ό", "ό", 908, nil, 908], - 973 => [0, 0, "ύ", "ύ", 910, nil, 910], - 974 => [0, 0, "ώ", "ώ", 911, nil, 911], - 976 => [0, 0, nil, "β", 914, nil, 914], - 977 => [0, 0, nil, "θ", 920, nil, 920], - 978 => [0, 0, nil, "Υ", nil, nil, nil], - 979 => [0, 0, "ϓ", "ϓ", nil, nil, nil], - 980 => [0, 0, "ϔ", "ϔ", nil, nil, nil], - 981 => [0, 0, nil, "φ", 934, nil, 934], - 982 => [0, 0, nil, "π", 928, nil, 928], - 986 => [0, 0, nil, nil, nil, 987, nil], - 987 => [0, 0, nil, nil, 986, nil, 986], - 988 => [0, 0, nil, nil, nil, 989, nil], - 989 => [0, 0, nil, nil, 988, nil, 988], - 990 => [0, 0, nil, nil, nil, 991, nil], - 991 => [0, 0, nil, nil, 990, nil, 990], - 992 => [0, 0, nil, nil, nil, 993, nil], - 993 => [0, 0, nil, nil, 992, nil, 992], - 994 => [0, 0, nil, nil, nil, 995, nil], - 995 => [0, 0, nil, nil, 994, nil, 994], - 996 => [0, 0, nil, nil, nil, 997, nil], - 997 => [0, 0, nil, nil, 996, nil, 996], - 998 => [0, 0, nil, nil, nil, 999, nil], - 999 => [0, 0, nil, nil, 998, nil, 998], - 1000 => [0, 0, nil, nil, nil, 1001, nil], - 1001 => [0, 0, nil, nil, 1000, nil, 1000], - 1002 => [0, 0, nil, nil, nil, 1003, nil], - 1003 => [0, 0, nil, nil, 1002, nil, 1002], - 1004 => [0, 0, nil, nil, nil, 1005, nil], - 1005 => [0, 0, nil, nil, 1004, nil, 1004], - 1006 => [0, 0, nil, nil, nil, 1007, nil], - 1007 => [0, 0, nil, nil, 1006, nil, 1006], - 1008 => [0, 0, nil, "κ", 922, nil, 922], - 1009 => [0, 0, nil, "ρ", 929, nil, 929], - 1010 => [0, 0, nil, "ς", 931, nil, 931], - 1024 => [0, 0, "Ѐ", "Ѐ", nil, 1104, nil], - 1025 => [0, 0, "Ё", "Ё", nil, 1105, nil], - 1026 => [0, 0, nil, nil, nil, 1106, nil], - 1027 => [0, 0, "Ѓ", "Ѓ", nil, 1107, nil], - 1028 => [0, 0, nil, nil, nil, 1108, nil], - 1029 => [0, 0, nil, nil, nil, 1109, nil], - 1030 => [0, 0, nil, nil, nil, 1110, nil], - 1031 => [0, 0, "Ї", "Ї", nil, 1111, nil], - 1032 => [0, 0, nil, nil, nil, 1112, nil], - 1033 => [0, 0, nil, nil, nil, 1113, nil], - 1034 => [0, 0, nil, nil, nil, 1114, nil], - 1035 => [0, 0, nil, nil, nil, 1115, nil], - 1036 => [0, 0, "Ќ", "Ќ", nil, 1116, nil], - 1037 => [0, 0, "Ѝ", "Ѝ", nil, 1117, nil], - 1038 => [0, 0, "Ў", "Ў", nil, 1118, nil], - 1039 => [0, 0, nil, nil, nil, 1119, nil], - 1040 => [0, 0, nil, nil, nil, 1072, nil], - 1041 => [0, 0, nil, nil, nil, 1073, nil], - 1042 => [0, 0, nil, nil, nil, 1074, nil], - 1043 => [0, 0, nil, nil, nil, 1075, nil], - 1044 => [0, 0, nil, nil, nil, 1076, nil], - 1045 => [0, 0, nil, nil, nil, 1077, nil], - 1046 => [0, 0, nil, nil, nil, 1078, nil], - 1047 => [0, 0, nil, nil, nil, 1079, nil], - 1048 => [0, 0, nil, nil, nil, 1080, nil], - 1049 => [0, 0, "Й", "Й", nil, 1081, nil], - 1050 => [0, 0, nil, nil, nil, 1082, nil], - 1051 => [0, 0, nil, nil, nil, 1083, nil], - 1052 => [0, 0, nil, nil, nil, 1084, nil], - 1053 => [0, 0, nil, nil, nil, 1085, nil], - 1054 => [0, 0, nil, nil, nil, 1086, nil], - 1055 => [0, 0, nil, nil, nil, 1087, nil], - 1056 => [0, 0, nil, nil, nil, 1088, nil], - 1057 => [0, 0, nil, nil, nil, 1089, nil], - 1058 => [0, 0, nil, nil, nil, 1090, nil], - 1059 => [0, 0, nil, nil, nil, 1091, nil], - 1060 => [0, 0, nil, nil, nil, 1092, nil], - 1061 => [0, 0, nil, nil, nil, 1093, nil], - 1062 => [0, 0, nil, nil, nil, 1094, nil], - 1063 => [0, 0, nil, nil, nil, 1095, nil], - 1064 => [0, 0, nil, nil, nil, 1096, nil], - 1065 => [0, 0, nil, nil, nil, 1097, nil], - 1066 => [0, 0, nil, nil, nil, 1098, nil], - 1067 => [0, 0, nil, nil, nil, 1099, nil], - 1068 => [0, 0, nil, nil, nil, 1100, nil], - 1069 => [0, 0, nil, nil, nil, 1101, nil], - 1070 => [0, 0, nil, nil, nil, 1102, nil], - 1071 => [0, 0, nil, nil, nil, 1103, nil], - 1072 => [0, 0, nil, nil, 1040, nil, 1040], - 1073 => [0, 0, nil, nil, 1041, nil, 1041], - 1074 => [0, 0, nil, nil, 1042, nil, 1042], - 1075 => [0, 0, nil, nil, 1043, nil, 1043], - 1076 => [0, 0, nil, nil, 1044, nil, 1044], - 1077 => [0, 0, nil, nil, 1045, nil, 1045], - 1078 => [0, 0, nil, nil, 1046, nil, 1046], - 1079 => [0, 0, nil, nil, 1047, nil, 1047], - 1080 => [0, 0, nil, nil, 1048, nil, 1048], - 1081 => [0, 0, "й", "й", 1049, nil, 1049], - 1082 => [0, 0, nil, nil, 1050, nil, 1050], - 1083 => [0, 0, nil, nil, 1051, nil, 1051], - 1084 => [0, 0, nil, nil, 1052, nil, 1052], - 1085 => [0, 0, nil, nil, 1053, nil, 1053], - 1086 => [0, 0, nil, nil, 1054, nil, 1054], - 1087 => [0, 0, nil, nil, 1055, nil, 1055], - 1088 => [0, 0, nil, nil, 1056, nil, 1056], - 1089 => [0, 0, nil, nil, 1057, nil, 1057], - 1090 => [0, 0, nil, nil, 1058, nil, 1058], - 1091 => [0, 0, nil, nil, 1059, nil, 1059], - 1092 => [0, 0, nil, nil, 1060, nil, 1060], - 1093 => [0, 0, nil, nil, 1061, nil, 1061], - 1094 => [0, 0, nil, nil, 1062, nil, 1062], - 1095 => [0, 0, nil, nil, 1063, nil, 1063], - 1096 => [0, 0, nil, nil, 1064, nil, 1064], - 1097 => [0, 0, nil, nil, 1065, nil, 1065], - 1098 => [0, 0, nil, nil, 1066, nil, 1066], - 1099 => [0, 0, nil, nil, 1067, nil, 1067], - 1100 => [0, 0, nil, nil, 1068, nil, 1068], - 1101 => [0, 0, nil, nil, 1069, nil, 1069], - 1102 => [0, 0, nil, nil, 1070, nil, 1070], - 1103 => [0, 0, nil, nil, 1071, nil, 1071], - 1104 => [0, 0, "ѐ", "ѐ", 1024, nil, 1024], - 1105 => [0, 0, "ё", "ё", 1025, nil, 1025], - 1106 => [0, 0, nil, nil, 1026, nil, 1026], - 1107 => [0, 0, "ѓ", "ѓ", 1027, nil, 1027], - 1108 => [0, 0, nil, nil, 1028, nil, 1028], - 1109 => [0, 0, nil, nil, 1029, nil, 1029], - 1110 => [0, 0, nil, nil, 1030, nil, 1030], - 1111 => [0, 0, "ї", "ї", 1031, nil, 1031], - 1112 => [0, 0, nil, nil, 1032, nil, 1032], - 1113 => [0, 0, nil, nil, 1033, nil, 1033], - 1114 => [0, 0, nil, nil, 1034, nil, 1034], - 1115 => [0, 0, nil, nil, 1035, nil, 1035], - 1116 => [0, 0, "ќ", "ќ", 1036, nil, 1036], - 1117 => [0, 0, "ѝ", "ѝ", 1037, nil, 1037], - 1118 => [0, 0, "ў", "ў", 1038, nil, 1038], - 1119 => [0, 0, nil, nil, 1039, nil, 1039], - 1120 => [0, 0, nil, nil, nil, 1121, nil], - 1121 => [0, 0, nil, nil, 1120, nil, 1120], - 1122 => [0, 0, nil, nil, nil, 1123, nil], - 1123 => [0, 0, nil, nil, 1122, nil, 1122], - 1124 => [0, 0, nil, nil, nil, 1125, nil], - 1125 => [0, 0, nil, nil, 1124, nil, 1124], - 1126 => [0, 0, nil, nil, nil, 1127, nil], - 1127 => [0, 0, nil, nil, 1126, nil, 1126], - 1128 => [0, 0, nil, nil, nil, 1129, nil], - 1129 => [0, 0, nil, nil, 1128, nil, 1128], - 1130 => [0, 0, nil, nil, nil, 1131, nil], - 1131 => [0, 0, nil, nil, 1130, nil, 1130], - 1132 => [0, 0, nil, nil, nil, 1133, nil], - 1133 => [0, 0, nil, nil, 1132, nil, 1132], - 1134 => [0, 0, nil, nil, nil, 1135, nil], - 1135 => [0, 0, nil, nil, 1134, nil, 1134], - 1136 => [0, 0, nil, nil, nil, 1137, nil], - 1137 => [0, 0, nil, nil, 1136, nil, 1136], - 1138 => [0, 0, nil, nil, nil, 1139, nil], - 1139 => [0, 0, nil, nil, 1138, nil, 1138], - 1140 => [0, 0, nil, nil, nil, 1141, nil], - 1141 => [0, 0, nil, nil, 1140, nil, 1140], - 1142 => [0, 0, "Ѷ", "Ѷ", nil, 1143, nil], - 1143 => [0, 0, "ѷ", "ѷ", 1142, nil, 1142], - 1144 => [0, 0, nil, nil, nil, 1145, nil], - 1145 => [0, 0, nil, nil, 1144, nil, 1144], - 1146 => [0, 0, nil, nil, nil, 1147, nil], - 1147 => [0, 0, nil, nil, 1146, nil, 1146], - 1148 => [0, 0, nil, nil, nil, 1149, nil], - 1149 => [0, 0, nil, nil, 1148, nil, 1148], - 1150 => [0, 0, nil, nil, nil, 1151, nil], - 1151 => [0, 0, nil, nil, 1150, nil, 1150], - 1152 => [0, 0, nil, nil, nil, 1153, nil], - 1153 => [0, 0, nil, nil, 1152, nil, 1152], - 1155 => [230, 0, nil, nil, nil, nil, nil], - 1156 => [230, 0, nil, nil, nil, nil, nil], - 1157 => [230, 0, nil, nil, nil, nil, nil], - 1158 => [230, 0, nil, nil, nil, nil, nil], - 1164 => [0, 0, nil, nil, nil, 1165, nil], - 1165 => [0, 0, nil, nil, 1164, nil, 1164], - 1166 => [0, 0, nil, nil, nil, 1167, nil], - 1167 => [0, 0, nil, nil, 1166, nil, 1166], - 1168 => [0, 0, nil, nil, nil, 1169, nil], - 1169 => [0, 0, nil, nil, 1168, nil, 1168], - 1170 => [0, 0, nil, nil, nil, 1171, nil], - 1171 => [0, 0, nil, nil, 1170, nil, 1170], - 1172 => [0, 0, nil, nil, nil, 1173, nil], - 1173 => [0, 0, nil, nil, 1172, nil, 1172], - 1174 => [0, 0, nil, nil, nil, 1175, nil], - 1175 => [0, 0, nil, nil, 1174, nil, 1174], - 1176 => [0, 0, nil, nil, nil, 1177, nil], - 1177 => [0, 0, nil, nil, 1176, nil, 1176], - 1178 => [0, 0, nil, nil, nil, 1179, nil], - 1179 => [0, 0, nil, nil, 1178, nil, 1178], - 1180 => [0, 0, nil, nil, nil, 1181, nil], - 1181 => [0, 0, nil, nil, 1180, nil, 1180], - 1182 => [0, 0, nil, nil, nil, 1183, nil], - 1183 => [0, 0, nil, nil, 1182, nil, 1182], - 1184 => [0, 0, nil, nil, nil, 1185, nil], - 1185 => [0, 0, nil, nil, 1184, nil, 1184], - 1186 => [0, 0, nil, nil, nil, 1187, nil], - 1187 => [0, 0, nil, nil, 1186, nil, 1186], - 1188 => [0, 0, nil, nil, nil, 1189, nil], - 1189 => [0, 0, nil, nil, 1188, nil, 1188], - 1190 => [0, 0, nil, nil, nil, 1191, nil], - 1191 => [0, 0, nil, nil, 1190, nil, 1190], - 1192 => [0, 0, nil, nil, nil, 1193, nil], - 1193 => [0, 0, nil, nil, 1192, nil, 1192], - 1194 => [0, 0, nil, nil, nil, 1195, nil], - 1195 => [0, 0, nil, nil, 1194, nil, 1194], - 1196 => [0, 0, nil, nil, nil, 1197, nil], - 1197 => [0, 0, nil, nil, 1196, nil, 1196], - 1198 => [0, 0, nil, nil, nil, 1199, nil], - 1199 => [0, 0, nil, nil, 1198, nil, 1198], - 1200 => [0, 0, nil, nil, nil, 1201, nil], - 1201 => [0, 0, nil, nil, 1200, nil, 1200], - 1202 => [0, 0, nil, nil, nil, 1203, nil], - 1203 => [0, 0, nil, nil, 1202, nil, 1202], - 1204 => [0, 0, nil, nil, nil, 1205, nil], - 1205 => [0, 0, nil, nil, 1204, nil, 1204], - 1206 => [0, 0, nil, nil, nil, 1207, nil], - 1207 => [0, 0, nil, nil, 1206, nil, 1206], - 1208 => [0, 0, nil, nil, nil, 1209, nil], - 1209 => [0, 0, nil, nil, 1208, nil, 1208], - 1210 => [0, 0, nil, nil, nil, 1211, nil], - 1211 => [0, 0, nil, nil, 1210, nil, 1210], - 1212 => [0, 0, nil, nil, nil, 1213, nil], - 1213 => [0, 0, nil, nil, 1212, nil, 1212], - 1214 => [0, 0, nil, nil, nil, 1215, nil], - 1215 => [0, 0, nil, nil, 1214, nil, 1214], - 1217 => [0, 0, "Ӂ", "Ӂ", nil, 1218, nil], - 1218 => [0, 0, "ӂ", "ӂ", 1217, nil, 1217], - 1219 => [0, 0, nil, nil, nil, 1220, nil], - 1220 => [0, 0, nil, nil, 1219, nil, 1219], - 1223 => [0, 0, nil, nil, nil, 1224, nil], - 1224 => [0, 0, nil, nil, 1223, nil, 1223], - 1227 => [0, 0, nil, nil, nil, 1228, nil], - 1228 => [0, 0, nil, nil, 1227, nil, 1227], - 1232 => [0, 0, "Ӑ", "Ӑ", nil, 1233, nil], - 1233 => [0, 0, "ӑ", "ӑ", 1232, nil, 1232], - 1234 => [0, 0, "Ӓ", "Ӓ", nil, 1235, nil], - 1235 => [0, 0, "ӓ", "ӓ", 1234, nil, 1234], - 1236 => [0, 0, nil, nil, nil, 1237, nil], - 1237 => [0, 0, nil, nil, 1236, nil, 1236], - 1238 => [0, 0, "Ӗ", "Ӗ", nil, 1239, nil], - 1239 => [0, 0, "ӗ", "ӗ", 1238, nil, 1238], - 1240 => [0, 0, nil, nil, nil, 1241, nil], - 1241 => [0, 0, nil, nil, 1240, nil, 1240], - 1242 => [0, 0, "Ӛ", "Ӛ", nil, 1243, nil], - 1243 => [0, 0, "ӛ", "ӛ", 1242, nil, 1242], - 1244 => [0, 0, "Ӝ", "Ӝ", nil, 1245, nil], - 1245 => [0, 0, "ӝ", "ӝ", 1244, nil, 1244], - 1246 => [0, 0, "Ӟ", "Ӟ", nil, 1247, nil], - 1247 => [0, 0, "ӟ", "ӟ", 1246, nil, 1246], - 1248 => [0, 0, nil, nil, nil, 1249, nil], - 1249 => [0, 0, nil, nil, 1248, nil, 1248], - 1250 => [0, 0, "Ӣ", "Ӣ", nil, 1251, nil], - 1251 => [0, 0, "ӣ", "ӣ", 1250, nil, 1250], - 1252 => [0, 0, "Ӥ", "Ӥ", nil, 1253, nil], - 1253 => [0, 0, "ӥ", "ӥ", 1252, nil, 1252], - 1254 => [0, 0, "Ӧ", "Ӧ", nil, 1255, nil], - 1255 => [0, 0, "ӧ", "ӧ", 1254, nil, 1254], - 1256 => [0, 0, nil, nil, nil, 1257, nil], - 1257 => [0, 0, nil, nil, 1256, nil, 1256], - 1258 => [0, 0, "Ӫ", "Ӫ", nil, 1259, nil], - 1259 => [0, 0, "ӫ", "ӫ", 1258, nil, 1258], - 1260 => [0, 0, "Ӭ", "Ӭ", nil, 1261, nil], - 1261 => [0, 0, "ӭ", "ӭ", 1260, nil, 1260], - 1262 => [0, 0, "Ӯ", "Ӯ", nil, 1263, nil], - 1263 => [0, 0, "ӯ", "ӯ", 1262, nil, 1262], - 1264 => [0, 0, "Ӱ", "Ӱ", nil, 1265, nil], - 1265 => [0, 0, "ӱ", "ӱ", 1264, nil, 1264], - 1266 => [0, 0, "Ӳ", "Ӳ", nil, 1267, nil], - 1267 => [0, 0, "ӳ", "ӳ", 1266, nil, 1266], - 1268 => [0, 0, "Ӵ", "Ӵ", nil, 1269, nil], - 1269 => [0, 0, "ӵ", "ӵ", 1268, nil, 1268], - 1272 => [0, 0, "Ӹ", "Ӹ", nil, 1273, nil], - 1273 => [0, 0, "ӹ", "ӹ", 1272, nil, 1272], - 1329 => [0, 0, nil, nil, nil, 1377, nil], - 1330 => [0, 0, nil, nil, nil, 1378, nil], - 1331 => [0, 0, nil, nil, nil, 1379, nil], - 1332 => [0, 0, nil, nil, nil, 1380, nil], - 1333 => [0, 0, nil, nil, nil, 1381, nil], - 1334 => [0, 0, nil, nil, nil, 1382, nil], - 1335 => [0, 0, nil, nil, nil, 1383, nil], - 1336 => [0, 0, nil, nil, nil, 1384, nil], - 1337 => [0, 0, nil, nil, nil, 1385, nil], - 1338 => [0, 0, nil, nil, nil, 1386, nil], - 1339 => [0, 0, nil, nil, nil, 1387, nil], - 1340 => [0, 0, nil, nil, nil, 1388, nil], - 1341 => [0, 0, nil, nil, nil, 1389, nil], - 1342 => [0, 0, nil, nil, nil, 1390, nil], - 1343 => [0, 0, nil, nil, nil, 1391, nil], - 1344 => [0, 0, nil, nil, nil, 1392, nil], - 1345 => [0, 0, nil, nil, nil, 1393, nil], - 1346 => [0, 0, nil, nil, nil, 1394, nil], - 1347 => [0, 0, nil, nil, nil, 1395, nil], - 1348 => [0, 0, nil, nil, nil, 1396, nil], - 1349 => [0, 0, nil, nil, nil, 1397, nil], - 1350 => [0, 0, nil, nil, nil, 1398, nil], - 1351 => [0, 0, nil, nil, nil, 1399, nil], - 1352 => [0, 0, nil, nil, nil, 1400, nil], - 1353 => [0, 0, nil, nil, nil, 1401, nil], - 1354 => [0, 0, nil, nil, nil, 1402, nil], - 1355 => [0, 0, nil, nil, nil, 1403, nil], - 1356 => [0, 0, nil, nil, nil, 1404, nil], - 1357 => [0, 0, nil, nil, nil, 1405, nil], - 1358 => [0, 0, nil, nil, nil, 1406, nil], - 1359 => [0, 0, nil, nil, nil, 1407, nil], - 1360 => [0, 0, nil, nil, nil, 1408, nil], - 1361 => [0, 0, nil, nil, nil, 1409, nil], - 1362 => [0, 0, nil, nil, nil, 1410, nil], - 1363 => [0, 0, nil, nil, nil, 1411, nil], - 1364 => [0, 0, nil, nil, nil, 1412, nil], - 1365 => [0, 0, nil, nil, nil, 1413, nil], - 1366 => [0, 0, nil, nil, nil, 1414, nil], - 1377 => [0, 0, nil, nil, 1329, nil, 1329], - 1378 => [0, 0, nil, nil, 1330, nil, 1330], - 1379 => [0, 0, nil, nil, 1331, nil, 1331], - 1380 => [0, 0, nil, nil, 1332, nil, 1332], - 1381 => [0, 0, nil, nil, 1333, nil, 1333], - 1382 => [0, 0, nil, nil, 1334, nil, 1334], - 1383 => [0, 0, nil, nil, 1335, nil, 1335], - 1384 => [0, 0, nil, nil, 1336, nil, 1336], - 1385 => [0, 0, nil, nil, 1337, nil, 1337], - 1386 => [0, 0, nil, nil, 1338, nil, 1338], - 1387 => [0, 0, nil, nil, 1339, nil, 1339], - 1388 => [0, 0, nil, nil, 1340, nil, 1340], - 1389 => [0, 0, nil, nil, 1341, nil, 1341], - 1390 => [0, 0, nil, nil, 1342, nil, 1342], - 1391 => [0, 0, nil, nil, 1343, nil, 1343], - 1392 => [0, 0, nil, nil, 1344, nil, 1344], - 1393 => [0, 0, nil, nil, 1345, nil, 1345], - 1394 => [0, 0, nil, nil, 1346, nil, 1346], - 1395 => [0, 0, nil, nil, 1347, nil, 1347], - 1396 => [0, 0, nil, nil, 1348, nil, 1348], - 1397 => [0, 0, nil, nil, 1349, nil, 1349], - 1398 => [0, 0, nil, nil, 1350, nil, 1350], - 1399 => [0, 0, nil, nil, 1351, nil, 1351], - 1400 => [0, 0, nil, nil, 1352, nil, 1352], - 1401 => [0, 0, nil, nil, 1353, nil, 1353], - 1402 => [0, 0, nil, nil, 1354, nil, 1354], - 1403 => [0, 0, nil, nil, 1355, nil, 1355], - 1404 => [0, 0, nil, nil, 1356, nil, 1356], - 1405 => [0, 0, nil, nil, 1357, nil, 1357], - 1406 => [0, 0, nil, nil, 1358, nil, 1358], - 1407 => [0, 0, nil, nil, 1359, nil, 1359], - 1408 => [0, 0, nil, nil, 1360, nil, 1360], - 1409 => [0, 0, nil, nil, 1361, nil, 1361], - 1410 => [0, 0, nil, nil, 1362, nil, 1362], - 1411 => [0, 0, nil, nil, 1363, nil, 1363], - 1412 => [0, 0, nil, nil, 1364, nil, 1364], - 1413 => [0, 0, nil, nil, 1365, nil, 1365], - 1414 => [0, 0, nil, nil, 1366, nil, 1366], - 1415 => [0, 0, nil, "եւ", nil, nil, nil], - 1425 => [220, 0, nil, nil, nil, nil, nil], - 1426 => [230, 0, nil, nil, nil, nil, nil], - 1427 => [230, 0, nil, nil, nil, nil, nil], - 1428 => [230, 0, nil, nil, nil, nil, nil], - 1429 => [230, 0, nil, nil, nil, nil, nil], - 1430 => [220, 0, nil, nil, nil, nil, nil], - 1431 => [230, 0, nil, nil, nil, nil, nil], - 1432 => [230, 0, nil, nil, nil, nil, nil], - 1433 => [230, 0, nil, nil, nil, nil, nil], - 1434 => [222, 0, nil, nil, nil, nil, nil], - 1435 => [220, 0, nil, nil, nil, nil, nil], - 1436 => [230, 0, nil, nil, nil, nil, nil], - 1437 => [230, 0, nil, nil, nil, nil, nil], - 1438 => [230, 0, nil, nil, nil, nil, nil], - 1439 => [230, 0, nil, nil, nil, nil, nil], - 1440 => [230, 0, nil, nil, nil, nil, nil], - 1441 => [230, 0, nil, nil, nil, nil, nil], - 1443 => [220, 0, nil, nil, nil, nil, nil], - 1444 => [220, 0, nil, nil, nil, nil, nil], - 1445 => [220, 0, nil, nil, nil, nil, nil], - 1446 => [220, 0, nil, nil, nil, nil, nil], - 1447 => [220, 0, nil, nil, nil, nil, nil], - 1448 => [230, 0, nil, nil, nil, nil, nil], - 1449 => [230, 0, nil, nil, nil, nil, nil], - 1450 => [220, 0, nil, nil, nil, nil, nil], - 1451 => [230, 0, nil, nil, nil, nil, nil], - 1452 => [230, 0, nil, nil, nil, nil, nil], - 1453 => [222, 0, nil, nil, nil, nil, nil], - 1454 => [228, 0, nil, nil, nil, nil, nil], - 1455 => [230, 0, nil, nil, nil, nil, nil], - 1456 => [10, 0, nil, nil, nil, nil, nil], - 1457 => [11, 0, nil, nil, nil, nil, nil], - 1458 => [12, 0, nil, nil, nil, nil, nil], - 1459 => [13, 0, nil, nil, nil, nil, nil], - 1460 => [14, 0, nil, nil, nil, nil, nil], - 1461 => [15, 0, nil, nil, nil, nil, nil], - 1462 => [16, 0, nil, nil, nil, nil, nil], - 1463 => [17, 0, nil, nil, nil, nil, nil], - 1464 => [18, 0, nil, nil, nil, nil, nil], - 1465 => [19, 0, nil, nil, nil, nil, nil], - 1467 => [20, 0, nil, nil, nil, nil, nil], - 1468 => [21, 0, nil, nil, nil, nil, nil], - 1469 => [22, 0, nil, nil, nil, nil, nil], - 1471 => [23, 0, nil, nil, nil, nil, nil], - 1473 => [24, 0, nil, nil, nil, nil, nil], - 1474 => [25, 0, nil, nil, nil, nil, nil], - 1476 => [230, 0, nil, nil, nil, nil, nil], - 1570 => [0, 0, "آ", "آ", nil, nil, nil], - 1571 => [0, 0, "أ", "أ", nil, nil, nil], - 1572 => [0, 0, "ؤ", "ؤ", nil, nil, nil], - 1573 => [0, 0, "إ", "إ", nil, nil, nil], - 1574 => [0, 0, "ئ", "ئ", nil, nil, nil], - 1611 => [27, 0, nil, nil, nil, nil, nil], - 1612 => [28, 0, nil, nil, nil, nil, nil], - 1613 => [29, 0, nil, nil, nil, nil, nil], - 1614 => [30, 0, nil, nil, nil, nil, nil], - 1615 => [31, 0, nil, nil, nil, nil, nil], - 1616 => [32, 0, nil, nil, nil, nil, nil], - 1617 => [33, 0, nil, nil, nil, nil, nil], - 1618 => [34, 0, nil, nil, nil, nil, nil], - 1619 => [230, 0, nil, nil, nil, nil, nil], - 1620 => [230, 0, nil, nil, nil, nil, nil], - 1621 => [220, 0, nil, nil, nil, nil, nil], - 1648 => [35, 0, nil, nil, nil, nil, nil], - 1653 => [0, 0, nil, "اٴ", nil, nil, nil], - 1654 => [0, 0, nil, "وٴ", nil, nil, nil], - 1655 => [0, 0, nil, "ۇٴ", nil, nil, nil], - 1656 => [0, 0, nil, "يٴ", nil, nil, nil], - 1728 => [0, 0, "ۀ", "ۀ", nil, nil, nil], - 1730 => [0, 0, "ۂ", "ۂ", nil, nil, nil], - 1747 => [0, 0, "ۓ", "ۓ", nil, nil, nil], - 1750 => [230, 0, nil, nil, nil, nil, nil], - 1751 => [230, 0, nil, nil, nil, nil, nil], - 1752 => [230, 0, nil, nil, nil, nil, nil], - 1753 => [230, 0, nil, nil, nil, nil, nil], - 1754 => [230, 0, nil, nil, nil, nil, nil], - 1755 => [230, 0, nil, nil, nil, nil, nil], - 1756 => [230, 0, nil, nil, nil, nil, nil], - 1759 => [230, 0, nil, nil, nil, nil, nil], - 1760 => [230, 0, nil, nil, nil, nil, nil], - 1761 => [230, 0, nil, nil, nil, nil, nil], - 1762 => [230, 0, nil, nil, nil, nil, nil], - 1763 => [220, 0, nil, nil, nil, nil, nil], - 1764 => [230, 0, nil, nil, nil, nil, nil], - 1767 => [230, 0, nil, nil, nil, nil, nil], - 1768 => [230, 0, nil, nil, nil, nil, nil], - 1770 => [220, 0, nil, nil, nil, nil, nil], - 1771 => [230, 0, nil, nil, nil, nil, nil], - 1772 => [230, 0, nil, nil, nil, nil, nil], - 1773 => [220, 0, nil, nil, nil, nil, nil], - 1809 => [36, 0, nil, nil, nil, nil, nil], - 1840 => [230, 0, nil, nil, nil, nil, nil], - 1841 => [220, 0, nil, nil, nil, nil, nil], - 1842 => [230, 0, nil, nil, nil, nil, nil], - 1843 => [230, 0, nil, nil, nil, nil, nil], - 1844 => [220, 0, nil, nil, nil, nil, nil], - 1845 => [230, 0, nil, nil, nil, nil, nil], - 1846 => [230, 0, nil, nil, nil, nil, nil], - 1847 => [220, 0, nil, nil, nil, nil, nil], - 1848 => [220, 0, nil, nil, nil, nil, nil], - 1849 => [220, 0, nil, nil, nil, nil, nil], - 1850 => [230, 0, nil, nil, nil, nil, nil], - 1851 => [220, 0, nil, nil, nil, nil, nil], - 1852 => [220, 0, nil, nil, nil, nil, nil], - 1853 => [230, 0, nil, nil, nil, nil, nil], - 1854 => [220, 0, nil, nil, nil, nil, nil], - 1855 => [230, 0, nil, nil, nil, nil, nil], - 1856 => [230, 0, nil, nil, nil, nil, nil], - 1857 => [230, 0, nil, nil, nil, nil, nil], - 1858 => [220, 0, nil, nil, nil, nil, nil], - 1859 => [230, 0, nil, nil, nil, nil, nil], - 1860 => [220, 0, nil, nil, nil, nil, nil], - 1861 => [230, 0, nil, nil, nil, nil, nil], - 1862 => [220, 0, nil, nil, nil, nil, nil], - 1863 => [230, 0, nil, nil, nil, nil, nil], - 1864 => [220, 0, nil, nil, nil, nil, nil], - 1865 => [230, 0, nil, nil, nil, nil, nil], - 1866 => [230, 0, nil, nil, nil, nil, nil], - 2345 => [0, 0, "ऩ", "ऩ", nil, nil, nil], - 2353 => [0, 0, "ऱ", "ऱ", nil, nil, nil], - 2356 => [0, 0, "ऴ", "ऴ", nil, nil, nil], - 2364 => [7, 0, nil, nil, nil, nil, nil], - 2381 => [9, 0, nil, nil, nil, nil, nil], - 2385 => [230, 0, nil, nil, nil, nil, nil], - 2386 => [220, 0, nil, nil, nil, nil, nil], - 2387 => [230, 0, nil, nil, nil, nil, nil], - 2388 => [230, 0, nil, nil, nil, nil, nil], - 2392 => [0, 1, "क़", "क़", nil, nil, nil], - 2393 => [0, 1, "ख़", "ख़", nil, nil, nil], - 2394 => [0, 1, "ग़", "ग़", nil, nil, nil], - 2395 => [0, 1, "ज़", "ज़", nil, nil, nil], - 2396 => [0, 1, "ड़", "ड़", nil, nil, nil], - 2397 => [0, 1, "ढ़", "ढ़", nil, nil, nil], - 2398 => [0, 1, "फ़", "फ़", nil, nil, nil], - 2399 => [0, 1, "य़", "य़", nil, nil, nil], - 2492 => [7, 0, nil, nil, nil, nil, nil], - 2507 => [0, 0, "ো", "ো", nil, nil, nil], - 2508 => [0, 0, "ৌ", "ৌ", nil, nil, nil], - 2509 => [9, 0, nil, nil, nil, nil, nil], - 2524 => [0, 1, "ড়", "ড়", nil, nil, nil], - 2525 => [0, 1, "ঢ়", "ঢ়", nil, nil, nil], - 2527 => [0, 1, "য়", "য়", nil, nil, nil], - 2611 => [0, 1, "ਲ਼", "ਲ਼", nil, nil, nil], - 2614 => [0, 1, "ਸ਼", "ਸ਼", nil, nil, nil], - 2620 => [7, 0, nil, nil, nil, nil, nil], - 2637 => [9, 0, nil, nil, nil, nil, nil], - 2649 => [0, 1, "ਖ਼", "ਖ਼", nil, nil, nil], - 2650 => [0, 1, "ਗ਼", "ਗ਼", nil, nil, nil], - 2651 => [0, 1, "ਜ਼", "ਜ਼", nil, nil, nil], - 2654 => [0, 1, "ਫ਼", "ਫ਼", nil, nil, nil], - 2748 => [7, 0, nil, nil, nil, nil, nil], - 2765 => [9, 0, nil, nil, nil, nil, nil], - 2876 => [7, 0, nil, nil, nil, nil, nil], - 2888 => [0, 0, "ୈ", "ୈ", nil, nil, nil], - 2891 => [0, 0, "ୋ", "ୋ", nil, nil, nil], - 2892 => [0, 0, "ୌ", "ୌ", nil, nil, nil], - 2893 => [9, 0, nil, nil, nil, nil, nil], - 2908 => [0, 1, "ଡ଼", "ଡ଼", nil, nil, nil], - 2909 => [0, 1, "ଢ଼", "ଢ଼", nil, nil, nil], - 2964 => [0, 0, "ஔ", "ஔ", nil, nil, nil], - 3018 => [0, 0, "ொ", "ொ", nil, nil, nil], - 3019 => [0, 0, "ோ", "ோ", nil, nil, nil], - 3020 => [0, 0, "ௌ", "ௌ", nil, nil, nil], - 3021 => [9, 0, nil, nil, nil, nil, nil], - 3144 => [0, 0, "ై", "ై", nil, nil, nil], - 3149 => [9, 0, nil, nil, nil, nil, nil], - 3157 => [84, 0, nil, nil, nil, nil, nil], - 3158 => [91, 0, nil, nil, nil, nil, nil], - 3264 => [0, 0, "ೀ", "ೀ", nil, nil, nil], - 3271 => [0, 0, "ೇ", "ೇ", nil, nil, nil], - 3272 => [0, 0, "ೈ", "ೈ", nil, nil, nil], - 3274 => [0, 0, "ೊ", "ೊ", nil, nil, nil], - 3275 => [0, 0, "ೋ", "ೋ", nil, nil, nil], - 3277 => [9, 0, nil, nil, nil, nil, nil], - 3402 => [0, 0, "ൊ", "ൊ", nil, nil, nil], - 3403 => [0, 0, "ോ", "ോ", nil, nil, nil], - 3404 => [0, 0, "ൌ", "ൌ", nil, nil, nil], - 3405 => [9, 0, nil, nil, nil, nil, nil], - 3530 => [9, 0, nil, nil, nil, nil, nil], - 3546 => [0, 0, "ේ", "ේ", nil, nil, nil], - 3548 => [0, 0, "ො", "ො", nil, nil, nil], - 3549 => [0, 0, "ෝ", "ෝ", nil, nil, nil], - 3550 => [0, 0, "ෞ", "ෞ", nil, nil, nil], - 3635 => [0, 0, nil, "ํา", nil, nil, nil], - 3640 => [103, 0, nil, nil, nil, nil, nil], - 3641 => [103, 0, nil, nil, nil, nil, nil], - 3642 => [9, 0, nil, nil, nil, nil, nil], - 3656 => [107, 0, nil, nil, nil, nil, nil], - 3657 => [107, 0, nil, nil, nil, nil, nil], - 3658 => [107, 0, nil, nil, nil, nil, nil], - 3659 => [107, 0, nil, nil, nil, nil, nil], - 3763 => [0, 0, nil, "ໍາ", nil, nil, nil], - 3768 => [118, 0, nil, nil, nil, nil, nil], - 3769 => [118, 0, nil, nil, nil, nil, nil], - 3784 => [122, 0, nil, nil, nil, nil, nil], - 3785 => [122, 0, nil, nil, nil, nil, nil], - 3786 => [122, 0, nil, nil, nil, nil, nil], - 3787 => [122, 0, nil, nil, nil, nil, nil], - 3804 => [0, 0, nil, "ຫນ", nil, nil, nil], - 3805 => [0, 0, nil, "ຫມ", nil, nil, nil], - 3852 => [0, 0, nil, "་", nil, nil, nil], - 3864 => [220, 0, nil, nil, nil, nil, nil], - 3865 => [220, 0, nil, nil, nil, nil, nil], - 3893 => [220, 0, nil, nil, nil, nil, nil], - 3895 => [220, 0, nil, nil, nil, nil, nil], - 3897 => [216, 0, nil, nil, nil, nil, nil], - 3907 => [0, 1, "གྷ", "གྷ", nil, nil, nil], - 3917 => [0, 1, "ཌྷ", "ཌྷ", nil, nil, nil], - 3922 => [0, 1, "དྷ", "དྷ", nil, nil, nil], - 3927 => [0, 1, "བྷ", "བྷ", nil, nil, nil], - 3932 => [0, 1, "ཛྷ", "ཛྷ", nil, nil, nil], - 3945 => [0, 1, "ཀྵ", "ཀྵ", nil, nil, nil], - 3953 => [129, 0, nil, nil, nil, nil, nil], - 3954 => [130, 0, nil, nil, nil, nil, nil], - 3955 => [0, 3, "ཱི", "ཱི", nil, nil, nil], - 3956 => [132, 0, nil, nil, nil, nil, nil], - 3957 => [0, 3, "ཱུ", "ཱུ", nil, nil, nil], - 3958 => [0, 1, "ྲྀ", "ྲྀ", nil, nil, nil], - 3959 => [0, 0, nil, "ྲཱྀ", nil, nil, nil], - 3960 => [0, 1, "ླྀ", "ླྀ", nil, nil, nil], - 3961 => [0, 0, nil, "ླཱྀ", nil, nil, nil], - 3962 => [130, 0, nil, nil, nil, nil, nil], - 3963 => [130, 0, nil, nil, nil, nil, nil], - 3964 => [130, 0, nil, nil, nil, nil, nil], - 3965 => [130, 0, nil, nil, nil, nil, nil], - 3968 => [130, 0, nil, nil, nil, nil, nil], - 3969 => [0, 3, "ཱྀ", "ཱྀ", nil, nil, nil], - 3970 => [230, 0, nil, nil, nil, nil, nil], - 3971 => [230, 0, nil, nil, nil, nil, nil], - 3972 => [9, 0, nil, nil, nil, nil, nil], - 3974 => [230, 0, nil, nil, nil, nil, nil], - 3975 => [230, 0, nil, nil, nil, nil, nil], - 3987 => [0, 1, "ྒྷ", "ྒྷ", nil, nil, nil], - 3997 => [0, 1, "ྜྷ", "ྜྷ", nil, nil, nil], - 4002 => [0, 1, "ྡྷ", "ྡྷ", nil, nil, nil], - 4007 => [0, 1, "ྦྷ", "ྦྷ", nil, nil, nil], - 4012 => [0, 1, "ྫྷ", "ྫྷ", nil, nil, nil], - 4025 => [0, 1, "ྐྵ", "ྐྵ", nil, nil, nil], - 4038 => [220, 0, nil, nil, nil, nil, nil], - 4134 => [0, 0, "ဦ", "ဦ", nil, nil, nil], - 4151 => [7, 0, nil, nil, nil, nil, nil], - 4153 => [9, 0, nil, nil, nil, nil, nil], - 6098 => [9, 0, nil, nil, nil, nil, nil], - 6313 => [228, 0, nil, nil, nil, nil, nil], - 7680 => [0, 0, "Ḁ", "Ḁ", nil, 7681, nil], - 7681 => [0, 0, "ḁ", "ḁ", 7680, nil, 7680], - 7682 => [0, 0, "Ḃ", "Ḃ", nil, 7683, nil], - 7683 => [0, 0, "ḃ", "ḃ", 7682, nil, 7682], - 7684 => [0, 0, "Ḅ", "Ḅ", nil, 7685, nil], - 7685 => [0, 0, "ḅ", "ḅ", 7684, nil, 7684], - 7686 => [0, 0, "Ḇ", "Ḇ", nil, 7687, nil], - 7687 => [0, 0, "ḇ", "ḇ", 7686, nil, 7686], - 7688 => [0, 0, "Ḉ", "Ḉ", nil, 7689, nil], - 7689 => [0, 0, "ḉ", "ḉ", 7688, nil, 7688], - 7690 => [0, 0, "Ḋ", "Ḋ", nil, 7691, nil], - 7691 => [0, 0, "ḋ", "ḋ", 7690, nil, 7690], - 7692 => [0, 0, "Ḍ", "Ḍ", nil, 7693, nil], - 7693 => [0, 0, "ḍ", "ḍ", 7692, nil, 7692], - 7694 => [0, 0, "Ḏ", "Ḏ", nil, 7695, nil], - 7695 => [0, 0, "ḏ", "ḏ", 7694, nil, 7694], - 7696 => [0, 0, "Ḑ", "Ḑ", nil, 7697, nil], - 7697 => [0, 0, "ḑ", "ḑ", 7696, nil, 7696], - 7698 => [0, 0, "Ḓ", "Ḓ", nil, 7699, nil], - 7699 => [0, 0, "ḓ", "ḓ", 7698, nil, 7698], - 7700 => [0, 0, "Ḕ", "Ḕ", nil, 7701, nil], - 7701 => [0, 0, "ḕ", "ḕ", 7700, nil, 7700], - 7702 => [0, 0, "Ḗ", "Ḗ", nil, 7703, nil], - 7703 => [0, 0, "ḗ", "ḗ", 7702, nil, 7702], - 7704 => [0, 0, "Ḙ", "Ḙ", nil, 7705, nil], - 7705 => [0, 0, "ḙ", "ḙ", 7704, nil, 7704], - 7706 => [0, 0, "Ḛ", "Ḛ", nil, 7707, nil], - 7707 => [0, 0, "ḛ", "ḛ", 7706, nil, 7706], - 7708 => [0, 0, "Ḝ", "Ḝ", nil, 7709, nil], - 7709 => [0, 0, "ḝ", "ḝ", 7708, nil, 7708], - 7710 => [0, 0, "Ḟ", "Ḟ", nil, 7711, nil], - 7711 => [0, 0, "ḟ", "ḟ", 7710, nil, 7710], - 7712 => [0, 0, "Ḡ", "Ḡ", nil, 7713, nil], - 7713 => [0, 0, "ḡ", "ḡ", 7712, nil, 7712], - 7714 => [0, 0, "Ḣ", "Ḣ", nil, 7715, nil], - 7715 => [0, 0, "ḣ", "ḣ", 7714, nil, 7714], - 7716 => [0, 0, "Ḥ", "Ḥ", nil, 7717, nil], - 7717 => [0, 0, "ḥ", "ḥ", 7716, nil, 7716], - 7718 => [0, 0, "Ḧ", "Ḧ", nil, 7719, nil], - 7719 => [0, 0, "ḧ", "ḧ", 7718, nil, 7718], - 7720 => [0, 0, "Ḩ", "Ḩ", nil, 7721, nil], - 7721 => [0, 0, "ḩ", "ḩ", 7720, nil, 7720], - 7722 => [0, 0, "Ḫ", "Ḫ", nil, 7723, nil], - 7723 => [0, 0, "ḫ", "ḫ", 7722, nil, 7722], - 7724 => [0, 0, "Ḭ", "Ḭ", nil, 7725, nil], - 7725 => [0, 0, "ḭ", "ḭ", 7724, nil, 7724], - 7726 => [0, 0, "Ḯ", "Ḯ", nil, 7727, nil], - 7727 => [0, 0, "ḯ", "ḯ", 7726, nil, 7726], - 7728 => [0, 0, "Ḱ", "Ḱ", nil, 7729, nil], - 7729 => [0, 0, "ḱ", "ḱ", 7728, nil, 7728], - 7730 => [0, 0, "Ḳ", "Ḳ", nil, 7731, nil], - 7731 => [0, 0, "ḳ", "ḳ", 7730, nil, 7730], - 7732 => [0, 0, "Ḵ", "Ḵ", nil, 7733, nil], - 7733 => [0, 0, "ḵ", "ḵ", 7732, nil, 7732], - 7734 => [0, 0, "Ḷ", "Ḷ", nil, 7735, nil], - 7735 => [0, 0, "ḷ", "ḷ", 7734, nil, 7734], - 7736 => [0, 0, "Ḹ", "Ḹ", nil, 7737, nil], - 7737 => [0, 0, "ḹ", "ḹ", 7736, nil, 7736], - 7738 => [0, 0, "Ḻ", "Ḻ", nil, 7739, nil], - 7739 => [0, 0, "ḻ", "ḻ", 7738, nil, 7738], - 7740 => [0, 0, "Ḽ", "Ḽ", nil, 7741, nil], - 7741 => [0, 0, "ḽ", "ḽ", 7740, nil, 7740], - 7742 => [0, 0, "Ḿ", "Ḿ", nil, 7743, nil], - 7743 => [0, 0, "ḿ", "ḿ", 7742, nil, 7742], - 7744 => [0, 0, "Ṁ", "Ṁ", nil, 7745, nil], - 7745 => [0, 0, "ṁ", "ṁ", 7744, nil, 7744], - 7746 => [0, 0, "Ṃ", "Ṃ", nil, 7747, nil], - 7747 => [0, 0, "ṃ", "ṃ", 7746, nil, 7746], - 7748 => [0, 0, "Ṅ", "Ṅ", nil, 7749, nil], - 7749 => [0, 0, "ṅ", "ṅ", 7748, nil, 7748], - 7750 => [0, 0, "Ṇ", "Ṇ", nil, 7751, nil], - 7751 => [0, 0, "ṇ", "ṇ", 7750, nil, 7750], - 7752 => [0, 0, "Ṉ", "Ṉ", nil, 7753, nil], - 7753 => [0, 0, "ṉ", "ṉ", 7752, nil, 7752], - 7754 => [0, 0, "Ṋ", "Ṋ", nil, 7755, nil], - 7755 => [0, 0, "ṋ", "ṋ", 7754, nil, 7754], - 7756 => [0, 0, "Ṍ", "Ṍ", nil, 7757, nil], - 7757 => [0, 0, "ṍ", "ṍ", 7756, nil, 7756], - 7758 => [0, 0, "Ṏ", "Ṏ", nil, 7759, nil], - 7759 => [0, 0, "ṏ", "ṏ", 7758, nil, 7758], - 7760 => [0, 0, "Ṑ", "Ṑ", nil, 7761, nil], - 7761 => [0, 0, "ṑ", "ṑ", 7760, nil, 7760], - 7762 => [0, 0, "Ṓ", "Ṓ", nil, 7763, nil], - 7763 => [0, 0, "ṓ", "ṓ", 7762, nil, 7762], - 7764 => [0, 0, "Ṕ", "Ṕ", nil, 7765, nil], - 7765 => [0, 0, "ṕ", "ṕ", 7764, nil, 7764], - 7766 => [0, 0, "Ṗ", "Ṗ", nil, 7767, nil], - 7767 => [0, 0, "ṗ", "ṗ", 7766, nil, 7766], - 7768 => [0, 0, "Ṙ", "Ṙ", nil, 7769, nil], - 7769 => [0, 0, "ṙ", "ṙ", 7768, nil, 7768], - 7770 => [0, 0, "Ṛ", "Ṛ", nil, 7771, nil], - 7771 => [0, 0, "ṛ", "ṛ", 7770, nil, 7770], - 7772 => [0, 0, "Ṝ", "Ṝ", nil, 7773, nil], - 7773 => [0, 0, "ṝ", "ṝ", 7772, nil, 7772], - 7774 => [0, 0, "Ṟ", "Ṟ", nil, 7775, nil], - 7775 => [0, 0, "ṟ", "ṟ", 7774, nil, 7774], - 7776 => [0, 0, "Ṡ", "Ṡ", nil, 7777, nil], - 7777 => [0, 0, "ṡ", "ṡ", 7776, nil, 7776], - 7778 => [0, 0, "Ṣ", "Ṣ", nil, 7779, nil], - 7779 => [0, 0, "ṣ", "ṣ", 7778, nil, 7778], - 7780 => [0, 0, "Ṥ", "Ṥ", nil, 7781, nil], - 7781 => [0, 0, "ṥ", "ṥ", 7780, nil, 7780], - 7782 => [0, 0, "Ṧ", "Ṧ", nil, 7783, nil], - 7783 => [0, 0, "ṧ", "ṧ", 7782, nil, 7782], - 7784 => [0, 0, "Ṩ", "Ṩ", nil, 7785, nil], - 7785 => [0, 0, "ṩ", "ṩ", 7784, nil, 7784], - 7786 => [0, 0, "Ṫ", "Ṫ", nil, 7787, nil], - 7787 => [0, 0, "ṫ", "ṫ", 7786, nil, 7786], - 7788 => [0, 0, "Ṭ", "Ṭ", nil, 7789, nil], - 7789 => [0, 0, "ṭ", "ṭ", 7788, nil, 7788], - 7790 => [0, 0, "Ṯ", "Ṯ", nil, 7791, nil], - 7791 => [0, 0, "ṯ", "ṯ", 7790, nil, 7790], - 7792 => [0, 0, "Ṱ", "Ṱ", nil, 7793, nil], - 7793 => [0, 0, "ṱ", "ṱ", 7792, nil, 7792], - 7794 => [0, 0, "Ṳ", "Ṳ", nil, 7795, nil], - 7795 => [0, 0, "ṳ", "ṳ", 7794, nil, 7794], - 7796 => [0, 0, "Ṵ", "Ṵ", nil, 7797, nil], - 7797 => [0, 0, "ṵ", "ṵ", 7796, nil, 7796], - 7798 => [0, 0, "Ṷ", "Ṷ", nil, 7799, nil], - 7799 => [0, 0, "ṷ", "ṷ", 7798, nil, 7798], - 7800 => [0, 0, "Ṹ", "Ṹ", nil, 7801, nil], - 7801 => [0, 0, "ṹ", "ṹ", 7800, nil, 7800], - 7802 => [0, 0, "Ṻ", "Ṻ", nil, 7803, nil], - 7803 => [0, 0, "ṻ", "ṻ", 7802, nil, 7802], - 7804 => [0, 0, "Ṽ", "Ṽ", nil, 7805, nil], - 7805 => [0, 0, "ṽ", "ṽ", 7804, nil, 7804], - 7806 => [0, 0, "Ṿ", "Ṿ", nil, 7807, nil], - 7807 => [0, 0, "ṿ", "ṿ", 7806, nil, 7806], - 7808 => [0, 0, "Ẁ", "Ẁ", nil, 7809, nil], - 7809 => [0, 0, "ẁ", "ẁ", 7808, nil, 7808], - 7810 => [0, 0, "Ẃ", "Ẃ", nil, 7811, nil], - 7811 => [0, 0, "ẃ", "ẃ", 7810, nil, 7810], - 7812 => [0, 0, "Ẅ", "Ẅ", nil, 7813, nil], - 7813 => [0, 0, "ẅ", "ẅ", 7812, nil, 7812], - 7814 => [0, 0, "Ẇ", "Ẇ", nil, 7815, nil], - 7815 => [0, 0, "ẇ", "ẇ", 7814, nil, 7814], - 7816 => [0, 0, "Ẉ", "Ẉ", nil, 7817, nil], - 7817 => [0, 0, "ẉ", "ẉ", 7816, nil, 7816], - 7818 => [0, 0, "Ẋ", "Ẋ", nil, 7819, nil], - 7819 => [0, 0, "ẋ", "ẋ", 7818, nil, 7818], - 7820 => [0, 0, "Ẍ", "Ẍ", nil, 7821, nil], - 7821 => [0, 0, "ẍ", "ẍ", 7820, nil, 7820], - 7822 => [0, 0, "Ẏ", "Ẏ", nil, 7823, nil], - 7823 => [0, 0, "ẏ", "ẏ", 7822, nil, 7822], - 7824 => [0, 0, "Ẑ", "Ẑ", nil, 7825, nil], - 7825 => [0, 0, "ẑ", "ẑ", 7824, nil, 7824], - 7826 => [0, 0, "Ẓ", "Ẓ", nil, 7827, nil], - 7827 => [0, 0, "ẓ", "ẓ", 7826, nil, 7826], - 7828 => [0, 0, "Ẕ", "Ẕ", nil, 7829, nil], - 7829 => [0, 0, "ẕ", "ẕ", 7828, nil, 7828], - 7830 => [0, 0, "ẖ", "ẖ", nil, nil, nil], - 7831 => [0, 0, "ẗ", "ẗ", nil, nil, nil], - 7832 => [0, 0, "ẘ", "ẘ", nil, nil, nil], - 7833 => [0, 0, "ẙ", "ẙ", nil, nil, nil], - 7834 => [0, 0, nil, "aʾ", nil, nil, nil], - 7835 => [0, 0, "ẛ", "ẛ", 7776, nil, 7776], - 7840 => [0, 0, "Ạ", "Ạ", nil, 7841, nil], - 7841 => [0, 0, "ạ", "ạ", 7840, nil, 7840], - 7842 => [0, 0, "Ả", "Ả", nil, 7843, nil], - 7843 => [0, 0, "ả", "ả", 7842, nil, 7842], - 7844 => [0, 0, "Ấ", "Ấ", nil, 7845, nil], - 7845 => [0, 0, "ấ", "ấ", 7844, nil, 7844], - 7846 => [0, 0, "Ầ", "Ầ", nil, 7847, nil], - 7847 => [0, 0, "ầ", "ầ", 7846, nil, 7846], - 7848 => [0, 0, "Ẩ", "Ẩ", nil, 7849, nil], - 7849 => [0, 0, "ẩ", "ẩ", 7848, nil, 7848], - 7850 => [0, 0, "Ẫ", "Ẫ", nil, 7851, nil], - 7851 => [0, 0, "ẫ", "ẫ", 7850, nil, 7850], - 7852 => [0, 0, "Ậ", "Ậ", nil, 7853, nil], - 7853 => [0, 0, "ậ", "ậ", 7852, nil, 7852], - 7854 => [0, 0, "Ắ", "Ắ", nil, 7855, nil], - 7855 => [0, 0, "ắ", "ắ", 7854, nil, 7854], - 7856 => [0, 0, "Ằ", "Ằ", nil, 7857, nil], - 7857 => [0, 0, "ằ", "ằ", 7856, nil, 7856], - 7858 => [0, 0, "Ẳ", "Ẳ", nil, 7859, nil], - 7859 => [0, 0, "ẳ", "ẳ", 7858, nil, 7858], - 7860 => [0, 0, "Ẵ", "Ẵ", nil, 7861, nil], - 7861 => [0, 0, "ẵ", "ẵ", 7860, nil, 7860], - 7862 => [0, 0, "Ặ", "Ặ", nil, 7863, nil], - 7863 => [0, 0, "ặ", "ặ", 7862, nil, 7862], - 7864 => [0, 0, "Ẹ", "Ẹ", nil, 7865, nil], - 7865 => [0, 0, "ẹ", "ẹ", 7864, nil, 7864], - 7866 => [0, 0, "Ẻ", "Ẻ", nil, 7867, nil], - 7867 => [0, 0, "ẻ", "ẻ", 7866, nil, 7866], - 7868 => [0, 0, "Ẽ", "Ẽ", nil, 7869, nil], - 7869 => [0, 0, "ẽ", "ẽ", 7868, nil, 7868], - 7870 => [0, 0, "Ế", "Ế", nil, 7871, nil], - 7871 => [0, 0, "ế", "ế", 7870, nil, 7870], - 7872 => [0, 0, "Ề", "Ề", nil, 7873, nil], - 7873 => [0, 0, "ề", "ề", 7872, nil, 7872], - 7874 => [0, 0, "Ể", "Ể", nil, 7875, nil], - 7875 => [0, 0, "ể", "ể", 7874, nil, 7874], - 7876 => [0, 0, "Ễ", "Ễ", nil, 7877, nil], - 7877 => [0, 0, "ễ", "ễ", 7876, nil, 7876], - 7878 => [0, 0, "Ệ", "Ệ", nil, 7879, nil], - 7879 => [0, 0, "ệ", "ệ", 7878, nil, 7878], - 7880 => [0, 0, "Ỉ", "Ỉ", nil, 7881, nil], - 7881 => [0, 0, "ỉ", "ỉ", 7880, nil, 7880], - 7882 => [0, 0, "Ị", "Ị", nil, 7883, nil], - 7883 => [0, 0, "ị", "ị", 7882, nil, 7882], - 7884 => [0, 0, "Ọ", "Ọ", nil, 7885, nil], - 7885 => [0, 0, "ọ", "ọ", 7884, nil, 7884], - 7886 => [0, 0, "Ỏ", "Ỏ", nil, 7887, nil], - 7887 => [0, 0, "ỏ", "ỏ", 7886, nil, 7886], - 7888 => [0, 0, "Ố", "Ố", nil, 7889, nil], - 7889 => [0, 0, "ố", "ố", 7888, nil, 7888], - 7890 => [0, 0, "Ồ", "Ồ", nil, 7891, nil], - 7891 => [0, 0, "ồ", "ồ", 7890, nil, 7890], - 7892 => [0, 0, "Ổ", "Ổ", nil, 7893, nil], - 7893 => [0, 0, "ổ", "ổ", 7892, nil, 7892], - 7894 => [0, 0, "Ỗ", "Ỗ", nil, 7895, nil], - 7895 => [0, 0, "ỗ", "ỗ", 7894, nil, 7894], - 7896 => [0, 0, "Ộ", "Ộ", nil, 7897, nil], - 7897 => [0, 0, "ộ", "ộ", 7896, nil, 7896], - 7898 => [0, 0, "Ớ", "Ớ", nil, 7899, nil], - 7899 => [0, 0, "ớ", "ớ", 7898, nil, 7898], - 7900 => [0, 0, "Ờ", "Ờ", nil, 7901, nil], - 7901 => [0, 0, "ờ", "ờ", 7900, nil, 7900], - 7902 => [0, 0, "Ở", "Ở", nil, 7903, nil], - 7903 => [0, 0, "ở", "ở", 7902, nil, 7902], - 7904 => [0, 0, "Ỡ", "Ỡ", nil, 7905, nil], - 7905 => [0, 0, "ỡ", "ỡ", 7904, nil, 7904], - 7906 => [0, 0, "Ợ", "Ợ", nil, 7907, nil], - 7907 => [0, 0, "ợ", "ợ", 7906, nil, 7906], - 7908 => [0, 0, "Ụ", "Ụ", nil, 7909, nil], - 7909 => [0, 0, "ụ", "ụ", 7908, nil, 7908], - 7910 => [0, 0, "Ủ", "Ủ", nil, 7911, nil], - 7911 => [0, 0, "ủ", "ủ", 7910, nil, 7910], - 7912 => [0, 0, "Ứ", "Ứ", nil, 7913, nil], - 7913 => [0, 0, "ứ", "ứ", 7912, nil, 7912], - 7914 => [0, 0, "Ừ", "Ừ", nil, 7915, nil], - 7915 => [0, 0, "ừ", "ừ", 7914, nil, 7914], - 7916 => [0, 0, "Ử", "Ử", nil, 7917, nil], - 7917 => [0, 0, "ử", "ử", 7916, nil, 7916], - 7918 => [0, 0, "Ữ", "Ữ", nil, 7919, nil], - 7919 => [0, 0, "ữ", "ữ", 7918, nil, 7918], - 7920 => [0, 0, "Ự", "Ự", nil, 7921, nil], - 7921 => [0, 0, "ự", "ự", 7920, nil, 7920], - 7922 => [0, 0, "Ỳ", "Ỳ", nil, 7923, nil], - 7923 => [0, 0, "ỳ", "ỳ", 7922, nil, 7922], - 7924 => [0, 0, "Ỵ", "Ỵ", nil, 7925, nil], - 7925 => [0, 0, "ỵ", "ỵ", 7924, nil, 7924], - 7926 => [0, 0, "Ỷ", "Ỷ", nil, 7927, nil], - 7927 => [0, 0, "ỷ", "ỷ", 7926, nil, 7926], - 7928 => [0, 0, "Ỹ", "Ỹ", nil, 7929, nil], - 7929 => [0, 0, "ỹ", "ỹ", 7928, nil, 7928], - 7936 => [0, 0, "ἀ", "ἀ", 7944, nil, 7944], - 7937 => [0, 0, "ἁ", "ἁ", 7945, nil, 7945], - 7938 => [0, 0, "ἂ", "ἂ", 7946, nil, 7946], - 7939 => [0, 0, "ἃ", "ἃ", 7947, nil, 7947], - 7940 => [0, 0, "ἄ", "ἄ", 7948, nil, 7948], - 7941 => [0, 0, "ἅ", "ἅ", 7949, nil, 7949], - 7942 => [0, 0, "ἆ", "ἆ", 7950, nil, 7950], - 7943 => [0, 0, "ἇ", "ἇ", 7951, nil, 7951], - 7944 => [0, 0, "Ἀ", "Ἀ", nil, 7936, nil], - 7945 => [0, 0, "Ἁ", "Ἁ", nil, 7937, nil], - 7946 => [0, 0, "Ἂ", "Ἂ", nil, 7938, nil], - 7947 => [0, 0, "Ἃ", "Ἃ", nil, 7939, nil], - 7948 => [0, 0, "Ἄ", "Ἄ", nil, 7940, nil], - 7949 => [0, 0, "Ἅ", "Ἅ", nil, 7941, nil], - 7950 => [0, 0, "Ἆ", "Ἆ", nil, 7942, nil], - 7951 => [0, 0, "Ἇ", "Ἇ", nil, 7943, nil], - 7952 => [0, 0, "ἐ", "ἐ", 7960, nil, 7960], - 7953 => [0, 0, "ἑ", "ἑ", 7961, nil, 7961], - 7954 => [0, 0, "ἒ", "ἒ", 7962, nil, 7962], - 7955 => [0, 0, "ἓ", "ἓ", 7963, nil, 7963], - 7956 => [0, 0, "ἔ", "ἔ", 7964, nil, 7964], - 7957 => [0, 0, "ἕ", "ἕ", 7965, nil, 7965], - 7960 => [0, 0, "Ἐ", "Ἐ", nil, 7952, nil], - 7961 => [0, 0, "Ἑ", "Ἑ", nil, 7953, nil], - 7962 => [0, 0, "Ἒ", "Ἒ", nil, 7954, nil], - 7963 => [0, 0, "Ἓ", "Ἓ", nil, 7955, nil], - 7964 => [0, 0, "Ἔ", "Ἔ", nil, 7956, nil], - 7965 => [0, 0, "Ἕ", "Ἕ", nil, 7957, nil], - 7968 => [0, 0, "ἠ", "ἠ", 7976, nil, 7976], - 7969 => [0, 0, "ἡ", "ἡ", 7977, nil, 7977], - 7970 => [0, 0, "ἢ", "ἢ", 7978, nil, 7978], - 7971 => [0, 0, "ἣ", "ἣ", 7979, nil, 7979], - 7972 => [0, 0, "ἤ", "ἤ", 7980, nil, 7980], - 7973 => [0, 0, "ἥ", "ἥ", 7981, nil, 7981], - 7974 => [0, 0, "ἦ", "ἦ", 7982, nil, 7982], - 7975 => [0, 0, "ἧ", "ἧ", 7983, nil, 7983], - 7976 => [0, 0, "Ἠ", "Ἠ", nil, 7968, nil], - 7977 => [0, 0, "Ἡ", "Ἡ", nil, 7969, nil], - 7978 => [0, 0, "Ἢ", "Ἢ", nil, 7970, nil], - 7979 => [0, 0, "Ἣ", "Ἣ", nil, 7971, nil], - 7980 => [0, 0, "Ἤ", "Ἤ", nil, 7972, nil], - 7981 => [0, 0, "Ἥ", "Ἥ", nil, 7973, nil], - 7982 => [0, 0, "Ἦ", "Ἦ", nil, 7974, nil], - 7983 => [0, 0, "Ἧ", "Ἧ", nil, 7975, nil], - 7984 => [0, 0, "ἰ", "ἰ", 7992, nil, 7992], - 7985 => [0, 0, "ἱ", "ἱ", 7993, nil, 7993], - 7986 => [0, 0, "ἲ", "ἲ", 7994, nil, 7994], - 7987 => [0, 0, "ἳ", "ἳ", 7995, nil, 7995], - 7988 => [0, 0, "ἴ", "ἴ", 7996, nil, 7996], - 7989 => [0, 0, "ἵ", "ἵ", 7997, nil, 7997], - 7990 => [0, 0, "ἶ", "ἶ", 7998, nil, 7998], - 7991 => [0, 0, "ἷ", "ἷ", 7999, nil, 7999], - 7992 => [0, 0, "Ἰ", "Ἰ", nil, 7984, nil], - 7993 => [0, 0, "Ἱ", "Ἱ", nil, 7985, nil], - 7994 => [0, 0, "Ἲ", "Ἲ", nil, 7986, nil], - 7995 => [0, 0, "Ἳ", "Ἳ", nil, 7987, nil], - 7996 => [0, 0, "Ἴ", "Ἴ", nil, 7988, nil], - 7997 => [0, 0, "Ἵ", "Ἵ", nil, 7989, nil], - 7998 => [0, 0, "Ἶ", "Ἶ", nil, 7990, nil], - 7999 => [0, 0, "Ἷ", "Ἷ", nil, 7991, nil], - 8000 => [0, 0, "ὀ", "ὀ", 8008, nil, 8008], - 8001 => [0, 0, "ὁ", "ὁ", 8009, nil, 8009], - 8002 => [0, 0, "ὂ", "ὂ", 8010, nil, 8010], - 8003 => [0, 0, "ὃ", "ὃ", 8011, nil, 8011], - 8004 => [0, 0, "ὄ", "ὄ", 8012, nil, 8012], - 8005 => [0, 0, "ὅ", "ὅ", 8013, nil, 8013], - 8008 => [0, 0, "Ὀ", "Ὀ", nil, 8000, nil], - 8009 => [0, 0, "Ὁ", "Ὁ", nil, 8001, nil], - 8010 => [0, 0, "Ὂ", "Ὂ", nil, 8002, nil], - 8011 => [0, 0, "Ὃ", "Ὃ", nil, 8003, nil], - 8012 => [0, 0, "Ὄ", "Ὄ", nil, 8004, nil], - 8013 => [0, 0, "Ὅ", "Ὅ", nil, 8005, nil], - 8016 => [0, 0, "ὐ", "ὐ", nil, nil, nil], - 8017 => [0, 0, "ὑ", "ὑ", 8025, nil, 8025], - 8018 => [0, 0, "ὒ", "ὒ", nil, nil, nil], - 8019 => [0, 0, "ὓ", "ὓ", 8027, nil, 8027], - 8020 => [0, 0, "ὔ", "ὔ", nil, nil, nil], - 8021 => [0, 0, "ὕ", "ὕ", 8029, nil, 8029], - 8022 => [0, 0, "ὖ", "ὖ", nil, nil, nil], - 8023 => [0, 0, "ὗ", "ὗ", 8031, nil, 8031], - 8025 => [0, 0, "Ὑ", "Ὑ", nil, 8017, nil], - 8027 => [0, 0, "Ὓ", "Ὓ", nil, 8019, nil], - 8029 => [0, 0, "Ὕ", "Ὕ", nil, 8021, nil], - 8031 => [0, 0, "Ὗ", "Ὗ", nil, 8023, nil], - 8032 => [0, 0, "ὠ", "ὠ", 8040, nil, 8040], - 8033 => [0, 0, "ὡ", "ὡ", 8041, nil, 8041], - 8034 => [0, 0, "ὢ", "ὢ", 8042, nil, 8042], - 8035 => [0, 0, "ὣ", "ὣ", 8043, nil, 8043], - 8036 => [0, 0, "ὤ", "ὤ", 8044, nil, 8044], - 8037 => [0, 0, "ὥ", "ὥ", 8045, nil, 8045], - 8038 => [0, 0, "ὦ", "ὦ", 8046, nil, 8046], - 8039 => [0, 0, "ὧ", "ὧ", 8047, nil, 8047], - 8040 => [0, 0, "Ὠ", "Ὠ", nil, 8032, nil], - 8041 => [0, 0, "Ὡ", "Ὡ", nil, 8033, nil], - 8042 => [0, 0, "Ὢ", "Ὢ", nil, 8034, nil], - 8043 => [0, 0, "Ὣ", "Ὣ", nil, 8035, nil], - 8044 => [0, 0, "Ὤ", "Ὤ", nil, 8036, nil], - 8045 => [0, 0, "Ὥ", "Ὥ", nil, 8037, nil], - 8046 => [0, 0, "Ὦ", "Ὦ", nil, 8038, nil], - 8047 => [0, 0, "Ὧ", "Ὧ", nil, 8039, nil], - 8048 => [0, 0, "ὰ", "ὰ", 8122, nil, 8122], - 8049 => [0, 2, "ά", "ά", 8123, nil, 8123], - 8050 => [0, 0, "ὲ", "ὲ", 8136, nil, 8136], - 8051 => [0, 2, "έ", "έ", 8137, nil, 8137], - 8052 => [0, 0, "ὴ", "ὴ", 8138, nil, 8138], - 8053 => [0, 2, "ή", "ή", 8139, nil, 8139], - 8054 => [0, 0, "ὶ", "ὶ", 8154, nil, 8154], - 8055 => [0, 2, "ί", "ί", 8155, nil, 8155], - 8056 => [0, 0, "ὸ", "ὸ", 8184, nil, 8184], - 8057 => [0, 2, "ό", "ό", 8185, nil, 8185], - 8058 => [0, 0, "ὺ", "ὺ", 8170, nil, 8170], - 8059 => [0, 2, "ύ", "ύ", 8171, nil, 8171], - 8060 => [0, 0, "ὼ", "ὼ", 8186, nil, 8186], - 8061 => [0, 2, "ώ", "ώ", 8187, nil, 8187], - 8064 => [0, 0, "ᾀ", "ᾀ", 8072, nil, 8072], - 8065 => [0, 0, "ᾁ", "ᾁ", 8073, nil, 8073], - 8066 => [0, 0, "ᾂ", "ᾂ", 8074, nil, 8074], - 8067 => [0, 0, "ᾃ", "ᾃ", 8075, nil, 8075], - 8068 => [0, 0, "ᾄ", "ᾄ", 8076, nil, 8076], - 8069 => [0, 0, "ᾅ", "ᾅ", 8077, nil, 8077], - 8070 => [0, 0, "ᾆ", "ᾆ", 8078, nil, 8078], - 8071 => [0, 0, "ᾇ", "ᾇ", 8079, nil, 8079], - 8072 => [0, 0, "ᾈ", "ᾈ", nil, 8064, nil], - 8073 => [0, 0, "ᾉ", "ᾉ", nil, 8065, nil], - 8074 => [0, 0, "ᾊ", "ᾊ", nil, 8066, nil], - 8075 => [0, 0, "ᾋ", "ᾋ", nil, 8067, nil], - 8076 => [0, 0, "ᾌ", "ᾌ", nil, 8068, nil], - 8077 => [0, 0, "ᾍ", "ᾍ", nil, 8069, nil], - 8078 => [0, 0, "ᾎ", "ᾎ", nil, 8070, nil], - 8079 => [0, 0, "ᾏ", "ᾏ", nil, 8071, nil], - 8080 => [0, 0, "ᾐ", "ᾐ", 8088, nil, 8088], - 8081 => [0, 0, "ᾑ", "ᾑ", 8089, nil, 8089], - 8082 => [0, 0, "ᾒ", "ᾒ", 8090, nil, 8090], - 8083 => [0, 0, "ᾓ", "ᾓ", 8091, nil, 8091], - 8084 => [0, 0, "ᾔ", "ᾔ", 8092, nil, 8092], - 8085 => [0, 0, "ᾕ", "ᾕ", 8093, nil, 8093], - 8086 => [0, 0, "ᾖ", "ᾖ", 8094, nil, 8094], - 8087 => [0, 0, "ᾗ", "ᾗ", 8095, nil, 8095], - 8088 => [0, 0, "ᾘ", "ᾘ", nil, 8080, nil], - 8089 => [0, 0, "ᾙ", "ᾙ", nil, 8081, nil], - 8090 => [0, 0, "ᾚ", "ᾚ", nil, 8082, nil], - 8091 => [0, 0, "ᾛ", "ᾛ", nil, 8083, nil], - 8092 => [0, 0, "ᾜ", "ᾜ", nil, 8084, nil], - 8093 => [0, 0, "ᾝ", "ᾝ", nil, 8085, nil], - 8094 => [0, 0, "ᾞ", "ᾞ", nil, 8086, nil], - 8095 => [0, 0, "ᾟ", "ᾟ", nil, 8087, nil], - 8096 => [0, 0, "ᾠ", "ᾠ", 8104, nil, 8104], - 8097 => [0, 0, "ᾡ", "ᾡ", 8105, nil, 8105], - 8098 => [0, 0, "ᾢ", "ᾢ", 8106, nil, 8106], - 8099 => [0, 0, "ᾣ", "ᾣ", 8107, nil, 8107], - 8100 => [0, 0, "ᾤ", "ᾤ", 8108, nil, 8108], - 8101 => [0, 0, "ᾥ", "ᾥ", 8109, nil, 8109], - 8102 => [0, 0, "ᾦ", "ᾦ", 8110, nil, 8110], - 8103 => [0, 0, "ᾧ", "ᾧ", 8111, nil, 8111], - 8104 => [0, 0, "ᾨ", "ᾨ", nil, 8096, nil], - 8105 => [0, 0, "ᾩ", "ᾩ", nil, 8097, nil], - 8106 => [0, 0, "ᾪ", "ᾪ", nil, 8098, nil], - 8107 => [0, 0, "ᾫ", "ᾫ", nil, 8099, nil], - 8108 => [0, 0, "ᾬ", "ᾬ", nil, 8100, nil], - 8109 => [0, 0, "ᾭ", "ᾭ", nil, 8101, nil], - 8110 => [0, 0, "ᾮ", "ᾮ", nil, 8102, nil], - 8111 => [0, 0, "ᾯ", "ᾯ", nil, 8103, nil], - 8112 => [0, 0, "ᾰ", "ᾰ", 8120, nil, 8120], - 8113 => [0, 0, "ᾱ", "ᾱ", 8121, nil, 8121], - 8114 => [0, 0, "ᾲ", "ᾲ", nil, nil, nil], - 8115 => [0, 0, "ᾳ", "ᾳ", 8124, nil, 8124], - 8116 => [0, 0, "ᾴ", "ᾴ", nil, nil, nil], - 8118 => [0, 0, "ᾶ", "ᾶ", nil, nil, nil], - 8119 => [0, 0, "ᾷ", "ᾷ", nil, nil, nil], - 8120 => [0, 0, "Ᾰ", "Ᾰ", nil, 8112, nil], - 8121 => [0, 0, "Ᾱ", "Ᾱ", nil, 8113, nil], - 8122 => [0, 0, "Ὰ", "Ὰ", nil, 8048, nil], - 8123 => [0, 2, "Ά", "Ά", nil, 8049, nil], - 8124 => [0, 0, "ᾼ", "ᾼ", nil, 8115, nil], - 8125 => [0, 0, nil, " ̓", nil, nil, nil], - 8126 => [0, 2, "ι", "ι", 921, nil, 921], - 8127 => [0, 0, nil, " ̓", nil, nil, nil], - 8128 => [0, 0, nil, " ͂", nil, nil, nil], - 8129 => [0, 0, "῁", "῁", nil, nil, nil], - 8130 => [0, 0, "ῂ", "ῂ", nil, nil, nil], - 8131 => [0, 0, "ῃ", "ῃ", 8140, nil, 8140], - 8132 => [0, 0, "ῄ", "ῄ", nil, nil, nil], - 8134 => [0, 0, "ῆ", "ῆ", nil, nil, nil], - 8135 => [0, 0, "ῇ", "ῇ", nil, nil, nil], - 8136 => [0, 0, "Ὲ", "Ὲ", nil, 8050, nil], - 8137 => [0, 2, "Έ", "Έ", nil, 8051, nil], - 8138 => [0, 0, "Ὴ", "Ὴ", nil, 8052, nil], - 8139 => [0, 2, "Ή", "Ή", nil, 8053, nil], - 8140 => [0, 0, "ῌ", "ῌ", nil, 8131, nil], - 8141 => [0, 0, "῍", "῍", nil, nil, nil], - 8142 => [0, 0, "῎", "῎", nil, nil, nil], - 8143 => [0, 0, "῏", "῏", nil, nil, nil], - 8144 => [0, 0, "ῐ", "ῐ", 8152, nil, 8152], - 8145 => [0, 0, "ῑ", "ῑ", 8153, nil, 8153], - 8146 => [0, 0, "ῒ", "ῒ", nil, nil, nil], - 8147 => [0, 2, "ΐ", "ΐ", nil, nil, nil], - 8150 => [0, 0, "ῖ", "ῖ", nil, nil, nil], - 8151 => [0, 0, "ῗ", "ῗ", nil, nil, nil], - 8152 => [0, 0, "Ῐ", "Ῐ", nil, 8144, nil], - 8153 => [0, 0, "Ῑ", "Ῑ", nil, 8145, nil], - 8154 => [0, 0, "Ὶ", "Ὶ", nil, 8054, nil], - 8155 => [0, 2, "Ί", "Ί", nil, 8055, nil], - 8157 => [0, 0, "῝", "῝", nil, nil, nil], - 8158 => [0, 0, "῞", "῞", nil, nil, nil], - 8159 => [0, 0, "῟", "῟", nil, nil, nil], - 8160 => [0, 0, "ῠ", "ῠ", 8168, nil, 8168], - 8161 => [0, 0, "ῡ", "ῡ", 8169, nil, 8169], - 8162 => [0, 0, "ῢ", "ῢ", nil, nil, nil], - 8163 => [0, 2, "ΰ", "ΰ", nil, nil, nil], - 8164 => [0, 0, "ῤ", "ῤ", nil, nil, nil], - 8165 => [0, 0, "ῥ", "ῥ", 8172, nil, 8172], - 8166 => [0, 0, "ῦ", "ῦ", nil, nil, nil], - 8167 => [0, 0, "ῧ", "ῧ", nil, nil, nil], - 8168 => [0, 0, "Ῠ", "Ῠ", nil, 8160, nil], - 8169 => [0, 0, "Ῡ", "Ῡ", nil, 8161, nil], - 8170 => [0, 0, "Ὺ", "Ὺ", nil, 8058, nil], - 8171 => [0, 2, "Ύ", "Ύ", nil, 8059, nil], - 8172 => [0, 0, "Ῥ", "Ῥ", nil, 8165, nil], - 8173 => [0, 0, "῭", "῭", nil, nil, nil], - 8174 => [0, 2, "΅", "΅", nil, nil, nil], - 8175 => [0, 2, "`", "`", nil, nil, nil], - 8178 => [0, 0, "ῲ", "ῲ", nil, nil, nil], - 8179 => [0, 0, "ῳ", "ῳ", 8188, nil, 8188], - 8180 => [0, 0, "ῴ", "ῴ", nil, nil, nil], - 8182 => [0, 0, "ῶ", "ῶ", nil, nil, nil], - 8183 => [0, 0, "ῷ", "ῷ", nil, nil, nil], - 8184 => [0, 0, "Ὸ", "Ὸ", nil, 8056, nil], - 8185 => [0, 2, "Ό", "Ό", nil, 8057, nil], - 8186 => [0, 0, "Ὼ", "Ὼ", nil, 8060, nil], - 8187 => [0, 2, "Ώ", "Ώ", nil, 8061, nil], - 8188 => [0, 0, "ῼ", "ῼ", nil, 8179, nil], - 8189 => [0, 2, "´", "´", nil, nil, nil], - 8190 => [0, 0, nil, " ̔", nil, nil, nil], - 8192 => [0, 2, " ", " ", nil, nil, nil], - 8193 => [0, 2, " ", " ", nil, nil, nil], - 8194 => [0, 0, nil, " ", nil, nil, nil], - 8195 => [0, 0, nil, " ", nil, nil, nil], - 8196 => [0, 0, nil, " ", nil, nil, nil], - 8197 => [0, 0, nil, " ", nil, nil, nil], - 8198 => [0, 0, nil, " ", nil, nil, nil], - 8199 => [0, 0, nil, " ", nil, nil, nil], - 8200 => [0, 0, nil, " ", nil, nil, nil], - 8201 => [0, 0, nil, " ", nil, nil, nil], - 8202 => [0, 0, nil, " ", nil, nil, nil], - 8209 => [0, 0, nil, "‐", nil, nil, nil], - 8215 => [0, 0, nil, " ̳", nil, nil, nil], - 8228 => [0, 0, nil, ".", nil, nil, nil], - 8229 => [0, 0, nil, "..", nil, nil, nil], - 8230 => [0, 0, nil, "...", nil, nil, nil], - 8239 => [0, 0, nil, " ", nil, nil, nil], - 8243 => [0, 0, nil, "′′", nil, nil, nil], - 8244 => [0, 0, nil, "′′′", nil, nil, nil], - 8246 => [0, 0, nil, "‵‵", nil, nil, nil], - 8247 => [0, 0, nil, "‵‵‵", nil, nil, nil], - 8252 => [0, 0, nil, "!!", nil, nil, nil], - 8254 => [0, 0, nil, " ̅", nil, nil, nil], - 8264 => [0, 0, nil, "?!", nil, nil, nil], - 8265 => [0, 0, nil, "!?", nil, nil, nil], - 8304 => [0, 0, nil, "0", nil, nil, nil], - 8308 => [0, 0, nil, "4", nil, nil, nil], - 8309 => [0, 0, nil, "5", nil, nil, nil], - 8310 => [0, 0, nil, "6", nil, nil, nil], - 8311 => [0, 0, nil, "7", nil, nil, nil], - 8312 => [0, 0, nil, "8", nil, nil, nil], - 8313 => [0, 0, nil, "9", nil, nil, nil], - 8314 => [0, 0, nil, "+", nil, nil, nil], - 8315 => [0, 0, nil, "−", nil, nil, nil], - 8316 => [0, 0, nil, "=", nil, nil, nil], - 8317 => [0, 0, nil, "(", nil, nil, nil], - 8318 => [0, 0, nil, ")", nil, nil, nil], - 8319 => [0, 0, nil, "n", nil, nil, nil], - 8320 => [0, 0, nil, "0", nil, nil, nil], - 8321 => [0, 0, nil, "1", nil, nil, nil], - 8322 => [0, 0, nil, "2", nil, nil, nil], - 8323 => [0, 0, nil, "3", nil, nil, nil], - 8324 => [0, 0, nil, "4", nil, nil, nil], - 8325 => [0, 0, nil, "5", nil, nil, nil], - 8326 => [0, 0, nil, "6", nil, nil, nil], - 8327 => [0, 0, nil, "7", nil, nil, nil], - 8328 => [0, 0, nil, "8", nil, nil, nil], - 8329 => [0, 0, nil, "9", nil, nil, nil], - 8330 => [0, 0, nil, "+", nil, nil, nil], - 8331 => [0, 0, nil, "−", nil, nil, nil], - 8332 => [0, 0, nil, "=", nil, nil, nil], - 8333 => [0, 0, nil, "(", nil, nil, nil], - 8334 => [0, 0, nil, ")", nil, nil, nil], - 8360 => [0, 0, nil, "Rs", nil, nil, nil], - 8400 => [230, 0, nil, nil, nil, nil, nil], - 8401 => [230, 0, nil, nil, nil, nil, nil], - 8402 => [1, 0, nil, nil, nil, nil, nil], - 8403 => [1, 0, nil, nil, nil, nil, nil], - 8404 => [230, 0, nil, nil, nil, nil, nil], - 8405 => [230, 0, nil, nil, nil, nil, nil], - 8406 => [230, 0, nil, nil, nil, nil, nil], - 8407 => [230, 0, nil, nil, nil, nil, nil], - 8408 => [1, 0, nil, nil, nil, nil, nil], - 8409 => [1, 0, nil, nil, nil, nil, nil], - 8410 => [1, 0, nil, nil, nil, nil, nil], - 8411 => [230, 0, nil, nil, nil, nil, nil], - 8412 => [230, 0, nil, nil, nil, nil, nil], - 8417 => [230, 0, nil, nil, nil, nil, nil], - 8448 => [0, 0, nil, "a/c", nil, nil, nil], - 8449 => [0, 0, nil, "a/s", nil, nil, nil], - 8450 => [0, 0, nil, "C", nil, nil, nil], - 8451 => [0, 0, nil, "°C", nil, nil, nil], - 8453 => [0, 0, nil, "c/o", nil, nil, nil], - 8454 => [0, 0, nil, "c/u", nil, nil, nil], - 8455 => [0, 0, nil, "Ɛ", nil, nil, nil], - 8457 => [0, 0, nil, "°F", nil, nil, nil], - 8458 => [0, 0, nil, "g", nil, nil, nil], - 8459 => [0, 0, nil, "H", nil, nil, nil], - 8460 => [0, 0, nil, "H", nil, nil, nil], - 8461 => [0, 0, nil, "H", nil, nil, nil], - 8462 => [0, 0, nil, "h", nil, nil, nil], - 8463 => [0, 0, nil, "ħ", nil, nil, nil], - 8464 => [0, 0, nil, "I", nil, nil, nil], - 8465 => [0, 0, nil, "I", nil, nil, nil], - 8466 => [0, 0, nil, "L", nil, nil, nil], - 8467 => [0, 0, nil, "l", nil, nil, nil], - 8469 => [0, 0, nil, "N", nil, nil, nil], - 8470 => [0, 0, nil, "No", nil, nil, nil], - 8473 => [0, 0, nil, "P", nil, nil, nil], - 8474 => [0, 0, nil, "Q", nil, nil, nil], - 8475 => [0, 0, nil, "R", nil, nil, nil], - 8476 => [0, 0, nil, "R", nil, nil, nil], - 8477 => [0, 0, nil, "R", nil, nil, nil], - 8480 => [0, 0, nil, "SM", nil, nil, nil], - 8481 => [0, 0, nil, "TEL", nil, nil, nil], - 8482 => [0, 0, nil, "TM", nil, nil, nil], - 8484 => [0, 0, nil, "Z", nil, nil, nil], - 8486 => [0, 2, "Ω", "Ω", nil, 969, nil], - 8488 => [0, 0, nil, "Z", nil, nil, nil], - 8490 => [0, 2, "K", "K", nil, 107, nil], - 8491 => [0, 2, "Å", "Å", nil, 229, nil], - 8492 => [0, 0, nil, "B", nil, nil, nil], - 8493 => [0, 0, nil, "C", nil, nil, nil], - 8495 => [0, 0, nil, "e", nil, nil, nil], - 8496 => [0, 0, nil, "E", nil, nil, nil], - 8497 => [0, 0, nil, "F", nil, nil, nil], - 8499 => [0, 0, nil, "M", nil, nil, nil], - 8500 => [0, 0, nil, "o", nil, nil, nil], - 8501 => [0, 0, nil, "א", nil, nil, nil], - 8502 => [0, 0, nil, "ב", nil, nil, nil], - 8503 => [0, 0, nil, "ג", nil, nil, nil], - 8504 => [0, 0, nil, "ד", nil, nil, nil], - 8505 => [0, 0, nil, "i", nil, nil, nil], - 8531 => [0, 0, nil, "1⁄3", nil, nil, nil], - 8532 => [0, 0, nil, "2⁄3", nil, nil, nil], - 8533 => [0, 0, nil, "1⁄5", nil, nil, nil], - 8534 => [0, 0, nil, "2⁄5", nil, nil, nil], - 8535 => [0, 0, nil, "3⁄5", nil, nil, nil], - 8536 => [0, 0, nil, "4⁄5", nil, nil, nil], - 8537 => [0, 0, nil, "1⁄6", nil, nil, nil], - 8538 => [0, 0, nil, "5⁄6", nil, nil, nil], - 8539 => [0, 0, nil, "1⁄8", nil, nil, nil], - 8540 => [0, 0, nil, "3⁄8", nil, nil, nil], - 8541 => [0, 0, nil, "5⁄8", nil, nil, nil], - 8542 => [0, 0, nil, "7⁄8", nil, nil, nil], - 8543 => [0, 0, nil, "1⁄", nil, nil, nil], - 8544 => [0, 0, nil, "I", nil, 8560, nil], - 8545 => [0, 0, nil, "II", nil, 8561, nil], - 8546 => [0, 0, nil, "III", nil, 8562, nil], - 8547 => [0, 0, nil, "IV", nil, 8563, nil], - 8548 => [0, 0, nil, "V", nil, 8564, nil], - 8549 => [0, 0, nil, "VI", nil, 8565, nil], - 8550 => [0, 0, nil, "VII", nil, 8566, nil], - 8551 => [0, 0, nil, "VIII", nil, 8567, nil], - 8552 => [0, 0, nil, "IX", nil, 8568, nil], - 8553 => [0, 0, nil, "X", nil, 8569, nil], - 8554 => [0, 0, nil, "XI", nil, 8570, nil], - 8555 => [0, 0, nil, "XII", nil, 8571, nil], - 8556 => [0, 0, nil, "L", nil, 8572, nil], - 8557 => [0, 0, nil, "C", nil, 8573, nil], - 8558 => [0, 0, nil, "D", nil, 8574, nil], - 8559 => [0, 0, nil, "M", nil, 8575, nil], - 8560 => [0, 0, nil, "i", 8544, nil, 8544], - 8561 => [0, 0, nil, "ii", 8545, nil, 8545], - 8562 => [0, 0, nil, "iii", 8546, nil, 8546], - 8563 => [0, 0, nil, "iv", 8547, nil, 8547], - 8564 => [0, 0, nil, "v", 8548, nil, 8548], - 8565 => [0, 0, nil, "vi", 8549, nil, 8549], - 8566 => [0, 0, nil, "vii", 8550, nil, 8550], - 8567 => [0, 0, nil, "viii", 8551, nil, 8551], - 8568 => [0, 0, nil, "ix", 8552, nil, 8552], - 8569 => [0, 0, nil, "x", 8553, nil, 8553], - 8570 => [0, 0, nil, "xi", 8554, nil, 8554], - 8571 => [0, 0, nil, "xii", 8555, nil, 8555], - 8572 => [0, 0, nil, "l", 8556, nil, 8556], - 8573 => [0, 0, nil, "c", 8557, nil, 8557], - 8574 => [0, 0, nil, "d", 8558, nil, 8558], - 8575 => [0, 0, nil, "m", 8559, nil, 8559], - 8602 => [0, 0, "↚", "↚", nil, nil, nil], - 8603 => [0, 0, "↛", "↛", nil, nil, nil], - 8622 => [0, 0, "↮", "↮", nil, nil, nil], - 8653 => [0, 0, "⇍", "⇍", nil, nil, nil], - 8654 => [0, 0, "⇎", "⇎", nil, nil, nil], - 8655 => [0, 0, "⇏", "⇏", nil, nil, nil], - 8708 => [0, 0, "∄", "∄", nil, nil, nil], - 8713 => [0, 0, "∉", "∉", nil, nil, nil], - 8716 => [0, 0, "∌", "∌", nil, nil, nil], - 8740 => [0, 0, "∤", "∤", nil, nil, nil], - 8742 => [0, 0, "∦", "∦", nil, nil, nil], - 8748 => [0, 0, nil, "∫∫", nil, nil, nil], - 8749 => [0, 0, nil, "∫∫∫", nil, nil, nil], - 8751 => [0, 0, nil, "∮∮", nil, nil, nil], - 8752 => [0, 0, nil, "∮∮∮", nil, nil, nil], - 8769 => [0, 0, "≁", "≁", nil, nil, nil], - 8772 => [0, 0, "≄", "≄", nil, nil, nil], - 8775 => [0, 0, "≇", "≇", nil, nil, nil], - 8777 => [0, 0, "≉", "≉", nil, nil, nil], - 8800 => [0, 0, "≠", "≠", nil, nil, nil], - 8802 => [0, 0, "≢", "≢", nil, nil, nil], - 8813 => [0, 0, "≭", "≭", nil, nil, nil], - 8814 => [0, 0, "≮", "≮", nil, nil, nil], - 8815 => [0, 0, "≯", "≯", nil, nil, nil], - 8816 => [0, 0, "≰", "≰", nil, nil, nil], - 8817 => [0, 0, "≱", "≱", nil, nil, nil], - 8820 => [0, 0, "≴", "≴", nil, nil, nil], - 8821 => [0, 0, "≵", "≵", nil, nil, nil], - 8824 => [0, 0, "≸", "≸", nil, nil, nil], - 8825 => [0, 0, "≹", "≹", nil, nil, nil], - 8832 => [0, 0, "⊀", "⊀", nil, nil, nil], - 8833 => [0, 0, "⊁", "⊁", nil, nil, nil], - 8836 => [0, 0, "⊄", "⊄", nil, nil, nil], - 8837 => [0, 0, "⊅", "⊅", nil, nil, nil], - 8840 => [0, 0, "⊈", "⊈", nil, nil, nil], - 8841 => [0, 0, "⊉", "⊉", nil, nil, nil], - 8876 => [0, 0, "⊬", "⊬", nil, nil, nil], - 8877 => [0, 0, "⊭", "⊭", nil, nil, nil], - 8878 => [0, 0, "⊮", "⊮", nil, nil, nil], - 8879 => [0, 0, "⊯", "⊯", nil, nil, nil], - 8928 => [0, 0, "⋠", "⋠", nil, nil, nil], - 8929 => [0, 0, "⋡", "⋡", nil, nil, nil], - 8930 => [0, 0, "⋢", "⋢", nil, nil, nil], - 8931 => [0, 0, "⋣", "⋣", nil, nil, nil], - 8938 => [0, 0, "⋪", "⋪", nil, nil, nil], - 8939 => [0, 0, "⋫", "⋫", nil, nil, nil], - 8940 => [0, 0, "⋬", "⋬", nil, nil, nil], - 8941 => [0, 0, "⋭", "⋭", nil, nil, nil], - 9001 => [0, 2, "〈", "〈", nil, nil, nil], - 9002 => [0, 2, "〉", "〉", nil, nil, nil], - 9312 => [0, 0, nil, "1", nil, nil, nil], - 9313 => [0, 0, nil, "2", nil, nil, nil], - 9314 => [0, 0, nil, "3", nil, nil, nil], - 9315 => [0, 0, nil, "4", nil, nil, nil], - 9316 => [0, 0, nil, "5", nil, nil, nil], - 9317 => [0, 0, nil, "6", nil, nil, nil], - 9318 => [0, 0, nil, "7", nil, nil, nil], - 9319 => [0, 0, nil, "8", nil, nil, nil], - 9320 => [0, 0, nil, "9", nil, nil, nil], - 9321 => [0, 0, nil, "10", nil, nil, nil], - 9322 => [0, 0, nil, "11", nil, nil, nil], - 9323 => [0, 0, nil, "12", nil, nil, nil], - 9324 => [0, 0, nil, "13", nil, nil, nil], - 9325 => [0, 0, nil, "14", nil, nil, nil], - 9326 => [0, 0, nil, "15", nil, nil, nil], - 9327 => [0, 0, nil, "16", nil, nil, nil], - 9328 => [0, 0, nil, "17", nil, nil, nil], - 9329 => [0, 0, nil, "18", nil, nil, nil], - 9330 => [0, 0, nil, "19", nil, nil, nil], - 9331 => [0, 0, nil, "20", nil, nil, nil], - 9332 => [0, 0, nil, "(1)", nil, nil, nil], - 9333 => [0, 0, nil, "(2)", nil, nil, nil], - 9334 => [0, 0, nil, "(3)", nil, nil, nil], - 9335 => [0, 0, nil, "(4)", nil, nil, nil], - 9336 => [0, 0, nil, "(5)", nil, nil, nil], - 9337 => [0, 0, nil, "(6)", nil, nil, nil], - 9338 => [0, 0, nil, "(7)", nil, nil, nil], - 9339 => [0, 0, nil, "(8)", nil, nil, nil], - 9340 => [0, 0, nil, "(9)", nil, nil, nil], - 9341 => [0, 0, nil, "(10)", nil, nil, nil], - 9342 => [0, 0, nil, "(11)", nil, nil, nil], - 9343 => [0, 0, nil, "(12)", nil, nil, nil], - 9344 => [0, 0, nil, "(13)", nil, nil, nil], - 9345 => [0, 0, nil, "(14)", nil, nil, nil], - 9346 => [0, 0, nil, "(15)", nil, nil, nil], - 9347 => [0, 0, nil, "(16)", nil, nil, nil], - 9348 => [0, 0, nil, "(17)", nil, nil, nil], - 9349 => [0, 0, nil, "(18)", nil, nil, nil], - 9350 => [0, 0, nil, "(19)", nil, nil, nil], - 9351 => [0, 0, nil, "(20)", nil, nil, nil], - 9352 => [0, 0, nil, "1.", nil, nil, nil], - 9353 => [0, 0, nil, "2.", nil, nil, nil], - 9354 => [0, 0, nil, "3.", nil, nil, nil], - 9355 => [0, 0, nil, "4.", nil, nil, nil], - 9356 => [0, 0, nil, "5.", nil, nil, nil], - 9357 => [0, 0, nil, "6.", nil, nil, nil], - 9358 => [0, 0, nil, "7.", nil, nil, nil], - 9359 => [0, 0, nil, "8.", nil, nil, nil], - 9360 => [0, 0, nil, "9.", nil, nil, nil], - 9361 => [0, 0, nil, "10.", nil, nil, nil], - 9362 => [0, 0, nil, "11.", nil, nil, nil], - 9363 => [0, 0, nil, "12.", nil, nil, nil], - 9364 => [0, 0, nil, "13.", nil, nil, nil], - 9365 => [0, 0, nil, "14.", nil, nil, nil], - 9366 => [0, 0, nil, "15.", nil, nil, nil], - 9367 => [0, 0, nil, "16.", nil, nil, nil], - 9368 => [0, 0, nil, "17.", nil, nil, nil], - 9369 => [0, 0, nil, "18.", nil, nil, nil], - 9370 => [0, 0, nil, "19.", nil, nil, nil], - 9371 => [0, 0, nil, "20.", nil, nil, nil], - 9372 => [0, 0, nil, "(a)", nil, nil, nil], - 9373 => [0, 0, nil, "(b)", nil, nil, nil], - 9374 => [0, 0, nil, "(c)", nil, nil, nil], - 9375 => [0, 0, nil, "(d)", nil, nil, nil], - 9376 => [0, 0, nil, "(e)", nil, nil, nil], - 9377 => [0, 0, nil, "(f)", nil, nil, nil], - 9378 => [0, 0, nil, "(g)", nil, nil, nil], - 9379 => [0, 0, nil, "(h)", nil, nil, nil], - 9380 => [0, 0, nil, "(i)", nil, nil, nil], - 9381 => [0, 0, nil, "(j)", nil, nil, nil], - 9382 => [0, 0, nil, "(k)", nil, nil, nil], - 9383 => [0, 0, nil, "(l)", nil, nil, nil], - 9384 => [0, 0, nil, "(m)", nil, nil, nil], - 9385 => [0, 0, nil, "(n)", nil, nil, nil], - 9386 => [0, 0, nil, "(o)", nil, nil, nil], - 9387 => [0, 0, nil, "(p)", nil, nil, nil], - 9388 => [0, 0, nil, "(q)", nil, nil, nil], - 9389 => [0, 0, nil, "(r)", nil, nil, nil], - 9390 => [0, 0, nil, "(s)", nil, nil, nil], - 9391 => [0, 0, nil, "(t)", nil, nil, nil], - 9392 => [0, 0, nil, "(u)", nil, nil, nil], - 9393 => [0, 0, nil, "(v)", nil, nil, nil], - 9394 => [0, 0, nil, "(w)", nil, nil, nil], - 9395 => [0, 0, nil, "(x)", nil, nil, nil], - 9396 => [0, 0, nil, "(y)", nil, nil, nil], - 9397 => [0, 0, nil, "(z)", nil, nil, nil], - 9398 => [0, 0, nil, "A", nil, 9424, nil], - 9399 => [0, 0, nil, "B", nil, 9425, nil], - 9400 => [0, 0, nil, "C", nil, 9426, nil], - 9401 => [0, 0, nil, "D", nil, 9427, nil], - 9402 => [0, 0, nil, "E", nil, 9428, nil], - 9403 => [0, 0, nil, "F", nil, 9429, nil], - 9404 => [0, 0, nil, "G", nil, 9430, nil], - 9405 => [0, 0, nil, "H", nil, 9431, nil], - 9406 => [0, 0, nil, "I", nil, 9432, nil], - 9407 => [0, 0, nil, "J", nil, 9433, nil], - 9408 => [0, 0, nil, "K", nil, 9434, nil], - 9409 => [0, 0, nil, "L", nil, 9435, nil], - 9410 => [0, 0, nil, "M", nil, 9436, nil], - 9411 => [0, 0, nil, "N", nil, 9437, nil], - 9412 => [0, 0, nil, "O", nil, 9438, nil], - 9413 => [0, 0, nil, "P", nil, 9439, nil], - 9414 => [0, 0, nil, "Q", nil, 9440, nil], - 9415 => [0, 0, nil, "R", nil, 9441, nil], - 9416 => [0, 0, nil, "S", nil, 9442, nil], - 9417 => [0, 0, nil, "T", nil, 9443, nil], - 9418 => [0, 0, nil, "U", nil, 9444, nil], - 9419 => [0, 0, nil, "V", nil, 9445, nil], - 9420 => [0, 0, nil, "W", nil, 9446, nil], - 9421 => [0, 0, nil, "X", nil, 9447, nil], - 9422 => [0, 0, nil, "Y", nil, 9448, nil], - 9423 => [0, 0, nil, "Z", nil, 9449, nil], - 9424 => [0, 0, nil, "a", 9398, nil, 9398], - 9425 => [0, 0, nil, "b", 9399, nil, 9399], - 9426 => [0, 0, nil, "c", 9400, nil, 9400], - 9427 => [0, 0, nil, "d", 9401, nil, 9401], - 9428 => [0, 0, nil, "e", 9402, nil, 9402], - 9429 => [0, 0, nil, "f", 9403, nil, 9403], - 9430 => [0, 0, nil, "g", 9404, nil, 9404], - 9431 => [0, 0, nil, "h", 9405, nil, 9405], - 9432 => [0, 0, nil, "i", 9406, nil, 9406], - 9433 => [0, 0, nil, "j", 9407, nil, 9407], - 9434 => [0, 0, nil, "k", 9408, nil, 9408], - 9435 => [0, 0, nil, "l", 9409, nil, 9409], - 9436 => [0, 0, nil, "m", 9410, nil, 9410], - 9437 => [0, 0, nil, "n", 9411, nil, 9411], - 9438 => [0, 0, nil, "o", 9412, nil, 9412], - 9439 => [0, 0, nil, "p", 9413, nil, 9413], - 9440 => [0, 0, nil, "q", 9414, nil, 9414], - 9441 => [0, 0, nil, "r", 9415, nil, 9415], - 9442 => [0, 0, nil, "s", 9416, nil, 9416], - 9443 => [0, 0, nil, "t", 9417, nil, 9417], - 9444 => [0, 0, nil, "u", 9418, nil, 9418], - 9445 => [0, 0, nil, "v", 9419, nil, 9419], - 9446 => [0, 0, nil, "w", 9420, nil, 9420], - 9447 => [0, 0, nil, "x", 9421, nil, 9421], - 9448 => [0, 0, nil, "y", 9422, nil, 9422], - 9449 => [0, 0, nil, "z", 9423, nil, 9423], - 9450 => [0, 0, nil, "0", nil, nil, nil], - 11935 => [0, 0, nil, "母", nil, nil, nil], - 12019 => [0, 0, nil, "龟", nil, nil, nil], - 12032 => [0, 0, nil, "一", nil, nil, nil], - 12033 => [0, 0, nil, "丨", nil, nil, nil], - 12034 => [0, 0, nil, "丶", nil, nil, nil], - 12035 => [0, 0, nil, "丿", nil, nil, nil], - 12036 => [0, 0, nil, "乙", nil, nil, nil], - 12037 => [0, 0, nil, "亅", nil, nil, nil], - 12038 => [0, 0, nil, "二", nil, nil, nil], - 12039 => [0, 0, nil, "亠", nil, nil, nil], - 12040 => [0, 0, nil, "人", nil, nil, nil], - 12041 => [0, 0, nil, "儿", nil, nil, nil], - 12042 => [0, 0, nil, "入", nil, nil, nil], - 12043 => [0, 0, nil, "八", nil, nil, nil], - 12044 => [0, 0, nil, "冂", nil, nil, nil], - 12045 => [0, 0, nil, "冖", nil, nil, nil], - 12046 => [0, 0, nil, "冫", nil, nil, nil], - 12047 => [0, 0, nil, "几", nil, nil, nil], - 12048 => [0, 0, nil, "凵", nil, nil, nil], - 12049 => [0, 0, nil, "刀", nil, nil, nil], - 12050 => [0, 0, nil, "力", nil, nil, nil], - 12051 => [0, 0, nil, "勹", nil, nil, nil], - 12052 => [0, 0, nil, "匕", nil, nil, nil], - 12053 => [0, 0, nil, "匚", nil, nil, nil], - 12054 => [0, 0, nil, "匸", nil, nil, nil], - 12055 => [0, 0, nil, "十", nil, nil, nil], - 12056 => [0, 0, nil, "卜", nil, nil, nil], - 12057 => [0, 0, nil, "卩", nil, nil, nil], - 12058 => [0, 0, nil, "厂", nil, nil, nil], - 12059 => [0, 0, nil, "厶", nil, nil, nil], - 12060 => [0, 0, nil, "又", nil, nil, nil], - 12061 => [0, 0, nil, "口", nil, nil, nil], - 12062 => [0, 0, nil, "囗", nil, nil, nil], - 12063 => [0, 0, nil, "土", nil, nil, nil], - 12064 => [0, 0, nil, "士", nil, nil, nil], - 12065 => [0, 0, nil, "夂", nil, nil, nil], - 12066 => [0, 0, nil, "夊", nil, nil, nil], - 12067 => [0, 0, nil, "夕", nil, nil, nil], - 12068 => [0, 0, nil, "大", nil, nil, nil], - 12069 => [0, 0, nil, "女", nil, nil, nil], - 12070 => [0, 0, nil, "子", nil, nil, nil], - 12071 => [0, 0, nil, "宀", nil, nil, nil], - 12072 => [0, 0, nil, "寸", nil, nil, nil], - 12073 => [0, 0, nil, "小", nil, nil, nil], - 12074 => [0, 0, nil, "尢", nil, nil, nil], - 12075 => [0, 0, nil, "尸", nil, nil, nil], - 12076 => [0, 0, nil, "屮", nil, nil, nil], - 12077 => [0, 0, nil, "山", nil, nil, nil], - 12078 => [0, 0, nil, "巛", nil, nil, nil], - 12079 => [0, 0, nil, "工", nil, nil, nil], - 12080 => [0, 0, nil, "己", nil, nil, nil], - 12081 => [0, 0, nil, "巾", nil, nil, nil], - 12082 => [0, 0, nil, "干", nil, nil, nil], - 12083 => [0, 0, nil, "幺", nil, nil, nil], - 12084 => [0, 0, nil, "广", nil, nil, nil], - 12085 => [0, 0, nil, "廴", nil, nil, nil], - 12086 => [0, 0, nil, "廾", nil, nil, nil], - 12087 => [0, 0, nil, "弋", nil, nil, nil], - 12088 => [0, 0, nil, "弓", nil, nil, nil], - 12089 => [0, 0, nil, "彐", nil, nil, nil], - 12090 => [0, 0, nil, "彡", nil, nil, nil], - 12091 => [0, 0, nil, "彳", nil, nil, nil], - 12092 => [0, 0, nil, "心", nil, nil, nil], - 12093 => [0, 0, nil, "戈", nil, nil, nil], - 12094 => [0, 0, nil, "戶", nil, nil, nil], - 12095 => [0, 0, nil, "手", nil, nil, nil], - 12096 => [0, 0, nil, "支", nil, nil, nil], - 12097 => [0, 0, nil, "攴", nil, nil, nil], - 12098 => [0, 0, nil, "文", nil, nil, nil], - 12099 => [0, 0, nil, "斗", nil, nil, nil], - 12100 => [0, 0, nil, "斤", nil, nil, nil], - 12101 => [0, 0, nil, "方", nil, nil, nil], - 12102 => [0, 0, nil, "无", nil, nil, nil], - 12103 => [0, 0, nil, "日", nil, nil, nil], - 12104 => [0, 0, nil, "曰", nil, nil, nil], - 12105 => [0, 0, nil, "月", nil, nil, nil], - 12106 => [0, 0, nil, "木", nil, nil, nil], - 12107 => [0, 0, nil, "欠", nil, nil, nil], - 12108 => [0, 0, nil, "止", nil, nil, nil], - 12109 => [0, 0, nil, "歹", nil, nil, nil], - 12110 => [0, 0, nil, "殳", nil, nil, nil], - 12111 => [0, 0, nil, "毋", nil, nil, nil], - 12112 => [0, 0, nil, "比", nil, nil, nil], - 12113 => [0, 0, nil, "毛", nil, nil, nil], - 12114 => [0, 0, nil, "氏", nil, nil, nil], - 12115 => [0, 0, nil, "气", nil, nil, nil], - 12116 => [0, 0, nil, "水", nil, nil, nil], - 12117 => [0, 0, nil, "火", nil, nil, nil], - 12118 => [0, 0, nil, "爪", nil, nil, nil], - 12119 => [0, 0, nil, "父", nil, nil, nil], - 12120 => [0, 0, nil, "爻", nil, nil, nil], - 12121 => [0, 0, nil, "爿", nil, nil, nil], - 12122 => [0, 0, nil, "片", nil, nil, nil], - 12123 => [0, 0, nil, "牙", nil, nil, nil], - 12124 => [0, 0, nil, "牛", nil, nil, nil], - 12125 => [0, 0, nil, "犬", nil, nil, nil], - 12126 => [0, 0, nil, "玄", nil, nil, nil], - 12127 => [0, 0, nil, "玉", nil, nil, nil], - 12128 => [0, 0, nil, "瓜", nil, nil, nil], - 12129 => [0, 0, nil, "瓦", nil, nil, nil], - 12130 => [0, 0, nil, "甘", nil, nil, nil], - 12131 => [0, 0, nil, "生", nil, nil, nil], - 12132 => [0, 0, nil, "用", nil, nil, nil], - 12133 => [0, 0, nil, "田", nil, nil, nil], - 12134 => [0, 0, nil, "疋", nil, nil, nil], - 12135 => [0, 0, nil, "疒", nil, nil, nil], - 12136 => [0, 0, nil, "癶", nil, nil, nil], - 12137 => [0, 0, nil, "白", nil, nil, nil], - 12138 => [0, 0, nil, "皮", nil, nil, nil], - 12139 => [0, 0, nil, "皿", nil, nil, nil], - 12140 => [0, 0, nil, "目", nil, nil, nil], - 12141 => [0, 0, nil, "矛", nil, nil, nil], - 12142 => [0, 0, nil, "矢", nil, nil, nil], - 12143 => [0, 0, nil, "石", nil, nil, nil], - 12144 => [0, 0, nil, "示", nil, nil, nil], - 12145 => [0, 0, nil, "禸", nil, nil, nil], - 12146 => [0, 0, nil, "禾", nil, nil, nil], - 12147 => [0, 0, nil, "穴", nil, nil, nil], - 12148 => [0, 0, nil, "立", nil, nil, nil], - 12149 => [0, 0, nil, "竹", nil, nil, nil], - 12150 => [0, 0, nil, "米", nil, nil, nil], - 12151 => [0, 0, nil, "糸", nil, nil, nil], - 12152 => [0, 0, nil, "缶", nil, nil, nil], - 12153 => [0, 0, nil, "网", nil, nil, nil], - 12154 => [0, 0, nil, "羊", nil, nil, nil], - 12155 => [0, 0, nil, "羽", nil, nil, nil], - 12156 => [0, 0, nil, "老", nil, nil, nil], - 12157 => [0, 0, nil, "而", nil, nil, nil], - 12158 => [0, 0, nil, "耒", nil, nil, nil], - 12159 => [0, 0, nil, "耳", nil, nil, nil], - 12160 => [0, 0, nil, "聿", nil, nil, nil], - 12161 => [0, 0, nil, "肉", nil, nil, nil], - 12162 => [0, 0, nil, "臣", nil, nil, nil], - 12163 => [0, 0, nil, "自", nil, nil, nil], - 12164 => [0, 0, nil, "至", nil, nil, nil], - 12165 => [0, 0, nil, "臼", nil, nil, nil], - 12166 => [0, 0, nil, "舌", nil, nil, nil], - 12167 => [0, 0, nil, "舛", nil, nil, nil], - 12168 => [0, 0, nil, "舟", nil, nil, nil], - 12169 => [0, 0, nil, "艮", nil, nil, nil], - 12170 => [0, 0, nil, "色", nil, nil, nil], - 12171 => [0, 0, nil, "艸", nil, nil, nil], - 12172 => [0, 0, nil, "虍", nil, nil, nil], - 12173 => [0, 0, nil, "虫", nil, nil, nil], - 12174 => [0, 0, nil, "血", nil, nil, nil], - 12175 => [0, 0, nil, "行", nil, nil, nil], - 12176 => [0, 0, nil, "衣", nil, nil, nil], - 12177 => [0, 0, nil, "襾", nil, nil, nil], - 12178 => [0, 0, nil, "見", nil, nil, nil], - 12179 => [0, 0, nil, "角", nil, nil, nil], - 12180 => [0, 0, nil, "言", nil, nil, nil], - 12181 => [0, 0, nil, "谷", nil, nil, nil], - 12182 => [0, 0, nil, "豆", nil, nil, nil], - 12183 => [0, 0, nil, "豕", nil, nil, nil], - 12184 => [0, 0, nil, "豸", nil, nil, nil], - 12185 => [0, 0, nil, "貝", nil, nil, nil], - 12186 => [0, 0, nil, "赤", nil, nil, nil], - 12187 => [0, 0, nil, "走", nil, nil, nil], - 12188 => [0, 0, nil, "足", nil, nil, nil], - 12189 => [0, 0, nil, "身", nil, nil, nil], - 12190 => [0, 0, nil, "車", nil, nil, nil], - 12191 => [0, 0, nil, "辛", nil, nil, nil], - 12192 => [0, 0, nil, "辰", nil, nil, nil], - 12193 => [0, 0, nil, "辵", nil, nil, nil], - 12194 => [0, 0, nil, "邑", nil, nil, nil], - 12195 => [0, 0, nil, "酉", nil, nil, nil], - 12196 => [0, 0, nil, "釆", nil, nil, nil], - 12197 => [0, 0, nil, "里", nil, nil, nil], - 12198 => [0, 0, nil, "金", nil, nil, nil], - 12199 => [0, 0, nil, "長", nil, nil, nil], - 12200 => [0, 0, nil, "門", nil, nil, nil], - 12201 => [0, 0, nil, "阜", nil, nil, nil], - 12202 => [0, 0, nil, "隶", nil, nil, nil], - 12203 => [0, 0, nil, "隹", nil, nil, nil], - 12204 => [0, 0, nil, "雨", nil, nil, nil], - 12205 => [0, 0, nil, "靑", nil, nil, nil], - 12206 => [0, 0, nil, "非", nil, nil, nil], - 12207 => [0, 0, nil, "面", nil, nil, nil], - 12208 => [0, 0, nil, "革", nil, nil, nil], - 12209 => [0, 0, nil, "韋", nil, nil, nil], - 12210 => [0, 0, nil, "韭", nil, nil, nil], - 12211 => [0, 0, nil, "音", nil, nil, nil], - 12212 => [0, 0, nil, "頁", nil, nil, nil], - 12213 => [0, 0, nil, "風", nil, nil, nil], - 12214 => [0, 0, nil, "飛", nil, nil, nil], - 12215 => [0, 0, nil, "食", nil, nil, nil], - 12216 => [0, 0, nil, "首", nil, nil, nil], - 12217 => [0, 0, nil, "香", nil, nil, nil], - 12218 => [0, 0, nil, "馬", nil, nil, nil], - 12219 => [0, 0, nil, "骨", nil, nil, nil], - 12220 => [0, 0, nil, "高", nil, nil, nil], - 12221 => [0, 0, nil, "髟", nil, nil, nil], - 12222 => [0, 0, nil, "鬥", nil, nil, nil], - 12223 => [0, 0, nil, "鬯", nil, nil, nil], - 12224 => [0, 0, nil, "鬲", nil, nil, nil], - 12225 => [0, 0, nil, "鬼", nil, nil, nil], - 12226 => [0, 0, nil, "魚", nil, nil, nil], - 12227 => [0, 0, nil, "鳥", nil, nil, nil], - 12228 => [0, 0, nil, "鹵", nil, nil, nil], - 12229 => [0, 0, nil, "鹿", nil, nil, nil], - 12230 => [0, 0, nil, "麥", nil, nil, nil], - 12231 => [0, 0, nil, "麻", nil, nil, nil], - 12232 => [0, 0, nil, "黃", nil, nil, nil], - 12233 => [0, 0, nil, "黍", nil, nil, nil], - 12234 => [0, 0, nil, "黑", nil, nil, nil], - 12235 => [0, 0, nil, "黹", nil, nil, nil], - 12236 => [0, 0, nil, "黽", nil, nil, nil], - 12237 => [0, 0, nil, "鼎", nil, nil, nil], - 12238 => [0, 0, nil, "鼓", nil, nil, nil], - 12239 => [0, 0, nil, "鼠", nil, nil, nil], - 12240 => [0, 0, nil, "鼻", nil, nil, nil], - 12241 => [0, 0, nil, "齊", nil, nil, nil], - 12242 => [0, 0, nil, "齒", nil, nil, nil], - 12243 => [0, 0, nil, "龍", nil, nil, nil], - 12244 => [0, 0, nil, "龜", nil, nil, nil], - 12245 => [0, 0, nil, "龠", nil, nil, nil], - 12288 => [0, 0, nil, " ", nil, nil, nil], - 12330 => [218, 0, nil, nil, nil, nil, nil], - 12331 => [228, 0, nil, nil, nil, nil, nil], - 12332 => [232, 0, nil, nil, nil, nil, nil], - 12333 => [222, 0, nil, nil, nil, nil, nil], - 12334 => [224, 0, nil, nil, nil, nil, nil], - 12335 => [224, 0, nil, nil, nil, nil, nil], - 12342 => [0, 0, nil, "〒", nil, nil, nil], - 12344 => [0, 0, nil, "十", nil, nil, nil], - 12345 => [0, 0, nil, "卄", nil, nil, nil], - 12346 => [0, 0, nil, "卅", nil, nil, nil], - 12364 => [0, 0, "が", "が", nil, nil, nil], - 12366 => [0, 0, "ぎ", "ぎ", nil, nil, nil], - 12368 => [0, 0, "ぐ", "ぐ", nil, nil, nil], - 12370 => [0, 0, "げ", "げ", nil, nil, nil], - 12372 => [0, 0, "ご", "ご", nil, nil, nil], - 12374 => [0, 0, "ざ", "ざ", nil, nil, nil], - 12376 => [0, 0, "じ", "じ", nil, nil, nil], - 12378 => [0, 0, "ず", "ず", nil, nil, nil], - 12380 => [0, 0, "ぜ", "ぜ", nil, nil, nil], - 12382 => [0, 0, "ぞ", "ぞ", nil, nil, nil], - 12384 => [0, 0, "だ", "だ", nil, nil, nil], - 12386 => [0, 0, "ぢ", "ぢ", nil, nil, nil], - 12389 => [0, 0, "づ", "づ", nil, nil, nil], - 12391 => [0, 0, "で", "で", nil, nil, nil], - 12393 => [0, 0, "ど", "ど", nil, nil, nil], - 12400 => [0, 0, "ば", "ば", nil, nil, nil], - 12401 => [0, 0, "ぱ", "ぱ", nil, nil, nil], - 12403 => [0, 0, "び", "び", nil, nil, nil], - 12404 => [0, 0, "ぴ", "ぴ", nil, nil, nil], - 12406 => [0, 0, "ぶ", "ぶ", nil, nil, nil], - 12407 => [0, 0, "ぷ", "ぷ", nil, nil, nil], - 12409 => [0, 0, "べ", "べ", nil, nil, nil], - 12410 => [0, 0, "ぺ", "ぺ", nil, nil, nil], - 12412 => [0, 0, "ぼ", "ぼ", nil, nil, nil], - 12413 => [0, 0, "ぽ", "ぽ", nil, nil, nil], - 12436 => [0, 0, "ゔ", "ゔ", nil, nil, nil], - 12441 => [8, 0, nil, nil, nil, nil, nil], - 12442 => [8, 0, nil, nil, nil, nil, nil], - 12443 => [0, 0, nil, " ゙", nil, nil, nil], - 12444 => [0, 0, nil, " ゚", nil, nil, nil], - 12446 => [0, 0, "ゞ", "ゞ", nil, nil, nil], - 12460 => [0, 0, "ガ", "ガ", nil, nil, nil], - 12462 => [0, 0, "ギ", "ギ", nil, nil, nil], - 12464 => [0, 0, "グ", "グ", nil, nil, nil], - 12466 => [0, 0, "ゲ", "ゲ", nil, nil, nil], - 12468 => [0, 0, "ゴ", "ゴ", nil, nil, nil], - 12470 => [0, 0, "ザ", "ザ", nil, nil, nil], - 12472 => [0, 0, "ジ", "ジ", nil, nil, nil], - 12474 => [0, 0, "ズ", "ズ", nil, nil, nil], - 12476 => [0, 0, "ゼ", "ゼ", nil, nil, nil], - 12478 => [0, 0, "ゾ", "ゾ", nil, nil, nil], - 12480 => [0, 0, "ダ", "ダ", nil, nil, nil], - 12482 => [0, 0, "ヂ", "ヂ", nil, nil, nil], - 12485 => [0, 0, "ヅ", "ヅ", nil, nil, nil], - 12487 => [0, 0, "デ", "デ", nil, nil, nil], - 12489 => [0, 0, "ド", "ド", nil, nil, nil], - 12496 => [0, 0, "バ", "バ", nil, nil, nil], - 12497 => [0, 0, "パ", "パ", nil, nil, nil], - 12499 => [0, 0, "ビ", "ビ", nil, nil, nil], - 12500 => [0, 0, "ピ", "ピ", nil, nil, nil], - 12502 => [0, 0, "ブ", "ブ", nil, nil, nil], - 12503 => [0, 0, "プ", "プ", nil, nil, nil], - 12505 => [0, 0, "ベ", "ベ", nil, nil, nil], - 12506 => [0, 0, "ペ", "ペ", nil, nil, nil], - 12508 => [0, 0, "ボ", "ボ", nil, nil, nil], - 12509 => [0, 0, "ポ", "ポ", nil, nil, nil], - 12532 => [0, 0, "ヴ", "ヴ", nil, nil, nil], - 12535 => [0, 0, "ヷ", "ヷ", nil, nil, nil], - 12536 => [0, 0, "ヸ", "ヸ", nil, nil, nil], - 12537 => [0, 0, "ヹ", "ヹ", nil, nil, nil], - 12538 => [0, 0, "ヺ", "ヺ", nil, nil, nil], - 12542 => [0, 0, "ヾ", "ヾ", nil, nil, nil], - 12593 => [0, 0, nil, "ᄀ", nil, nil, nil], - 12594 => [0, 0, nil, "ᄁ", nil, nil, nil], - 12595 => [0, 0, nil, "ᆪ", nil, nil, nil], - 12596 => [0, 0, nil, "ᄂ", nil, nil, nil], - 12597 => [0, 0, nil, "ᆬ", nil, nil, nil], - 12598 => [0, 0, nil, "ᆭ", nil, nil, nil], - 12599 => [0, 0, nil, "ᄃ", nil, nil, nil], - 12600 => [0, 0, nil, "ᄄ", nil, nil, nil], - 12601 => [0, 0, nil, "ᄅ", nil, nil, nil], - 12602 => [0, 0, nil, "ᆰ", nil, nil, nil], - 12603 => [0, 0, nil, "ᆱ", nil, nil, nil], - 12604 => [0, 0, nil, "ᆲ", nil, nil, nil], - 12605 => [0, 0, nil, "ᆳ", nil, nil, nil], - 12606 => [0, 0, nil, "ᆴ", nil, nil, nil], - 12607 => [0, 0, nil, "ᆵ", nil, nil, nil], - 12608 => [0, 0, nil, "ᄚ", nil, nil, nil], - 12609 => [0, 0, nil, "ᄆ", nil, nil, nil], - 12610 => [0, 0, nil, "ᄇ", nil, nil, nil], - 12611 => [0, 0, nil, "ᄈ", nil, nil, nil], - 12612 => [0, 0, nil, "ᄡ", nil, nil, nil], - 12613 => [0, 0, nil, "ᄉ", nil, nil, nil], - 12614 => [0, 0, nil, "ᄊ", nil, nil, nil], - 12615 => [0, 0, nil, "ᄋ", nil, nil, nil], - 12616 => [0, 0, nil, "ᄌ", nil, nil, nil], - 12617 => [0, 0, nil, "ᄍ", nil, nil, nil], - 12618 => [0, 0, nil, "ᄎ", nil, nil, nil], - 12619 => [0, 0, nil, "ᄏ", nil, nil, nil], - 12620 => [0, 0, nil, "ᄐ", nil, nil, nil], - 12621 => [0, 0, nil, "ᄑ", nil, nil, nil], - 12622 => [0, 0, nil, "ᄒ", nil, nil, nil], - 12623 => [0, 0, nil, "ᅡ", nil, nil, nil], - 12624 => [0, 0, nil, "ᅢ", nil, nil, nil], - 12625 => [0, 0, nil, "ᅣ", nil, nil, nil], - 12626 => [0, 0, nil, "ᅤ", nil, nil, nil], - 12627 => [0, 0, nil, "ᅥ", nil, nil, nil], - 12628 => [0, 0, nil, "ᅦ", nil, nil, nil], - 12629 => [0, 0, nil, "ᅧ", nil, nil, nil], - 12630 => [0, 0, nil, "ᅨ", nil, nil, nil], - 12631 => [0, 0, nil, "ᅩ", nil, nil, nil], - 12632 => [0, 0, nil, "ᅪ", nil, nil, nil], - 12633 => [0, 0, nil, "ᅫ", nil, nil, nil], - 12634 => [0, 0, nil, "ᅬ", nil, nil, nil], - 12635 => [0, 0, nil, "ᅭ", nil, nil, nil], - 12636 => [0, 0, nil, "ᅮ", nil, nil, nil], - 12637 => [0, 0, nil, "ᅯ", nil, nil, nil], - 12638 => [0, 0, nil, "ᅰ", nil, nil, nil], - 12639 => [0, 0, nil, "ᅱ", nil, nil, nil], - 12640 => [0, 0, nil, "ᅲ", nil, nil, nil], - 12641 => [0, 0, nil, "ᅳ", nil, nil, nil], - 12642 => [0, 0, nil, "ᅴ", nil, nil, nil], - 12643 => [0, 0, nil, "ᅵ", nil, nil, nil], - 12644 => [0, 0, nil, "ᅠ", nil, nil, nil], - 12645 => [0, 0, nil, "ᄔ", nil, nil, nil], - 12646 => [0, 0, nil, "ᄕ", nil, nil, nil], - 12647 => [0, 0, nil, "ᇇ", nil, nil, nil], - 12648 => [0, 0, nil, "ᇈ", nil, nil, nil], - 12649 => [0, 0, nil, "ᇌ", nil, nil, nil], - 12650 => [0, 0, nil, "ᇎ", nil, nil, nil], - 12651 => [0, 0, nil, "ᇓ", nil, nil, nil], - 12652 => [0, 0, nil, "ᇗ", nil, nil, nil], - 12653 => [0, 0, nil, "ᇙ", nil, nil, nil], - 12654 => [0, 0, nil, "ᄜ", nil, nil, nil], - 12655 => [0, 0, nil, "ᇝ", nil, nil, nil], - 12656 => [0, 0, nil, "ᇟ", nil, nil, nil], - 12657 => [0, 0, nil, "ᄝ", nil, nil, nil], - 12658 => [0, 0, nil, "ᄞ", nil, nil, nil], - 12659 => [0, 0, nil, "ᄠ", nil, nil, nil], - 12660 => [0, 0, nil, "ᄢ", nil, nil, nil], - 12661 => [0, 0, nil, "ᄣ", nil, nil, nil], - 12662 => [0, 0, nil, "ᄧ", nil, nil, nil], - 12663 => [0, 0, nil, "ᄩ", nil, nil, nil], - 12664 => [0, 0, nil, "ᄫ", nil, nil, nil], - 12665 => [0, 0, nil, "ᄬ", nil, nil, nil], - 12666 => [0, 0, nil, "ᄭ", nil, nil, nil], - 12667 => [0, 0, nil, "ᄮ", nil, nil, nil], - 12668 => [0, 0, nil, "ᄯ", nil, nil, nil], - 12669 => [0, 0, nil, "ᄲ", nil, nil, nil], - 12670 => [0, 0, nil, "ᄶ", nil, nil, nil], - 12671 => [0, 0, nil, "ᅀ", nil, nil, nil], - 12672 => [0, 0, nil, "ᅇ", nil, nil, nil], - 12673 => [0, 0, nil, "ᅌ", nil, nil, nil], - 12674 => [0, 0, nil, "ᇱ", nil, nil, nil], - 12675 => [0, 0, nil, "ᇲ", nil, nil, nil], - 12676 => [0, 0, nil, "ᅗ", nil, nil, nil], - 12677 => [0, 0, nil, "ᅘ", nil, nil, nil], - 12678 => [0, 0, nil, "ᅙ", nil, nil, nil], - 12679 => [0, 0, nil, "ᆄ", nil, nil, nil], - 12680 => [0, 0, nil, "ᆅ", nil, nil, nil], - 12681 => [0, 0, nil, "ᆈ", nil, nil, nil], - 12682 => [0, 0, nil, "ᆑ", nil, nil, nil], - 12683 => [0, 0, nil, "ᆒ", nil, nil, nil], - 12684 => [0, 0, nil, "ᆔ", nil, nil, nil], - 12685 => [0, 0, nil, "ᆞ", nil, nil, nil], - 12686 => [0, 0, nil, "ᆡ", nil, nil, nil], - 12690 => [0, 0, nil, "一", nil, nil, nil], - 12691 => [0, 0, nil, "二", nil, nil, nil], - 12692 => [0, 0, nil, "三", nil, nil, nil], - 12693 => [0, 0, nil, "四", nil, nil, nil], - 12694 => [0, 0, nil, "上", nil, nil, nil], - 12695 => [0, 0, nil, "中", nil, nil, nil], - 12696 => [0, 0, nil, "下", nil, nil, nil], - 12697 => [0, 0, nil, "甲", nil, nil, nil], - 12698 => [0, 0, nil, "乙", nil, nil, nil], - 12699 => [0, 0, nil, "丙", nil, nil, nil], - 12700 => [0, 0, nil, "丁", nil, nil, nil], - 12701 => [0, 0, nil, "天", nil, nil, nil], - 12702 => [0, 0, nil, "地", nil, nil, nil], - 12703 => [0, 0, nil, "人", nil, nil, nil], - 12800 => [0, 0, nil, "(ᄀ)", nil, nil, nil], - 12801 => [0, 0, nil, "(ᄂ)", nil, nil, nil], - 12802 => [0, 0, nil, "(ᄃ)", nil, nil, nil], - 12803 => [0, 0, nil, "(ᄅ)", nil, nil, nil], - 12804 => [0, 0, nil, "(ᄆ)", nil, nil, nil], - 12805 => [0, 0, nil, "(ᄇ)", nil, nil, nil], - 12806 => [0, 0, nil, "(ᄉ)", nil, nil, nil], - 12807 => [0, 0, nil, "(ᄋ)", nil, nil, nil], - 12808 => [0, 0, nil, "(ᄌ)", nil, nil, nil], - 12809 => [0, 0, nil, "(ᄎ)", nil, nil, nil], - 12810 => [0, 0, nil, "(ᄏ)", nil, nil, nil], - 12811 => [0, 0, nil, "(ᄐ)", nil, nil, nil], - 12812 => [0, 0, nil, "(ᄑ)", nil, nil, nil], - 12813 => [0, 0, nil, "(ᄒ)", nil, nil, nil], - 12814 => [0, 0, nil, "(가)", nil, nil, nil], - 12815 => [0, 0, nil, "(나)", nil, nil, nil], - 12816 => [0, 0, nil, "(다)", nil, nil, nil], - 12817 => [0, 0, nil, "(라)", nil, nil, nil], - 12818 => [0, 0, nil, "(마)", nil, nil, nil], - 12819 => [0, 0, nil, "(바)", nil, nil, nil], - 12820 => [0, 0, nil, "(사)", nil, nil, nil], - 12821 => [0, 0, nil, "(아)", nil, nil, nil], - 12822 => [0, 0, nil, "(자)", nil, nil, nil], - 12823 => [0, 0, nil, "(차)", nil, nil, nil], - 12824 => [0, 0, nil, "(카)", nil, nil, nil], - 12825 => [0, 0, nil, "(타)", nil, nil, nil], - 12826 => [0, 0, nil, "(파)", nil, nil, nil], - 12827 => [0, 0, nil, "(하)", nil, nil, nil], - 12828 => [0, 0, nil, "(주)", nil, nil, nil], - 12832 => [0, 0, nil, "(一)", nil, nil, nil], - 12833 => [0, 0, nil, "(二)", nil, nil, nil], - 12834 => [0, 0, nil, "(三)", nil, nil, nil], - 12835 => [0, 0, nil, "(四)", nil, nil, nil], - 12836 => [0, 0, nil, "(五)", nil, nil, nil], - 12837 => [0, 0, nil, "(六)", nil, nil, nil], - 12838 => [0, 0, nil, "(七)", nil, nil, nil], - 12839 => [0, 0, nil, "(八)", nil, nil, nil], - 12840 => [0, 0, nil, "(九)", nil, nil, nil], - 12841 => [0, 0, nil, "(十)", nil, nil, nil], - 12842 => [0, 0, nil, "(月)", nil, nil, nil], - 12843 => [0, 0, nil, "(火)", nil, nil, nil], - 12844 => [0, 0, nil, "(水)", nil, nil, nil], - 12845 => [0, 0, nil, "(木)", nil, nil, nil], - 12846 => [0, 0, nil, "(金)", nil, nil, nil], - 12847 => [0, 0, nil, "(土)", nil, nil, nil], - 12848 => [0, 0, nil, "(日)", nil, nil, nil], - 12849 => [0, 0, nil, "(株)", nil, nil, nil], - 12850 => [0, 0, nil, "(有)", nil, nil, nil], - 12851 => [0, 0, nil, "(社)", nil, nil, nil], - 12852 => [0, 0, nil, "(名)", nil, nil, nil], - 12853 => [0, 0, nil, "(特)", nil, nil, nil], - 12854 => [0, 0, nil, "(財)", nil, nil, nil], - 12855 => [0, 0, nil, "(祝)", nil, nil, nil], - 12856 => [0, 0, nil, "(労)", nil, nil, nil], - 12857 => [0, 0, nil, "(代)", nil, nil, nil], - 12858 => [0, 0, nil, "(呼)", nil, nil, nil], - 12859 => [0, 0, nil, "(学)", nil, nil, nil], - 12860 => [0, 0, nil, "(監)", nil, nil, nil], - 12861 => [0, 0, nil, "(企)", nil, nil, nil], - 12862 => [0, 0, nil, "(資)", nil, nil, nil], - 12863 => [0, 0, nil, "(協)", nil, nil, nil], - 12864 => [0, 0, nil, "(祭)", nil, nil, nil], - 12865 => [0, 0, nil, "(休)", nil, nil, nil], - 12866 => [0, 0, nil, "(自)", nil, nil, nil], - 12867 => [0, 0, nil, "(至)", nil, nil, nil], - 12896 => [0, 0, nil, "ᄀ", nil, nil, nil], - 12897 => [0, 0, nil, "ᄂ", nil, nil, nil], - 12898 => [0, 0, nil, "ᄃ", nil, nil, nil], - 12899 => [0, 0, nil, "ᄅ", nil, nil, nil], - 12900 => [0, 0, nil, "ᄆ", nil, nil, nil], - 12901 => [0, 0, nil, "ᄇ", nil, nil, nil], - 12902 => [0, 0, nil, "ᄉ", nil, nil, nil], - 12903 => [0, 0, nil, "ᄋ", nil, nil, nil], - 12904 => [0, 0, nil, "ᄌ", nil, nil, nil], - 12905 => [0, 0, nil, "ᄎ", nil, nil, nil], - 12906 => [0, 0, nil, "ᄏ", nil, nil, nil], - 12907 => [0, 0, nil, "ᄐ", nil, nil, nil], - 12908 => [0, 0, nil, "ᄑ", nil, nil, nil], - 12909 => [0, 0, nil, "ᄒ", nil, nil, nil], - 12910 => [0, 0, nil, "가", nil, nil, nil], - 12911 => [0, 0, nil, "나", nil, nil, nil], - 12912 => [0, 0, nil, "다", nil, nil, nil], - 12913 => [0, 0, nil, "라", nil, nil, nil], - 12914 => [0, 0, nil, "마", nil, nil, nil], - 12915 => [0, 0, nil, "바", nil, nil, nil], - 12916 => [0, 0, nil, "사", nil, nil, nil], - 12917 => [0, 0, nil, "아", nil, nil, nil], - 12918 => [0, 0, nil, "자", nil, nil, nil], - 12919 => [0, 0, nil, "차", nil, nil, nil], - 12920 => [0, 0, nil, "카", nil, nil, nil], - 12921 => [0, 0, nil, "타", nil, nil, nil], - 12922 => [0, 0, nil, "파", nil, nil, nil], - 12923 => [0, 0, nil, "하", nil, nil, nil], - 12928 => [0, 0, nil, "一", nil, nil, nil], - 12929 => [0, 0, nil, "二", nil, nil, nil], - 12930 => [0, 0, nil, "三", nil, nil, nil], - 12931 => [0, 0, nil, "四", nil, nil, nil], - 12932 => [0, 0, nil, "五", nil, nil, nil], - 12933 => [0, 0, nil, "六", nil, nil, nil], - 12934 => [0, 0, nil, "七", nil, nil, nil], - 12935 => [0, 0, nil, "八", nil, nil, nil], - 12936 => [0, 0, nil, "九", nil, nil, nil], - 12937 => [0, 0, nil, "十", nil, nil, nil], - 12938 => [0, 0, nil, "月", nil, nil, nil], - 12939 => [0, 0, nil, "火", nil, nil, nil], - 12940 => [0, 0, nil, "水", nil, nil, nil], - 12941 => [0, 0, nil, "木", nil, nil, nil], - 12942 => [0, 0, nil, "金", nil, nil, nil], - 12943 => [0, 0, nil, "土", nil, nil, nil], - 12944 => [0, 0, nil, "日", nil, nil, nil], - 12945 => [0, 0, nil, "株", nil, nil, nil], - 12946 => [0, 0, nil, "有", nil, nil, nil], - 12947 => [0, 0, nil, "社", nil, nil, nil], - 12948 => [0, 0, nil, "名", nil, nil, nil], - 12949 => [0, 0, nil, "特", nil, nil, nil], - 12950 => [0, 0, nil, "財", nil, nil, nil], - 12951 => [0, 0, nil, "祝", nil, nil, nil], - 12952 => [0, 0, nil, "労", nil, nil, nil], - 12953 => [0, 0, nil, "秘", nil, nil, nil], - 12954 => [0, 0, nil, "男", nil, nil, nil], - 12955 => [0, 0, nil, "女", nil, nil, nil], - 12956 => [0, 0, nil, "適", nil, nil, nil], - 12957 => [0, 0, nil, "優", nil, nil, nil], - 12958 => [0, 0, nil, "印", nil, nil, nil], - 12959 => [0, 0, nil, "注", nil, nil, nil], - 12960 => [0, 0, nil, "項", nil, nil, nil], - 12961 => [0, 0, nil, "休", nil, nil, nil], - 12962 => [0, 0, nil, "写", nil, nil, nil], - 12963 => [0, 0, nil, "正", nil, nil, nil], - 12964 => [0, 0, nil, "上", nil, nil, nil], - 12965 => [0, 0, nil, "中", nil, nil, nil], - 12966 => [0, 0, nil, "下", nil, nil, nil], - 12967 => [0, 0, nil, "左", nil, nil, nil], - 12968 => [0, 0, nil, "右", nil, nil, nil], - 12969 => [0, 0, nil, "医", nil, nil, nil], - 12970 => [0, 0, nil, "宗", nil, nil, nil], - 12971 => [0, 0, nil, "学", nil, nil, nil], - 12972 => [0, 0, nil, "監", nil, nil, nil], - 12973 => [0, 0, nil, "企", nil, nil, nil], - 12974 => [0, 0, nil, "資", nil, nil, nil], - 12975 => [0, 0, nil, "協", nil, nil, nil], - 12976 => [0, 0, nil, "夜", nil, nil, nil], - 12992 => [0, 0, nil, "1月", nil, nil, nil], - 12993 => [0, 0, nil, "2月", nil, nil, nil], - 12994 => [0, 0, nil, "3月", nil, nil, nil], - 12995 => [0, 0, nil, "4月", nil, nil, nil], - 12996 => [0, 0, nil, "5月", nil, nil, nil], - 12997 => [0, 0, nil, "6月", nil, nil, nil], - 12998 => [0, 0, nil, "7月", nil, nil, nil], - 12999 => [0, 0, nil, "8月", nil, nil, nil], - 13000 => [0, 0, nil, "9月", nil, nil, nil], - 13001 => [0, 0, nil, "10月", nil, nil, nil], - 13002 => [0, 0, nil, "11月", nil, nil, nil], - 13003 => [0, 0, nil, "12月", nil, nil, nil], - 13008 => [0, 0, nil, "ア", nil, nil, nil], - 13009 => [0, 0, nil, "イ", nil, nil, nil], - 13010 => [0, 0, nil, "ウ", nil, nil, nil], - 13011 => [0, 0, nil, "エ", nil, nil, nil], - 13012 => [0, 0, nil, "オ", nil, nil, nil], - 13013 => [0, 0, nil, "カ", nil, nil, nil], - 13014 => [0, 0, nil, "キ", nil, nil, nil], - 13015 => [0, 0, nil, "ク", nil, nil, nil], - 13016 => [0, 0, nil, "ケ", nil, nil, nil], - 13017 => [0, 0, nil, "コ", nil, nil, nil], - 13018 => [0, 0, nil, "サ", nil, nil, nil], - 13019 => [0, 0, nil, "シ", nil, nil, nil], - 13020 => [0, 0, nil, "ス", nil, nil, nil], - 13021 => [0, 0, nil, "セ", nil, nil, nil], - 13022 => [0, 0, nil, "ソ", nil, nil, nil], - 13023 => [0, 0, nil, "タ", nil, nil, nil], - 13024 => [0, 0, nil, "チ", nil, nil, nil], - 13025 => [0, 0, nil, "ツ", nil, nil, nil], - 13026 => [0, 0, nil, "テ", nil, nil, nil], - 13027 => [0, 0, nil, "ト", nil, nil, nil], - 13028 => [0, 0, nil, "ナ", nil, nil, nil], - 13029 => [0, 0, nil, "ニ", nil, nil, nil], - 13030 => [0, 0, nil, "ヌ", nil, nil, nil], - 13031 => [0, 0, nil, "ネ", nil, nil, nil], - 13032 => [0, 0, nil, "ノ", nil, nil, nil], - 13033 => [0, 0, nil, "ハ", nil, nil, nil], - 13034 => [0, 0, nil, "ヒ", nil, nil, nil], - 13035 => [0, 0, nil, "フ", nil, nil, nil], - 13036 => [0, 0, nil, "ヘ", nil, nil, nil], - 13037 => [0, 0, nil, "ホ", nil, nil, nil], - 13038 => [0, 0, nil, "マ", nil, nil, nil], - 13039 => [0, 0, nil, "ミ", nil, nil, nil], - 13040 => [0, 0, nil, "ム", nil, nil, nil], - 13041 => [0, 0, nil, "メ", nil, nil, nil], - 13042 => [0, 0, nil, "モ", nil, nil, nil], - 13043 => [0, 0, nil, "ヤ", nil, nil, nil], - 13044 => [0, 0, nil, "ユ", nil, nil, nil], - 13045 => [0, 0, nil, "ヨ", nil, nil, nil], - 13046 => [0, 0, nil, "ラ", nil, nil, nil], - 13047 => [0, 0, nil, "リ", nil, nil, nil], - 13048 => [0, 0, nil, "ル", nil, nil, nil], - 13049 => [0, 0, nil, "レ", nil, nil, nil], - 13050 => [0, 0, nil, "ロ", nil, nil, nil], - 13051 => [0, 0, nil, "ワ", nil, nil, nil], - 13052 => [0, 0, nil, "ヰ", nil, nil, nil], - 13053 => [0, 0, nil, "ヱ", nil, nil, nil], - 13054 => [0, 0, nil, "ヲ", nil, nil, nil], - 13056 => [0, 0, nil, "アパート", nil, nil, nil], - 13057 => [0, 0, nil, "アルファ", nil, nil, nil], - 13058 => [0, 0, nil, "アンペア", nil, nil, nil], - 13059 => [0, 0, nil, "アール", nil, nil, nil], - 13060 => [0, 0, nil, "イニング", nil, nil, nil], - 13061 => [0, 0, nil, "インチ", nil, nil, nil], - 13062 => [0, 0, nil, "ウォン", nil, nil, nil], - 13063 => [0, 0, nil, "エスクード", nil, nil, nil], - 13064 => [0, 0, nil, "エーカー", nil, nil, nil], - 13065 => [0, 0, nil, "オンス", nil, nil, nil], - 13066 => [0, 0, nil, "オーム", nil, nil, nil], - 13067 => [0, 0, nil, "カイリ", nil, nil, nil], - 13068 => [0, 0, nil, "カラット", nil, nil, nil], - 13069 => [0, 0, nil, "カロリー", nil, nil, nil], - 13070 => [0, 0, nil, "ガロン", nil, nil, nil], - 13071 => [0, 0, nil, "ガンマ", nil, nil, nil], - 13072 => [0, 0, nil, "ギガ", nil, nil, nil], - 13073 => [0, 0, nil, "ギニー", nil, nil, nil], - 13074 => [0, 0, nil, "キュリー", nil, nil, nil], - 13075 => [0, 0, nil, "ギルダー", nil, nil, nil], - 13076 => [0, 0, nil, "キロ", nil, nil, nil], - 13077 => [0, 0, nil, "キログラム", nil, nil, nil], - 13078 => [0, 0, nil, "キロメートル", nil, nil, nil], - 13079 => [0, 0, nil, "キロワット", nil, nil, nil], - 13080 => [0, 0, nil, "グラム", nil, nil, nil], - 13081 => [0, 0, nil, "グラムトン", nil, nil, nil], - 13082 => [0, 0, nil, "クルゼイロ", nil, nil, nil], - 13083 => [0, 0, nil, "クローネ", nil, nil, nil], - 13084 => [0, 0, nil, "ケース", nil, nil, nil], - 13085 => [0, 0, nil, "コルナ", nil, nil, nil], - 13086 => [0, 0, nil, "コーポ", nil, nil, nil], - 13087 => [0, 0, nil, "サイクル", nil, nil, nil], - 13088 => [0, 0, nil, "サンチーム", nil, nil, nil], - 13089 => [0, 0, nil, "シリング", nil, nil, nil], - 13090 => [0, 0, nil, "センチ", nil, nil, nil], - 13091 => [0, 0, nil, "セント", nil, nil, nil], - 13092 => [0, 0, nil, "ダース", nil, nil, nil], - 13093 => [0, 0, nil, "デシ", nil, nil, nil], - 13094 => [0, 0, nil, "ドル", nil, nil, nil], - 13095 => [0, 0, nil, "トン", nil, nil, nil], - 13096 => [0, 0, nil, "ナノ", nil, nil, nil], - 13097 => [0, 0, nil, "ノット", nil, nil, nil], - 13098 => [0, 0, nil, "ハイツ", nil, nil, nil], - 13099 => [0, 0, nil, "パーセント", nil, nil, nil], - 13100 => [0, 0, nil, "パーツ", nil, nil, nil], - 13101 => [0, 0, nil, "バーレル", nil, nil, nil], - 13102 => [0, 0, nil, "ピアストル", nil, nil, nil], - 13103 => [0, 0, nil, "ピクル", nil, nil, nil], - 13104 => [0, 0, nil, "ピコ", nil, nil, nil], - 13105 => [0, 0, nil, "ビル", nil, nil, nil], - 13106 => [0, 0, nil, "ファラッド", nil, nil, nil], - 13107 => [0, 0, nil, "フィート", nil, nil, nil], - 13108 => [0, 0, nil, "ブッシェル", nil, nil, nil], - 13109 => [0, 0, nil, "フラン", nil, nil, nil], - 13110 => [0, 0, nil, "ヘクタール", nil, nil, nil], - 13111 => [0, 0, nil, "ペソ", nil, nil, nil], - 13112 => [0, 0, nil, "ペニヒ", nil, nil, nil], - 13113 => [0, 0, nil, "ヘルツ", nil, nil, nil], - 13114 => [0, 0, nil, "ペンス", nil, nil, nil], - 13115 => [0, 0, nil, "ページ", nil, nil, nil], - 13116 => [0, 0, nil, "ベータ", nil, nil, nil], - 13117 => [0, 0, nil, "ポイント", nil, nil, nil], - 13118 => [0, 0, nil, "ボルト", nil, nil, nil], - 13119 => [0, 0, nil, "ホン", nil, nil, nil], - 13120 => [0, 0, nil, "ポンド", nil, nil, nil], - 13121 => [0, 0, nil, "ホール", nil, nil, nil], - 13122 => [0, 0, nil, "ホーン", nil, nil, nil], - 13123 => [0, 0, nil, "マイクロ", nil, nil, nil], - 13124 => [0, 0, nil, "マイル", nil, nil, nil], - 13125 => [0, 0, nil, "マッハ", nil, nil, nil], - 13126 => [0, 0, nil, "マルク", nil, nil, nil], - 13127 => [0, 0, nil, "マンション", nil, nil, nil], - 13128 => [0, 0, nil, "ミクロン", nil, nil, nil], - 13129 => [0, 0, nil, "ミリ", nil, nil, nil], - 13130 => [0, 0, nil, "ミリバール", nil, nil, nil], - 13131 => [0, 0, nil, "メガ", nil, nil, nil], - 13132 => [0, 0, nil, "メガトン", nil, nil, nil], - 13133 => [0, 0, nil, "メートル", nil, nil, nil], - 13134 => [0, 0, nil, "ヤード", nil, nil, nil], - 13135 => [0, 0, nil, "ヤール", nil, nil, nil], - 13136 => [0, 0, nil, "ユアン", nil, nil, nil], - 13137 => [0, 0, nil, "リットル", nil, nil, nil], - 13138 => [0, 0, nil, "リラ", nil, nil, nil], - 13139 => [0, 0, nil, "ルピー", nil, nil, nil], - 13140 => [0, 0, nil, "ルーブル", nil, nil, nil], - 13141 => [0, 0, nil, "レム", nil, nil, nil], - 13142 => [0, 0, nil, "レントゲン", nil, nil, nil], - 13143 => [0, 0, nil, "ワット", nil, nil, nil], - 13144 => [0, 0, nil, "0点", nil, nil, nil], - 13145 => [0, 0, nil, "1点", nil, nil, nil], - 13146 => [0, 0, nil, "2点", nil, nil, nil], - 13147 => [0, 0, nil, "3点", nil, nil, nil], - 13148 => [0, 0, nil, "4点", nil, nil, nil], - 13149 => [0, 0, nil, "5点", nil, nil, nil], - 13150 => [0, 0, nil, "6点", nil, nil, nil], - 13151 => [0, 0, nil, "7点", nil, nil, nil], - 13152 => [0, 0, nil, "8点", nil, nil, nil], - 13153 => [0, 0, nil, "9点", nil, nil, nil], - 13154 => [0, 0, nil, "10点", nil, nil, nil], - 13155 => [0, 0, nil, "11点", nil, nil, nil], - 13156 => [0, 0, nil, "12点", nil, nil, nil], - 13157 => [0, 0, nil, "13点", nil, nil, nil], - 13158 => [0, 0, nil, "14点", nil, nil, nil], - 13159 => [0, 0, nil, "15点", nil, nil, nil], - 13160 => [0, 0, nil, "16点", nil, nil, nil], - 13161 => [0, 0, nil, "17点", nil, nil, nil], - 13162 => [0, 0, nil, "18点", nil, nil, nil], - 13163 => [0, 0, nil, "19点", nil, nil, nil], - 13164 => [0, 0, nil, "20点", nil, nil, nil], - 13165 => [0, 0, nil, "21点", nil, nil, nil], - 13166 => [0, 0, nil, "22点", nil, nil, nil], - 13167 => [0, 0, nil, "23点", nil, nil, nil], - 13168 => [0, 0, nil, "24点", nil, nil, nil], - 13169 => [0, 0, nil, "hPa", nil, nil, nil], - 13170 => [0, 0, nil, "da", nil, nil, nil], - 13171 => [0, 0, nil, "AU", nil, nil, nil], - 13172 => [0, 0, nil, "bar", nil, nil, nil], - 13173 => [0, 0, nil, "oV", nil, nil, nil], - 13174 => [0, 0, nil, "pc", nil, nil, nil], - 13179 => [0, 0, nil, "平成", nil, nil, nil], - 13180 => [0, 0, nil, "昭和", nil, nil, nil], - 13181 => [0, 0, nil, "大正", nil, nil, nil], - 13182 => [0, 0, nil, "明治", nil, nil, nil], - 13183 => [0, 0, nil, "株式会社", nil, nil, nil], - 13184 => [0, 0, nil, "pA", nil, nil, nil], - 13185 => [0, 0, nil, "nA", nil, nil, nil], - 13186 => [0, 0, nil, "μA", nil, nil, nil], - 13187 => [0, 0, nil, "mA", nil, nil, nil], - 13188 => [0, 0, nil, "kA", nil, nil, nil], - 13189 => [0, 0, nil, "KB", nil, nil, nil], - 13190 => [0, 0, nil, "MB", nil, nil, nil], - 13191 => [0, 0, nil, "GB", nil, nil, nil], - 13192 => [0, 0, nil, "cal", nil, nil, nil], - 13193 => [0, 0, nil, "kcal", nil, nil, nil], - 13194 => [0, 0, nil, "pF", nil, nil, nil], - 13195 => [0, 0, nil, "nF", nil, nil, nil], - 13196 => [0, 0, nil, "μF", nil, nil, nil], - 13197 => [0, 0, nil, "μg", nil, nil, nil], - 13198 => [0, 0, nil, "mg", nil, nil, nil], - 13199 => [0, 0, nil, "kg", nil, nil, nil], - 13200 => [0, 0, nil, "Hz", nil, nil, nil], - 13201 => [0, 0, nil, "kHz", nil, nil, nil], - 13202 => [0, 0, nil, "MHz", nil, nil, nil], - 13203 => [0, 0, nil, "GHz", nil, nil, nil], - 13204 => [0, 0, nil, "THz", nil, nil, nil], - 13205 => [0, 0, nil, "μℓ", nil, nil, nil], - 13206 => [0, 0, nil, "mℓ", nil, nil, nil], - 13207 => [0, 0, nil, "dℓ", nil, nil, nil], - 13208 => [0, 0, nil, "kℓ", nil, nil, nil], - 13209 => [0, 0, nil, "fm", nil, nil, nil], - 13210 => [0, 0, nil, "nm", nil, nil, nil], - 13211 => [0, 0, nil, "μm", nil, nil, nil], - 13212 => [0, 0, nil, "mm", nil, nil, nil], - 13213 => [0, 0, nil, "cm", nil, nil, nil], - 13214 => [0, 0, nil, "km", nil, nil, nil], - 13215 => [0, 0, nil, "mm²", nil, nil, nil], - 13216 => [0, 0, nil, "cm²", nil, nil, nil], - 13217 => [0, 0, nil, "m²", nil, nil, nil], - 13218 => [0, 0, nil, "km²", nil, nil, nil], - 13219 => [0, 0, nil, "mm³", nil, nil, nil], - 13220 => [0, 0, nil, "cm³", nil, nil, nil], - 13221 => [0, 0, nil, "m³", nil, nil, nil], - 13222 => [0, 0, nil, "km³", nil, nil, nil], - 13223 => [0, 0, nil, "m∕s", nil, nil, nil], - 13224 => [0, 0, nil, "m∕s²", nil, nil, nil], - 13225 => [0, 0, nil, "Pa", nil, nil, nil], - 13226 => [0, 0, nil, "kPa", nil, nil, nil], - 13227 => [0, 0, nil, "MPa", nil, nil, nil], - 13228 => [0, 0, nil, "GPa", nil, nil, nil], - 13229 => [0, 0, nil, "rad", nil, nil, nil], - 13230 => [0, 0, nil, "rad∕s", nil, nil, nil], - 13231 => [0, 0, nil, "rad∕s²", nil, nil, nil], - 13232 => [0, 0, nil, "ps", nil, nil, nil], - 13233 => [0, 0, nil, "ns", nil, nil, nil], - 13234 => [0, 0, nil, "μs", nil, nil, nil], - 13235 => [0, 0, nil, "ms", nil, nil, nil], - 13236 => [0, 0, nil, "pV", nil, nil, nil], - 13237 => [0, 0, nil, "nV", nil, nil, nil], - 13238 => [0, 0, nil, "μV", nil, nil, nil], - 13239 => [0, 0, nil, "mV", nil, nil, nil], - 13240 => [0, 0, nil, "kV", nil, nil, nil], - 13241 => [0, 0, nil, "MV", nil, nil, nil], - 13242 => [0, 0, nil, "pW", nil, nil, nil], - 13243 => [0, 0, nil, "nW", nil, nil, nil], - 13244 => [0, 0, nil, "μW", nil, nil, nil], - 13245 => [0, 0, nil, "mW", nil, nil, nil], - 13246 => [0, 0, nil, "kW", nil, nil, nil], - 13247 => [0, 0, nil, "MW", nil, nil, nil], - 13248 => [0, 0, nil, "kΩ", nil, nil, nil], - 13249 => [0, 0, nil, "MΩ", nil, nil, nil], - 13250 => [0, 0, nil, "a.m.", nil, nil, nil], - 13251 => [0, 0, nil, "Bq", nil, nil, nil], - 13252 => [0, 0, nil, "cc", nil, nil, nil], - 13253 => [0, 0, nil, "cd", nil, nil, nil], - 13254 => [0, 0, nil, "C∕kg", nil, nil, nil], - 13255 => [0, 0, nil, "Co.", nil, nil, nil], - 13256 => [0, 0, nil, "dB", nil, nil, nil], - 13257 => [0, 0, nil, "Gy", nil, nil, nil], - 13258 => [0, 0, nil, "ha", nil, nil, nil], - 13259 => [0, 0, nil, "HP", nil, nil, nil], - 13260 => [0, 0, nil, "in", nil, nil, nil], - 13261 => [0, 0, nil, "KK", nil, nil, nil], - 13262 => [0, 0, nil, "KM", nil, nil, nil], - 13263 => [0, 0, nil, "kt", nil, nil, nil], - 13264 => [0, 0, nil, "lm", nil, nil, nil], - 13265 => [0, 0, nil, "ln", nil, nil, nil], - 13266 => [0, 0, nil, "log", nil, nil, nil], - 13267 => [0, 0, nil, "lx", nil, nil, nil], - 13268 => [0, 0, nil, "mb", nil, nil, nil], - 13269 => [0, 0, nil, "mil", nil, nil, nil], - 13270 => [0, 0, nil, "mol", nil, nil, nil], - 13271 => [0, 0, nil, "PH", nil, nil, nil], - 13272 => [0, 0, nil, "p.m.", nil, nil, nil], - 13273 => [0, 0, nil, "PPM", nil, nil, nil], - 13274 => [0, 0, nil, "PR", nil, nil, nil], - 13275 => [0, 0, nil, "sr", nil, nil, nil], - 13276 => [0, 0, nil, "Sv", nil, nil, nil], - 13277 => [0, 0, nil, "Wb", nil, nil, nil], - 13280 => [0, 0, nil, "1日", nil, nil, nil], - 13281 => [0, 0, nil, "2日", nil, nil, nil], - 13282 => [0, 0, nil, "3日", nil, nil, nil], - 13283 => [0, 0, nil, "4日", nil, nil, nil], - 13284 => [0, 0, nil, "5日", nil, nil, nil], - 13285 => [0, 0, nil, "6日", nil, nil, nil], - 13286 => [0, 0, nil, "7日", nil, nil, nil], - 13287 => [0, 0, nil, "8日", nil, nil, nil], - 13288 => [0, 0, nil, "9日", nil, nil, nil], - 13289 => [0, 0, nil, "10日", nil, nil, nil], - 13290 => [0, 0, nil, "11日", nil, nil, nil], - 13291 => [0, 0, nil, "12日", nil, nil, nil], - 13292 => [0, 0, nil, "13日", nil, nil, nil], - 13293 => [0, 0, nil, "14日", nil, nil, nil], - 13294 => [0, 0, nil, "15日", nil, nil, nil], - 13295 => [0, 0, nil, "16日", nil, nil, nil], - 13296 => [0, 0, nil, "17日", nil, nil, nil], - 13297 => [0, 0, nil, "18日", nil, nil, nil], - 13298 => [0, 0, nil, "19日", nil, nil, nil], - 13299 => [0, 0, nil, "20日", nil, nil, nil], - 13300 => [0, 0, nil, "21日", nil, nil, nil], - 13301 => [0, 0, nil, "22日", nil, nil, nil], - 13302 => [0, 0, nil, "23日", nil, nil, nil], - 13303 => [0, 0, nil, "24日", nil, nil, nil], - 13304 => [0, 0, nil, "25日", nil, nil, nil], - 13305 => [0, 0, nil, "26日", nil, nil, nil], - 13306 => [0, 0, nil, "27日", nil, nil, nil], - 13307 => [0, 0, nil, "28日", nil, nil, nil], - 13308 => [0, 0, nil, "29日", nil, nil, nil], - 13309 => [0, 0, nil, "30日", nil, nil, nil], - 13310 => [0, 0, nil, "31日", nil, nil, nil], - 63744 => [0, 2, "豈", "豈", nil, nil, nil], - 63745 => [0, 2, "更", "更", nil, nil, nil], - 63746 => [0, 2, "車", "車", nil, nil, nil], - 63747 => [0, 2, "賈", "賈", nil, nil, nil], - 63748 => [0, 2, "滑", "滑", nil, nil, nil], - 63749 => [0, 2, "串", "串", nil, nil, nil], - 63750 => [0, 2, "句", "句", nil, nil, nil], - 63751 => [0, 2, "龜", "龜", nil, nil, nil], - 63752 => [0, 2, "龜", "龜", nil, nil, nil], - 63753 => [0, 2, "契", "契", nil, nil, nil], - 63754 => [0, 2, "金", "金", nil, nil, nil], - 63755 => [0, 2, "喇", "喇", nil, nil, nil], - 63756 => [0, 2, "奈", "奈", nil, nil, nil], - 63757 => [0, 2, "懶", "懶", nil, nil, nil], - 63758 => [0, 2, "癩", "癩", nil, nil, nil], - 63759 => [0, 2, "羅", "羅", nil, nil, nil], - 63760 => [0, 2, "蘿", "蘿", nil, nil, nil], - 63761 => [0, 2, "螺", "螺", nil, nil, nil], - 63762 => [0, 2, "裸", "裸", nil, nil, nil], - 63763 => [0, 2, "邏", "邏", nil, nil, nil], - 63764 => [0, 2, "樂", "樂", nil, nil, nil], - 63765 => [0, 2, "洛", "洛", nil, nil, nil], - 63766 => [0, 2, "烙", "烙", nil, nil, nil], - 63767 => [0, 2, "珞", "珞", nil, nil, nil], - 63768 => [0, 2, "落", "落", nil, nil, nil], - 63769 => [0, 2, "酪", "酪", nil, nil, nil], - 63770 => [0, 2, "駱", "駱", nil, nil, nil], - 63771 => [0, 2, "亂", "亂", nil, nil, nil], - 63772 => [0, 2, "卵", "卵", nil, nil, nil], - 63773 => [0, 2, "欄", "欄", nil, nil, nil], - 63774 => [0, 2, "爛", "爛", nil, nil, nil], - 63775 => [0, 2, "蘭", "蘭", nil, nil, nil], - 63776 => [0, 2, "鸞", "鸞", nil, nil, nil], - 63777 => [0, 2, "嵐", "嵐", nil, nil, nil], - 63778 => [0, 2, "濫", "濫", nil, nil, nil], - 63779 => [0, 2, "藍", "藍", nil, nil, nil], - 63780 => [0, 2, "襤", "襤", nil, nil, nil], - 63781 => [0, 2, "拉", "拉", nil, nil, nil], - 63782 => [0, 2, "臘", "臘", nil, nil, nil], - 63783 => [0, 2, "蠟", "蠟", nil, nil, nil], - 63784 => [0, 2, "廊", "廊", nil, nil, nil], - 63785 => [0, 2, "朗", "朗", nil, nil, nil], - 63786 => [0, 2, "浪", "浪", nil, nil, nil], - 63787 => [0, 2, "狼", "狼", nil, nil, nil], - 63788 => [0, 2, "郎", "郎", nil, nil, nil], - 63789 => [0, 2, "來", "來", nil, nil, nil], - 63790 => [0, 2, "冷", "冷", nil, nil, nil], - 63791 => [0, 2, "勞", "勞", nil, nil, nil], - 63792 => [0, 2, "擄", "擄", nil, nil, nil], - 63793 => [0, 2, "櫓", "櫓", nil, nil, nil], - 63794 => [0, 2, "爐", "爐", nil, nil, nil], - 63795 => [0, 2, "盧", "盧", nil, nil, nil], - 63796 => [0, 2, "老", "老", nil, nil, nil], - 63797 => [0, 2, "蘆", "蘆", nil, nil, nil], - 63798 => [0, 2, "虜", "虜", nil, nil, nil], - 63799 => [0, 2, "路", "路", nil, nil, nil], - 63800 => [0, 2, "露", "露", nil, nil, nil], - 63801 => [0, 2, "魯", "魯", nil, nil, nil], - 63802 => [0, 2, "鷺", "鷺", nil, nil, nil], - 63803 => [0, 2, "碌", "碌", nil, nil, nil], - 63804 => [0, 2, "祿", "祿", nil, nil, nil], - 63805 => [0, 2, "綠", "綠", nil, nil, nil], - 63806 => [0, 2, "菉", "菉", nil, nil, nil], - 63807 => [0, 2, "錄", "錄", nil, nil, nil], - 63808 => [0, 2, "鹿", "鹿", nil, nil, nil], - 63809 => [0, 2, "論", "論", nil, nil, nil], - 63810 => [0, 2, "壟", "壟", nil, nil, nil], - 63811 => [0, 2, "弄", "弄", nil, nil, nil], - 63812 => [0, 2, "籠", "籠", nil, nil, nil], - 63813 => [0, 2, "聾", "聾", nil, nil, nil], - 63814 => [0, 2, "牢", "牢", nil, nil, nil], - 63815 => [0, 2, "磊", "磊", nil, nil, nil], - 63816 => [0, 2, "賂", "賂", nil, nil, nil], - 63817 => [0, 2, "雷", "雷", nil, nil, nil], - 63818 => [0, 2, "壘", "壘", nil, nil, nil], - 63819 => [0, 2, "屢", "屢", nil, nil, nil], - 63820 => [0, 2, "樓", "樓", nil, nil, nil], - 63821 => [0, 2, "淚", "淚", nil, nil, nil], - 63822 => [0, 2, "漏", "漏", nil, nil, nil], - 63823 => [0, 2, "累", "累", nil, nil, nil], - 63824 => [0, 2, "縷", "縷", nil, nil, nil], - 63825 => [0, 2, "電", "電", nil, nil, nil], - 63826 => [0, 2, "勒", "勒", nil, nil, nil], - 63827 => [0, 2, "肋", "肋", nil, nil, nil], - 63828 => [0, 2, "凜", "凜", nil, nil, nil], - 63829 => [0, 2, "凌", "凌", nil, nil, nil], - 63830 => [0, 2, "稜", "稜", nil, nil, nil], - 63831 => [0, 2, "綾", "綾", nil, nil, nil], - 63832 => [0, 2, "菱", "菱", nil, nil, nil], - 63833 => [0, 2, "陵", "陵", nil, nil, nil], - 63834 => [0, 2, "讀", "讀", nil, nil, nil], - 63835 => [0, 2, "拏", "拏", nil, nil, nil], - 63836 => [0, 2, "樂", "樂", nil, nil, nil], - 63837 => [0, 2, "諾", "諾", nil, nil, nil], - 63838 => [0, 2, "丹", "丹", nil, nil, nil], - 63839 => [0, 2, "寧", "寧", nil, nil, nil], - 63840 => [0, 2, "怒", "怒", nil, nil, nil], - 63841 => [0, 2, "率", "率", nil, nil, nil], - 63842 => [0, 2, "異", "異", nil, nil, nil], - 63843 => [0, 2, "北", "北", nil, nil, nil], - 63844 => [0, 2, "磻", "磻", nil, nil, nil], - 63845 => [0, 2, "便", "便", nil, nil, nil], - 63846 => [0, 2, "復", "復", nil, nil, nil], - 63847 => [0, 2, "不", "不", nil, nil, nil], - 63848 => [0, 2, "泌", "泌", nil, nil, nil], - 63849 => [0, 2, "數", "數", nil, nil, nil], - 63850 => [0, 2, "索", "索", nil, nil, nil], - 63851 => [0, 2, "參", "參", nil, nil, nil], - 63852 => [0, 2, "塞", "塞", nil, nil, nil], - 63853 => [0, 2, "省", "省", nil, nil, nil], - 63854 => [0, 2, "葉", "葉", nil, nil, nil], - 63855 => [0, 2, "說", "說", nil, nil, nil], - 63856 => [0, 2, "殺", "殺", nil, nil, nil], - 63857 => [0, 2, "辰", "辰", nil, nil, nil], - 63858 => [0, 2, "沈", "沈", nil, nil, nil], - 63859 => [0, 2, "拾", "拾", nil, nil, nil], - 63860 => [0, 2, "若", "若", nil, nil, nil], - 63861 => [0, 2, "掠", "掠", nil, nil, nil], - 63862 => [0, 2, "略", "略", nil, nil, nil], - 63863 => [0, 2, "亮", "亮", nil, nil, nil], - 63864 => [0, 2, "兩", "兩", nil, nil, nil], - 63865 => [0, 2, "凉", "凉", nil, nil, nil], - 63866 => [0, 2, "梁", "梁", nil, nil, nil], - 63867 => [0, 2, "糧", "糧", nil, nil, nil], - 63868 => [0, 2, "良", "良", nil, nil, nil], - 63869 => [0, 2, "諒", "諒", nil, nil, nil], - 63870 => [0, 2, "量", "量", nil, nil, nil], - 63871 => [0, 2, "勵", "勵", nil, nil, nil], - 63872 => [0, 2, "呂", "呂", nil, nil, nil], - 63873 => [0, 2, "女", "女", nil, nil, nil], - 63874 => [0, 2, "廬", "廬", nil, nil, nil], - 63875 => [0, 2, "旅", "旅", nil, nil, nil], - 63876 => [0, 2, "濾", "濾", nil, nil, nil], - 63877 => [0, 2, "礪", "礪", nil, nil, nil], - 63878 => [0, 2, "閭", "閭", nil, nil, nil], - 63879 => [0, 2, "驪", "驪", nil, nil, nil], - 63880 => [0, 2, "麗", "麗", nil, nil, nil], - 63881 => [0, 2, "黎", "黎", nil, nil, nil], - 63882 => [0, 2, "力", "力", nil, nil, nil], - 63883 => [0, 2, "曆", "曆", nil, nil, nil], - 63884 => [0, 2, "歷", "歷", nil, nil, nil], - 63885 => [0, 2, "轢", "轢", nil, nil, nil], - 63886 => [0, 2, "年", "年", nil, nil, nil], - 63887 => [0, 2, "憐", "憐", nil, nil, nil], - 63888 => [0, 2, "戀", "戀", nil, nil, nil], - 63889 => [0, 2, "撚", "撚", nil, nil, nil], - 63890 => [0, 2, "漣", "漣", nil, nil, nil], - 63891 => [0, 2, "煉", "煉", nil, nil, nil], - 63892 => [0, 2, "璉", "璉", nil, nil, nil], - 63893 => [0, 2, "秊", "秊", nil, nil, nil], - 63894 => [0, 2, "練", "練", nil, nil, nil], - 63895 => [0, 2, "聯", "聯", nil, nil, nil], - 63896 => [0, 2, "輦", "輦", nil, nil, nil], - 63897 => [0, 2, "蓮", "蓮", nil, nil, nil], - 63898 => [0, 2, "連", "連", nil, nil, nil], - 63899 => [0, 2, "鍊", "鍊", nil, nil, nil], - 63900 => [0, 2, "列", "列", nil, nil, nil], - 63901 => [0, 2, "劣", "劣", nil, nil, nil], - 63902 => [0, 2, "咽", "咽", nil, nil, nil], - 63903 => [0, 2, "烈", "烈", nil, nil, nil], - 63904 => [0, 2, "裂", "裂", nil, nil, nil], - 63905 => [0, 2, "說", "說", nil, nil, nil], - 63906 => [0, 2, "廉", "廉", nil, nil, nil], - 63907 => [0, 2, "念", "念", nil, nil, nil], - 63908 => [0, 2, "捻", "捻", nil, nil, nil], - 63909 => [0, 2, "殮", "殮", nil, nil, nil], - 63910 => [0, 2, "簾", "簾", nil, nil, nil], - 63911 => [0, 2, "獵", "獵", nil, nil, nil], - 63912 => [0, 2, "令", "令", nil, nil, nil], - 63913 => [0, 2, "囹", "囹", nil, nil, nil], - 63914 => [0, 2, "寧", "寧", nil, nil, nil], - 63915 => [0, 2, "嶺", "嶺", nil, nil, nil], - 63916 => [0, 2, "怜", "怜", nil, nil, nil], - 63917 => [0, 2, "玲", "玲", nil, nil, nil], - 63918 => [0, 2, "瑩", "瑩", nil, nil, nil], - 63919 => [0, 2, "羚", "羚", nil, nil, nil], - 63920 => [0, 2, "聆", "聆", nil, nil, nil], - 63921 => [0, 2, "鈴", "鈴", nil, nil, nil], - 63922 => [0, 2, "零", "零", nil, nil, nil], - 63923 => [0, 2, "靈", "靈", nil, nil, nil], - 63924 => [0, 2, "領", "領", nil, nil, nil], - 63925 => [0, 2, "例", "例", nil, nil, nil], - 63926 => [0, 2, "禮", "禮", nil, nil, nil], - 63927 => [0, 2, "醴", "醴", nil, nil, nil], - 63928 => [0, 2, "隸", "隸", nil, nil, nil], - 63929 => [0, 2, "惡", "惡", nil, nil, nil], - 63930 => [0, 2, "了", "了", nil, nil, nil], - 63931 => [0, 2, "僚", "僚", nil, nil, nil], - 63932 => [0, 2, "寮", "寮", nil, nil, nil], - 63933 => [0, 2, "尿", "尿", nil, nil, nil], - 63934 => [0, 2, "料", "料", nil, nil, nil], - 63935 => [0, 2, "樂", "樂", nil, nil, nil], - 63936 => [0, 2, "燎", "燎", nil, nil, nil], - 63937 => [0, 2, "療", "療", nil, nil, nil], - 63938 => [0, 2, "蓼", "蓼", nil, nil, nil], - 63939 => [0, 2, "遼", "遼", nil, nil, nil], - 63940 => [0, 2, "龍", "龍", nil, nil, nil], - 63941 => [0, 2, "暈", "暈", nil, nil, nil], - 63942 => [0, 2, "阮", "阮", nil, nil, nil], - 63943 => [0, 2, "劉", "劉", nil, nil, nil], - 63944 => [0, 2, "杻", "杻", nil, nil, nil], - 63945 => [0, 2, "柳", "柳", nil, nil, nil], - 63946 => [0, 2, "流", "流", nil, nil, nil], - 63947 => [0, 2, "溜", "溜", nil, nil, nil], - 63948 => [0, 2, "琉", "琉", nil, nil, nil], - 63949 => [0, 2, "留", "留", nil, nil, nil], - 63950 => [0, 2, "硫", "硫", nil, nil, nil], - 63951 => [0, 2, "紐", "紐", nil, nil, nil], - 63952 => [0, 2, "類", "類", nil, nil, nil], - 63953 => [0, 2, "六", "六", nil, nil, nil], - 63954 => [0, 2, "戮", "戮", nil, nil, nil], - 63955 => [0, 2, "陸", "陸", nil, nil, nil], - 63956 => [0, 2, "倫", "倫", nil, nil, nil], - 63957 => [0, 2, "崙", "崙", nil, nil, nil], - 63958 => [0, 2, "淪", "淪", nil, nil, nil], - 63959 => [0, 2, "輪", "輪", nil, nil, nil], - 63960 => [0, 2, "律", "律", nil, nil, nil], - 63961 => [0, 2, "慄", "慄", nil, nil, nil], - 63962 => [0, 2, "栗", "栗", nil, nil, nil], - 63963 => [0, 2, "率", "率", nil, nil, nil], - 63964 => [0, 2, "隆", "隆", nil, nil, nil], - 63965 => [0, 2, "利", "利", nil, nil, nil], - 63966 => [0, 2, "吏", "吏", nil, nil, nil], - 63967 => [0, 2, "履", "履", nil, nil, nil], - 63968 => [0, 2, "易", "易", nil, nil, nil], - 63969 => [0, 2, "李", "李", nil, nil, nil], - 63970 => [0, 2, "梨", "梨", nil, nil, nil], - 63971 => [0, 2, "泥", "泥", nil, nil, nil], - 63972 => [0, 2, "理", "理", nil, nil, nil], - 63973 => [0, 2, "痢", "痢", nil, nil, nil], - 63974 => [0, 2, "罹", "罹", nil, nil, nil], - 63975 => [0, 2, "裏", "裏", nil, nil, nil], - 63976 => [0, 2, "裡", "裡", nil, nil, nil], - 63977 => [0, 2, "里", "里", nil, nil, nil], - 63978 => [0, 2, "離", "離", nil, nil, nil], - 63979 => [0, 2, "匿", "匿", nil, nil, nil], - 63980 => [0, 2, "溺", "溺", nil, nil, nil], - 63981 => [0, 2, "吝", "吝", nil, nil, nil], - 63982 => [0, 2, "燐", "燐", nil, nil, nil], - 63983 => [0, 2, "璘", "璘", nil, nil, nil], - 63984 => [0, 2, "藺", "藺", nil, nil, nil], - 63985 => [0, 2, "隣", "隣", nil, nil, nil], - 63986 => [0, 2, "鱗", "鱗", nil, nil, nil], - 63987 => [0, 2, "麟", "麟", nil, nil, nil], - 63988 => [0, 2, "林", "林", nil, nil, nil], - 63989 => [0, 2, "淋", "淋", nil, nil, nil], - 63990 => [0, 2, "臨", "臨", nil, nil, nil], - 63991 => [0, 2, "立", "立", nil, nil, nil], - 63992 => [0, 2, "笠", "笠", nil, nil, nil], - 63993 => [0, 2, "粒", "粒", nil, nil, nil], - 63994 => [0, 2, "狀", "狀", nil, nil, nil], - 63995 => [0, 2, "炙", "炙", nil, nil, nil], - 63996 => [0, 2, "識", "識", nil, nil, nil], - 63997 => [0, 2, "什", "什", nil, nil, nil], - 63998 => [0, 2, "茶", "茶", nil, nil, nil], - 63999 => [0, 2, "刺", "刺", nil, nil, nil], - 64000 => [0, 2, "切", "切", nil, nil, nil], - 64001 => [0, 2, "度", "度", nil, nil, nil], - 64002 => [0, 2, "拓", "拓", nil, nil, nil], - 64003 => [0, 2, "糖", "糖", nil, nil, nil], - 64004 => [0, 2, "宅", "宅", nil, nil, nil], - 64005 => [0, 2, "洞", "洞", nil, nil, nil], - 64006 => [0, 2, "暴", "暴", nil, nil, nil], - 64007 => [0, 2, "輻", "輻", nil, nil, nil], - 64008 => [0, 2, "行", "行", nil, nil, nil], - 64009 => [0, 2, "降", "降", nil, nil, nil], - 64010 => [0, 2, "見", "見", nil, nil, nil], - 64011 => [0, 2, "廓", "廓", nil, nil, nil], - 64012 => [0, 2, "兀", "兀", nil, nil, nil], - 64013 => [0, 2, "嗀", "嗀", nil, nil, nil], - 64016 => [0, 2, "塚", "塚", nil, nil, nil], - 64018 => [0, 2, "晴", "晴", nil, nil, nil], - 64021 => [0, 2, "凞", "凞", nil, nil, nil], - 64022 => [0, 2, "猪", "猪", nil, nil, nil], - 64023 => [0, 2, "益", "益", nil, nil, nil], - 64024 => [0, 2, "礼", "礼", nil, nil, nil], - 64025 => [0, 2, "神", "神", nil, nil, nil], - 64026 => [0, 2, "祥", "祥", nil, nil, nil], - 64027 => [0, 2, "福", "福", nil, nil, nil], - 64028 => [0, 2, "靖", "靖", nil, nil, nil], - 64029 => [0, 2, "精", "精", nil, nil, nil], - 64030 => [0, 2, "羽", "羽", nil, nil, nil], - 64032 => [0, 2, "蘒", "蘒", nil, nil, nil], - 64034 => [0, 2, "諸", "諸", nil, nil, nil], - 64037 => [0, 2, "逸", "逸", nil, nil, nil], - 64038 => [0, 2, "都", "都", nil, nil, nil], - 64042 => [0, 2, "飯", "飯", nil, nil, nil], - 64043 => [0, 2, "飼", "飼", nil, nil, nil], - 64044 => [0, 2, "館", "館", nil, nil, nil], - 64045 => [0, 2, "鶴", "鶴", nil, nil, nil], - 64256 => [0, 0, nil, "ff", nil, nil, nil], - 64257 => [0, 0, nil, "fi", nil, nil, nil], - 64258 => [0, 0, nil, "fl", nil, nil, nil], - 64259 => [0, 0, nil, "ffi", nil, nil, nil], - 64260 => [0, 0, nil, "ffl", nil, nil, nil], - 64261 => [0, 0, nil, "ſt", nil, nil, nil], - 64262 => [0, 0, nil, "st", nil, nil, nil], - 64275 => [0, 0, nil, "մն", nil, nil, nil], - 64276 => [0, 0, nil, "մե", nil, nil, nil], - 64277 => [0, 0, nil, "մի", nil, nil, nil], - 64278 => [0, 0, nil, "վն", nil, nil, nil], - 64279 => [0, 0, nil, "մխ", nil, nil, nil], - 64285 => [0, 0, "יִ", "יִ", nil, nil, nil], - 64286 => [26, 0, nil, nil, nil, nil, nil], - 64287 => [0, 1, "ײַ", "ײַ", nil, nil, nil], - 64288 => [0, 0, nil, "ע", nil, nil, nil], - 64289 => [0, 0, nil, "א", nil, nil, nil], - 64290 => [0, 0, nil, "ד", nil, nil, nil], - 64291 => [0, 0, nil, "ה", nil, nil, nil], - 64292 => [0, 0, nil, "כ", nil, nil, nil], - 64293 => [0, 0, nil, "ל", nil, nil, nil], - 64294 => [0, 0, nil, "ם", nil, nil, nil], - 64295 => [0, 0, nil, "ר", nil, nil, nil], - 64296 => [0, 0, nil, "ת", nil, nil, nil], - 64297 => [0, 0, nil, "+", nil, nil, nil], - 64298 => [0, 1, "שׁ", "שׁ", nil, nil, nil], - 64299 => [0, 1, "שׂ", "שׂ", nil, nil, nil], - 64300 => [0, 1, "שּׁ", "שּׁ", nil, nil, nil], - 64301 => [0, 1, "שּׂ", "שּׂ", nil, nil, nil], - 64302 => [0, 1, "אַ", "אַ", nil, nil, nil], - 64303 => [0, 1, "אָ", "אָ", nil, nil, nil], - 64304 => [0, 1, "אּ", "אּ", nil, nil, nil], - 64305 => [0, 1, "בּ", "בּ", nil, nil, nil], - 64306 => [0, 1, "גּ", "גּ", nil, nil, nil], - 64307 => [0, 1, "דּ", "דּ", nil, nil, nil], - 64308 => [0, 1, "הּ", "הּ", nil, nil, nil], - 64309 => [0, 1, "וּ", "וּ", nil, nil, nil], - 64310 => [0, 1, "זּ", "זּ", nil, nil, nil], - 64312 => [0, 1, "טּ", "טּ", nil, nil, nil], - 64313 => [0, 1, "יּ", "יּ", nil, nil, nil], - 64314 => [0, 1, "ךּ", "ךּ", nil, nil, nil], - 64315 => [0, 1, "כּ", "כּ", nil, nil, nil], - 64316 => [0, 1, "לּ", "לּ", nil, nil, nil], - 64318 => [0, 1, "מּ", "מּ", nil, nil, nil], - 64320 => [0, 1, "נּ", "נּ", nil, nil, nil], - 64321 => [0, 1, "סּ", "סּ", nil, nil, nil], - 64323 => [0, 1, "ףּ", "ףּ", nil, nil, nil], - 64324 => [0, 1, "פּ", "פּ", nil, nil, nil], - 64326 => [0, 1, "צּ", "צּ", nil, nil, nil], - 64327 => [0, 1, "קּ", "קּ", nil, nil, nil], - 64328 => [0, 1, "רּ", "רּ", nil, nil, nil], - 64329 => [0, 1, "שּ", "שּ", nil, nil, nil], - 64330 => [0, 1, "תּ", "תּ", nil, nil, nil], - 64331 => [0, 1, "וֹ", "וֹ", nil, nil, nil], - 64332 => [0, 1, "בֿ", "בֿ", nil, nil, nil], - 64333 => [0, 1, "כֿ", "כֿ", nil, nil, nil], - 64334 => [0, 1, "פֿ", "פֿ", nil, nil, nil], - 64335 => [0, 0, nil, "אל", nil, nil, nil], - 64336 => [0, 0, nil, "ٱ", nil, nil, nil], - 64337 => [0, 0, nil, "ٱ", nil, nil, nil], - 64338 => [0, 0, nil, "ٻ", nil, nil, nil], - 64339 => [0, 0, nil, "ٻ", nil, nil, nil], - 64340 => [0, 0, nil, "ٻ", nil, nil, nil], - 64341 => [0, 0, nil, "ٻ", nil, nil, nil], - 64342 => [0, 0, nil, "پ", nil, nil, nil], - 64343 => [0, 0, nil, "پ", nil, nil, nil], - 64344 => [0, 0, nil, "پ", nil, nil, nil], - 64345 => [0, 0, nil, "پ", nil, nil, nil], - 64346 => [0, 0, nil, "ڀ", nil, nil, nil], - 64347 => [0, 0, nil, "ڀ", nil, nil, nil], - 64348 => [0, 0, nil, "ڀ", nil, nil, nil], - 64349 => [0, 0, nil, "ڀ", nil, nil, nil], - 64350 => [0, 0, nil, "ٺ", nil, nil, nil], - 64351 => [0, 0, nil, "ٺ", nil, nil, nil], - 64352 => [0, 0, nil, "ٺ", nil, nil, nil], - 64353 => [0, 0, nil, "ٺ", nil, nil, nil], - 64354 => [0, 0, nil, "ٿ", nil, nil, nil], - 64355 => [0, 0, nil, "ٿ", nil, nil, nil], - 64356 => [0, 0, nil, "ٿ", nil, nil, nil], - 64357 => [0, 0, nil, "ٿ", nil, nil, nil], - 64358 => [0, 0, nil, "ٹ", nil, nil, nil], - 64359 => [0, 0, nil, "ٹ", nil, nil, nil], - 64360 => [0, 0, nil, "ٹ", nil, nil, nil], - 64361 => [0, 0, nil, "ٹ", nil, nil, nil], - 64362 => [0, 0, nil, "ڤ", nil, nil, nil], - 64363 => [0, 0, nil, "ڤ", nil, nil, nil], - 64364 => [0, 0, nil, "ڤ", nil, nil, nil], - 64365 => [0, 0, nil, "ڤ", nil, nil, nil], - 64366 => [0, 0, nil, "ڦ", nil, nil, nil], - 64367 => [0, 0, nil, "ڦ", nil, nil, nil], - 64368 => [0, 0, nil, "ڦ", nil, nil, nil], - 64369 => [0, 0, nil, "ڦ", nil, nil, nil], - 64370 => [0, 0, nil, "ڄ", nil, nil, nil], - 64371 => [0, 0, nil, "ڄ", nil, nil, nil], - 64372 => [0, 0, nil, "ڄ", nil, nil, nil], - 64373 => [0, 0, nil, "ڄ", nil, nil, nil], - 64374 => [0, 0, nil, "ڃ", nil, nil, nil], - 64375 => [0, 0, nil, "ڃ", nil, nil, nil], - 64376 => [0, 0, nil, "ڃ", nil, nil, nil], - 64377 => [0, 0, nil, "ڃ", nil, nil, nil], - 64378 => [0, 0, nil, "چ", nil, nil, nil], - 64379 => [0, 0, nil, "چ", nil, nil, nil], - 64380 => [0, 0, nil, "چ", nil, nil, nil], - 64381 => [0, 0, nil, "چ", nil, nil, nil], - 64382 => [0, 0, nil, "ڇ", nil, nil, nil], - 64383 => [0, 0, nil, "ڇ", nil, nil, nil], - 64384 => [0, 0, nil, "ڇ", nil, nil, nil], - 64385 => [0, 0, nil, "ڇ", nil, nil, nil], - 64386 => [0, 0, nil, "ڍ", nil, nil, nil], - 64387 => [0, 0, nil, "ڍ", nil, nil, nil], - 64388 => [0, 0, nil, "ڌ", nil, nil, nil], - 64389 => [0, 0, nil, "ڌ", nil, nil, nil], - 64390 => [0, 0, nil, "ڎ", nil, nil, nil], - 64391 => [0, 0, nil, "ڎ", nil, nil, nil], - 64392 => [0, 0, nil, "ڈ", nil, nil, nil], - 64393 => [0, 0, nil, "ڈ", nil, nil, nil], - 64394 => [0, 0, nil, "ژ", nil, nil, nil], - 64395 => [0, 0, nil, "ژ", nil, nil, nil], - 64396 => [0, 0, nil, "ڑ", nil, nil, nil], - 64397 => [0, 0, nil, "ڑ", nil, nil, nil], - 64398 => [0, 0, nil, "ک", nil, nil, nil], - 64399 => [0, 0, nil, "ک", nil, nil, nil], - 64400 => [0, 0, nil, "ک", nil, nil, nil], - 64401 => [0, 0, nil, "ک", nil, nil, nil], - 64402 => [0, 0, nil, "گ", nil, nil, nil], - 64403 => [0, 0, nil, "گ", nil, nil, nil], - 64404 => [0, 0, nil, "گ", nil, nil, nil], - 64405 => [0, 0, nil, "گ", nil, nil, nil], - 64406 => [0, 0, nil, "ڳ", nil, nil, nil], - 64407 => [0, 0, nil, "ڳ", nil, nil, nil], - 64408 => [0, 0, nil, "ڳ", nil, nil, nil], - 64409 => [0, 0, nil, "ڳ", nil, nil, nil], - 64410 => [0, 0, nil, "ڱ", nil, nil, nil], - 64411 => [0, 0, nil, "ڱ", nil, nil, nil], - 64412 => [0, 0, nil, "ڱ", nil, nil, nil], - 64413 => [0, 0, nil, "ڱ", nil, nil, nil], - 64414 => [0, 0, nil, "ں", nil, nil, nil], - 64415 => [0, 0, nil, "ں", nil, nil, nil], - 64416 => [0, 0, nil, "ڻ", nil, nil, nil], - 64417 => [0, 0, nil, "ڻ", nil, nil, nil], - 64418 => [0, 0, nil, "ڻ", nil, nil, nil], - 64419 => [0, 0, nil, "ڻ", nil, nil, nil], - 64420 => [0, 0, nil, "ۀ", nil, nil, nil], - 64421 => [0, 0, nil, "ۀ", nil, nil, nil], - 64422 => [0, 0, nil, "ہ", nil, nil, nil], - 64423 => [0, 0, nil, "ہ", nil, nil, nil], - 64424 => [0, 0, nil, "ہ", nil, nil, nil], - 64425 => [0, 0, nil, "ہ", nil, nil, nil], - 64426 => [0, 0, nil, "ھ", nil, nil, nil], - 64427 => [0, 0, nil, "ھ", nil, nil, nil], - 64428 => [0, 0, nil, "ھ", nil, nil, nil], - 64429 => [0, 0, nil, "ھ", nil, nil, nil], - 64430 => [0, 0, nil, "ے", nil, nil, nil], - 64431 => [0, 0, nil, "ے", nil, nil, nil], - 64432 => [0, 0, nil, "ۓ", nil, nil, nil], - 64433 => [0, 0, nil, "ۓ", nil, nil, nil], - 64467 => [0, 0, nil, "ڭ", nil, nil, nil], - 64468 => [0, 0, nil, "ڭ", nil, nil, nil], - 64469 => [0, 0, nil, "ڭ", nil, nil, nil], - 64470 => [0, 0, nil, "ڭ", nil, nil, nil], - 64471 => [0, 0, nil, "ۇ", nil, nil, nil], - 64472 => [0, 0, nil, "ۇ", nil, nil, nil], - 64473 => [0, 0, nil, "ۆ", nil, nil, nil], - 64474 => [0, 0, nil, "ۆ", nil, nil, nil], - 64475 => [0, 0, nil, "ۈ", nil, nil, nil], - 64476 => [0, 0, nil, "ۈ", nil, nil, nil], - 64477 => [0, 0, nil, "ٷ", nil, nil, nil], - 64478 => [0, 0, nil, "ۋ", nil, nil, nil], - 64479 => [0, 0, nil, "ۋ", nil, nil, nil], - 64480 => [0, 0, nil, "ۅ", nil, nil, nil], - 64481 => [0, 0, nil, "ۅ", nil, nil, nil], - 64482 => [0, 0, nil, "ۉ", nil, nil, nil], - 64483 => [0, 0, nil, "ۉ", nil, nil, nil], - 64484 => [0, 0, nil, "ې", nil, nil, nil], - 64485 => [0, 0, nil, "ې", nil, nil, nil], - 64486 => [0, 0, nil, "ې", nil, nil, nil], - 64487 => [0, 0, nil, "ې", nil, nil, nil], - 64488 => [0, 0, nil, "ى", nil, nil, nil], - 64489 => [0, 0, nil, "ى", nil, nil, nil], - 64490 => [0, 0, nil, "ئا", nil, nil, nil], - 64491 => [0, 0, nil, "ئا", nil, nil, nil], - 64492 => [0, 0, nil, "ئە", nil, nil, nil], - 64493 => [0, 0, nil, "ئە", nil, nil, nil], - 64494 => [0, 0, nil, "ئو", nil, nil, nil], - 64495 => [0, 0, nil, "ئو", nil, nil, nil], - 64496 => [0, 0, nil, "ئۇ", nil, nil, nil], - 64497 => [0, 0, nil, "ئۇ", nil, nil, nil], - 64498 => [0, 0, nil, "ئۆ", nil, nil, nil], - 64499 => [0, 0, nil, "ئۆ", nil, nil, nil], - 64500 => [0, 0, nil, "ئۈ", nil, nil, nil], - 64501 => [0, 0, nil, "ئۈ", nil, nil, nil], - 64502 => [0, 0, nil, "ئې", nil, nil, nil], - 64503 => [0, 0, nil, "ئې", nil, nil, nil], - 64504 => [0, 0, nil, "ئې", nil, nil, nil], - 64505 => [0, 0, nil, "ئى", nil, nil, nil], - 64506 => [0, 0, nil, "ئى", nil, nil, nil], - 64507 => [0, 0, nil, "ئى", nil, nil, nil], - 64508 => [0, 0, nil, "ی", nil, nil, nil], - 64509 => [0, 0, nil, "ی", nil, nil, nil], - 64510 => [0, 0, nil, "ی", nil, nil, nil], - 64511 => [0, 0, nil, "ی", nil, nil, nil], - 64512 => [0, 0, nil, "ئج", nil, nil, nil], - 64513 => [0, 0, nil, "ئح", nil, nil, nil], - 64514 => [0, 0, nil, "ئم", nil, nil, nil], - 64515 => [0, 0, nil, "ئى", nil, nil, nil], - 64516 => [0, 0, nil, "ئي", nil, nil, nil], - 64517 => [0, 0, nil, "بج", nil, nil, nil], - 64518 => [0, 0, nil, "بح", nil, nil, nil], - 64519 => [0, 0, nil, "بخ", nil, nil, nil], - 64520 => [0, 0, nil, "بم", nil, nil, nil], - 64521 => [0, 0, nil, "بى", nil, nil, nil], - 64522 => [0, 0, nil, "بي", nil, nil, nil], - 64523 => [0, 0, nil, "تج", nil, nil, nil], - 64524 => [0, 0, nil, "تح", nil, nil, nil], - 64525 => [0, 0, nil, "تخ", nil, nil, nil], - 64526 => [0, 0, nil, "تم", nil, nil, nil], - 64527 => [0, 0, nil, "تى", nil, nil, nil], - 64528 => [0, 0, nil, "تي", nil, nil, nil], - 64529 => [0, 0, nil, "ثج", nil, nil, nil], - 64530 => [0, 0, nil, "ثم", nil, nil, nil], - 64531 => [0, 0, nil, "ثى", nil, nil, nil], - 64532 => [0, 0, nil, "ثي", nil, nil, nil], - 64533 => [0, 0, nil, "جح", nil, nil, nil], - 64534 => [0, 0, nil, "جم", nil, nil, nil], - 64535 => [0, 0, nil, "حج", nil, nil, nil], - 64536 => [0, 0, nil, "حم", nil, nil, nil], - 64537 => [0, 0, nil, "خج", nil, nil, nil], - 64538 => [0, 0, nil, "خح", nil, nil, nil], - 64539 => [0, 0, nil, "خم", nil, nil, nil], - 64540 => [0, 0, nil, "سج", nil, nil, nil], - 64541 => [0, 0, nil, "سح", nil, nil, nil], - 64542 => [0, 0, nil, "سخ", nil, nil, nil], - 64543 => [0, 0, nil, "سم", nil, nil, nil], - 64544 => [0, 0, nil, "صح", nil, nil, nil], - 64545 => [0, 0, nil, "صم", nil, nil, nil], - 64546 => [0, 0, nil, "ضج", nil, nil, nil], - 64547 => [0, 0, nil, "ضح", nil, nil, nil], - 64548 => [0, 0, nil, "ضخ", nil, nil, nil], - 64549 => [0, 0, nil, "ضم", nil, nil, nil], - 64550 => [0, 0, nil, "طح", nil, nil, nil], - 64551 => [0, 0, nil, "طم", nil, nil, nil], - 64552 => [0, 0, nil, "ظم", nil, nil, nil], - 64553 => [0, 0, nil, "عج", nil, nil, nil], - 64554 => [0, 0, nil, "عم", nil, nil, nil], - 64555 => [0, 0, nil, "غج", nil, nil, nil], - 64556 => [0, 0, nil, "غم", nil, nil, nil], - 64557 => [0, 0, nil, "فج", nil, nil, nil], - 64558 => [0, 0, nil, "فح", nil, nil, nil], - 64559 => [0, 0, nil, "فخ", nil, nil, nil], - 64560 => [0, 0, nil, "فم", nil, nil, nil], - 64561 => [0, 0, nil, "فى", nil, nil, nil], - 64562 => [0, 0, nil, "في", nil, nil, nil], - 64563 => [0, 0, nil, "قح", nil, nil, nil], - 64564 => [0, 0, nil, "قم", nil, nil, nil], - 64565 => [0, 0, nil, "قى", nil, nil, nil], - 64566 => [0, 0, nil, "قي", nil, nil, nil], - 64567 => [0, 0, nil, "كا", nil, nil, nil], - 64568 => [0, 0, nil, "كج", nil, nil, nil], - 64569 => [0, 0, nil, "كح", nil, nil, nil], - 64570 => [0, 0, nil, "كخ", nil, nil, nil], - 64571 => [0, 0, nil, "كل", nil, nil, nil], - 64572 => [0, 0, nil, "كم", nil, nil, nil], - 64573 => [0, 0, nil, "كى", nil, nil, nil], - 64574 => [0, 0, nil, "كي", nil, nil, nil], - 64575 => [0, 0, nil, "لج", nil, nil, nil], - 64576 => [0, 0, nil, "لح", nil, nil, nil], - 64577 => [0, 0, nil, "لخ", nil, nil, nil], - 64578 => [0, 0, nil, "لم", nil, nil, nil], - 64579 => [0, 0, nil, "لى", nil, nil, nil], - 64580 => [0, 0, nil, "لي", nil, nil, nil], - 64581 => [0, 0, nil, "مج", nil, nil, nil], - 64582 => [0, 0, nil, "مح", nil, nil, nil], - 64583 => [0, 0, nil, "مخ", nil, nil, nil], - 64584 => [0, 0, nil, "مم", nil, nil, nil], - 64585 => [0, 0, nil, "مى", nil, nil, nil], - 64586 => [0, 0, nil, "مي", nil, nil, nil], - 64587 => [0, 0, nil, "نج", nil, nil, nil], - 64588 => [0, 0, nil, "نح", nil, nil, nil], - 64589 => [0, 0, nil, "نخ", nil, nil, nil], - 64590 => [0, 0, nil, "نم", nil, nil, nil], - 64591 => [0, 0, nil, "نى", nil, nil, nil], - 64592 => [0, 0, nil, "ني", nil, nil, nil], - 64593 => [0, 0, nil, "هج", nil, nil, nil], - 64594 => [0, 0, nil, "هم", nil, nil, nil], - 64595 => [0, 0, nil, "هى", nil, nil, nil], - 64596 => [0, 0, nil, "هي", nil, nil, nil], - 64597 => [0, 0, nil, "يج", nil, nil, nil], - 64598 => [0, 0, nil, "يح", nil, nil, nil], - 64599 => [0, 0, nil, "يخ", nil, nil, nil], - 64600 => [0, 0, nil, "يم", nil, nil, nil], - 64601 => [0, 0, nil, "يى", nil, nil, nil], - 64602 => [0, 0, nil, "يي", nil, nil, nil], - 64603 => [0, 0, nil, "ذٰ", nil, nil, nil], - 64604 => [0, 0, nil, "رٰ", nil, nil, nil], - 64605 => [0, 0, nil, "ىٰ", nil, nil, nil], - 64606 => [0, 0, nil, " ٌّ", nil, nil, nil], - 64607 => [0, 0, nil, " ٍّ", nil, nil, nil], - 64608 => [0, 0, nil, " َّ", nil, nil, nil], - 64609 => [0, 0, nil, " ُّ", nil, nil, nil], - 64610 => [0, 0, nil, " ِّ", nil, nil, nil], - 64611 => [0, 0, nil, " ّٰ", nil, nil, nil], - 64612 => [0, 0, nil, "ئر", nil, nil, nil], - 64613 => [0, 0, nil, "ئز", nil, nil, nil], - 64614 => [0, 0, nil, "ئم", nil, nil, nil], - 64615 => [0, 0, nil, "ئن", nil, nil, nil], - 64616 => [0, 0, nil, "ئى", nil, nil, nil], - 64617 => [0, 0, nil, "ئي", nil, nil, nil], - 64618 => [0, 0, nil, "بر", nil, nil, nil], - 64619 => [0, 0, nil, "بز", nil, nil, nil], - 64620 => [0, 0, nil, "بم", nil, nil, nil], - 64621 => [0, 0, nil, "بن", nil, nil, nil], - 64622 => [0, 0, nil, "بى", nil, nil, nil], - 64623 => [0, 0, nil, "بي", nil, nil, nil], - 64624 => [0, 0, nil, "تر", nil, nil, nil], - 64625 => [0, 0, nil, "تز", nil, nil, nil], - 64626 => [0, 0, nil, "تم", nil, nil, nil], - 64627 => [0, 0, nil, "تن", nil, nil, nil], - 64628 => [0, 0, nil, "تى", nil, nil, nil], - 64629 => [0, 0, nil, "تي", nil, nil, nil], - 64630 => [0, 0, nil, "ثر", nil, nil, nil], - 64631 => [0, 0, nil, "ثز", nil, nil, nil], - 64632 => [0, 0, nil, "ثم", nil, nil, nil], - 64633 => [0, 0, nil, "ثن", nil, nil, nil], - 64634 => [0, 0, nil, "ثى", nil, nil, nil], - 64635 => [0, 0, nil, "ثي", nil, nil, nil], - 64636 => [0, 0, nil, "فى", nil, nil, nil], - 64637 => [0, 0, nil, "في", nil, nil, nil], - 64638 => [0, 0, nil, "قى", nil, nil, nil], - 64639 => [0, 0, nil, "قي", nil, nil, nil], - 64640 => [0, 0, nil, "كا", nil, nil, nil], - 64641 => [0, 0, nil, "كل", nil, nil, nil], - 64642 => [0, 0, nil, "كم", nil, nil, nil], - 64643 => [0, 0, nil, "كى", nil, nil, nil], - 64644 => [0, 0, nil, "كي", nil, nil, nil], - 64645 => [0, 0, nil, "لم", nil, nil, nil], - 64646 => [0, 0, nil, "لى", nil, nil, nil], - 64647 => [0, 0, nil, "لي", nil, nil, nil], - 64648 => [0, 0, nil, "ما", nil, nil, nil], - 64649 => [0, 0, nil, "مم", nil, nil, nil], - 64650 => [0, 0, nil, "نر", nil, nil, nil], - 64651 => [0, 0, nil, "نز", nil, nil, nil], - 64652 => [0, 0, nil, "نم", nil, nil, nil], - 64653 => [0, 0, nil, "نن", nil, nil, nil], - 64654 => [0, 0, nil, "نى", nil, nil, nil], - 64655 => [0, 0, nil, "ني", nil, nil, nil], - 64656 => [0, 0, nil, "ىٰ", nil, nil, nil], - 64657 => [0, 0, nil, "ير", nil, nil, nil], - 64658 => [0, 0, nil, "يز", nil, nil, nil], - 64659 => [0, 0, nil, "يم", nil, nil, nil], - 64660 => [0, 0, nil, "ين", nil, nil, nil], - 64661 => [0, 0, nil, "يى", nil, nil, nil], - 64662 => [0, 0, nil, "يي", nil, nil, nil], - 64663 => [0, 0, nil, "ئج", nil, nil, nil], - 64664 => [0, 0, nil, "ئح", nil, nil, nil], - 64665 => [0, 0, nil, "ئخ", nil, nil, nil], - 64666 => [0, 0, nil, "ئم", nil, nil, nil], - 64667 => [0, 0, nil, "ئه", nil, nil, nil], - 64668 => [0, 0, nil, "بج", nil, nil, nil], - 64669 => [0, 0, nil, "بح", nil, nil, nil], - 64670 => [0, 0, nil, "بخ", nil, nil, nil], - 64671 => [0, 0, nil, "بم", nil, nil, nil], - 64672 => [0, 0, nil, "به", nil, nil, nil], - 64673 => [0, 0, nil, "تج", nil, nil, nil], - 64674 => [0, 0, nil, "تح", nil, nil, nil], - 64675 => [0, 0, nil, "تخ", nil, nil, nil], - 64676 => [0, 0, nil, "تم", nil, nil, nil], - 64677 => [0, 0, nil, "ته", nil, nil, nil], - 64678 => [0, 0, nil, "ثم", nil, nil, nil], - 64679 => [0, 0, nil, "جح", nil, nil, nil], - 64680 => [0, 0, nil, "جم", nil, nil, nil], - 64681 => [0, 0, nil, "حج", nil, nil, nil], - 64682 => [0, 0, nil, "حم", nil, nil, nil], - 64683 => [0, 0, nil, "خج", nil, nil, nil], - 64684 => [0, 0, nil, "خم", nil, nil, nil], - 64685 => [0, 0, nil, "سج", nil, nil, nil], - 64686 => [0, 0, nil, "سح", nil, nil, nil], - 64687 => [0, 0, nil, "سخ", nil, nil, nil], - 64688 => [0, 0, nil, "سم", nil, nil, nil], - 64689 => [0, 0, nil, "صح", nil, nil, nil], - 64690 => [0, 0, nil, "صخ", nil, nil, nil], - 64691 => [0, 0, nil, "صم", nil, nil, nil], - 64692 => [0, 0, nil, "ضج", nil, nil, nil], - 64693 => [0, 0, nil, "ضح", nil, nil, nil], - 64694 => [0, 0, nil, "ضخ", nil, nil, nil], - 64695 => [0, 0, nil, "ضم", nil, nil, nil], - 64696 => [0, 0, nil, "طح", nil, nil, nil], - 64697 => [0, 0, nil, "ظم", nil, nil, nil], - 64698 => [0, 0, nil, "عج", nil, nil, nil], - 64699 => [0, 0, nil, "عم", nil, nil, nil], - 64700 => [0, 0, nil, "غج", nil, nil, nil], - 64701 => [0, 0, nil, "غم", nil, nil, nil], - 64702 => [0, 0, nil, "فج", nil, nil, nil], - 64703 => [0, 0, nil, "فح", nil, nil, nil], - 64704 => [0, 0, nil, "فخ", nil, nil, nil], - 64705 => [0, 0, nil, "فم", nil, nil, nil], - 64706 => [0, 0, nil, "قح", nil, nil, nil], - 64707 => [0, 0, nil, "قم", nil, nil, nil], - 64708 => [0, 0, nil, "كج", nil, nil, nil], - 64709 => [0, 0, nil, "كح", nil, nil, nil], - 64710 => [0, 0, nil, "كخ", nil, nil, nil], - 64711 => [0, 0, nil, "كل", nil, nil, nil], - 64712 => [0, 0, nil, "كم", nil, nil, nil], - 64713 => [0, 0, nil, "لج", nil, nil, nil], - 64714 => [0, 0, nil, "لح", nil, nil, nil], - 64715 => [0, 0, nil, "لخ", nil, nil, nil], - 64716 => [0, 0, nil, "لم", nil, nil, nil], - 64717 => [0, 0, nil, "له", nil, nil, nil], - 64718 => [0, 0, nil, "مج", nil, nil, nil], - 64719 => [0, 0, nil, "مح", nil, nil, nil], - 64720 => [0, 0, nil, "مخ", nil, nil, nil], - 64721 => [0, 0, nil, "مم", nil, nil, nil], - 64722 => [0, 0, nil, "نج", nil, nil, nil], - 64723 => [0, 0, nil, "نح", nil, nil, nil], - 64724 => [0, 0, nil, "نخ", nil, nil, nil], - 64725 => [0, 0, nil, "نم", nil, nil, nil], - 64726 => [0, 0, nil, "نه", nil, nil, nil], - 64727 => [0, 0, nil, "هج", nil, nil, nil], - 64728 => [0, 0, nil, "هم", nil, nil, nil], - 64729 => [0, 0, nil, "هٰ", nil, nil, nil], - 64730 => [0, 0, nil, "يج", nil, nil, nil], - 64731 => [0, 0, nil, "يح", nil, nil, nil], - 64732 => [0, 0, nil, "يخ", nil, nil, nil], - 64733 => [0, 0, nil, "يم", nil, nil, nil], - 64734 => [0, 0, nil, "يه", nil, nil, nil], - 64735 => [0, 0, nil, "ئم", nil, nil, nil], - 64736 => [0, 0, nil, "ئه", nil, nil, nil], - 64737 => [0, 0, nil, "بم", nil, nil, nil], - 64738 => [0, 0, nil, "به", nil, nil, nil], - 64739 => [0, 0, nil, "تم", nil, nil, nil], - 64740 => [0, 0, nil, "ته", nil, nil, nil], - 64741 => [0, 0, nil, "ثم", nil, nil, nil], - 64742 => [0, 0, nil, "ثه", nil, nil, nil], - 64743 => [0, 0, nil, "سم", nil, nil, nil], - 64744 => [0, 0, nil, "سه", nil, nil, nil], - 64745 => [0, 0, nil, "شم", nil, nil, nil], - 64746 => [0, 0, nil, "شه", nil, nil, nil], - 64747 => [0, 0, nil, "كل", nil, nil, nil], - 64748 => [0, 0, nil, "كم", nil, nil, nil], - 64749 => [0, 0, nil, "لم", nil, nil, nil], - 64750 => [0, 0, nil, "نم", nil, nil, nil], - 64751 => [0, 0, nil, "نه", nil, nil, nil], - 64752 => [0, 0, nil, "يم", nil, nil, nil], - 64753 => [0, 0, nil, "يه", nil, nil, nil], - 64754 => [0, 0, nil, "ـَّ", nil, nil, nil], - 64755 => [0, 0, nil, "ـُّ", nil, nil, nil], - 64756 => [0, 0, nil, "ـِّ", nil, nil, nil], - 64757 => [0, 0, nil, "طى", nil, nil, nil], - 64758 => [0, 0, nil, "طي", nil, nil, nil], - 64759 => [0, 0, nil, "عى", nil, nil, nil], - 64760 => [0, 0, nil, "عي", nil, nil, nil], - 64761 => [0, 0, nil, "غى", nil, nil, nil], - 64762 => [0, 0, nil, "غي", nil, nil, nil], - 64763 => [0, 0, nil, "سى", nil, nil, nil], - 64764 => [0, 0, nil, "سي", nil, nil, nil], - 64765 => [0, 0, nil, "شى", nil, nil, nil], - 64766 => [0, 0, nil, "شي", nil, nil, nil], - 64767 => [0, 0, nil, "حى", nil, nil, nil], - 64768 => [0, 0, nil, "حي", nil, nil, nil], - 64769 => [0, 0, nil, "جى", nil, nil, nil], - 64770 => [0, 0, nil, "جي", nil, nil, nil], - 64771 => [0, 0, nil, "خى", nil, nil, nil], - 64772 => [0, 0, nil, "خي", nil, nil, nil], - 64773 => [0, 0, nil, "صى", nil, nil, nil], - 64774 => [0, 0, nil, "صي", nil, nil, nil], - 64775 => [0, 0, nil, "ضى", nil, nil, nil], - 64776 => [0, 0, nil, "ضي", nil, nil, nil], - 64777 => [0, 0, nil, "شج", nil, nil, nil], - 64778 => [0, 0, nil, "شح", nil, nil, nil], - 64779 => [0, 0, nil, "شخ", nil, nil, nil], - 64780 => [0, 0, nil, "شم", nil, nil, nil], - 64781 => [0, 0, nil, "شر", nil, nil, nil], - 64782 => [0, 0, nil, "سر", nil, nil, nil], - 64783 => [0, 0, nil, "صر", nil, nil, nil], - 64784 => [0, 0, nil, "ضر", nil, nil, nil], - 64785 => [0, 0, nil, "طى", nil, nil, nil], - 64786 => [0, 0, nil, "طي", nil, nil, nil], - 64787 => [0, 0, nil, "عى", nil, nil, nil], - 64788 => [0, 0, nil, "عي", nil, nil, nil], - 64789 => [0, 0, nil, "غى", nil, nil, nil], - 64790 => [0, 0, nil, "غي", nil, nil, nil], - 64791 => [0, 0, nil, "سى", nil, nil, nil], - 64792 => [0, 0, nil, "سي", nil, nil, nil], - 64793 => [0, 0, nil, "شى", nil, nil, nil], - 64794 => [0, 0, nil, "شي", nil, nil, nil], - 64795 => [0, 0, nil, "حى", nil, nil, nil], - 64796 => [0, 0, nil, "حي", nil, nil, nil], - 64797 => [0, 0, nil, "جى", nil, nil, nil], - 64798 => [0, 0, nil, "جي", nil, nil, nil], - 64799 => [0, 0, nil, "خى", nil, nil, nil], - 64800 => [0, 0, nil, "خي", nil, nil, nil], - 64801 => [0, 0, nil, "صى", nil, nil, nil], - 64802 => [0, 0, nil, "صي", nil, nil, nil], - 64803 => [0, 0, nil, "ضى", nil, nil, nil], - 64804 => [0, 0, nil, "ضي", nil, nil, nil], - 64805 => [0, 0, nil, "شج", nil, nil, nil], - 64806 => [0, 0, nil, "شح", nil, nil, nil], - 64807 => [0, 0, nil, "شخ", nil, nil, nil], - 64808 => [0, 0, nil, "شم", nil, nil, nil], - 64809 => [0, 0, nil, "شر", nil, nil, nil], - 64810 => [0, 0, nil, "سر", nil, nil, nil], - 64811 => [0, 0, nil, "صر", nil, nil, nil], - 64812 => [0, 0, nil, "ضر", nil, nil, nil], - 64813 => [0, 0, nil, "شج", nil, nil, nil], - 64814 => [0, 0, nil, "شح", nil, nil, nil], - 64815 => [0, 0, nil, "شخ", nil, nil, nil], - 64816 => [0, 0, nil, "شم", nil, nil, nil], - 64817 => [0, 0, nil, "سه", nil, nil, nil], - 64818 => [0, 0, nil, "شه", nil, nil, nil], - 64819 => [0, 0, nil, "طم", nil, nil, nil], - 64820 => [0, 0, nil, "سج", nil, nil, nil], - 64821 => [0, 0, nil, "سح", nil, nil, nil], - 64822 => [0, 0, nil, "سخ", nil, nil, nil], - 64823 => [0, 0, nil, "شج", nil, nil, nil], - 64824 => [0, 0, nil, "شح", nil, nil, nil], - 64825 => [0, 0, nil, "شخ", nil, nil, nil], - 64826 => [0, 0, nil, "طم", nil, nil, nil], - 64827 => [0, 0, nil, "ظم", nil, nil, nil], - 64828 => [0, 0, nil, "اً", nil, nil, nil], - 64829 => [0, 0, nil, "اً", nil, nil, nil], - 64848 => [0, 0, nil, "تجم", nil, nil, nil], - 64849 => [0, 0, nil, "تحج", nil, nil, nil], - 64850 => [0, 0, nil, "تحج", nil, nil, nil], - 64851 => [0, 0, nil, "تحم", nil, nil, nil], - 64852 => [0, 0, nil, "تخم", nil, nil, nil], - 64853 => [0, 0, nil, "تمج", nil, nil, nil], - 64854 => [0, 0, nil, "تمح", nil, nil, nil], - 64855 => [0, 0, nil, "تمخ", nil, nil, nil], - 64856 => [0, 0, nil, "جمح", nil, nil, nil], - 64857 => [0, 0, nil, "جمح", nil, nil, nil], - 64858 => [0, 0, nil, "حمي", nil, nil, nil], - 64859 => [0, 0, nil, "حمى", nil, nil, nil], - 64860 => [0, 0, nil, "سحج", nil, nil, nil], - 64861 => [0, 0, nil, "سجح", nil, nil, nil], - 64862 => [0, 0, nil, "سجى", nil, nil, nil], - 64863 => [0, 0, nil, "سمح", nil, nil, nil], - 64864 => [0, 0, nil, "سمح", nil, nil, nil], - 64865 => [0, 0, nil, "سمج", nil, nil, nil], - 64866 => [0, 0, nil, "سمم", nil, nil, nil], - 64867 => [0, 0, nil, "سمم", nil, nil, nil], - 64868 => [0, 0, nil, "صحح", nil, nil, nil], - 64869 => [0, 0, nil, "صحح", nil, nil, nil], - 64870 => [0, 0, nil, "صمم", nil, nil, nil], - 64871 => [0, 0, nil, "شحم", nil, nil, nil], - 64872 => [0, 0, nil, "شحم", nil, nil, nil], - 64873 => [0, 0, nil, "شجي", nil, nil, nil], - 64874 => [0, 0, nil, "شمخ", nil, nil, nil], - 64875 => [0, 0, nil, "شمخ", nil, nil, nil], - 64876 => [0, 0, nil, "شمم", nil, nil, nil], - 64877 => [0, 0, nil, "شمم", nil, nil, nil], - 64878 => [0, 0, nil, "ضحى", nil, nil, nil], - 64879 => [0, 0, nil, "ضخم", nil, nil, nil], - 64880 => [0, 0, nil, "ضخم", nil, nil, nil], - 64881 => [0, 0, nil, "طمح", nil, nil, nil], - 64882 => [0, 0, nil, "طمح", nil, nil, nil], - 64883 => [0, 0, nil, "طمم", nil, nil, nil], - 64884 => [0, 0, nil, "طمي", nil, nil, nil], - 64885 => [0, 0, nil, "عجم", nil, nil, nil], - 64886 => [0, 0, nil, "عمم", nil, nil, nil], - 64887 => [0, 0, nil, "عمم", nil, nil, nil], - 64888 => [0, 0, nil, "عمى", nil, nil, nil], - 64889 => [0, 0, nil, "غمم", nil, nil, nil], - 64890 => [0, 0, nil, "غمي", nil, nil, nil], - 64891 => [0, 0, nil, "غمى", nil, nil, nil], - 64892 => [0, 0, nil, "فخم", nil, nil, nil], - 64893 => [0, 0, nil, "فخم", nil, nil, nil], - 64894 => [0, 0, nil, "قمح", nil, nil, nil], - 64895 => [0, 0, nil, "قمم", nil, nil, nil], - 64896 => [0, 0, nil, "لحم", nil, nil, nil], - 64897 => [0, 0, nil, "لحي", nil, nil, nil], - 64898 => [0, 0, nil, "لحى", nil, nil, nil], - 64899 => [0, 0, nil, "لجج", nil, nil, nil], - 64900 => [0, 0, nil, "لجج", nil, nil, nil], - 64901 => [0, 0, nil, "لخم", nil, nil, nil], - 64902 => [0, 0, nil, "لخم", nil, nil, nil], - 64903 => [0, 0, nil, "لمح", nil, nil, nil], - 64904 => [0, 0, nil, "لمح", nil, nil, nil], - 64905 => [0, 0, nil, "محج", nil, nil, nil], - 64906 => [0, 0, nil, "محم", nil, nil, nil], - 64907 => [0, 0, nil, "محي", nil, nil, nil], - 64908 => [0, 0, nil, "مجح", nil, nil, nil], - 64909 => [0, 0, nil, "مجم", nil, nil, nil], - 64910 => [0, 0, nil, "مخج", nil, nil, nil], - 64911 => [0, 0, nil, "مخم", nil, nil, nil], - 64914 => [0, 0, nil, "مجخ", nil, nil, nil], - 64915 => [0, 0, nil, "همج", nil, nil, nil], - 64916 => [0, 0, nil, "همم", nil, nil, nil], - 64917 => [0, 0, nil, "نحم", nil, nil, nil], - 64918 => [0, 0, nil, "نحى", nil, nil, nil], - 64919 => [0, 0, nil, "نجم", nil, nil, nil], - 64920 => [0, 0, nil, "نجم", nil, nil, nil], - 64921 => [0, 0, nil, "نجى", nil, nil, nil], - 64922 => [0, 0, nil, "نمي", nil, nil, nil], - 64923 => [0, 0, nil, "نمى", nil, nil, nil], - 64924 => [0, 0, nil, "يمم", nil, nil, nil], - 64925 => [0, 0, nil, "يمم", nil, nil, nil], - 64926 => [0, 0, nil, "بخي", nil, nil, nil], - 64927 => [0, 0, nil, "تجي", nil, nil, nil], - 64928 => [0, 0, nil, "تجى", nil, nil, nil], - 64929 => [0, 0, nil, "تخي", nil, nil, nil], - 64930 => [0, 0, nil, "تخى", nil, nil, nil], - 64931 => [0, 0, nil, "تمي", nil, nil, nil], - 64932 => [0, 0, nil, "تمى", nil, nil, nil], - 64933 => [0, 0, nil, "جمي", nil, nil, nil], - 64934 => [0, 0, nil, "جحى", nil, nil, nil], - 64935 => [0, 0, nil, "جمى", nil, nil, nil], - 64936 => [0, 0, nil, "سخى", nil, nil, nil], - 64937 => [0, 0, nil, "صحي", nil, nil, nil], - 64938 => [0, 0, nil, "شحي", nil, nil, nil], - 64939 => [0, 0, nil, "ضحي", nil, nil, nil], - 64940 => [0, 0, nil, "لجي", nil, nil, nil], - 64941 => [0, 0, nil, "لمي", nil, nil, nil], - 64942 => [0, 0, nil, "يحي", nil, nil, nil], - 64943 => [0, 0, nil, "يجي", nil, nil, nil], - 64944 => [0, 0, nil, "يمي", nil, nil, nil], - 64945 => [0, 0, nil, "ممي", nil, nil, nil], - 64946 => [0, 0, nil, "قمي", nil, nil, nil], - 64947 => [0, 0, nil, "نحي", nil, nil, nil], - 64948 => [0, 0, nil, "قمح", nil, nil, nil], - 64949 => [0, 0, nil, "لحم", nil, nil, nil], - 64950 => [0, 0, nil, "عمي", nil, nil, nil], - 64951 => [0, 0, nil, "كمي", nil, nil, nil], - 64952 => [0, 0, nil, "نجح", nil, nil, nil], - 64953 => [0, 0, nil, "مخي", nil, nil, nil], - 64954 => [0, 0, nil, "لجم", nil, nil, nil], - 64955 => [0, 0, nil, "كمم", nil, nil, nil], - 64956 => [0, 0, nil, "لجم", nil, nil, nil], - 64957 => [0, 0, nil, "نجح", nil, nil, nil], - 64958 => [0, 0, nil, "جحي", nil, nil, nil], - 64959 => [0, 0, nil, "حجي", nil, nil, nil], - 64960 => [0, 0, nil, "مجي", nil, nil, nil], - 64961 => [0, 0, nil, "فمي", nil, nil, nil], - 64962 => [0, 0, nil, "بحي", nil, nil, nil], - 64963 => [0, 0, nil, "كمم", nil, nil, nil], - 64964 => [0, 0, nil, "عجم", nil, nil, nil], - 64965 => [0, 0, nil, "صمم", nil, nil, nil], - 64966 => [0, 0, nil, "سخي", nil, nil, nil], - 64967 => [0, 0, nil, "نجي", nil, nil, nil], - 65008 => [0, 0, nil, "صلے", nil, nil, nil], - 65009 => [0, 0, nil, "قلے", nil, nil, nil], - 65010 => [0, 0, nil, "الله", nil, nil, nil], - 65011 => [0, 0, nil, "اكبر", nil, nil, nil], - 65012 => [0, 0, nil, "محمد", nil, nil, nil], - 65013 => [0, 0, nil, "صلعم", nil, nil, nil], - 65014 => [0, 0, nil, "رسول", nil, nil, nil], - 65015 => [0, 0, nil, "عليه", nil, nil, nil], - 65016 => [0, 0, nil, "وسلم", nil, nil, nil], - 65017 => [0, 0, nil, "صلى", nil, nil, nil], - 65018 => [0, 0, nil, "صلى الله عليه وسلم", nil, nil, nil], - 65019 => [0, 0, nil, "جل جلاله", nil, nil, nil], - 65056 => [230, 0, nil, nil, nil, nil, nil], - 65057 => [230, 0, nil, nil, nil, nil, nil], - 65058 => [230, 0, nil, nil, nil, nil, nil], - 65059 => [230, 0, nil, nil, nil, nil, nil], - 65072 => [0, 0, nil, "‥", nil, nil, nil], - 65073 => [0, 0, nil, "—", nil, nil, nil], - 65074 => [0, 0, nil, "–", nil, nil, nil], - 65075 => [0, 0, nil, "_", nil, nil, nil], - 65076 => [0, 0, nil, "_", nil, nil, nil], - 65077 => [0, 0, nil, "(", nil, nil, nil], - 65078 => [0, 0, nil, ")", nil, nil, nil], - 65079 => [0, 0, nil, "{", nil, nil, nil], - 65080 => [0, 0, nil, "}", nil, nil, nil], - 65081 => [0, 0, nil, "〔", nil, nil, nil], - 65082 => [0, 0, nil, "〕", nil, nil, nil], - 65083 => [0, 0, nil, "【", nil, nil, nil], - 65084 => [0, 0, nil, "】", nil, nil, nil], - 65085 => [0, 0, nil, "《", nil, nil, nil], - 65086 => [0, 0, nil, "》", nil, nil, nil], - 65087 => [0, 0, nil, "〈", nil, nil, nil], - 65088 => [0, 0, nil, "〉", nil, nil, nil], - 65089 => [0, 0, nil, "「", nil, nil, nil], - 65090 => [0, 0, nil, "」", nil, nil, nil], - 65091 => [0, 0, nil, "『", nil, nil, nil], - 65092 => [0, 0, nil, "』", nil, nil, nil], - 65097 => [0, 0, nil, "‾", nil, nil, nil], - 65098 => [0, 0, nil, "‾", nil, nil, nil], - 65099 => [0, 0, nil, "‾", nil, nil, nil], - 65100 => [0, 0, nil, "‾", nil, nil, nil], - 65101 => [0, 0, nil, "_", nil, nil, nil], - 65102 => [0, 0, nil, "_", nil, nil, nil], - 65103 => [0, 0, nil, "_", nil, nil, nil], - 65104 => [0, 0, nil, ",", nil, nil, nil], - 65105 => [0, 0, nil, "、", nil, nil, nil], - 65106 => [0, 0, nil, ".", nil, nil, nil], - 65108 => [0, 0, nil, ";", nil, nil, nil], - 65109 => [0, 0, nil, ":", nil, nil, nil], - 65110 => [0, 0, nil, "?", nil, nil, nil], - 65111 => [0, 0, nil, "!", nil, nil, nil], - 65112 => [0, 0, nil, "—", nil, nil, nil], - 65113 => [0, 0, nil, "(", nil, nil, nil], - 65114 => [0, 0, nil, ")", nil, nil, nil], - 65115 => [0, 0, nil, "{", nil, nil, nil], - 65116 => [0, 0, nil, "}", nil, nil, nil], - 65117 => [0, 0, nil, "〔", nil, nil, nil], - 65118 => [0, 0, nil, "〕", nil, nil, nil], - 65119 => [0, 0, nil, "#", nil, nil, nil], - 65120 => [0, 0, nil, "&", nil, nil, nil], - 65121 => [0, 0, nil, "*", nil, nil, nil], - 65122 => [0, 0, nil, "+", nil, nil, nil], - 65123 => [0, 0, nil, "-", nil, nil, nil], - 65124 => [0, 0, nil, "<", nil, nil, nil], - 65125 => [0, 0, nil, ">", nil, nil, nil], - 65126 => [0, 0, nil, "=", nil, nil, nil], - 65128 => [0, 0, nil, "\\", nil, nil, nil], - 65129 => [0, 0, nil, "$", nil, nil, nil], - 65130 => [0, 0, nil, "%", nil, nil, nil], - 65131 => [0, 0, nil, "@", nil, nil, nil], - 65136 => [0, 0, nil, " ً", nil, nil, nil], - 65137 => [0, 0, nil, "ـً", nil, nil, nil], - 65138 => [0, 0, nil, " ٌ", nil, nil, nil], - 65140 => [0, 0, nil, " ٍ", nil, nil, nil], - 65142 => [0, 0, nil, " َ", nil, nil, nil], - 65143 => [0, 0, nil, "ـَ", nil, nil, nil], - 65144 => [0, 0, nil, " ُ", nil, nil, nil], - 65145 => [0, 0, nil, "ـُ", nil, nil, nil], - 65146 => [0, 0, nil, " ِ", nil, nil, nil], - 65147 => [0, 0, nil, "ـِ", nil, nil, nil], - 65148 => [0, 0, nil, " ّ", nil, nil, nil], - 65149 => [0, 0, nil, "ـّ", nil, nil, nil], - 65150 => [0, 0, nil, " ْ", nil, nil, nil], - 65151 => [0, 0, nil, "ـْ", nil, nil, nil], - 65152 => [0, 0, nil, "ء", nil, nil, nil], - 65153 => [0, 0, nil, "آ", nil, nil, nil], - 65154 => [0, 0, nil, "آ", nil, nil, nil], - 65155 => [0, 0, nil, "أ", nil, nil, nil], - 65156 => [0, 0, nil, "أ", nil, nil, nil], - 65157 => [0, 0, nil, "ؤ", nil, nil, nil], - 65158 => [0, 0, nil, "ؤ", nil, nil, nil], - 65159 => [0, 0, nil, "إ", nil, nil, nil], - 65160 => [0, 0, nil, "إ", nil, nil, nil], - 65161 => [0, 0, nil, "ئ", nil, nil, nil], - 65162 => [0, 0, nil, "ئ", nil, nil, nil], - 65163 => [0, 0, nil, "ئ", nil, nil, nil], - 65164 => [0, 0, nil, "ئ", nil, nil, nil], - 65165 => [0, 0, nil, "ا", nil, nil, nil], - 65166 => [0, 0, nil, "ا", nil, nil, nil], - 65167 => [0, 0, nil, "ب", nil, nil, nil], - 65168 => [0, 0, nil, "ب", nil, nil, nil], - 65169 => [0, 0, nil, "ب", nil, nil, nil], - 65170 => [0, 0, nil, "ب", nil, nil, nil], - 65171 => [0, 0, nil, "ة", nil, nil, nil], - 65172 => [0, 0, nil, "ة", nil, nil, nil], - 65173 => [0, 0, nil, "ت", nil, nil, nil], - 65174 => [0, 0, nil, "ت", nil, nil, nil], - 65175 => [0, 0, nil, "ت", nil, nil, nil], - 65176 => [0, 0, nil, "ت", nil, nil, nil], - 65177 => [0, 0, nil, "ث", nil, nil, nil], - 65178 => [0, 0, nil, "ث", nil, nil, nil], - 65179 => [0, 0, nil, "ث", nil, nil, nil], - 65180 => [0, 0, nil, "ث", nil, nil, nil], - 65181 => [0, 0, nil, "ج", nil, nil, nil], - 65182 => [0, 0, nil, "ج", nil, nil, nil], - 65183 => [0, 0, nil, "ج", nil, nil, nil], - 65184 => [0, 0, nil, "ج", nil, nil, nil], - 65185 => [0, 0, nil, "ح", nil, nil, nil], - 65186 => [0, 0, nil, "ح", nil, nil, nil], - 65187 => [0, 0, nil, "ح", nil, nil, nil], - 65188 => [0, 0, nil, "ح", nil, nil, nil], - 65189 => [0, 0, nil, "خ", nil, nil, nil], - 65190 => [0, 0, nil, "خ", nil, nil, nil], - 65191 => [0, 0, nil, "خ", nil, nil, nil], - 65192 => [0, 0, nil, "خ", nil, nil, nil], - 65193 => [0, 0, nil, "د", nil, nil, nil], - 65194 => [0, 0, nil, "د", nil, nil, nil], - 65195 => [0, 0, nil, "ذ", nil, nil, nil], - 65196 => [0, 0, nil, "ذ", nil, nil, nil], - 65197 => [0, 0, nil, "ر", nil, nil, nil], - 65198 => [0, 0, nil, "ر", nil, nil, nil], - 65199 => [0, 0, nil, "ز", nil, nil, nil], - 65200 => [0, 0, nil, "ز", nil, nil, nil], - 65201 => [0, 0, nil, "س", nil, nil, nil], - 65202 => [0, 0, nil, "س", nil, nil, nil], - 65203 => [0, 0, nil, "س", nil, nil, nil], - 65204 => [0, 0, nil, "س", nil, nil, nil], - 65205 => [0, 0, nil, "ش", nil, nil, nil], - 65206 => [0, 0, nil, "ش", nil, nil, nil], - 65207 => [0, 0, nil, "ش", nil, nil, nil], - 65208 => [0, 0, nil, "ش", nil, nil, nil], - 65209 => [0, 0, nil, "ص", nil, nil, nil], - 65210 => [0, 0, nil, "ص", nil, nil, nil], - 65211 => [0, 0, nil, "ص", nil, nil, nil], - 65212 => [0, 0, nil, "ص", nil, nil, nil], - 65213 => [0, 0, nil, "ض", nil, nil, nil], - 65214 => [0, 0, nil, "ض", nil, nil, nil], - 65215 => [0, 0, nil, "ض", nil, nil, nil], - 65216 => [0, 0, nil, "ض", nil, nil, nil], - 65217 => [0, 0, nil, "ط", nil, nil, nil], - 65218 => [0, 0, nil, "ط", nil, nil, nil], - 65219 => [0, 0, nil, "ط", nil, nil, nil], - 65220 => [0, 0, nil, "ط", nil, nil, nil], - 65221 => [0, 0, nil, "ظ", nil, nil, nil], - 65222 => [0, 0, nil, "ظ", nil, nil, nil], - 65223 => [0, 0, nil, "ظ", nil, nil, nil], - 65224 => [0, 0, nil, "ظ", nil, nil, nil], - 65225 => [0, 0, nil, "ع", nil, nil, nil], - 65226 => [0, 0, nil, "ع", nil, nil, nil], - 65227 => [0, 0, nil, "ع", nil, nil, nil], - 65228 => [0, 0, nil, "ع", nil, nil, nil], - 65229 => [0, 0, nil, "غ", nil, nil, nil], - 65230 => [0, 0, nil, "غ", nil, nil, nil], - 65231 => [0, 0, nil, "غ", nil, nil, nil], - 65232 => [0, 0, nil, "غ", nil, nil, nil], - 65233 => [0, 0, nil, "ف", nil, nil, nil], - 65234 => [0, 0, nil, "ف", nil, nil, nil], - 65235 => [0, 0, nil, "ف", nil, nil, nil], - 65236 => [0, 0, nil, "ف", nil, nil, nil], - 65237 => [0, 0, nil, "ق", nil, nil, nil], - 65238 => [0, 0, nil, "ق", nil, nil, nil], - 65239 => [0, 0, nil, "ق", nil, nil, nil], - 65240 => [0, 0, nil, "ق", nil, nil, nil], - 65241 => [0, 0, nil, "ك", nil, nil, nil], - 65242 => [0, 0, nil, "ك", nil, nil, nil], - 65243 => [0, 0, nil, "ك", nil, nil, nil], - 65244 => [0, 0, nil, "ك", nil, nil, nil], - 65245 => [0, 0, nil, "ل", nil, nil, nil], - 65246 => [0, 0, nil, "ل", nil, nil, nil], - 65247 => [0, 0, nil, "ل", nil, nil, nil], - 65248 => [0, 0, nil, "ل", nil, nil, nil], - 65249 => [0, 0, nil, "م", nil, nil, nil], - 65250 => [0, 0, nil, "م", nil, nil, nil], - 65251 => [0, 0, nil, "م", nil, nil, nil], - 65252 => [0, 0, nil, "م", nil, nil, nil], - 65253 => [0, 0, nil, "ن", nil, nil, nil], - 65254 => [0, 0, nil, "ن", nil, nil, nil], - 65255 => [0, 0, nil, "ن", nil, nil, nil], - 65256 => [0, 0, nil, "ن", nil, nil, nil], - 65257 => [0, 0, nil, "ه", nil, nil, nil], - 65258 => [0, 0, nil, "ه", nil, nil, nil], - 65259 => [0, 0, nil, "ه", nil, nil, nil], - 65260 => [0, 0, nil, "ه", nil, nil, nil], - 65261 => [0, 0, nil, "و", nil, nil, nil], - 65262 => [0, 0, nil, "و", nil, nil, nil], - 65263 => [0, 0, nil, "ى", nil, nil, nil], - 65264 => [0, 0, nil, "ى", nil, nil, nil], - 65265 => [0, 0, nil, "ي", nil, nil, nil], - 65266 => [0, 0, nil, "ي", nil, nil, nil], - 65267 => [0, 0, nil, "ي", nil, nil, nil], - 65268 => [0, 0, nil, "ي", nil, nil, nil], - 65269 => [0, 0, nil, "لآ", nil, nil, nil], - 65270 => [0, 0, nil, "لآ", nil, nil, nil], - 65271 => [0, 0, nil, "لأ", nil, nil, nil], - 65272 => [0, 0, nil, "لأ", nil, nil, nil], - 65273 => [0, 0, nil, "لإ", nil, nil, nil], - 65274 => [0, 0, nil, "لإ", nil, nil, nil], - 65275 => [0, 0, nil, "لا", nil, nil, nil], - 65276 => [0, 0, nil, "لا", nil, nil, nil], - 65281 => [0, 0, nil, "!", nil, nil, nil], - 65282 => [0, 0, nil, "\"", nil, nil, nil], - 65283 => [0, 0, nil, "#", nil, nil, nil], - 65284 => [0, 0, nil, "$", nil, nil, nil], - 65285 => [0, 0, nil, "%", nil, nil, nil], - 65286 => [0, 0, nil, "&", nil, nil, nil], - 65287 => [0, 0, nil, "'", nil, nil, nil], - 65288 => [0, 0, nil, "(", nil, nil, nil], - 65289 => [0, 0, nil, ")", nil, nil, nil], - 65290 => [0, 0, nil, "*", nil, nil, nil], - 65291 => [0, 0, nil, "+", nil, nil, nil], - 65292 => [0, 0, nil, ",", nil, nil, nil], - 65293 => [0, 0, nil, "-", nil, nil, nil], - 65294 => [0, 0, nil, ".", nil, nil, nil], - 65295 => [0, 0, nil, "/", nil, nil, nil], - 65296 => [0, 0, nil, "0", nil, nil, nil], - 65297 => [0, 0, nil, "1", nil, nil, nil], - 65298 => [0, 0, nil, "2", nil, nil, nil], - 65299 => [0, 0, nil, "3", nil, nil, nil], - 65300 => [0, 0, nil, "4", nil, nil, nil], - 65301 => [0, 0, nil, "5", nil, nil, nil], - 65302 => [0, 0, nil, "6", nil, nil, nil], - 65303 => [0, 0, nil, "7", nil, nil, nil], - 65304 => [0, 0, nil, "8", nil, nil, nil], - 65305 => [0, 0, nil, "9", nil, nil, nil], - 65306 => [0, 0, nil, ":", nil, nil, nil], - 65307 => [0, 0, nil, ";", nil, nil, nil], - 65308 => [0, 0, nil, "<", nil, nil, nil], - 65309 => [0, 0, nil, "=", nil, nil, nil], - 65310 => [0, 0, nil, ">", nil, nil, nil], - 65311 => [0, 0, nil, "?", nil, nil, nil], - 65312 => [0, 0, nil, "@", nil, nil, nil], - 65313 => [0, 0, nil, "A", nil, 65345, nil], - 65314 => [0, 0, nil, "B", nil, 65346, nil], - 65315 => [0, 0, nil, "C", nil, 65347, nil], - 65316 => [0, 0, nil, "D", nil, 65348, nil], - 65317 => [0, 0, nil, "E", nil, 65349, nil], - 65318 => [0, 0, nil, "F", nil, 65350, nil], - 65319 => [0, 0, nil, "G", nil, 65351, nil], - 65320 => [0, 0, nil, "H", nil, 65352, nil], - 65321 => [0, 0, nil, "I", nil, 65353, nil], - 65322 => [0, 0, nil, "J", nil, 65354, nil], - 65323 => [0, 0, nil, "K", nil, 65355, nil], - 65324 => [0, 0, nil, "L", nil, 65356, nil], - 65325 => [0, 0, nil, "M", nil, 65357, nil], - 65326 => [0, 0, nil, "N", nil, 65358, nil], - 65327 => [0, 0, nil, "O", nil, 65359, nil], - 65328 => [0, 0, nil, "P", nil, 65360, nil], - 65329 => [0, 0, nil, "Q", nil, 65361, nil], - 65330 => [0, 0, nil, "R", nil, 65362, nil], - 65331 => [0, 0, nil, "S", nil, 65363, nil], - 65332 => [0, 0, nil, "T", nil, 65364, nil], - 65333 => [0, 0, nil, "U", nil, 65365, nil], - 65334 => [0, 0, nil, "V", nil, 65366, nil], - 65335 => [0, 0, nil, "W", nil, 65367, nil], - 65336 => [0, 0, nil, "X", nil, 65368, nil], - 65337 => [0, 0, nil, "Y", nil, 65369, nil], - 65338 => [0, 0, nil, "Z", nil, 65370, nil], - 65339 => [0, 0, nil, "[", nil, nil, nil], - 65340 => [0, 0, nil, "\\", nil, nil, nil], - 65341 => [0, 0, nil, "]", nil, nil, nil], - 65342 => [0, 0, nil, "^", nil, nil, nil], - 65343 => [0, 0, nil, "_", nil, nil, nil], - 65344 => [0, 0, nil, "`", nil, nil, nil], - 65345 => [0, 0, nil, "a", 65313, nil, 65313], - 65346 => [0, 0, nil, "b", 65314, nil, 65314], - 65347 => [0, 0, nil, "c", 65315, nil, 65315], - 65348 => [0, 0, nil, "d", 65316, nil, 65316], - 65349 => [0, 0, nil, "e", 65317, nil, 65317], - 65350 => [0, 0, nil, "f", 65318, nil, 65318], - 65351 => [0, 0, nil, "g", 65319, nil, 65319], - 65352 => [0, 0, nil, "h", 65320, nil, 65320], - 65353 => [0, 0, nil, "i", 65321, nil, 65321], - 65354 => [0, 0, nil, "j", 65322, nil, 65322], - 65355 => [0, 0, nil, "k", 65323, nil, 65323], - 65356 => [0, 0, nil, "l", 65324, nil, 65324], - 65357 => [0, 0, nil, "m", 65325, nil, 65325], - 65358 => [0, 0, nil, "n", 65326, nil, 65326], - 65359 => [0, 0, nil, "o", 65327, nil, 65327], - 65360 => [0, 0, nil, "p", 65328, nil, 65328], - 65361 => [0, 0, nil, "q", 65329, nil, 65329], - 65362 => [0, 0, nil, "r", 65330, nil, 65330], - 65363 => [0, 0, nil, "s", 65331, nil, 65331], - 65364 => [0, 0, nil, "t", 65332, nil, 65332], - 65365 => [0, 0, nil, "u", 65333, nil, 65333], - 65366 => [0, 0, nil, "v", 65334, nil, 65334], - 65367 => [0, 0, nil, "w", 65335, nil, 65335], - 65368 => [0, 0, nil, "x", 65336, nil, 65336], - 65369 => [0, 0, nil, "y", 65337, nil, 65337], - 65370 => [0, 0, nil, "z", 65338, nil, 65338], - 65371 => [0, 0, nil, "{", nil, nil, nil], - 65372 => [0, 0, nil, "|", nil, nil, nil], - 65373 => [0, 0, nil, "}", nil, nil, nil], - 65374 => [0, 0, nil, "~", nil, nil, nil], - 65377 => [0, 0, nil, "。", nil, nil, nil], - 65378 => [0, 0, nil, "「", nil, nil, nil], - 65379 => [0, 0, nil, "」", nil, nil, nil], - 65380 => [0, 0, nil, "、", nil, nil, nil], - 65381 => [0, 0, nil, "・", nil, nil, nil], - 65382 => [0, 0, nil, "ヲ", nil, nil, nil], - 65383 => [0, 0, nil, "ァ", nil, nil, nil], - 65384 => [0, 0, nil, "ィ", nil, nil, nil], - 65385 => [0, 0, nil, "ゥ", nil, nil, nil], - 65386 => [0, 0, nil, "ェ", nil, nil, nil], - 65387 => [0, 0, nil, "ォ", nil, nil, nil], - 65388 => [0, 0, nil, "ャ", nil, nil, nil], - 65389 => [0, 0, nil, "ュ", nil, nil, nil], - 65390 => [0, 0, nil, "ョ", nil, nil, nil], - 65391 => [0, 0, nil, "ッ", nil, nil, nil], - 65392 => [0, 0, nil, "ー", nil, nil, nil], - 65393 => [0, 0, nil, "ア", nil, nil, nil], - 65394 => [0, 0, nil, "イ", nil, nil, nil], - 65395 => [0, 0, nil, "ウ", nil, nil, nil], - 65396 => [0, 0, nil, "エ", nil, nil, nil], - 65397 => [0, 0, nil, "オ", nil, nil, nil], - 65398 => [0, 0, nil, "カ", nil, nil, nil], - 65399 => [0, 0, nil, "キ", nil, nil, nil], - 65400 => [0, 0, nil, "ク", nil, nil, nil], - 65401 => [0, 0, nil, "ケ", nil, nil, nil], - 65402 => [0, 0, nil, "コ", nil, nil, nil], - 65403 => [0, 0, nil, "サ", nil, nil, nil], - 65404 => [0, 0, nil, "シ", nil, nil, nil], - 65405 => [0, 0, nil, "ス", nil, nil, nil], - 65406 => [0, 0, nil, "セ", nil, nil, nil], - 65407 => [0, 0, nil, "ソ", nil, nil, nil], - 65408 => [0, 0, nil, "タ", nil, nil, nil], - 65409 => [0, 0, nil, "チ", nil, nil, nil], - 65410 => [0, 0, nil, "ツ", nil, nil, nil], - 65411 => [0, 0, nil, "テ", nil, nil, nil], - 65412 => [0, 0, nil, "ト", nil, nil, nil], - 65413 => [0, 0, nil, "ナ", nil, nil, nil], - 65414 => [0, 0, nil, "ニ", nil, nil, nil], - 65415 => [0, 0, nil, "ヌ", nil, nil, nil], - 65416 => [0, 0, nil, "ネ", nil, nil, nil], - 65417 => [0, 0, nil, "ノ", nil, nil, nil], - 65418 => [0, 0, nil, "ハ", nil, nil, nil], - 65419 => [0, 0, nil, "ヒ", nil, nil, nil], - 65420 => [0, 0, nil, "フ", nil, nil, nil], - 65421 => [0, 0, nil, "ヘ", nil, nil, nil], - 65422 => [0, 0, nil, "ホ", nil, nil, nil], - 65423 => [0, 0, nil, "マ", nil, nil, nil], - 65424 => [0, 0, nil, "ミ", nil, nil, nil], - 65425 => [0, 0, nil, "ム", nil, nil, nil], - 65426 => [0, 0, nil, "メ", nil, nil, nil], - 65427 => [0, 0, nil, "モ", nil, nil, nil], - 65428 => [0, 0, nil, "ヤ", nil, nil, nil], - 65429 => [0, 0, nil, "ユ", nil, nil, nil], - 65430 => [0, 0, nil, "ヨ", nil, nil, nil], - 65431 => [0, 0, nil, "ラ", nil, nil, nil], - 65432 => [0, 0, nil, "リ", nil, nil, nil], - 65433 => [0, 0, nil, "ル", nil, nil, nil], - 65434 => [0, 0, nil, "レ", nil, nil, nil], - 65435 => [0, 0, nil, "ロ", nil, nil, nil], - 65436 => [0, 0, nil, "ワ", nil, nil, nil], - 65437 => [0, 0, nil, "ン", nil, nil, nil], - 65438 => [0, 0, nil, "゙", nil, nil, nil], - 65439 => [0, 0, nil, "゚", nil, nil, nil], - 65440 => [0, 0, nil, "ㅤ", nil, nil, nil], - 65441 => [0, 0, nil, "ㄱ", nil, nil, nil], - 65442 => [0, 0, nil, "ㄲ", nil, nil, nil], - 65443 => [0, 0, nil, "ㄳ", nil, nil, nil], - 65444 => [0, 0, nil, "ㄴ", nil, nil, nil], - 65445 => [0, 0, nil, "ㄵ", nil, nil, nil], - 65446 => [0, 0, nil, "ㄶ", nil, nil, nil], - 65447 => [0, 0, nil, "ㄷ", nil, nil, nil], - 65448 => [0, 0, nil, "ㄸ", nil, nil, nil], - 65449 => [0, 0, nil, "ㄹ", nil, nil, nil], - 65450 => [0, 0, nil, "ㄺ", nil, nil, nil], - 65451 => [0, 0, nil, "ㄻ", nil, nil, nil], - 65452 => [0, 0, nil, "ㄼ", nil, nil, nil], - 65453 => [0, 0, nil, "ㄽ", nil, nil, nil], - 65454 => [0, 0, nil, "ㄾ", nil, nil, nil], - 65455 => [0, 0, nil, "ㄿ", nil, nil, nil], - 65456 => [0, 0, nil, "ㅀ", nil, nil, nil], - 65457 => [0, 0, nil, "ㅁ", nil, nil, nil], - 65458 => [0, 0, nil, "ㅂ", nil, nil, nil], - 65459 => [0, 0, nil, "ㅃ", nil, nil, nil], - 65460 => [0, 0, nil, "ㅄ", nil, nil, nil], - 65461 => [0, 0, nil, "ㅅ", nil, nil, nil], - 65462 => [0, 0, nil, "ㅆ", nil, nil, nil], - 65463 => [0, 0, nil, "ㅇ", nil, nil, nil], - 65464 => [0, 0, nil, "ㅈ", nil, nil, nil], - 65465 => [0, 0, nil, "ㅉ", nil, nil, nil], - 65466 => [0, 0, nil, "ㅊ", nil, nil, nil], - 65467 => [0, 0, nil, "ㅋ", nil, nil, nil], - 65468 => [0, 0, nil, "ㅌ", nil, nil, nil], - 65469 => [0, 0, nil, "ㅍ", nil, nil, nil], - 65470 => [0, 0, nil, "ㅎ", nil, nil, nil], - 65474 => [0, 0, nil, "ㅏ", nil, nil, nil], - 65475 => [0, 0, nil, "ㅐ", nil, nil, nil], - 65476 => [0, 0, nil, "ㅑ", nil, nil, nil], - 65477 => [0, 0, nil, "ㅒ", nil, nil, nil], - 65478 => [0, 0, nil, "ㅓ", nil, nil, nil], - 65479 => [0, 0, nil, "ㅔ", nil, nil, nil], - 65482 => [0, 0, nil, "ㅕ", nil, nil, nil], - 65483 => [0, 0, nil, "ㅖ", nil, nil, nil], - 65484 => [0, 0, nil, "ㅗ", nil, nil, nil], - 65485 => [0, 0, nil, "ㅘ", nil, nil, nil], - 65486 => [0, 0, nil, "ㅙ", nil, nil, nil], - 65487 => [0, 0, nil, "ㅚ", nil, nil, nil], - 65490 => [0, 0, nil, "ㅛ", nil, nil, nil], - 65491 => [0, 0, nil, "ㅜ", nil, nil, nil], - 65492 => [0, 0, nil, "ㅝ", nil, nil, nil], - 65493 => [0, 0, nil, "ㅞ", nil, nil, nil], - 65494 => [0, 0, nil, "ㅟ", nil, nil, nil], - 65495 => [0, 0, nil, "ㅠ", nil, nil, nil], - 65498 => [0, 0, nil, "ㅡ", nil, nil, nil], - 65499 => [0, 0, nil, "ㅢ", nil, nil, nil], - 65500 => [0, 0, nil, "ㅣ", nil, nil, nil], - 65504 => [0, 0, nil, "¢", nil, nil, nil], - 65505 => [0, 0, nil, "£", nil, nil, nil], - 65506 => [0, 0, nil, "¬", nil, nil, nil], - 65507 => [0, 0, nil, "¯", nil, nil, nil], - 65508 => [0, 0, nil, "¦", nil, nil, nil], - 65509 => [0, 0, nil, "¥", nil, nil, nil], - 65510 => [0, 0, nil, "₩", nil, nil, nil], - 65512 => [0, 0, nil, "│", nil, nil, nil], - 65513 => [0, 0, nil, "←", nil, nil, nil], - 65514 => [0, 0, nil, "↑", nil, nil, nil], - 65515 => [0, 0, nil, "→", nil, nil, nil], - 65516 => [0, 0, nil, "↓", nil, nil, nil], - 65517 => [0, 0, nil, "■", nil, nil, nil], - 65518 => [0, 0, nil, "○", nil, nil, nil], - } - - UNICODE_MAX_LENGTH = 256 - ACE_MAX_LENGTH = 256 - - PUNYCODE_BASE = 36 - PUNYCODE_TMIN = 1 - PUNYCODE_TMAX = 26 - PUNYCODE_SKEW = 38 - PUNYCODE_DAMP = 700 - PUNYCODE_INITIAL_BIAS = 72 - PUNYCODE_INITIAL_N = 0x80 - PUNYCODE_DELIMITER = 0x2D - - PUNYCODE_MAXINT = 1 << 64 - - PUNYCODE_PRINT_ASCII = - "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + - "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + - " !\"\#$%&'()*+,-./" + - "0123456789:;<=>?" + - "@ABCDEFGHIJKLMNO" + - "PQRSTUVWXYZ[\\]^_" + - "`abcdefghijklmno" + - "pqrstuvwxyz{|}~\n" - - # Input is invalid. - class PunycodeBadInput < StandardError; end - # Output would exceed the space provided. - class PunycodeBigOutput < StandardError; end - # Input needs wider integers to process. - class PunycodeOverflow < StandardError; end - - def self.punycode_encode(unicode) - unicode = unicode.to_s unless unicode.is_a?(String) - input = unicode.unpack("U*") - output = [] - max_out = ACE_MAX_LENGTH - - # The positions of each non-basic code point, and a Fenwick tree of - # the positions of the code points handled so far, so that counting - # the handled code points before a position doesn't take a pass over - # the input. - positions = {} - handled = Array.new(input.size + 1, 0) - - # Handle the basic code points: - input.each_with_index do |codepoint, j| - if punycode_basic?(codepoint) - if max_out - output.size < 2 - raise PunycodeBigOutput, - "Output would exceed the space provided." - end - output << codepoint - handled[j + 1] = 1 - else - (positions[codepoint] ||= []) << j - end - end - (1..input.size).each do |i| - parent = i + (i & -i) - handled[parent] += handled[i] if parent <= input.size - end - - h = b = output.size - - # h is the number of code points that have been handled, b is the - # number of basic code points, and output.size is the number of - # characters that have been output. - - output << PUNYCODE_DELIMITER if b > 0 - - # Main encoding loop: handle each non-basic code point in ascending - # order. - - n = PUNYCODE_INITIAL_N - delta = 0 - bias = PUNYCODE_INITIAL_BIAS - - positions.keys.sort.each do |m| - # Increase delta enough to advance the decoder's - # state to , but guard against overflow: - - if m - n > (PUNYCODE_MAXINT - delta) / (h + 1) - raise PunycodeOverflow, "Input needs wider integers to process." - end - delta += (m - n) * (h + 1) - n = m - - # Each occurrence of n adds the handled code points since the last - # one, which RFC 3492 counts as code points less than n. - handled_before_pass = h - counted = 0 - positions[n].each do |position| - before = 0 - i = position - while i > 0 - before += handled[i] - i -= i & -i - end - delta += before - counted - counted = before - - # Represent delta as a generalized variable-length integer: - - q = delta; k = PUNYCODE_BASE - while true - if output.size >= max_out - raise PunycodeBigOutput, - "Output would exceed the space provided." - end - t = ( - if k <= bias - PUNYCODE_TMIN - elsif k >= bias + PUNYCODE_TMAX - PUNYCODE_TMAX - else - k - bias - end - ) - break if q < t - output << - punycode_encode_digit(t + (q - t) % (PUNYCODE_BASE - t)) - q = (q - t) / (PUNYCODE_BASE - t) - k += PUNYCODE_BASE - end - - output << punycode_encode_digit(q) - bias = punycode_adapt(delta, h + 1, h == b) - delta = 0 - h += 1 - end - delta += handled_before_pass - counted - - positions[n].each do |position| - i = position + 1 - while i <= input.size - handled[i] += 1 - i += i & -i - end - end - - delta += 1 - n += 1 - end - - output.pack("C*").force_encoding(Encoding::US_ASCII) - end - private_class_method :punycode_encode - - def self.punycode_decode(punycode) - input = [] - output = [] - - if ACE_MAX_LENGTH * 2 < punycode.size - raise PunycodeBigOutput, "Output would exceed the space provided." - end - punycode.each_byte do |c| - unless c >= 0 && c <= 127 - raise PunycodeBadInput, "Input is invalid." - end - input.push(c) - end - - input_length = input.length - output_length = [UNICODE_MAX_LENGTH] - - # Initialize the state - n = PUNYCODE_INITIAL_N - - out = i = 0 - max_out = output_length[0] - bias = PUNYCODE_INITIAL_BIAS - - # Handle the basic code points: Let b be the number of input code - # points before the last delimiter, or 0 if there is none, then - # copy the first b code points to the output. - - b = 0 - input_length.times do |j| - b = j if punycode_delimiter?(input[j]) - end - if b > max_out - raise PunycodeBigOutput, "Output would exceed the space provided." - end - - b.times do |j| - unless punycode_basic?(input[j]) - raise PunycodeBadInput, "Input is invalid." - end - output[out] = input[j] - out+=1 - end - - # Main decoding loop: Start just after the last delimiter if any - # basic code points were copied; start at the beginning otherwise. - - in_ = b > 0 ? b + 1 : 0 - while in_ < input_length - - # in_ is the index of the next character to be consumed, and - # out is the number of code points in the output array. - - # Decode a generalized variable-length integer into delta, - # which gets added to i. The overflow checking is easier - # if we increase i as we go, then subtract off its starting - # value at the end to obtain delta. - - oldi = i; w = 1; k = PUNYCODE_BASE - while true - if in_ >= input_length - raise PunycodeBadInput, "Input is invalid." - end - digit = punycode_decode_digit(input[in_]) - in_+=1 - if digit >= PUNYCODE_BASE - raise PunycodeBadInput, "Input is invalid." - end - if digit > (PUNYCODE_MAXINT - i) / w - raise PunycodeOverflow, "Input needs wider integers to process." - end - i += digit * w - t = ( - if k <= bias - PUNYCODE_TMIN - elsif k >= bias + PUNYCODE_TMAX - PUNYCODE_TMAX - else - k - bias - end - ) - break if digit < t - if w > PUNYCODE_MAXINT / (PUNYCODE_BASE - t) - raise PunycodeOverflow, "Input needs wider integers to process." - end - w *= PUNYCODE_BASE - t - k += PUNYCODE_BASE - end - - bias = punycode_adapt(i - oldi, out + 1, oldi == 0) - - # I was supposed to wrap around from out + 1 to 0, - # incrementing n each time, so we'll fix that now: - - if i / (out + 1) > PUNYCODE_MAXINT - n - raise PunycodeOverflow, "Input needs wider integers to process." - end - n += i / (out + 1) - i %= out + 1 - - # Insert n at position i of the output: - - # not needed for Punycode: - # raise PUNYCODE_INVALID_INPUT if decode_digit(n) <= base - if out >= max_out - raise PunycodeBigOutput, "Output would exceed the space provided." - end - - #memmove(output + i + 1, output + i, (out - i) * sizeof *output) - output[i + 1, out - i] = output[i, out - i] - output[i] = n - i += 1 - - out += 1 - end - - output_length[0] = out - - output.pack("U*") - end - private_class_method :punycode_decode - - def self.punycode_basic?(codepoint) - codepoint < 0x80 - end - private_class_method :punycode_basic? - - def self.punycode_delimiter?(codepoint) - codepoint == PUNYCODE_DELIMITER - end - private_class_method :punycode_delimiter? - - def self.punycode_encode_digit(d) - d + 22 + 75 * ((d < 26) ? 1 : 0) - end - private_class_method :punycode_encode_digit - - # Returns the numeric value of a basic codepoint - # (for use in representing integers) in the range 0 to - # base - 1, or PUNYCODE_BASE if codepoint does not represent a value. - def self.punycode_decode_digit(codepoint) - if codepoint >= 48 && codepoint <= 57 - codepoint - 22 - elsif codepoint >= 65 && codepoint <= 90 - codepoint - 65 - elsif codepoint >= 97 && codepoint <= 122 - codepoint - 97 - else - PUNYCODE_BASE - end - end - private_class_method :punycode_decode_digit - - # Bias adaptation method - def self.punycode_adapt(delta, numpoints, firsttime) - delta = firsttime ? delta / PUNYCODE_DAMP : delta >> 1 - # delta >> 1 is a faster way of doing delta / 2 - delta += delta / numpoints - difference = PUNYCODE_BASE - PUNYCODE_TMIN - - k = 0 - while delta > (difference * PUNYCODE_TMAX) / 2 - delta /= difference - k += PUNYCODE_BASE - end - - k + (difference + 1) * delta / (delta + PUNYCODE_SKEW) - end - private_class_method :punycode_adapt - end - # :startdoc: -end diff --git a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable/template.rb b/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable/template.rb deleted file mode 100644 index d2e507f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable/template.rb +++ /dev/null @@ -1,1236 +0,0 @@ -# frozen_string_literal: true - -#-- -# Copyright (C) Bob Aman -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#++ - - -require "addressable/version" -require "addressable/uri" - -module Addressable - ## - # This is an implementation of a URI template based on - # RFC 6570 (http://tools.ietf.org/html/rfc6570). - class Template - # Constants used throughout the template code. - anything = - Addressable::URI::CharacterClasses::RESERVED + - Addressable::URI::CharacterClasses::UNRESERVED - - - variable_char_class = - Addressable::URI::CharacterClasses::ALPHA + - Addressable::URI::CharacterClasses::DIGIT + '_' - - var_char = - "(?>(?:[#{variable_char_class}]|%[a-fA-F0-9][a-fA-F0-9])+)" - RESERVED = - "(?:[#{anything}]|%[a-fA-F0-9][a-fA-F0-9])" - RESERVED_NO_COMMA = - "(?:[#{anything.delete(',')}]|%[a-fA-F0-9][a-fA-F0-9])" - UNRESERVED = - "(?:[#{ - Addressable::URI::CharacterClasses::UNRESERVED - }]|%[a-fA-F0-9][a-fA-F0-9])" - variable = - "(?:#{var_char}(?:\\.?#{var_char})*)" - varspec = - "(?:(#{variable})(\\*|:\\d+)?)" - VARNAME = - /^#{variable}$/ - VARSPEC = - /^#{varspec}$/ - VARIABLE_LIST = - /^#{varspec}(?:,#{varspec})*$/ - operator = - "+#./;?&=,!@|" - EXPRESSION = - /\{([#{operator}])?(#{varspec}(?:,#{varspec})*)\}/ - - - LEADERS = { - '?' => '?', - '/' => '/', - '#' => '#', - '.' => '.', - ';' => ';', - '&' => '&' - } - JOINERS = { - '?' => '&', - '.' => '.', - ';' => ';', - '&' => '&', - '/' => '/' - } - - ## - # Raised if an invalid template value is supplied. - class InvalidTemplateValueError < StandardError - end - - ## - # Raised if an invalid template operator is used in a pattern. - class InvalidTemplateOperatorError < StandardError - end - - ## - # Raised if an invalid template operator is used in a pattern. - class TemplateOperatorAbortedError < StandardError - end - - ## - # This class represents the data that is extracted when a Template - # is matched against a URI. - class MatchData - ## - # Creates a new MatchData object. - # MatchData objects should never be instantiated directly. - # - # @param [Addressable::URI] uri - # The URI that the template was matched against. - def initialize(uri, template, mapping) - @uri = uri.dup.freeze - @template = template - @mapping = mapping.dup.freeze - end - - ## - # @return [Addressable::URI] - # The URI that the Template was matched against. - attr_reader :uri - - ## - # @return [Addressable::Template] - # The Template used for the match. - attr_reader :template - - ## - # @return [Hash] - # The mapping that resulted from the match. - # Note that this mapping does not include keys or values for - # variables that appear in the Template, but are not present - # in the URI. - attr_reader :mapping - - ## - # @return [Array] - # The list of variables that were present in the Template. - # Note that this list will include variables which do not appear - # in the mapping because they were not present in URI. - def variables - self.template.variables - end - alias_method :keys, :variables - alias_method :names, :variables - - ## - # @return [Array] - # The list of values that were captured by the Template. - # Note that this list will include nils for any variables which - # were in the Template, but did not appear in the URI. - def values - @values ||= self.variables.inject([]) do |accu, key| - accu << self.mapping[key] - accu - end - end - alias_method :captures, :values - - ## - # Accesses captured values by name or by index. - # - # @param [String, Symbol, Fixnum] key - # Capture index or name. Note that when accessing by with index - # of 0, the full URI will be returned. The intention is to mimic - # the ::MatchData#[] behavior. - # - # @param [#to_int, nil] len - # If provided, an array of values will be returned with the given - # parameter used as length. - # - # @return [Array, String, nil] - # The captured value corresponding to the index or name. If the - # value was not provided or the key is unknown, nil will be - # returned. - # - # If the second parameter is provided, an array of that length will - # be returned instead. - def [](key, len = nil) - if len - to_a[key, len] - elsif String === key or Symbol === key - mapping[key.to_s] - else - to_a[key] - end - end - - ## - # @return [Array] - # Array with the matched URI as first element followed by the captured - # values. - def to_a - [to_s, *values] - end - - ## - # @return [String] - # The matched URI as String. - def to_s - uri.to_s - end - alias_method :string, :to_s - - # Returns multiple captured values at once. - # - # @param [String, Symbol, Fixnum] *indexes - # Indices of the captures to be returned - # - # @return [Array] - # Values corresponding to given indices. - # - # @see Addressable::Template::MatchData#[] - def values_at(*indexes) - indexes.map { |i| self[i] } - end - - ## - # Returns a String representation of the MatchData's state. - # - # @return [String] The MatchData's state, as a String. - def inspect - sprintf("#<%s:%#0x RESULT:%s>", - self.class.to_s, self.object_id, self.mapping.inspect) - end - - ## - # Dummy method for code expecting a ::MatchData instance - # - # @return [String] An empty string. - def pre_match - "" - end - alias_method :post_match, :pre_match - end - - ## - # Creates a new Addressable::Template object. - # - # @param [#to_str] pattern The URI Template pattern. - # - # @return [Addressable::Template] The initialized Template object. - def initialize(pattern) - if !pattern.respond_to?(:to_str) - raise TypeError, "Can't convert #{pattern.class} into String." - end - @pattern = pattern.to_str.dup.freeze - end - - ## - # Freeze URI, initializing instance variables. - # - # @return [Addressable::URI] The frozen URI object. - def freeze - self.variables - self.variable_defaults - self.named_captures - super - end - - ## - # @return [String] The Template object's pattern. - attr_reader :pattern - - ## - # Returns a String representation of the Template object's state. - # - # @return [String] The Template object's state, as a String. - def inspect - sprintf("#<%s:%#0x PATTERN:%s>", - self.class.to_s, self.object_id, self.pattern) - end - - ## - # Returns true if the Template objects are equal. This method - # does NOT normalize either Template before doing the comparison. - # - # @param [Object] template The Template to compare. - # - # @return [TrueClass, FalseClass] - # true if the Templates are equivalent, false - # otherwise. - def ==(template) - return false unless template.kind_of?(Template) - return self.pattern == template.pattern - end - - ## - # Addressable::Template makes no distinction between `==` and `eql?`. - # - # @see #== - alias_method :eql?, :== - - ## - # Extracts a mapping from the URI using a URI Template pattern. - # - # @param [Addressable::URI, #to_str] uri - # The URI to extract from. - # - # @param [#restore, #match] processor - # A template processor object may optionally be supplied. - # - # The object should respond to either the restore or - # match messages or both. The restore method should - # take two parameters: `[String] name` and `[String] value`. - # The restore method should reverse any transformations that - # have been performed on the value to ensure a valid URI. - # The match method should take a single - # parameter: `[String] name`. The match method should return - # a String containing a regular expression capture group for - # matching on that particular variable. The default value is `".*?"`. - # The match method has no effect on multivariate operator - # expansions. - # - # @return [Hash, NilClass] - # The Hash mapping that was extracted from the URI, or - # nil if the URI didn't match the template. - # - # @example - # class ExampleProcessor - # def self.restore(name, value) - # return value.gsub(/\+/, " ") if name == "query" - # return value - # end - # - # def self.match(name) - # return ".*?" if name == "first" - # return ".*" - # end - # end - # - # uri = Addressable::URI.parse( - # "http://example.com/search/an+example+search+query/" - # ) - # Addressable::Template.new( - # "http://example.com/search/{query}/" - # ).extract(uri, ExampleProcessor) - # #=> {"query" => "an example search query"} - # - # uri = Addressable::URI.parse("http://example.com/a/b/c/") - # Addressable::Template.new( - # "http://example.com/{first}/{second}/" - # ).extract(uri, ExampleProcessor) - # #=> {"first" => "a", "second" => "b/c"} - # - # uri = Addressable::URI.parse("http://example.com/a/b/c/") - # Addressable::Template.new( - # "http://example.com/{first}/{-list|/|second}/" - # ).extract(uri) - # #=> {"first" => "a", "second" => ["b", "c"]} - def extract(uri, processor=nil) - match_data = self.match(uri, processor) - return (match_data ? match_data.mapping : nil) - end - - ## - # Extracts match data from the URI using a URI Template pattern. - # - # @param [Addressable::URI, #to_str] uri - # The URI to extract from. - # - # @param [#restore, #match] processor - # A template processor object may optionally be supplied. - # - # The object should respond to either the restore or - # match messages or both. The restore method should - # take two parameters: `[String] name` and `[String] value`. - # The restore method should reverse any transformations that - # have been performed on the value to ensure a valid URI. - # The match method should take a single - # parameter: `[String] name`. The match method should return - # a String containing a regular expression capture group for - # matching on that particular variable. The default value is `".*?"`. - # The match method has no effect on multivariate operator - # expansions. - # - # @return [Hash, NilClass] - # The Hash mapping that was extracted from the URI, or - # nil if the URI didn't match the template. - # - # @example - # class ExampleProcessor - # def self.restore(name, value) - # return value.gsub(/\+/, " ") if name == "query" - # return value - # end - # - # def self.match(name) - # return ".*?" if name == "first" - # return ".*" - # end - # end - # - # uri = Addressable::URI.parse( - # "http://example.com/search/an+example+search+query/" - # ) - # match = Addressable::Template.new( - # "http://example.com/search/{query}/" - # ).match(uri, ExampleProcessor) - # match.variables - # #=> ["query"] - # match.captures - # #=> ["an example search query"] - # - # uri = Addressable::URI.parse("http://example.com/a/b/c/") - # match = Addressable::Template.new( - # "http://example.com/{first}/{+second}/" - # ).match(uri, ExampleProcessor) - # match.variables - # #=> ["first", "second"] - # match.captures - # #=> ["a", "b/c"] - # - # uri = Addressable::URI.parse("http://example.com/a/b/c/") - # match = Addressable::Template.new( - # "http://example.com/{first}{/second*}/" - # ).match(uri) - # match.variables - # #=> ["first", "second"] - # match.captures - # #=> ["a", ["b", "c"]] - def match(uri, processor=nil) - unless uri.is_a?(Addressable::URI) - begin - uri = Addressable::URI.parse(uri) - rescue Addressable::URI::InvalidURIError - # Per the documented contract, match returns nil for any input - # that doesn't match the template - including a string that - # isn't even a valid URI. - return nil - end - end - mapping = {} - - # First, we need to process the pattern, and extract the values. - expansions, expansion_regexp = - parse_template_pattern(pattern, processor) - - matched = uri.to_str.match(expansion_regexp) - return nil unless matched - unparsed_values = matched.captures - - if uri.to_str == pattern - return Addressable::Template::MatchData.new(uri, self, mapping) - elsif expansions.size > 0 - index = 0 - expansions.each do |expansion| - _, operator, varlist = *expansion.match(EXPRESSION) - varlist.split(',').each do |varspec| - _, name, modifier = *varspec.match(VARSPEC) - mapping[name] ||= nil - case operator - when nil, '+', '#', '/', '.' - unparsed_value = unparsed_values[index] - name = varspec[VARSPEC, 1] - value = unparsed_value - value = value.split(JOINERS[operator]) if value && modifier == '*' - when ';', '?', '&' - if modifier == '*' - if unparsed_values[index] - value = unparsed_values[index].split(JOINERS[operator]) - value = value.inject({}) do |acc, v| - key, val = v.split('=') - val = "" if val.nil? - acc[key] = val - acc - end - end - else - if (unparsed_values[index]) - name, value = unparsed_values[index].split('=') - value = "" if value.nil? - end - end - end - if processor != nil && processor.respond_to?(:restore) - value = processor.restore(name, value) - end - if processor == nil - if value.is_a?(Hash) - value = value.inject({}){|acc, (k, v)| - acc[Addressable::URI.unencode_component(k)] = - Addressable::URI.unencode_component(v) - acc - } - elsif value.is_a?(Array) - value = value.map{|v| Addressable::URI.unencode_component(v) } - else - value = Addressable::URI.unencode_component(value) - end - end - if !mapping.has_key?(name) || mapping[name].nil? - # Doesn't exist, set to value (even if value is nil) - mapping[name] = value - end - index = index + 1 - end - end - return Addressable::Template::MatchData.new(uri, self, mapping) - else - return nil - end - end - - ## - # Expands a URI template into another URI template. - # - # @param [Hash] mapping The mapping that corresponds to the pattern. - # @param [#validate, #transform] processor - # An optional processor object may be supplied. - # @param [Boolean] normalize_values - # Optional flag to enable/disable unicode normalization. Default: true - # - # The object should respond to either the validate or - # transform messages or both. Both the validate and - # transform methods should take two parameters: name and - # value. The validate method should return true - # or false; true if the value of the variable is valid, - # false otherwise. An InvalidTemplateValueError - # exception will be raised if the value is invalid. The transform - # method should return the transformed variable value as a String. - # If a transform method is used, the value will not be percent - # encoded automatically. Unicode normalization will be performed both - # before and after sending the value to the transform method. - # - # @return [Addressable::Template] The partially expanded URI template. - # - # @example - # Addressable::Template.new( - # "http://example.com/{one}/{two}/" - # ).partial_expand({"one" => "1"}).pattern - # #=> "http://example.com/1/{two}/" - # - # Addressable::Template.new( - # "http://example.com/{?one,two}/" - # ).partial_expand({"one" => "1"}).pattern - # #=> "http://example.com/?one=1{&two}/" - # - # Addressable::Template.new( - # "http://example.com/{?one,two,three}/" - # ).partial_expand({"one" => "1", "three" => 3}).pattern - # #=> "http://example.com/?one=1{&two}&three=3" - def partial_expand(mapping, processor=nil, normalize_values=true) - result = self.pattern.dup - mapping = normalize_keys(mapping) - result.gsub!( EXPRESSION ) do |capture| - transform_partial_capture(mapping, capture, processor, normalize_values) - end - return Addressable::Template.new(result) - end - - ## - # Expands a URI template into a full URI. - # - # @param [Hash] mapping The mapping that corresponds to the pattern. - # @param [#validate, #transform] processor - # An optional processor object may be supplied. - # @param [Boolean] normalize_values - # Optional flag to enable/disable unicode normalization. Default: true - # - # The object should respond to either the validate or - # transform messages or both. Both the validate and - # transform methods should take two parameters: name and - # value. The validate method should return true - # or false; true if the value of the variable is valid, - # false otherwise. An InvalidTemplateValueError - # exception will be raised if the value is invalid. The transform - # method should return the transformed variable value as a String. - # If a transform method is used, the value will not be percent - # encoded automatically. Unicode normalization will be performed both - # before and after sending the value to the transform method. - # - # @return [Addressable::URI] The expanded URI template. - # - # @example - # class ExampleProcessor - # def self.validate(name, value) - # return !!(value =~ /^[\w ]+$/) if name == "query" - # return true - # end - # - # def self.transform(name, value) - # return value.gsub(/ /, "+") if name == "query" - # return value - # end - # end - # - # Addressable::Template.new( - # "http://example.com/search/{query}/" - # ).expand( - # {"query" => "an example search query"}, - # ExampleProcessor - # ).to_str - # #=> "http://example.com/search/an+example+search+query/" - # - # Addressable::Template.new( - # "http://example.com/search/{query}/" - # ).expand( - # {"query" => "an example search query"} - # ).to_str - # #=> "http://example.com/search/an%20example%20search%20query/" - # - # Addressable::Template.new( - # "http://example.com/search/{query}/" - # ).expand( - # {"query" => "bogus!"}, - # ExampleProcessor - # ).to_str - # #=> Addressable::Template::InvalidTemplateValueError - def expand(mapping, processor=nil, normalize_values=true) - result = self.pattern.dup - mapping = normalize_keys(mapping) - result.gsub!( EXPRESSION ) do |capture| - transform_capture(mapping, capture, processor, normalize_values) - end - return Addressable::URI.parse(result) - end - - ## - # Returns an Array of variables used within the template pattern. - # The variables are listed in the Array in the order they appear within - # the pattern. Multiple occurrences of a variable within a pattern are - # not represented in this Array. - # - # @return [Array] The variables present in the template's pattern. - def variables - @variables ||= ordered_variable_defaults.map { |var, val| var }.uniq - end - alias_method :keys, :variables - alias_method :names, :variables - - ## - # Returns a mapping of variables to their default values specified - # in the template. Variables without defaults are not returned. - # - # @return [Hash] Mapping of template variables to their defaults - def variable_defaults - @variable_defaults ||= - Hash[*ordered_variable_defaults.reject { |k, v| v.nil? }.flatten] - end - - ## - # Coerces a template into a `Regexp` object. This regular expression will - # behave very similarly to the actual template, and should match the same - # URI values, but it cannot fully handle, for example, values that would - # extract to an `Array`. - # - # @return [Regexp] A regular expression which should match the template. - def to_regexp - _, source = parse_template_pattern(pattern) - Regexp.new(source) - end - - ## - # Returns the source of the coerced `Regexp`. - # - # @return [String] The source of the `Regexp` given by {#to_regexp}. - # - # @api private - def source - self.to_regexp.source - end - - ## - # Returns the named captures of the coerced `Regexp`. - # - # @return [Hash] The named captures of the `Regexp` given by {#to_regexp}. - # - # @api private - def named_captures - self.to_regexp.named_captures - end - - private - def ordered_variable_defaults - @ordered_variable_defaults ||= begin - expansions, _ = parse_template_pattern(pattern) - expansions.flat_map do |capture| - _, _, varlist = *capture.match(EXPRESSION) - varlist.split(',').map do |varspec| - varspec[VARSPEC, 1] - end - end - end - end - - - ## - # Loops through each capture and expands any values available in mapping - # - # @param [Hash] mapping - # Set of keys to expand - # @param [String] capture - # The expression to expand - # @param [#validate, #transform] processor - # An optional processor object may be supplied. - # @param [Boolean] normalize_values - # Optional flag to enable/disable unicode normalization. Default: true - # - # The object should respond to either the validate or - # transform messages or both. Both the validate and - # transform methods should take two parameters: name and - # value. The validate method should return true - # or false; true if the value of the variable is valid, - # false otherwise. An InvalidTemplateValueError exception - # will be raised if the value is invalid. The transform method - # should return the transformed variable value as a String. If a - # transform method is used, the value will not be percent encoded - # automatically. Unicode normalization will be performed both before and - # after sending the value to the transform method. - # - # @return [String] The expanded expression - def transform_partial_capture(mapping, capture, processor = nil, - normalize_values = true) - _, operator, varlist = *capture.match(EXPRESSION) - - vars = varlist.split(",") - - if operator == "?" - # partial expansion of form style query variables sometimes requires a - # slight reordering of the variables to produce a valid url. - first_to_expand = vars.find { |varspec| - _, name, _ = *varspec.match(VARSPEC) - mapping.key?(name) && !mapping[name].nil? - } - - vars = [first_to_expand] + vars.reject {|varspec| varspec == first_to_expand} if first_to_expand - end - - vars. - inject("".dup) do |acc, varspec| - _, name, _ = *varspec.match(VARSPEC) - next_val = if mapping.key? name - transform_capture(mapping, "{#{operator}#{varspec}}", - processor, normalize_values) - else - "{#{operator}#{varspec}}" - end - # If we've already expanded at least one '?' operator with non-empty - # value, change to '&' - operator = "&" if (operator == "?") && (next_val != "") - acc << next_val - end - end - - ## - # Transforms a mapped value so that values can be substituted into the - # template. - # - # @param [Hash] mapping The mapping to replace captures - # @param [String] capture - # The expression to replace - # @param [#validate, #transform] processor - # An optional processor object may be supplied. - # @param [Boolean] normalize_values - # Optional flag to enable/disable unicode normalization. Default: true - # - # - # The object should respond to either the validate or - # transform messages or both. Both the validate and - # transform methods should take two parameters: name and - # value. The validate method should return true - # or false; true if the value of the variable is valid, - # false otherwise. An InvalidTemplateValueError exception - # will be raised if the value is invalid. The transform method - # should return the transformed variable value as a String. If a - # transform method is used, the value will not be percent encoded - # automatically. Unicode normalization will be performed both before and - # after sending the value to the transform method. - # - # @return [String] The expanded expression - def transform_capture(mapping, capture, processor=nil, - normalize_values=true) - _, operator, varlist = *capture.match(EXPRESSION) - return_value = varlist.split(',').inject([]) do |acc, varspec| - _, name, modifier = *varspec.match(VARSPEC) - value = mapping[name] - unless value == nil || value == {} - allow_reserved = %w(+ #).include?(operator) - # Common primitives where the .to_s output is well-defined - if Numeric === value || Symbol === value || - value == true || value == false - value = value.to_s - end - length = modifier.gsub(':', '').to_i if modifier =~ /^:\d+/ - - unless (Hash === value) || - value.respond_to?(:to_ary) || value.respond_to?(:to_str) - raise TypeError, - "Can't convert #{value.class} into String or Array." - end - - value = normalize_value(value) if normalize_values - - if processor == nil || !processor.respond_to?(:transform) - # Handle percent escaping - if allow_reserved - encode_map = - Addressable::URI::CharacterClasses::RESERVED + - Addressable::URI::CharacterClasses::UNRESERVED - else - encode_map = Addressable::URI::CharacterClasses::UNRESERVED - end - if value.kind_of?(Array) - transformed_value = value.map do |val| - if length - Addressable::URI.encode_component(val[0...length], encode_map) - else - Addressable::URI.encode_component(val, encode_map) - end - end - unless modifier == "*" - transformed_value = transformed_value.join(',') - end - elsif value.kind_of?(Hash) - transformed_value = value.map do |key, val| - if modifier == "*" - "#{ - Addressable::URI.encode_component( key, encode_map) - }=#{ - Addressable::URI.encode_component( val, encode_map) - }" - else - "#{ - Addressable::URI.encode_component( key, encode_map) - },#{ - Addressable::URI.encode_component( val, encode_map) - }" - end - end - unless modifier == "*" - transformed_value = transformed_value.join(',') - end - else - if length - transformed_value = Addressable::URI.encode_component( - value[0...length], encode_map) - else - transformed_value = Addressable::URI.encode_component( - value, encode_map) - end - end - end - - # Process, if we've got a processor - if processor != nil - if processor.respond_to?(:validate) - if !processor.validate(name, value) - display_value = value.kind_of?(Array) ? value.inspect : value - raise InvalidTemplateValueError, - "#{name}=#{display_value} is an invalid template value." - end - end - if processor.respond_to?(:transform) - transformed_value = processor.transform(name, value) - if normalize_values - transformed_value = normalize_value(transformed_value) - end - end - end - acc << [name, transformed_value] - end - acc - end - return "" if return_value.empty? - join_values(operator, return_value) - end - - ## - # Takes a set of values, and joins them together based on the - # operator. - # - # @param [String, Nil] operator One of the operators from the set - # (?,&,+,#,;,/,.), or nil if there wasn't one. - # @param [Array] return_value - # The set of return values (as [variable_name, value] tuples) that will - # be joined together. - # - # @return [String] The transformed mapped value - def join_values(operator, return_value) - leader = LEADERS.fetch(operator, '') - joiner = JOINERS.fetch(operator, ',') - case operator - when '&', '?' - leader + return_value.map{|k,v| - if v.is_a?(Array) && v.first =~ /=/ - v.join(joiner) - elsif v.is_a?(Array) - v.map{|inner_value| "#{k}=#{inner_value}"}.join(joiner) - else - "#{k}=#{v}" - end - }.join(joiner) - when ';' - return_value.map{|k,v| - if v.is_a?(Array) && v.first =~ /=/ - ';' + v.join(";") - elsif v.is_a?(Array) - ';' + v.map{|inner_value| "#{k}=#{inner_value}"}.join(";") - else - v && v != '' ? ";#{k}=#{v}" : ";#{k}" - end - }.join - else - leader + return_value.map{|k,v| v}.join(joiner) - end - end - - ## - # Takes a set of values, and joins them together based on the - # operator. - # - # @param [Hash, Array, String] value - # Normalizes unicode keys and values with String#unicode_normalize (NFC) - # - # @return [Hash, Array, String] The normalized values - def normalize_value(value) - # Handle unicode normalization - if value.respond_to?(:to_ary) - value = value.to_ary.map { |val| normalize_value(val) } - elsif value.kind_of?(Hash) - value = value.inject({}) { |acc, (k, v)| - acc[normalize_value(k)] = normalize_value(v) - acc - } - else - value = value.to_s if !value.kind_of?(String) - if value.encoding != Encoding::UTF_8 - value = value.dup.force_encoding(Encoding::UTF_8) - end - value = value.unicode_normalize(:nfc) - end - value - end - - ## - # Generates a hash with string keys - # - # @param [Hash] mapping A mapping hash to normalize - # - # @return [Hash] - # A hash with stringified keys - def normalize_keys(mapping) - return mapping.inject({}) do |accu, pair| - name, value = pair - if Symbol === name - name = name.to_s - elsif name.respond_to?(:to_str) - name = name.to_str - else - raise TypeError, - "Can't convert #{name.class} into String." - end - accu[name] = value - accu - end - end - - ## - # Generates the Regexp that parses a template pattern. Memoizes the - # value if template processor not set (processors may not be deterministic) - # - # @param [String] pattern The URI template pattern. - # @param [#match] processor The template processor to use. - # - # @return [Array, Regexp] - # An array of expansion variables nad a regular expression which may be - # used to parse a template pattern - def parse_template_pattern(pattern, processor = nil) - if processor.nil? && pattern == @pattern - @cached_template_parse ||= - parse_new_template_pattern(pattern, processor) - else - parse_new_template_pattern(pattern, processor) - end - end - - ## - # Describes what follows each expression in a template pattern. - # - # @param [String] escaped_pattern The escaped URI template pattern. - # - # @return [Array] For each expression, the MatchData of - # the expression directly after it (or nil), and whether the - # text after it could start with a comma. - def expression_followers(escaped_pattern) - expressions = escaped_pattern.to_enum(:scan, EXPRESSION).map do - Regexp.last_match - end - expressions.each_with_index.map do |current, index| - following = expressions[index + 1] - following = nil unless following && following.begin(0) == current.end(0) - # Expressions can match nothing, so look past any that can't start - # with a comma. - position = current.end(0) - comma = expressions[(index + 1)..-1].any? do |later| - break false unless later.begin(0) == position - position = later.end(0) - may_start_with_comma?(later[1], later[2]) - end - [following, comma || escaped_pattern[position] == ','] - end - end - - ## - # Whether an expression could match a string that starts with a comma. - # - # @param [String, nil] operator The expression's operator. - # @param [String] varlist The expression's variable list. - # - # @return [TrueClass, FalseClass] - def may_start_with_comma?(operator, varlist) - return false unless LEADERS.fetch(operator, '').empty? - operator == '+' || !(varlist =~ VARSPEC && $2 != '*') - end - - ## - # Whether an expression, followed directly by another one, could only - # match characters that the other one could also match, in any amount. - # - # @param [MatchData] following The expression that follows. - # @param [String, nil] operator The operator of the first expression. - # @param [Array] varspecs The varspecs of the first expression. - # - # @return [TrueClass, FalseClass] - def absorbed_by?(following, operator, varspecs) - last = following[2].split(',').last - case following[1] - when '+' - # An unexploded last variable matches any characters that an - # expression can, and can end anywhere. - last[VARSPEC, 2] != '*' - when nil - if last[VARSPEC, 2] == '*' - # Matches any unreserved characters and commas. - operator.nil? || operator == '.' - elsif following[2] == last - # Matches any unreserved characters. - operator == '.' || (operator.nil? && varspecs.size == 1 && - varspecs.first[VARSPEC, 2] != '*') - else - false - end - else - false - end - end - - ## - # Generates the Regexp that parses a template pattern. - # - # @param [String] pattern The URI template pattern. - # @param [#match] processor The template processor to use. - # - # @return [Array, Regexp] - # An array of expansion variables nad a regular expression which may be - # used to parse a template pattern - def parse_new_template_pattern(pattern, processor = nil) - # Escape the pattern. The two gsubs restore the escaped curly braces - # back to their original form. Basically, escape everything that isn't - # within an expansion. - escaped_pattern = Regexp.escape( - pattern - ).gsub(/\\\{(.*?)\\\}/) do |escaped| - escaped.gsub(/\\(.)/, "\\1") - end - - expansions = [] - # Processor patterns can match anything, so they get 2.9.0's choices. - plain_processor = !(processor && processor.respond_to?(:match)) - followers = expression_followers(escaped_pattern) - - # Create a regular expression that captures the values of the - # variables in the URI. - regexp_string = escaped_pattern.gsub( EXPRESSION ) do |expansion| - - index = expansions.size - expansions << expansion - _, operator, varlist = *expansion.match(EXPRESSION) - leader = Regexp.escape(LEADERS.fetch(operator, '')) - joiner = Regexp.escape(JOINERS.fetch(operator, ',')) - varspecs = varlist.split(',') - results = varspecs.map do |varspec| - name = varspec[VARSPEC, 1] - processor && processor.respond_to?(:match) ? processor.match(name) : nil - end - # Without processor patterns, any variable in the expression can take - # the characters that an earlier variable leaves, which lets the - # variables after the first one have fewer choices below. - plain = results.compact.empty? - explodes = varspecs.map { |varspec| varspec[VARSPEC, 2] == '*' } - first_explode = explodes.index(true) - not_after_value = - "(?#{ result })" - else - group = case operator - when '+' - "#{ RESERVED }*?" - when '#' - "#{ RESERVED }*?" - when '/' - "#{ UNRESERVED }*?" - when '.' - "#{ UNRESERVED.gsub('\.', '') }*?" - when ';' - # The same strings, tried in the same order, as 2.9.0's - # "U*=?U*?", but a name without "=" can only match one way. - "(?:#{UNRESERVED}*=#{UNRESERVED}*?|#{UNRESERVED}*)" - when '?' - "#{ UNRESERVED }*=#{ UNRESERVED }*?" - when '&' - "#{ UNRESERVED }*=#{ UNRESERVED }*?" - else - "#{ UNRESERVED }*?" - end - if modifier == '*' - # The ; ? and & members match the same strings, in the same - # order of preference, as 2.9.0's members joined by an optional - # joiner, but each character can only belong to one member. - seg = case operator - when '+', '#' then "#{RESERVED_NO_COMMA}*+" - when ';' then "(?:#{UNRESERVED}|=)*" - when '?', '&' - "#{UNRESERVED}*=(?:#{UNRESERVED}*=)*#{UNRESERVED}*?" - else group - end - # The joiner between exploded members must be mandatory. With - # an optional joiner, a run of members can be partitioned in - # exponentially many ways, which backtracks catastrophically on - # engines without match memoization (MRI < 3.2, JRuby, - # TruffleRuby). - value = "#{seg}(?:#{joiner}#{seg})*" - end - if plain && first_explode && position > first_explode && - (operator == '+' || operator == '#' || operator == ';') - # Exploded values were tried longest first, so whatever this - # variable could match after the first exploded one, that one - # already tried matching itself. Only the last unexploded + or - # # variable can stop inside a member, where an exploded - # variable can't. As in 2.9.0, a variable is the last one if - # its varspec is the same as the last varspec. - if operator == ';' - "(?<#{name}>)" - elsif modifier != '*' && varspec == varspecs.last - "(?<#{name}>#{RESERVED_NO_COMMA}*?)?" - else - # 2.9.0 skipped the variable when it couldn't be empty. - "(?:(?<#{name}>)(?!#{RESERVED_NO_COMMA}))?" - end - elsif plain && modifier == '*' && explodes[(position + 1)..-1].any? && - (operator.nil? || operator == '/' || operator == '.') - # Exploded values were tried shortest first, and a later - # exploded variable can match whatever this one leaves, so once - # a split fails, every split where this variable is longer - # fails too. Of the values tried, only the leading joiners are - # shorter than every value tried before them. - "(?<#{name}>(?:#{joiner})*)" - elsif plain && position > 0 && explodes[position - 1] && - (operator == '?' || operator == '&') - # Whatever this variable could match after an exploded one, - # that one already tried matching itself, unless it couldn't: - # an exploded member can't be empty, so this variable may only - # start right after an empty one. - "(?<#{name}>(?<=#{leader}#{joiner}|#{joiner}#{joiner})" \ - "#{value || group})?" - elsif operator == ';' && plain && position > 0 - # Values were tried longest first, and splitting an earlier - # variable's run of characters with this one never gave a - # different result, so this one may only start after that run. - "(?<#{name}>(?:#{not_after_value}#{value || group})?)" - elsif modifier == '*' - "(?<#{name}>#{value})?" - elsif varspecs.size > 1 && (operator == '+' || operator == '#') && - varspec != varspecs.last - "(?<#{name}>#{RESERVED_NO_COMMA}*+)?" - elsif plain && position < varspecs.size - 1 && - (operator.nil? || operator == '/' || operator == '.') - # Values were tried shortest first, so a run of characters - # without a joiner went to a later variable. The only other - # value that could change the result is the whole run up to the - # next joiner. - "(?<#{name}>(?:#{group}(?=#{joiner}))??)" - else - "(?<#{name}>#{group})?" - end - end - end - following, comma_follows = followers[index] - single = varspecs.size == 1 && varspecs.first[VARSPEC, 2] != '*' - if plain_processor && following && - absorbed_by?(following, operator, varspecs) - # Each expression tried its empty alternative first. When the next - # one follows it directly and can match anything it could, followed - # by anything the next one could match on its own, every other - # choice ends where the empty one can also end, so the empty - # alternative always gave the first match. - leader = "(?!)#{leader}" - combined = combined.join("#{joiner}?") - elsif plain_processor && single && following && - following[1].nil? && following[2] =~ VARSPEC && $2 != '*' && - (operator == '+' || operator == '#') - # Values were tried shortest first, and the next expression can - # match any unreserved characters, so the value only needs to end - # after a character that the next expression couldn't match. - combined = "(?<#{varspecs.first[VARSPEC, 1]}>" \ - "#{RESERVED}*?#{not_after_value})?" - elsif plain && varspecs.size > 1 && - (operator == '+' || operator == '#') && - !comma_follows && - varspecs.none? { |varspec| varspec[VARSPEC, 2] == '*' } && - !varspecs[0...-1].include?(varspecs.last) - # 2.9.0 tried each value with the joiner after it first, then the - # value on its own, then skipping the variable, and every other - # choice gave a value to a later variable that an earlier one had - # already been tried with. A variable after a skipped one is - # skipped too. Stopping before a joiner is left out, so this is - # only used when no joiner can follow the expression. As in 2.9.0, - # a variable is the last one if its varspec is the same as the - # last varspec. - nested = varspecs[0...-1].reverse.inject("") do |inner, varspec| - "(?:(?<#{varspec[VARSPEC, 1]}>#{RESERVED_NO_COMMA}*+)" \ - "#{joiner}?+#{inner}|(?=#{RESERVED_NO_COMMA}))" - end - combined = nested + combined.last - else - combined = combined.join("#{joiner}?") - end - "(?:|#{leader}#{combined})" - end - - # Ensure that the regular expression matches the whole URI. - regexp_string = "\\A#{regexp_string}\\z" - return expansions, Regexp.new(regexp_string) - end - - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable/uri.rb b/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable/uri.rb deleted file mode 100644 index b58dc1b..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable/uri.rb +++ /dev/null @@ -1,2650 +0,0 @@ -# frozen_string_literal: true - -#-- -# Copyright (C) Bob Aman -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#++ - - -require "addressable/version" -require "addressable/idna" -require "public_suffix" - -## -# Addressable is a library for processing links and URIs. -module Addressable - ## - # This is an implementation of a URI parser based on - # RFC 3986, - # RFC 3987. - class URI - ## - # Raised if something other than a uri is supplied. - class InvalidURIError < StandardError - end - - ## - # Container for the character classes specified in - # RFC 3986. - # - # Note: Concatenated and interpolated `String`s are not affected by the - # `frozen_string_literal` directive and must be frozen explicitly. - # - # Interpolated `String`s *were* frozen this way before Ruby 3.0: - # https://bugs.ruby-lang.org/issues/17104 - module CharacterClasses - ALPHA = "a-zA-Z" - DIGIT = "0-9" - GEN_DELIMS = "\\:\\/\\?\\#\\[\\]\\@" - SUB_DELIMS = "\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=" - RESERVED = (GEN_DELIMS + SUB_DELIMS).freeze - UNRESERVED = (ALPHA + DIGIT + "\\-\\.\\_\\~").freeze - RESERVED_AND_UNRESERVED = RESERVED + UNRESERVED - PCHAR = (UNRESERVED + SUB_DELIMS + "\\:\\@").freeze - SCHEME = (ALPHA + DIGIT + "\\-\\+\\.").freeze - HOST = (UNRESERVED + SUB_DELIMS + "\\[\\:\\]").freeze - AUTHORITY = (PCHAR + "\\[\\]").freeze - PATH = (PCHAR + "\\/").freeze - QUERY = (PCHAR + "\\/\\?").freeze - FRAGMENT = (PCHAR + "\\/\\?").freeze - end - - module NormalizeCharacterClasses - HOST = /[^#{CharacterClasses::HOST}]/ - UNRESERVED = /[^#{CharacterClasses::UNRESERVED}]/ - PCHAR = /[^#{CharacterClasses::PCHAR}]/ - SCHEME = /[^#{CharacterClasses::SCHEME}]/ - FRAGMENT = /[^#{CharacterClasses::FRAGMENT}]/ - QUERY = %r{[^a-zA-Z0-9\-\.\_\~\!\$\'\(\)\*\+\,\=\:\@\/\?%]|%(?!2B|2b)} - end - - module CharacterClassesRegexps - AUTHORITY = /[^#{CharacterClasses::AUTHORITY}]/ - FRAGMENT = /[^#{CharacterClasses::FRAGMENT}]/ - HOST = /[^#{CharacterClasses::HOST}]/ - PATH = /[^#{CharacterClasses::PATH}]/ - QUERY = /[^#{CharacterClasses::QUERY}]/ - RESERVED = /[^#{CharacterClasses::RESERVED}]/ - RESERVED_AND_UNRESERVED = /[^#{CharacterClasses::RESERVED_AND_UNRESERVED}]/ - SCHEME = /[^#{CharacterClasses::SCHEME}]/ - UNRESERVED = /[^#{CharacterClasses::UNRESERVED}]/ - end - - SLASH = '/' - EMPTY_STR = '' - - URIREGEX = /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/ - - PORT_MAPPING = { - "http" => 80, - "https" => 443, - "ftp" => 21, - "tftp" => 69, - "sftp" => 22, - "ssh" => 22, - "svn+ssh" => 22, - "telnet" => 23, - "nntp" => 119, - "gopher" => 70, - "wais" => 210, - "ldap" => 389, - "prospero" => 1525 - }.freeze - - ## - # Returns a URI object based on the parsed string. - # - # @param [String, Addressable::URI, #to_str] uri - # The URI string to parse. - # No parsing is performed if the object is already an - # Addressable::URI. - # - # @return [Addressable::URI] The parsed URI. - def self.parse(uri) - # If we were given nil, return nil. - return nil unless uri - # If a URI object is passed, just return itself. - return uri.dup if uri.kind_of?(self) - - # If a URI object of the Ruby standard library variety is passed, - # convert it to a string, then parse the string. - # We do the check this way because we don't want to accidentally - # cause a missing constant exception to be thrown. - if uri.class.name =~ /^URI\b/ - uri = uri.to_s - end - - # Otherwise, convert to a String - begin - uri = uri.to_str - rescue TypeError, NoMethodError - raise TypeError, "Can't convert #{uri.class} into String." - end unless uri.is_a?(String) - - # This Regexp supplied as an example in RFC 3986, and it works great. - scan = uri.scan(URIREGEX) - fragments = scan[0] - scheme = fragments[1] - authority = fragments[3] - path = fragments[4] - query = fragments[6] - fragment = fragments[8] - user = nil - password = nil - host = nil - port = nil - if authority != nil - # The Regexp above doesn't split apart the authority. - userinfo = authority[/^([^\[\]]*)@/, 1] - if userinfo != nil - user = userinfo.strip[/^([^:]*):?/, 1] - password = userinfo.strip[/:(.*)$/, 1] - end - - host = authority.sub( - /^([^\[\]]*)@/, EMPTY_STR - ).sub( - /:([^:@\[\]]*?)$/, EMPTY_STR - ) - - port = authority[/:([^:@\[\]]*?)$/, 1] - port = nil if port == EMPTY_STR - end - - return new( - :scheme => scheme, - :user => user, - :password => password, - :host => host, - :port => port, - :path => path, - :query => query, - :fragment => fragment - ) - end - - ## - # Converts an input to a URI. The input does not have to be a valid - # URI — the method will use heuristics to guess what URI was intended. - # This is not standards-compliant, merely user-friendly. - # - # @param [String, Addressable::URI, #to_str] uri - # The URI string to parse. - # No parsing is performed if the object is already an - # Addressable::URI. - # @param [Hash] hints - # A Hash of hints to the heuristic parser. - # Defaults to {:scheme => "http"}. - # - # @return [Addressable::URI] The parsed URI. - def self.heuristic_parse(uri, hints={}) - # If we were given nil, return nil. - return nil unless uri - # If a URI object is passed, just return itself. - return uri.dup if uri.kind_of?(self) - - # If a URI object of the Ruby standard library variety is passed, - # convert it to a string, then parse the string. - # We do the check this way because we don't want to accidentally - # cause a missing constant exception to be thrown. - if uri.class.name =~ /^URI\b/ - uri = uri.to_s - end - - unless uri.respond_to?(:to_str) - raise TypeError, "Can't convert #{uri.class} into String." - end - # Otherwise, convert to a String - uri = uri.to_str.dup.strip - hints = { - :scheme => "http" - }.merge(hints) - case uri - when /^http:\//i - uri.sub!(/^http:\/+/i, "http://") - when /^https:\//i - uri.sub!(/^https:\/+/i, "https://") - when /^feed:\/+http:\//i - uri.sub!(/^feed:\/+http:\/+/i, "feed:http://") - when /^feed:\//i - uri.sub!(/^feed:\/+/i, "feed://") - when %r[^file:/{4}]i - uri.sub!(%r[^file:/+]i, "file:////") - when %r[^file://localhost/]i - uri.sub!(%r[^file://localhost/+]i, "file:///") - when %r[^file:/+]i - uri.sub!(%r[^file:/+]i, "file:///") - when /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/ - uri.sub!(/^/, hints[:scheme] + "://") - when /\A\d+\..*:\d+\z/ - uri = "#{hints[:scheme]}://#{uri}" - end - match = uri.match(URIREGEX) - fragments = match.captures - authority = fragments[3] - if authority && authority.length > 0 - new_authority = authority.tr("\\", "/").gsub(" ", "%20") - # NOTE: We want offset 4, not 3! - offset = match.offset(4) - uri = uri.dup - uri[offset[0]...offset[1]] = new_authority - end - parsed = self.parse(uri) - if parsed.scheme =~ /^[^\/?#\.]+\.[^\/?#]+$/ - parsed = self.parse(hints[:scheme] + "://" + uri) - end - if parsed.path.include?(".") - if parsed.path[/\b@\b/] - parsed.scheme = "mailto" unless parsed.scheme - elsif new_host = parsed.path[/^([^\/]+\.[^\/]*)/, 1] - parsed.defer_validation do - new_path = parsed.path.sub( - Regexp.new("^" + Regexp.escape(new_host)), EMPTY_STR) - parsed.host = new_host - parsed.path = new_path - parsed.scheme = hints[:scheme] unless parsed.scheme - end - end - end - return parsed - end - - ## - # Converts a path to a file scheme URI. If the path supplied is - # relative, it will be returned as a relative URI. If the path supplied - # is actually a non-file URI, it will parse the URI as if it had been - # parsed with Addressable::URI.parse. Handles all of the - # various Microsoft-specific formats for specifying paths. - # - # @param [String, Addressable::URI, #to_str] path - # Typically a String path to a file or directory, but - # will return a sensible return value if an absolute URI is supplied - # instead. - # - # @return [Addressable::URI] - # The parsed file scheme URI or the original URI if some other URI - # scheme was provided. - # - # @example - # base = Addressable::URI.convert_path("/absolute/path/") - # uri = Addressable::URI.convert_path("relative/path") - # (base + uri).to_s - # #=> "file:///absolute/path/relative/path" - # - # Addressable::URI.convert_path( - # "c:\\windows\\My Documents 100%20\\foo.txt" - # ).to_s - # #=> "file:///c:/windows/My%20Documents%20100%20/foo.txt" - # - # Addressable::URI.convert_path("http://example.com/").to_s - # #=> "http://example.com/" - def self.convert_path(path) - # If we were given nil, return nil. - return nil unless path - # If a URI object is passed, just return itself. - return path if path.kind_of?(self) - unless path.respond_to?(:to_str) - raise TypeError, "Can't convert #{path.class} into String." - end - # Otherwise, convert to a String - path = path.to_str.strip - - path.sub!(/^file:\/?\/?/, EMPTY_STR) if path =~ /^file:\/?\/?/ - path = SLASH + path if path =~ /^([a-zA-Z])[\|:]/ - uri = self.parse(path) - - if uri.scheme == nil - # Adjust windows-style uris - uri.path.sub!(/^\/?([a-zA-Z])[\|:][\\\/]/) do - "/#{$1.downcase}:/" - end - uri.path.tr!("\\", SLASH) - if File.exist?(uri.path) && - File.stat(uri.path).directory? - uri.path.chomp!(SLASH) - uri.path = uri.path + '/' - end - - # If the path is absolute, set the scheme and host. - if uri.path.start_with?(SLASH) - uri.scheme = "file" - uri.host = EMPTY_STR - end - uri.normalize! - end - - return uri - end - - ## - # Joins several URIs together. - # - # @param [String, Addressable::URI, #to_str] *uris - # The URIs to join. - # - # @return [Addressable::URI] The joined URI. - # - # @example - # base = "http://example.com/" - # uri = Addressable::URI.parse("relative/path") - # Addressable::URI.join(base, uri) - # #=> # - def self.join(*uris) - uri_objects = uris.collect do |uri| - unless uri.respond_to?(:to_str) - raise TypeError, "Can't convert #{uri.class} into String." - end - uri.kind_of?(self) ? uri : self.parse(uri.to_str) - end - result = uri_objects.shift.dup - uri_objects.each do |uri| - result.join!(uri) - end - return result - end - - ## - # Tables used to optimize encoding operations in `self.encode_component` - # and `self.normalize_component` - SEQUENCE_ENCODING_TABLE = (0..255).map do |byte| - format("%02x", byte).freeze - end.freeze - - SEQUENCE_UPCASED_PERCENT_ENCODING_TABLE = (0..255).map do |byte| - format("%%%02X", byte).freeze - end.freeze - - ## - # Percent encodes a URI component. - # - # @param [String, #to_str] component The URI component to encode. - # - # @param [String, Regexp] character_class - # The characters which are not percent encoded. If a String - # is passed, the String must be formatted as a regular - # expression character class. (Do not include the surrounding square - # brackets.) For example, "b-zB-Z0-9" would cause - # everything but the letters 'b' through 'z' and the numbers '0' through - # '9' to be percent encoded. If a Regexp is passed, the - # value /[^b-zB-Z0-9]/ would have the same effect. A set of - # useful String values may be found in the - # Addressable::URI::CharacterClasses module. The default - # value is the reserved plus unreserved character classes specified in - # RFC 3986. - # - # @param [Regexp] upcase_encoded - # A string of characters that may already be percent encoded, and whose - # encodings should be upcased. This allows normalization of percent - # encodings for characters not included in the - # character_class. - # - # @return [String] The encoded component. - # - # @example - # Addressable::URI.encode_component("simple/example", "b-zB-Z0-9") - # => "simple%2Fex%61mple" - # Addressable::URI.encode_component("simple/example", /[^b-zB-Z0-9]/) - # => "simple%2Fex%61mple" - # Addressable::URI.encode_component( - # "simple/example", Addressable::URI::CharacterClasses::UNRESERVED - # ) - # => "simple%2Fexample" - def self.encode_component(component, character_class=CharacterClassesRegexps::RESERVED_AND_UNRESERVED, upcase_encoded='') - return nil if component.nil? - - begin - if component.kind_of?(Symbol) || - component.kind_of?(Numeric) || - component.kind_of?(TrueClass) || - component.kind_of?(FalseClass) - component = component.to_s - else - component = component.to_str - end - rescue TypeError, NoMethodError - raise TypeError, "Can't convert #{component.class} into String." - end if !component.is_a? String - - if ![String, Regexp].include?(character_class.class) - raise TypeError, - "Expected String or Regexp, got #{character_class.inspect}" - end - if character_class.kind_of?(String) - character_class = /[^#{character_class}]/ - end - # We can't perform regexps on invalid UTF sequences, but - # here we need to, so switch to ASCII. - component = component.dup - component.force_encoding(Encoding::ASCII_8BIT) - # Avoiding gsub! because there are edge cases with frozen strings - component = component.gsub(character_class) do |char| - SEQUENCE_UPCASED_PERCENT_ENCODING_TABLE[char.ord] - end - if upcase_encoded.length > 0 - upcase_encoded_chars = upcase_encoded.bytes.map do |byte| - SEQUENCE_ENCODING_TABLE[byte] - end - component = component.gsub(/%(#{upcase_encoded_chars.join('|')})/, - &:upcase) - end - - return component - end - - class << self - alias_method :escape_component, :encode_component - end - - ## - # Unencodes any percent encoded characters within a URI component. - # This method may be used for unencoding either components or full URIs, - # however, it is recommended to use the unencode_component - # alias when unencoding components. - # - # @param [String, Addressable::URI, #to_str] uri - # The URI or component to unencode. - # - # @param [Class] return_type - # The type of object to return. - # This value may only be set to String or - # Addressable::URI. All other values are invalid. Defaults - # to String. - # - # @param [String] leave_encoded - # A string of characters to leave encoded. If a percent encoded character - # in this list is encountered then it will remain percent encoded. - # - # @return [String, Addressable::URI] - # The unencoded component or URI. - # The return type is determined by the return_type - # parameter. - def self.unencode(uri, return_type=String, leave_encoded='') - return nil if uri.nil? - - begin - uri = uri.to_str - rescue NoMethodError, TypeError - raise TypeError, "Can't convert #{uri.class} into String." - end if !uri.is_a? String - if ![String, ::Addressable::URI].include?(return_type) - raise TypeError, - "Expected Class (String or Addressable::URI), " + - "got #{return_type.inspect}" - end - - result = uri.gsub(/%[0-9a-f]{2}/i) do |sequence| - c = sequence[1..3].to_i(16).chr - c.force_encoding(sequence.encoding) - leave_encoded.include?(c) ? sequence : c - end - - result.force_encoding(Encoding::UTF_8) - if return_type == String - return result - elsif return_type == ::Addressable::URI - return ::Addressable::URI.parse(result) - end - end - - class << self - alias_method :unescape, :unencode - alias_method :unencode_component, :unencode - alias_method :unescape_component, :unencode - end - - - ## - # Normalizes the encoding of a URI component. - # - # @param [String, #to_str] component The URI component to encode. - # - # @param [String, Regexp] character_class - # The characters which are not percent encoded. If a String - # is passed, the String must be formatted as a regular - # expression character class. (Do not include the surrounding square - # brackets.) For example, "b-zB-Z0-9" would cause - # everything but the letters 'b' through 'z' and the numbers '0' - # through '9' to be percent encoded. If a Regexp is passed, - # the value /[^b-zB-Z0-9]/ would have the same effect. A - # set of useful String values may be found in the - # Addressable::URI::CharacterClasses module. The default - # value is the reserved plus unreserved character classes specified in - # RFC 3986. - # - # @param [String] leave_encoded - # When character_class is a String then - # leave_encoded is a string of characters that should remain - # percent encoded while normalizing the component; if they appear percent - # encoded in the original component, then they will be upcased ("%2f" - # normalized to "%2F") but otherwise left alone. - # - # @return [String] The normalized component. - # - # @example - # Addressable::URI.normalize_component("simpl%65/%65xampl%65", "b-zB-Z") - # => "simple%2Fex%61mple" - # Addressable::URI.normalize_component( - # "simpl%65/%65xampl%65", /[^b-zB-Z]/ - # ) - # => "simple%2Fex%61mple" - # Addressable::URI.normalize_component( - # "simpl%65/%65xampl%65", - # Addressable::URI::CharacterClasses::UNRESERVED - # ) - # => "simple%2Fexample" - # Addressable::URI.normalize_component( - # "one%20two%2fthree%26four", - # "0-9a-zA-Z &/", - # "/" - # ) - # => "one two%2Fthree&four" - def self.normalize_component(component, character_class= - CharacterClassesRegexps::RESERVED_AND_UNRESERVED, - leave_encoded='') - return nil if component.nil? - - begin - component = component.to_str - rescue NoMethodError, TypeError - raise TypeError, "Can't convert #{component.class} into String." - end if !component.is_a? String - - if ![String, Regexp].include?(character_class.class) - raise TypeError, - "Expected String or Regexp, got #{character_class.inspect}" - end - if character_class.kind_of?(String) - leave_re = if leave_encoded.length > 0 - character_class = "#{character_class}%" unless character_class.include?('%') - - bytes = leave_encoded.bytes - leave_encoded_pattern = bytes.map { |b| SEQUENCE_ENCODING_TABLE[b] }.join('|') - "|%(?!#{leave_encoded_pattern}|#{leave_encoded_pattern.upcase})" - end - - character_class = if leave_re - /[^#{character_class}]#{leave_re}/ - else - /[^#{character_class}]/ - end - end - # We can't perform regexps on invalid UTF sequences, but - # here we need to, so switch to ASCII. - component = component.dup - component.force_encoding(Encoding::ASCII_8BIT) - unencoded = self.unencode_component(component, String, leave_encoded) - begin - encoded = self.encode_component( - unencoded.unicode_normalize(:nfc), - character_class, - leave_encoded - ) - rescue ArgumentError - encoded = self.encode_component(unencoded) - end - encoded.force_encoding(Encoding::UTF_8) - return encoded - end - - ## - # Percent encodes any special characters in the URI. - # - # @param [String, Addressable::URI, #to_str] uri - # The URI to encode. - # - # @param [Class] return_type - # The type of object to return. - # This value may only be set to String or - # Addressable::URI. All other values are invalid. Defaults - # to String. - # - # @return [String, Addressable::URI] - # The encoded URI. - # The return type is determined by the return_type - # parameter. - def self.encode(uri, return_type=String) - return nil if uri.nil? - - begin - uri = uri.to_str - rescue NoMethodError, TypeError - raise TypeError, "Can't convert #{uri.class} into String." - end if !uri.is_a? String - - if ![String, ::Addressable::URI].include?(return_type) - raise TypeError, - "Expected Class (String or Addressable::URI), " + - "got #{return_type.inspect}" - end - uri_object = uri.kind_of?(self) ? uri : self.parse(uri) - encoded_uri = Addressable::URI.new( - :scheme => self.encode_component(uri_object.scheme, - Addressable::URI::CharacterClassesRegexps::SCHEME), - :authority => self.encode_component(uri_object.authority, - Addressable::URI::CharacterClassesRegexps::AUTHORITY), - :path => self.encode_component(uri_object.path, - Addressable::URI::CharacterClassesRegexps::PATH), - :query => self.encode_component(uri_object.query, - Addressable::URI::CharacterClassesRegexps::QUERY), - :fragment => self.encode_component(uri_object.fragment, - Addressable::URI::CharacterClassesRegexps::FRAGMENT) - ) - if return_type == String - return encoded_uri.to_s - elsif return_type == ::Addressable::URI - return encoded_uri - end - end - - class << self - alias_method :escape, :encode - end - - ## - # Normalizes the encoding of a URI. Characters within a hostname are - # not percent encoded to allow for internationalized domain names. - # - # @param [String, Addressable::URI, #to_str] uri - # The URI to encode. - # - # @param [Class] return_type - # The type of object to return. - # This value may only be set to String or - # Addressable::URI. All other values are invalid. Defaults - # to String. - # - # @return [String, Addressable::URI] - # The encoded URI. - # The return type is determined by the return_type - # parameter. - def self.normalized_encode(uri, return_type=String) - begin - uri = uri.to_str - rescue NoMethodError, TypeError - raise TypeError, "Can't convert #{uri.class} into String." - end if !uri.is_a? String - - if ![String, ::Addressable::URI].include?(return_type) - raise TypeError, - "Expected Class (String or Addressable::URI), " + - "got #{return_type.inspect}" - end - uri_object = uri.kind_of?(self) ? uri : self.parse(uri) - components = { - :scheme => self.unencode_component(uri_object.scheme), - :user => self.unencode_component(uri_object.user), - :password => self.unencode_component(uri_object.password), - :host => self.unencode_component(uri_object.host), - :port => (uri_object.port.nil? ? nil : uri_object.port.to_s), - :path => self.unencode_component(uri_object.path), - :query => self.unencode_component(uri_object.query), - :fragment => self.unencode_component(uri_object.fragment) - } - components.each do |key, value| - if value != nil - begin - components[key] = value.to_str.unicode_normalize(:nfc) - rescue ArgumentError - # Likely a malformed UTF-8 character, skip unicode normalization - components[key] = value.to_str - end - end - end - encoded_uri = Addressable::URI.new( - :scheme => self.encode_component(components[:scheme], - Addressable::URI::CharacterClassesRegexps::SCHEME), - :user => self.encode_component(components[:user], - Addressable::URI::CharacterClassesRegexps::UNRESERVED), - :password => self.encode_component(components[:password], - Addressable::URI::CharacterClassesRegexps::UNRESERVED), - :host => components[:host], - :port => components[:port], - :path => self.encode_component(components[:path], - Addressable::URI::CharacterClassesRegexps::PATH), - :query => self.encode_component(components[:query], - Addressable::URI::CharacterClassesRegexps::QUERY), - :fragment => self.encode_component(components[:fragment], - Addressable::URI::CharacterClassesRegexps::FRAGMENT) - ) - if return_type == String - return encoded_uri.to_s - elsif return_type == ::Addressable::URI - return encoded_uri - end - end - - ## - # Encodes a set of key/value pairs according to the rules for the - # application/x-www-form-urlencoded MIME type. - # - # @param [#to_hash, #to_ary] form_values - # The form values to encode. - # - # @param [TrueClass, FalseClass] sort - # Sort the key/value pairs prior to encoding. - # Defaults to false. - # - # @return [String] - # The encoded value. - def self.form_encode(form_values, sort=false) - if form_values.respond_to?(:to_hash) - form_values = form_values.to_hash.to_a - elsif form_values.respond_to?(:to_ary) - form_values = form_values.to_ary - else - raise TypeError, "Can't convert #{form_values.class} into Array." - end - - form_values = form_values.inject([]) do |accu, (key, value)| - if value.kind_of?(Array) - value.each do |v| - accu << [key.to_s, v.to_s] - end - else - accu << [key.to_s, value.to_s] - end - accu - end - - if sort - # Useful for OAuth and optimizing caching systems - form_values = form_values.sort - end - escaped_form_values = form_values.map do |(key, value)| - # Line breaks are CRLF pairs - [ - self.encode_component( - key.gsub(/(\r\n|\n|\r)/, "\r\n"), - CharacterClassesRegexps::UNRESERVED - ).gsub("%20", "+"), - self.encode_component( - value.gsub(/(\r\n|\n|\r)/, "\r\n"), - CharacterClassesRegexps::UNRESERVED - ).gsub("%20", "+") - ] - end - return escaped_form_values.map do |(key, value)| - "#{key}=#{value}" - end.join("&") - end - - ## - # Decodes a String according to the rules for the - # application/x-www-form-urlencoded MIME type. - # - # @param [String, #to_str] encoded_value - # The form values to decode. - # - # @return [Array] - # The decoded values. - # This is not a Hash because of the possibility for - # duplicate keys. - def self.form_unencode(encoded_value) - if !encoded_value.respond_to?(:to_str) - raise TypeError, "Can't convert #{encoded_value.class} into String." - end - encoded_value = encoded_value.to_str - split_values = encoded_value.split("&").map do |pair| - pair.split("=", 2) - end - return split_values.map do |(key, value)| - [ - key ? self.unencode_component( - key.gsub("+", "%20")).gsub(/(\r\n|\n|\r)/, "\n") : nil, - value ? (self.unencode_component( - value.gsub("+", "%20")).gsub(/(\r\n|\n|\r)/, "\n")) : nil - ] - end - end - - ## - # Creates a new uri object from component parts. - # - # @option [String, #to_str] scheme The scheme component. - # @option [String, #to_str] user The user component. - # @option [String, #to_str] password The password component. - # @option [String, #to_str] userinfo - # The userinfo component. If this is supplied, the user and password - # components must be omitted. - # @option [String, #to_str] host The host component. - # @option [String, #to_str] port The port component. - # @option [String, #to_str] authority - # The authority component. If this is supplied, the user, password, - # userinfo, host, and port components must be omitted. - # @option [String, #to_str] path The path component. - # @option [String, #to_str] query The query component. - # @option [String, #to_str] fragment The fragment component. - # - # @return [Addressable::URI] The constructed URI object. - def initialize(options={}) - if options.has_key?(:authority) - if (options.keys & [:userinfo, :user, :password, :host, :port]).any? - raise ArgumentError, - "Cannot specify both an authority and any of the components " + - "within the authority." - end - end - if options.has_key?(:userinfo) - if (options.keys & [:user, :password]).any? - raise ArgumentError, - "Cannot specify both a userinfo and either the user or password." - end - end - - reset_ivs - - defer_validation do - # Bunch of crazy logic required because of the composite components - # like userinfo and authority. - self.scheme = options[:scheme] if options[:scheme] - self.user = options[:user] if options[:user] - self.password = options[:password] if options[:password] - self.userinfo = options[:userinfo] if options[:userinfo] - self.host = options[:host] if options[:host] - self.port = options[:port] if options[:port] - self.authority = options[:authority] if options[:authority] - self.path = options[:path] if options[:path] - self.query = options[:query] if options[:query] - self.query_values = options[:query_values] if options[:query_values] - self.fragment = options[:fragment] if options[:fragment] - end - - to_s # force path validation - end - - ## - # Freeze URI, initializing instance variables. - # - # @return [Addressable::URI] The frozen URI object. - def freeze - self.normalized_scheme - self.normalized_user - self.normalized_password - self.normalized_userinfo - self.normalized_host - self.normalized_port - self.normalized_authority - self.normalized_site - self.normalized_path - self.normalized_query - self.normalized_fragment - self.hash - super - end - - ## - # The scheme component for this URI. - # - # @return [String] The scheme component. - attr_reader :scheme - - ## - # The scheme component for this URI, normalized. - # - # @return [String] The scheme component, normalized. - def normalized_scheme - return nil unless self.scheme - if @normalized_scheme == NONE - @normalized_scheme = if self.scheme =~ /^\s*ssh\+svn\s*$/i - "svn+ssh".dup - else - Addressable::URI.normalize_component( - self.scheme.strip.downcase, - Addressable::URI::NormalizeCharacterClasses::SCHEME - ) - end - end - # All normalized values should be UTF-8 - force_utf8_encoding_if_needed(@normalized_scheme) - @normalized_scheme - end - - ## - # Sets the scheme component for this URI. - # - # @param [String, #to_str] new_scheme The new scheme component. - def scheme=(new_scheme) - if new_scheme && !new_scheme.respond_to?(:to_str) - raise TypeError, "Can't convert #{new_scheme.class} into String." - elsif new_scheme - new_scheme = new_scheme.to_str - end - if new_scheme && new_scheme !~ /\A[a-z][a-z0-9\.\+\-]*\z/i - raise InvalidURIError, "Invalid scheme format: '#{new_scheme}'" - end - @scheme = new_scheme - @scheme = nil if @scheme.to_s.strip.empty? - - # Reset dependent values - @normalized_scheme = NONE - @normalized_user = NONE - @normalized_password = NONE - @normalized_userinfo = NONE - @normalized_port = NONE - @normalized_path = nil - remove_composite_values - - # Ensure we haven't created an invalid URI - validate() - end - - ## - # The user component for this URI. - # - # @return [String] The user component. - attr_reader :user - - ## - # The user component for this URI, normalized. - # - # @return [String] The user component, normalized. - def normalized_user - return nil unless self.user - return @normalized_user unless @normalized_user == NONE - @normalized_user = begin - if normalized_scheme =~ /https?/ && self.user.strip.empty? && - (!self.password || self.password.strip.empty?) - nil - else - Addressable::URI.normalize_component( - self.user.strip, - Addressable::URI::NormalizeCharacterClasses::UNRESERVED - ) - end - end - # All normalized values should be UTF-8 - force_utf8_encoding_if_needed(@normalized_user) - @normalized_user - end - - ## - # Sets the user component for this URI. - # - # @param [String, #to_str] new_user The new user component. - def user=(new_user) - if new_user && !new_user.respond_to?(:to_str) - raise TypeError, "Can't convert #{new_user.class} into String." - end - @user = new_user ? new_user.to_str : nil - - # You can't have a nil user with a non-nil password - if password != nil - @user = EMPTY_STR unless user - end - - # Reset dependent values - @userinfo = nil - @normalized_userinfo = NONE - @authority = nil - @normalized_user = NONE - @normalized_password = NONE - remove_composite_values - - # Ensure we haven't created an invalid URI - validate() - end - - ## - # The password component for this URI. - # - # @return [String] The password component. - attr_reader :password - - ## - # The password component for this URI, normalized. - # - # @return [String] The password component, normalized. - def normalized_password - return nil unless self.password - return @normalized_password unless @normalized_password == NONE - @normalized_password = begin - if self.normalized_scheme =~ /https?/ && self.password.strip.empty? && - (!self.user || self.user.strip.empty?) - nil - else - Addressable::URI.normalize_component( - self.password.strip, - Addressable::URI::NormalizeCharacterClasses::UNRESERVED - ) - end - end - # All normalized values should be UTF-8 - force_utf8_encoding_if_needed(@normalized_password) - @normalized_password - end - - ## - # Sets the password component for this URI. - # - # @param [String, #to_str] new_password The new password component. - def password=(new_password) - if new_password && !new_password.respond_to?(:to_str) - raise TypeError, "Can't convert #{new_password.class} into String." - end - @password = new_password ? new_password.to_str : nil - - # You can't have a nil user with a non-nil password - if @password != nil - self.user = EMPTY_STR if user.nil? - end - - # Reset dependent values - @userinfo = nil - @normalized_userinfo = NONE - @authority = nil - @normalized_password = NONE - @normalized_user = NONE - remove_composite_values - - # Ensure we haven't created an invalid URI - validate() - end - - ## - # The userinfo component for this URI. - # Combines the user and password components. - # - # @return [String] The userinfo component. - def userinfo - current_user = self.user - current_password = self.password - (current_user || current_password) && @userinfo ||= begin - if current_user && current_password - "#{current_user}:#{current_password}" - elsif current_user && !current_password - "#{current_user}" - end - end - end - - ## - # The userinfo component for this URI, normalized. - # - # @return [String] The userinfo component, normalized. - def normalized_userinfo - return nil unless self.userinfo - return @normalized_userinfo unless @normalized_userinfo == NONE - @normalized_userinfo = begin - current_user = self.normalized_user - current_password = self.normalized_password - if !current_user && !current_password - nil - elsif current_user && current_password - "#{current_user}:#{current_password}".dup - elsif current_user && !current_password - "#{current_user}".dup - end - end - # All normalized values should be UTF-8 - force_utf8_encoding_if_needed(@normalized_userinfo) - @normalized_userinfo - end - - ## - # Sets the userinfo component for this URI. - # - # @param [String, #to_str] new_userinfo The new userinfo component. - def userinfo=(new_userinfo) - if new_userinfo && !new_userinfo.respond_to?(:to_str) - raise TypeError, "Can't convert #{new_userinfo.class} into String." - end - new_user, new_password = if new_userinfo - [ - new_userinfo.to_str.strip[/^(.*):/, 1], - new_userinfo.to_str.strip[/:(.*)$/, 1] - ] - else - [nil, nil] - end - - # Password assigned first to ensure validity in case of nil - self.password = new_password - self.user = new_user - - # Reset dependent values - @authority = nil - remove_composite_values - - # Ensure we haven't created an invalid URI - validate() - end - - ## - # The host component for this URI. - # - # @return [String] The host component. - attr_reader :host - - ## - # The host component for this URI, normalized. - # - # @return [String] The host component, normalized. - def normalized_host - return nil unless self.host - - @normalized_host ||= begin - if !self.host.strip.empty? - result = ::Addressable::IDNA.to_ascii( - URI.unencode_component(self.host.strip.downcase) - ) - if result =~ /[^\.]\.$/ - # Single trailing dots are unnecessary. - result = result[0...-1] - end - result = Addressable::URI.normalize_component( - result, - NormalizeCharacterClasses::HOST - ) - result - else - EMPTY_STR.dup - end - end - # All normalized values should be UTF-8 - force_utf8_encoding_if_needed(@normalized_host) - @normalized_host - end - - ## - # Sets the host component for this URI. - # - # @param [String, #to_str] new_host The new host component. - def host=(new_host) - if new_host && !new_host.respond_to?(:to_str) - raise TypeError, "Can't convert #{new_host.class} into String." - end - @host = new_host ? new_host.to_str : nil - - # Reset dependent values - @authority = nil - @normalized_host = nil - remove_composite_values - - # Ensure we haven't created an invalid URI - validate() - end - - ## - # This method is same as URI::Generic#host except - # brackets for IPv6 (and 'IPvFuture') addresses are removed. - # - # @see Addressable::URI#host - # - # @return [String] The hostname for this URI. - def hostname - v = self.host - /\A\[(.*)\]\z/ =~ v ? $1 : v - end - - ## - # This method is same as URI::Generic#host= except - # the argument can be a bare IPv6 address (or 'IPvFuture'). - # - # @see Addressable::URI#host= - # - # @param [String, #to_str] new_hostname The new hostname for this URI. - def hostname=(new_hostname) - if new_hostname && - (new_hostname.respond_to?(:ipv4?) || new_hostname.respond_to?(:ipv6?)) - new_hostname = new_hostname.to_s - elsif new_hostname && !new_hostname.respond_to?(:to_str) - raise TypeError, "Can't convert #{new_hostname.class} into String." - end - v = new_hostname ? new_hostname.to_str : nil - v = "[#{v}]" if /\A\[.*\]\z/ !~ v && /:/ =~ v - self.host = v - end - - ## - # Returns the top-level domain for this host. - # - # @example - # Addressable::URI.parse("http://www.example.co.uk").tld # => "co.uk" - def tld - PublicSuffix.parse(self.host, ignore_private: true).tld - end - - ## - # Sets the top-level domain for this URI. - # - # @param [String, #to_str] new_tld The new top-level domain. - def tld=(new_tld) - replaced_tld = host.sub(/#{tld}\z/, new_tld) - self.host = PublicSuffix::Domain.new(replaced_tld).to_s - end - - ## - # Returns the public suffix domain for this host. - # - # @example - # Addressable::URI.parse("http://www.example.co.uk").domain # => "example.co.uk" - def domain - PublicSuffix.domain(self.host, ignore_private: true) - end - - ## - # The authority component for this URI. - # Combines the user, password, host, and port components. - # - # @return [String] The authority component. - def authority - self.host && @authority ||= begin - authority = String.new - if self.userinfo != nil - authority << "#{self.userinfo}@" - end - authority << self.host - if self.port != nil - authority << ":#{self.port}" - end - authority - end - end - - ## - # The authority component for this URI, normalized. - # - # @return [String] The authority component, normalized. - def normalized_authority - return nil unless self.authority - @normalized_authority ||= begin - authority = String.new - if self.normalized_userinfo != nil - authority << "#{self.normalized_userinfo}@" - end - authority << self.normalized_host - if self.normalized_port != nil - authority << ":#{self.normalized_port}" - end - authority - end - # All normalized values should be UTF-8 - force_utf8_encoding_if_needed(@normalized_authority) - @normalized_authority - end - - ## - # Sets the authority component for this URI. - # - # @param [String, #to_str] new_authority The new authority component. - def authority=(new_authority) - if new_authority - if !new_authority.respond_to?(:to_str) - raise TypeError, "Can't convert #{new_authority.class} into String." - end - new_authority = new_authority.to_str - new_userinfo = new_authority[/^([^\[\]]*)@/, 1] - if new_userinfo - new_user = new_userinfo.strip[/^([^:]*):?/, 1] - new_password = new_userinfo.strip[/:(.*)$/, 1] - end - new_host = new_authority.sub( - /^([^\[\]]*)@/, EMPTY_STR - ).sub( - /:([^:@\[\]]*?)$/, EMPTY_STR - ) - new_port = - new_authority[/:([^:@\[\]]*?)$/, 1] - end - - # Password assigned first to ensure validity in case of nil - self.password = new_password - self.user = new_user - self.host = new_host - self.port = new_port - - # Reset dependent values - @userinfo = nil - @normalized_userinfo = NONE - remove_composite_values - - # Ensure we haven't created an invalid URI - validate() - end - - ## - # The origin for this URI, serialized to ASCII, as per - # RFC 6454, section 6.2. - # - # @return [String] The serialized origin. - def origin - if self.scheme && self.authority - if self.normalized_port - "#{self.normalized_scheme}://#{self.normalized_host}" + - ":#{self.normalized_port}" - else - "#{self.normalized_scheme}://#{self.normalized_host}" - end - else - "null" - end - end - - ## - # Sets the origin for this URI, serialized to ASCII, as per - # RFC 6454, section 6.2. This assignment will reset the `userinfo` - # component. - # - # @param [String, #to_str] new_origin The new origin component. - def origin=(new_origin) - if new_origin - if !new_origin.respond_to?(:to_str) - raise TypeError, "Can't convert #{new_origin.class} into String." - end - new_origin = new_origin.to_str - new_scheme = new_origin[/^([^:\/?#]+):\/\//, 1] - unless new_scheme - raise InvalidURIError, 'An origin cannot omit the scheme.' - end - new_host = new_origin[/:\/\/([^\/?#:]+)/, 1] - unless new_host - raise InvalidURIError, 'An origin cannot omit the host.' - end - new_port = new_origin[/:([^:@\[\]\/]*?)$/, 1] - # An empty port is the same as no port (Section 3.2.3 of RFC 3986). - if new_port == EMPTY_STR && new_origin =~ /\A[^:\/?#]+:\/\/[^\/?#:@\[\]]+:\z/ - new_port = nil - end - end - - self.scheme = new_scheme - self.host = new_host - self.port = new_port - self.userinfo = nil - - # Reset dependent values - @userinfo = nil - @normalized_userinfo = NONE - @authority = nil - @normalized_authority = nil - remove_composite_values - - # Ensure we haven't created an invalid URI - validate() - end - - # Returns an array of known ip-based schemes. These schemes typically - # use a similar URI form: - # //:@:/ - def self.ip_based_schemes - return self.port_mapping.keys - end - - # Returns a hash of common IP-based schemes and their default port - # numbers. Adding new schemes to this hash, as necessary, will allow - # for better URI normalization. - def self.port_mapping - PORT_MAPPING - end - - ## - # The port component for this URI. - # This is the port number actually given in the URI. This does not - # infer port numbers from default values. - # - # @return [Integer] The port component. - attr_reader :port - - ## - # The port component for this URI, normalized. - # - # @return [Integer] The port component, normalized. - def normalized_port - return nil unless self.port - return @normalized_port unless @normalized_port == NONE - @normalized_port = begin - if URI.port_mapping[self.normalized_scheme] == self.port - nil - else - self.port - end - end - end - - ## - # Sets the port component for this URI. - # - # @param [String, Integer, #to_s] new_port The new port component. - def port=(new_port) - if new_port != nil && new_port.respond_to?(:to_str) - new_port = Addressable::URI.unencode_component(new_port.to_str) - end - - if new_port.respond_to?(:valid_encoding?) && !new_port.valid_encoding? - raise InvalidURIError, "Invalid encoding in port" - end - - if new_port != nil && !(new_port.to_s =~ /^\d+$/) - raise InvalidURIError, - "Invalid port number: #{new_port.inspect}" - end - - @port = new_port.to_s.to_i - @port = nil if @port == 0 - - # Reset dependent values - @authority = nil - @normalized_port = NONE - remove_composite_values - - # Ensure we haven't created an invalid URI - validate() - end - - ## - # The inferred port component for this URI. - # This method will normalize to the default port for the URI's scheme if - # the port isn't explicitly specified in the URI. - # - # @return [Integer] The inferred port component. - def inferred_port - if self.port.to_i == 0 - self.default_port - else - self.port.to_i - end - end - - ## - # The default port for this URI's scheme. - # This method will always returns the default port for the URI's scheme - # regardless of the presence of an explicit port in the URI. - # - # @return [Integer] The default port. - def default_port - URI.port_mapping[self.scheme.strip.downcase] if self.scheme - end - - ## - # The combination of components that represent a site. - # Combines the scheme, user, password, host, and port components. - # Primarily useful for HTTP and HTTPS. - # - # For example, "http://example.com/path?query" would have a - # site value of "http://example.com". - # - # @return [String] The components that identify a site. - def site - (self.scheme || self.authority) && @site ||= begin - site_string = "".dup - site_string << "#{self.scheme}:" if self.scheme != nil - site_string << "//#{self.authority}" if self.authority != nil - site_string - end - end - - ## - # The normalized combination of components that represent a site. - # Combines the scheme, user, password, host, and port components. - # Primarily useful for HTTP and HTTPS. - # - # For example, "http://example.com/path?query" would have a - # site value of "http://example.com". - # - # @return [String] The normalized components that identify a site. - def normalized_site - return nil unless self.site - @normalized_site ||= begin - site_string = "".dup - if self.normalized_scheme != nil - site_string << "#{self.normalized_scheme}:" - end - if self.normalized_authority != nil - site_string << "//#{self.normalized_authority}" - end - site_string - end - # All normalized values should be UTF-8 - force_utf8_encoding_if_needed(@normalized_site) - @normalized_site - end - - ## - # Sets the site value for this URI. - # - # @param [String, #to_str] new_site The new site value. - def site=(new_site) - if new_site - if !new_site.respond_to?(:to_str) - raise TypeError, "Can't convert #{new_site.class} into String." - end - new_site = new_site.to_str - # These two regular expressions derived from the primary parsing - # expression - self.scheme = new_site[/^(?:([^:\/?#]+):)?(?:\/\/(?:[^\/?#]*))?$/, 1] - self.authority = new_site[ - /^(?:(?:[^:\/?#]+):)?(?:\/\/([^\/?#]*))?$/, 1 - ] - else - self.scheme = nil - self.authority = nil - end - end - - ## - # The path component for this URI. - # - # @return [String] The path component. - attr_reader :path - - NORMPATH = /^(?!\/)[^\/:]*:.*$/ - ## - # The path component for this URI, normalized. - # - # @return [String] The path component, normalized. - def normalized_path - @normalized_path ||= begin - path = self.path.to_s - if self.scheme == nil && path =~ NORMPATH - # Relative paths with colons in the first segment are ambiguous. - path = path.sub(":", "%2F") - end - # String#split(delimiter, -1) uses the more strict splitting behavior - # found by default in Python. - result = path.strip.split(SLASH, -1).map do |segment| - Addressable::URI.normalize_component( - segment, - Addressable::URI::NormalizeCharacterClasses::PCHAR - ) - end.join(SLASH) - - result = URI.normalize_path(result) - if result.empty? && - ["http", "https", "ftp", "tftp"].include?(self.normalized_scheme) - result = SLASH.dup - end - result - end - # All normalized values should be UTF-8 - force_utf8_encoding_if_needed(@normalized_path) - @normalized_path - end - - ## - # Sets the path component for this URI. - # - # @param [String, #to_str] new_path The new path component. - def path=(new_path) - if new_path && !new_path.respond_to?(:to_str) - raise TypeError, "Can't convert #{new_path.class} into String." - end - @path = (new_path || EMPTY_STR).to_str - if !@path.empty? && @path[0..0] != SLASH && host != nil - @path = "/#{@path}" - end - - # Reset dependent values - @normalized_path = nil - remove_composite_values - - # Ensure we haven't created an invalid URI - validate() - end - - ## - # The basename, if any, of the file in the path component. - # - # @return [String] The path's basename. - def basename - # Path cannot be nil - return File.basename(self.path).sub(/;[^\/]*$/, EMPTY_STR) - end - - ## - # The extname, if any, of the file in the path component. - # Empty string if there is no extension. - # - # @return [String] The path's extname. - def extname - return nil unless self.path - return File.extname(self.basename) - end - - ## - # The query component for this URI. - # - # @return [String] The query component. - attr_reader :query - - ## - # The query component for this URI, normalized. - # - # @return [String] The query component, normalized. - def normalized_query(*flags) - return nil unless self.query - return @normalized_query if flags.empty? && @normalized_query != NONE - normalized_query = begin - pairs = (query || "").split("&", -1) - pairs.delete_if(&:empty?).uniq! if flags.include?(:compacted) - pairs.sort! if flags.include?(:sorted) - component = pairs.map do |pair| - Addressable::URI.normalize_component( - pair, - Addressable::URI::NormalizeCharacterClasses::QUERY, - "+" - ) - end.join("&") - component == "" ? nil : component - end - # All normalized values should be UTF-8 - force_utf8_encoding_if_needed(normalized_query) - @normalized_query = normalized_query if flags.empty? - normalized_query - end - - ## - # Sets the query component for this URI. - # - # @param [String, #to_str] new_query The new query component. - def query=(new_query) - if new_query && !new_query.respond_to?(:to_str) - raise TypeError, "Can't convert #{new_query.class} into String." - end - @query = new_query ? new_query.to_str : nil - - # Reset dependent values - @normalized_query = NONE - remove_composite_values - end - - ## - # Converts the query component to a Hash value. - # - # @param [Class] return_type The return type desired. Value must be either - # `Hash` or `Array`. - # - # @return [Hash, Array, nil] The query string parsed as a Hash or Array - # or nil if the query string is blank. - # - # @example - # Addressable::URI.parse("?one=1&two=2&three=3").query_values - # #=> {"one" => "1", "two" => "2", "three" => "3"} - # Addressable::URI.parse("?one=two&one=three").query_values(Array) - # #=> [["one", "two"], ["one", "three"]] - # Addressable::URI.parse("?one=two&one=three").query_values(Hash) - # #=> {"one" => "three"} - # Addressable::URI.parse("?").query_values - # #=> {} - # Addressable::URI.parse("").query_values - # #=> nil - def query_values(return_type=Hash) - empty_accumulator = Array == return_type ? [] : {} - if return_type != Hash && return_type != Array - raise ArgumentError, "Invalid return type. Must be Hash or Array." - end - return nil if self.query == nil - split_query = self.query.split("&").map do |pair| - pair.split("=", 2) if pair && !pair.empty? - end.compact - return split_query.inject(empty_accumulator.dup) do |accu, pair| - # I'd rather use key/value identifiers instead of array lookups, - # but in this case I really want to maintain the exact pair structure, - # so it's best to make all changes in-place. - pair[0] = URI.unencode_component(pair[0]) - if pair[1].respond_to?(:to_str) - value = pair[1].to_str - # I loathe the fact that I have to do this. Stupid HTML 4.01. - # Treating '+' as a space was just an unbelievably bad idea. - # There was nothing wrong with '%20'! - # If it ain't broke, don't fix it! - value = value.tr("+", " ") if ["http", "https", nil].include?(scheme) - pair[1] = URI.unencode_component(value) - end - if return_type == Hash - accu[pair[0]] = pair[1] - else - accu << pair - end - accu - end - end - - ## - # Sets the query component for this URI from a Hash object. - # An empty Hash or Array will result in an empty query string. - # - # @param [Hash, #to_hash, Array] new_query_values The new query values. - # - # @example - # uri.query_values = {:a => "a", :b => ["c", "d", "e"]} - # uri.query - # # => "a=a&b=c&b=d&b=e" - # uri.query_values = [['a', 'a'], ['b', 'c'], ['b', 'd'], ['b', 'e']] - # uri.query - # # => "a=a&b=c&b=d&b=e" - # uri.query_values = [['a', 'a'], ['b', ['c', 'd', 'e']]] - # uri.query - # # => "a=a&b=c&b=d&b=e" - # uri.query_values = [['flag'], ['key', 'value']] - # uri.query - # # => "flag&key=value" - def query_values=(new_query_values) - if new_query_values == nil - self.query = nil - return nil - end - - if !new_query_values.is_a?(Array) - if !new_query_values.respond_to?(:to_hash) - raise TypeError, - "Can't convert #{new_query_values.class} into Hash." - end - new_query_values = new_query_values.to_hash - new_query_values = new_query_values.map do |key, value| - key = key.to_s if key.kind_of?(Symbol) - [key, value] - end - # Useful default for OAuth and caching. - # Only to be used for non-Array inputs. Arrays should preserve order. - new_query_values.sort! - end - - # new_query_values have form [['key1', 'value1'], ['key2', 'value2']] - buffer = "".dup - new_query_values.each do |key, value| - encoded_key = URI.encode_component( - key, CharacterClassesRegexps::UNRESERVED - ) - if value == nil - buffer << "#{encoded_key}&" - elsif value.kind_of?(Array) - value.each do |sub_value| - encoded_value = URI.encode_component( - sub_value, CharacterClassesRegexps::UNRESERVED - ) - buffer << "#{encoded_key}=#{encoded_value}&" - end - else - encoded_value = URI.encode_component( - value, CharacterClassesRegexps::UNRESERVED - ) - buffer << "#{encoded_key}=#{encoded_value}&" - end - end - self.query = buffer.chop - end - - ## - # The HTTP request URI for this URI. This is the path and the - # query string. - # - # @return [String] The request URI required for an HTTP request. - def request_uri - return nil if self.absolute? && self.scheme !~ /^https?$/i - return ( - (!self.path.empty? ? self.path : SLASH) + - (self.query ? "?#{self.query}" : EMPTY_STR) - ) - end - - ## - # Sets the HTTP request URI for this URI. - # - # @param [String, #to_str] new_request_uri The new HTTP request URI. - def request_uri=(new_request_uri) - if !new_request_uri.respond_to?(:to_str) - raise TypeError, "Can't convert #{new_request_uri.class} into String." - end - if self.absolute? && self.scheme !~ /^https?$/i - raise InvalidURIError, - "Cannot set an HTTP request URI for a non-HTTP URI." - end - new_request_uri = new_request_uri.to_str - path_component = new_request_uri[/^([^\?]*)\??(?:.*)$/, 1] - query_component = new_request_uri[/^(?:[^\?]*)\?(.*)$/, 1] - path_component = path_component.to_s - path_component = (!path_component.empty? ? path_component : SLASH) - self.path = path_component - self.query = query_component - - # Reset dependent values - remove_composite_values - end - - ## - # The fragment component for this URI. - # - # @return [String] The fragment component. - attr_reader :fragment - - ## - # The fragment component for this URI, normalized. - # - # @return [String] The fragment component, normalized. - def normalized_fragment - return nil unless self.fragment - return @normalized_fragment unless @normalized_fragment == NONE - @normalized_fragment = begin - component = Addressable::URI.normalize_component( - self.fragment, - Addressable::URI::NormalizeCharacterClasses::FRAGMENT - ) - component == "" ? nil : component - end - # All normalized values should be UTF-8 - force_utf8_encoding_if_needed(@normalized_fragment) - @normalized_fragment - end - - ## - # Sets the fragment component for this URI. - # - # @param [String, #to_str] new_fragment The new fragment component. - def fragment=(new_fragment) - if new_fragment && !new_fragment.respond_to?(:to_str) - raise TypeError, "Can't convert #{new_fragment.class} into String." - end - @fragment = new_fragment ? new_fragment.to_str : nil - - # Reset dependent values - @normalized_fragment = NONE - remove_composite_values - - # Ensure we haven't created an invalid URI - validate() - end - - ## - # Determines if the scheme indicates an IP-based protocol. - # - # @return [TrueClass, FalseClass] - # true if the scheme indicates an IP-based protocol. - # false otherwise. - def ip_based? - if self.scheme - return URI.ip_based_schemes.include?( - self.scheme.strip.downcase) - end - return false - end - - ## - # Determines if the URI is relative. - # - # @return [TrueClass, FalseClass] - # true if the URI is relative. false - # otherwise. - def relative? - return self.scheme.nil? - end - - ## - # Determines if the URI is absolute. - # - # @return [TrueClass, FalseClass] - # true if the URI is absolute. false - # otherwise. - def absolute? - return !relative? - end - - ## - # Joins two URIs together. - # - # @param [String, Addressable::URI, #to_str] The URI to join with. - # - # @return [Addressable::URI] The joined URI. - def join(uri) - if !uri.respond_to?(:to_str) - raise TypeError, "Can't convert #{uri.class} into String." - end - if !uri.kind_of?(URI) - # Otherwise, convert to a String, then parse. - uri = URI.parse(uri.to_str) - end - if uri.to_s.empty? - return self.dup - end - - joined_scheme = nil - joined_user = nil - joined_password = nil - joined_host = nil - joined_port = nil - joined_path = nil - joined_query = nil - joined_fragment = nil - - # Section 5.2.2 of RFC 3986 - if uri.scheme != nil - joined_scheme = uri.scheme - joined_user = uri.user - joined_password = uri.password - joined_host = uri.host - joined_port = uri.port - joined_path = URI.normalize_path(uri.path) - joined_query = uri.query - else - if uri.authority != nil - joined_user = uri.user - joined_password = uri.password - joined_host = uri.host - joined_port = uri.port - joined_path = URI.normalize_path(uri.path) - joined_query = uri.query - else - if uri.path == nil || uri.path.empty? - joined_path = self.path - if uri.query != nil - joined_query = uri.query - else - joined_query = self.query - end - else - if uri.path[0..0] == SLASH - joined_path = URI.normalize_path(uri.path) - else - base_path = self.path.dup - base_path = EMPTY_STR if base_path == nil - base_path = URI.normalize_path(base_path) - - # Section 5.2.3 of RFC 3986 - # - # Removes the right-most path segment from the base path. - if base_path.include?(SLASH) - base_path.sub!(/\/[^\/]+$/, SLASH) - else - base_path = EMPTY_STR - end - - # If the base path is empty and an authority segment has been - # defined, use a base path of SLASH - if base_path.empty? && self.authority != nil - base_path = SLASH - end - - joined_path = URI.normalize_path(base_path + uri.path) - end - joined_query = uri.query - end - joined_user = self.user - joined_password = self.password - joined_host = self.host - joined_port = self.port - end - joined_scheme = self.scheme - end - joined_fragment = uri.fragment - - return self.class.new( - :scheme => joined_scheme, - :user => joined_user, - :password => joined_password, - :host => joined_host, - :port => joined_port, - :path => joined_path, - :query => joined_query, - :fragment => joined_fragment - ) - end - alias_method :+, :join - - ## - # Destructive form of join. - # - # @param [String, Addressable::URI, #to_str] The URI to join with. - # - # @return [Addressable::URI] The joined URI. - # - # @see Addressable::URI#join - def join!(uri) - replace_self(self.join(uri)) - end - - ## - # Merges a URI with a Hash of components. - # This method has different behavior from join. Any - # components present in the hash parameter will override the - # original components. The path component is not treated specially. - # - # @param [Hash, Addressable::URI, #to_hash] The components to merge with. - # - # @return [Addressable::URI] The merged URI. - # - # @see Hash#merge - def merge(hash) - unless hash.respond_to?(:to_hash) - raise TypeError, "Can't convert #{hash.class} into Hash." - end - hash = hash.to_hash - - if hash.has_key?(:authority) - if (hash.keys & [:userinfo, :user, :password, :host, :port]).any? - raise ArgumentError, - "Cannot specify both an authority and any of the components " + - "within the authority." - end - end - if hash.has_key?(:userinfo) - if (hash.keys & [:user, :password]).any? - raise ArgumentError, - "Cannot specify both a userinfo and either the user or password." - end - end - - uri = self.class.new - uri.defer_validation do - # Bunch of crazy logic required because of the composite components - # like userinfo and authority. - uri.scheme = - hash.has_key?(:scheme) ? hash[:scheme] : self.scheme - if hash.has_key?(:authority) - uri.authority = - hash.has_key?(:authority) ? hash[:authority] : self.authority - end - if hash.has_key?(:userinfo) - uri.userinfo = - hash.has_key?(:userinfo) ? hash[:userinfo] : self.userinfo - end - if !hash.has_key?(:userinfo) && !hash.has_key?(:authority) - uri.user = - hash.has_key?(:user) ? hash[:user] : self.user - uri.password = - hash.has_key?(:password) ? hash[:password] : self.password - end - if !hash.has_key?(:authority) - uri.host = - hash.has_key?(:host) ? hash[:host] : self.host - uri.port = - hash.has_key?(:port) ? hash[:port] : self.port - end - uri.path = - hash.has_key?(:path) ? hash[:path] : self.path - uri.query = - hash.has_key?(:query) ? hash[:query] : self.query - uri.fragment = - hash.has_key?(:fragment) ? hash[:fragment] : self.fragment - end - - return uri - end - - ## - # Destructive form of merge. - # - # @param [Hash, Addressable::URI, #to_hash] The components to merge with. - # - # @return [Addressable::URI] The merged URI. - # - # @see Addressable::URI#merge - def merge!(uri) - replace_self(self.merge(uri)) - end - - ## - # Returns the shortest normalized relative form of this URI that uses the - # supplied URI as a base for resolution. Returns an absolute URI if - # necessary. This is effectively the opposite of route_to. - # - # @param [String, Addressable::URI, #to_str] uri The URI to route from. - # - # @return [Addressable::URI] - # The normalized relative URI that is equivalent to the original URI. - def route_from(uri) - uri = URI.parse(uri).normalize - normalized_self = self.normalize - if normalized_self.relative? - raise ArgumentError, "Expected absolute URI, got: #{self.to_s}" - end - if uri.relative? - raise ArgumentError, "Expected absolute URI, got: #{uri.to_s}" - end - if normalized_self == uri - return Addressable::URI.parse("##{normalized_self.fragment}") - end - components = normalized_self.to_hash - if normalized_self.scheme == uri.scheme - components[:scheme] = nil - if normalized_self.authority == uri.authority - components[:user] = nil - components[:password] = nil - components[:host] = nil - components[:port] = nil - if normalized_self.path == uri.path - components[:path] = nil - if normalized_self.query == uri.query - components[:query] = nil - end - else - if uri.path != SLASH and components[:path] - self_splitted_path = split_path(components[:path]) - uri_splitted_path = split_path(uri.path) - self_dir = self_splitted_path.shift - uri_dir = uri_splitted_path.shift - while !self_splitted_path.empty? && !uri_splitted_path.empty? and self_dir == uri_dir - self_dir = self_splitted_path.shift - uri_dir = uri_splitted_path.shift - end - components[:path] = (uri_splitted_path.fill('..') + [self_dir] + self_splitted_path).join(SLASH) - end - end - end - end - # Avoid network-path references. - if components[:host] != nil - components[:scheme] = normalized_self.scheme - end - # A first segment containing a colon would be read as a scheme. - if components[:scheme].nil? && components[:path] && - components[:path][/\A[^\/]*/].include?(":") - components[:path] = "./" + components[:path] - end - return Addressable::URI.new( - :scheme => components[:scheme], - :user => components[:user], - :password => components[:password], - :host => components[:host], - :port => components[:port], - :path => components[:path], - :query => components[:query], - :fragment => components[:fragment] - ) - end - - ## - # Returns the shortest normalized relative form of the supplied URI that - # uses this URI as a base for resolution. Returns an absolute URI if - # necessary. This is effectively the opposite of route_from. - # - # @param [String, Addressable::URI, #to_str] uri The URI to route to. - # - # @return [Addressable::URI] - # The normalized relative URI that is equivalent to the supplied URI. - def route_to(uri) - return URI.parse(uri).route_from(self) - end - - ## - # Returns a normalized URI object. - # - # NOTE: This method does not attempt to fully conform to specifications. - # It exists largely to correct other people's failures to read the - # specifications, and also to deal with caching issues since several - # different URIs may represent the same resource and should not be - # cached multiple times. - # - # @return [Addressable::URI] The normalized URI. - def normalize - # This is a special exception for the frequently misused feed - # URI scheme. - if normalized_scheme == "feed" - if self.to_s =~ /^feed:\/*http:\/*/ - return URI.parse( - self.to_s[/^feed:\/*(http:\/*.*)/, 1] - ).normalize - end - end - - return self.class.new( - :scheme => normalized_scheme, - :authority => normalized_authority, - :path => normalized_path, - :query => normalized_query, - :fragment => normalized_fragment - ) - end - - ## - # Destructively normalizes this URI object. - # - # @return [Addressable::URI] The normalized URI. - # - # @see Addressable::URI#normalize - def normalize! - replace_self(self.normalize) - end - - ## - # Creates a URI suitable for display to users. If semantic attacks are - # likely, the application should try to detect these and warn the user. - # See RFC 3986, - # section 7.6 for more information. - # - # @return [Addressable::URI] A URI suitable for display purposes. - def display_uri - display_uri = self.normalize - display_uri.host = ::Addressable::IDNA.to_unicode(display_uri.host) if display_uri.host - return display_uri - end - - ## - # Returns true if the URI objects are equal. This method - # normalizes both URIs before doing the comparison, and allows comparison - # against Strings. - # - # @param [Object] uri The URI to compare. - # - # @return [TrueClass, FalseClass] - # true if the URIs are equivalent, false - # otherwise. - def ===(uri) - if uri.respond_to?(:normalize) - uri_string = uri.normalize.to_s - else - begin - uri_string = ::Addressable::URI.parse(uri).normalize.to_s - rescue InvalidURIError, TypeError - return false - end - end - return self.normalize.to_s == uri_string - end - - ## - # Returns true if the URI objects are equal. This method - # normalizes both URIs before doing the comparison. - # - # @param [Object] uri The URI to compare. - # - # @return [TrueClass, FalseClass] - # true if the URIs are equivalent, false - # otherwise. - def ==(uri) - return false unless uri.kind_of?(URI) - return self.normalize.to_s == uri.normalize.to_s - end - - ## - # Returns true if the URI objects are equal. This method - # does NOT normalize either URI before doing the comparison. - # - # @param [Object] uri The URI to compare. - # - # @return [TrueClass, FalseClass] - # true if the URIs are equivalent, false - # otherwise. - def eql?(uri) - return false unless uri.kind_of?(URI) - return self.to_s == uri.to_s - end - - ## - # A hash value that will make a URI equivalent to its normalized - # form. - # - # @return [Integer] A hash of the URI. - def hash - @hash ||= self.to_s.hash * -1 - end - - ## - # Clones the URI object. - # - # @return [Addressable::URI] The cloned URI. - def dup - duplicated_uri = self.class.new( - :scheme => self.scheme ? self.scheme.dup : nil, - :user => self.user ? self.user.dup : nil, - :password => self.password ? self.password.dup : nil, - :host => self.host ? self.host.dup : nil, - :port => self.port, - :path => self.path ? self.path.dup : nil, - :query => self.query ? self.query.dup : nil, - :fragment => self.fragment ? self.fragment.dup : nil - ) - return duplicated_uri - end - - ## - # Omits components from a URI. - # - # @param [Symbol] *components The components to be omitted. - # - # @return [Addressable::URI] The URI with components omitted. - # - # @example - # uri = Addressable::URI.parse("http://example.com/path?query") - # #=> # - # uri.omit(:scheme, :authority) - # #=> # - def omit(*components) - invalid_components = components - [ - :scheme, :user, :password, :userinfo, :host, :port, :authority, - :path, :query, :fragment - ] - unless invalid_components.empty? - raise ArgumentError, - "Invalid component names: #{invalid_components.inspect}." - end - duplicated_uri = self.dup - duplicated_uri.defer_validation do - components.each do |component| - duplicated_uri.send((component.to_s + "=").to_sym, nil) - end - duplicated_uri.user = duplicated_uri.normalized_user - end - duplicated_uri - end - - ## - # Destructive form of omit. - # - # @param [Symbol] *components The components to be omitted. - # - # @return [Addressable::URI] The URI with components omitted. - # - # @see Addressable::URI#omit - def omit!(*components) - replace_self(self.omit(*components)) - end - - ## - # Determines if the URI is an empty string. - # - # @return [TrueClass, FalseClass] - # Returns true if empty, false otherwise. - def empty? - return self.to_s.empty? - end - - ## - # Converts the URI to a String. - # - # @return [String] The URI's String representation. - def to_s - if self.scheme == nil && self.path != nil && !self.path.empty? && - self.path =~ NORMPATH - raise InvalidURIError, - "Cannot assemble URI string with ambiguous path: '#{self.path}'" - end - @uri_string ||= begin - uri_string = String.new - uri_string << "#{self.scheme}:" if self.scheme != nil - uri_string << "//#{self.authority}" if self.authority != nil - uri_string << self.path.to_s - uri_string << "?#{self.query}" if self.query != nil - uri_string << "##{self.fragment}" if self.fragment != nil - uri_string.force_encoding(Encoding::UTF_8) - uri_string - end - end - - ## - # URI's are glorified Strings. Allow implicit conversion. - alias_method :to_str, :to_s - - ## - # Returns a Hash of the URI components. - # - # @return [Hash] The URI as a Hash of components. - def to_hash - return { - :scheme => self.scheme, - :user => self.user, - :password => self.password, - :host => self.host, - :port => self.port, - :path => self.path, - :query => self.query, - :fragment => self.fragment - } - end - - ## - # Returns a String representation of the URI object's state. - # - # @return [String] The URI object's state, as a String. - def inspect - sprintf("#<%s:%#0x URI:%s>", self.class.to_s, self.object_id, self.to_s) - end - - ## - # This method allows you to make several changes to a URI simultaneously, - # which separately would cause validation errors, but in conjunction, - # are valid. The URI will be revalidated as soon as the entire block has - # been executed. - # - # @param [Proc] block - # A set of operations to perform on a given URI. - def defer_validation - validation_was_deferred = - !!(defined?(@validation_deferred) && @validation_deferred) - raise LocalJumpError, "No block given." unless block_given? - @validation_deferred = true - yield - @validation_deferred = validation_was_deferred - validate unless validation_was_deferred - ensure - @validation_deferred = validation_was_deferred - end - - def encode_with(coder) - instance_variables.each do |ivar| - value = instance_variable_get(ivar) - if value != NONE - key = ivar.to_s.slice(1..-1) - coder[key] = value - end - end - nil - end - - def init_with(coder) - reset_ivs - coder.map.each do |key, value| - instance_variable_set("@#{key}", value) - end - nil - end - - protected - SELF_REF = '.' - PARENT = '..' - - # Deprecated. No longer used by normalize_path; will be removed in 2.10.0. - RULE_2A = /\/\.\/|\/\.$/ - RULE_2B_2C = /\/([^\/]*)\/\.\.\/|\/([^\/]*)\/\.\.$/ - RULE_2D = /^\.\.?\/?/ - RULE_PREFIXED_PARENT = /^\/\.\.?\/|^(\/\.\.?)+\/?$/ - if respond_to?(:deprecate_constant, true) - deprecate_constant :RULE_2A, :RULE_2B_2C, :RULE_2D, :RULE_PREFIXED_PARENT - end - - ## - # Resolves paths to their simplest form. - # - # @param [String] path The path to normalize. - # - # @return [String] The normalized path. - def self.normalize_path(path) - # Section 5.2.4 of RFC 3986, as a single pass over the segments so that - # the running time is linear in the length of the path. - - return if path.nil? - segments = path.split(SLASH, -1) - return path.dup if segments.empty? - - # The first segment is never removed by a parent reference. For an - # absolute path it is the empty segment before the leading slash. - output = [segments.first] - last = segments.size - 1 - (1..last).each do |index| - segment = segments[index] - if segment == SELF_REF - output << EMPTY_STR if index == last - elsif segment == PARENT - if output.size > 1 - output.pop - output << EMPTY_STR if index == last - else - output << PARENT - end - else - output << segment - end - end - normalized_path = output.join(SLASH) - - # Non-standard, removes prefixed dotted segments from path. At this - # point an absolute path can only start with a single "/..", and a - # relative path keeps its leading dots. - start = 0 - if normalized_path.start_with?(SLASH) - if normalized_path == "/#{PARENT}" - return normalized_path[0, 1] - elsif normalized_path.start_with?("/#{PARENT}/") - start = PARENT.size + 1 - end - else - while normalized_path[start] == SELF_REF - start += 1 - start += 1 if normalized_path[start] == SELF_REF - start += 1 if normalized_path[start] == SLASH - end - end - start.zero? ? normalized_path : normalized_path[start..-1] - end - - ## - # Ensures that the URI is valid. - def validate - return if !!@validation_deferred - if self.scheme != nil && self.ip_based? && - (self.host == nil || self.host.empty?) && - (self.path == nil || self.path.empty?) - raise InvalidURIError, - "Absolute URI missing hierarchical segment: '#{self.to_s}'" - end - if self.host == nil - if self.port != nil || - self.user != nil || - self.password != nil - raise InvalidURIError, "Hostname not supplied: '#{self.to_s}'" - end - end - if self.path != nil && !self.path.empty? && self.path[0..0] != SLASH && - self.authority != nil - raise InvalidURIError, - "Cannot have a relative path with an authority set: '#{self.to_s}'" - end - if self.path != nil && !self.path.empty? && - self.path[0..1] == SLASH + SLASH && self.authority == nil - raise InvalidURIError, - "Cannot have a path with two leading slashes " + - "without an authority set: '#{self.to_s}'" - end - unreserved = CharacterClasses::UNRESERVED - sub_delims = CharacterClasses::SUB_DELIMS - if !self.host.nil? && (self.host =~ /[<>{}\/\\\?\#\@"[[:space:]]]/ || - (self.host[/^\[(.*)\]$/, 1] != nil && self.host[/^\[(.*)\]$/, 1] !~ - Regexp.new("^[#{unreserved}#{sub_delims}:]*$"))) - raise InvalidURIError, "Invalid character in host: '#{self.host.to_s}'" - end - return nil - end - - ## - # Replaces the internal state of self with the specified URI's state. - # Used in destructive operations to avoid massive code repetition. - # - # @param [Addressable::URI] uri The URI to replace self with. - # - # @return [Addressable::URI] self. - def replace_self(uri) - # Reset dependent values - reset_ivs - - @scheme = uri.scheme - @user = uri.user - @password = uri.password - @host = uri.host - @port = uri.port - @path = uri.path - @query = uri.query - @fragment = uri.fragment - return self - end - - ## - # Splits path string with "/" (slash). - # It is considered that there is empty string after last slash when - # path ends with slash. - # - # @param [String] path The path to split. - # - # @return [Array] An array of parts of path. - def split_path(path) - splitted = path.split(SLASH) - splitted << EMPTY_STR if path.end_with? SLASH - splitted - end - - ## - # Resets composite values for the entire URI - # - # @api private - def remove_composite_values - @uri_string = nil - @hash = nil - @site = nil - @normalized_site = nil - @normalized_authority = nil - end - - ## - # Converts the string to be UTF-8 if it is not already UTF-8 - # - # @api private - def force_utf8_encoding_if_needed(str) - if str && str.encoding != Encoding::UTF_8 - str.force_encoding(Encoding::UTF_8) - end - end - - private - - def initialize_copy(other) - super - instance_variables.each do |ivar| - value = instance_variable_get(ivar) - instance_variable_set(ivar, value.dup) if value.kind_of?(String) - end - end - - ## - # Resets instance variables - # - # @api private - def reset_ivs - @site = nil - @normalized_site = nil - @scheme = nil - @user = nil - @normalized_scheme = NONE - @normalized_user = NONE - @uri_string = nil - @hash = nil - @userinfo = nil - @normalized_userinfo = NONE - @authority = nil - @password = nil - @normalized_authority = nil - @port = nil - @normalized_password = NONE - @host = nil - @normalized_host = nil - @normalized_port = NONE - @path = EMPTY_STR - @normalized_path = nil - @normalized_query = NONE - @fragment = nil - @normalized_fragment = NONE - @query = nil - end - - NONE = Module.new.freeze - - private_constant :NONE - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable/version.rb b/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable/version.rb deleted file mode 100644 index 2ec7205..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/addressable-2.9.2/lib/addressable/version.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -#-- -# Copyright (C) Bob Aman -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#++ - - -# Used to prevent the class/module from being loaded more than once -if !defined?(Addressable::VERSION) - module Addressable - module VERSION - MAJOR = 2 - MINOR = 9 - TINY = 2 - - STRING = [MAJOR, MINOR, TINY].join('.') - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/LICENSE.MIT b/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/LICENSE.MIT deleted file mode 100644 index 7c483cf..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/LICENSE.MIT +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2011-2013 Peter Zotov - -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/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/README.YARD.md b/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/README.YARD.md deleted file mode 100644 index d2616c3..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/README.YARD.md +++ /dev/null @@ -1,12 +0,0 @@ -{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. diff --git a/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast.rb b/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast.rb deleted file mode 100644 index 4af060f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast.rb +++ /dev/null @@ -1,17 +0,0 @@ -# {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. -# -module AST - require_relative 'ast/node' - require_relative 'ast/processor' - require_relative 'ast/sexp' -end diff --git a/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast/node.rb b/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast/node.rb deleted file mode 100644 index 9e9341f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast/node.rb +++ /dev/null @@ -1,268 +0,0 @@ -# frozen_string_literal: true - -module AST - # 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. - # - class Node - # Returns the type of this node. - # @return [Symbol] - attr_reader :type - - # 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] - attr_reader :children - alias to_a children - - # Returns the precomputed hash value for this node - # @return [Integer] - attr_reader :hash - - # 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}. - def initialize(type, children=[], properties={}) - @type, @children = type.to_sym, children.to_a.freeze - - assign_properties(properties) - - @hash = [@type, @children, self.class].hash - - freeze - end - - # Test if other object is equal to - # @param [Object] other - # @return [Boolean] - def eql?(other) - self.class.eql?(other.class) && - @type.eql?(other.type) && - @children.eql?(other.children) - end - - # 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] - def assign_properties(properties) - properties.each do |name, value| - instance_variable_set :"@#{name}", value - end - - nil - end - protected :assign_properties - - alias :original_dup :dup - private :original_dup - - # 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 - def dup - self - end - alias :clone :dup - - # 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 [Symbol, nil] type - # @param [Array, nil] children - # @param [Hash, nil] properties - # @return [AST::Node] - def updated(type=nil, children=nil, properties=nil) - new_type = type || @type - new_children = children || @children - new_properties = properties || {} - - if @type == new_type && - @children == new_children && - properties.nil? - self - else - copy = original_dup - copy.send :initialize, new_type, new_children, new_properties - copy - end - end - - # Compares `self` to `other`, possibly converting with `to_ast`. Only - # `type` and `children` are compared; metadata is deliberately ignored. - # - # @return [Boolean] - def ==(other) - if equal?(other) - true - elsif other.respond_to? :to_ast - other = other.to_ast - other.type == self.type && - other.children == self.children - else - false - end - end - - # Concatenates `array` with `children` and returns the resulting node. - # - # @return [AST::Node] - def concat(array) - updated(nil, @children + array.to_a) - end - - alias + concat - - # Appends `element` to `children` and returns the resulting node. - # - # @return [AST::Node] - def append(element) - updated(nil, @children + [element]) - end - - alias << append - - # Converts `self` to a pretty-printed s-expression. - # - # @param [Integer] indent Base indentation level. - # @return [String] - def to_sexp(indent=0) - indented = " " * indent - sexp = "#{indented}(#{fancy_type}" - - children.each do |child| - if child.is_a?(Node) - sexp += "\n#{child.to_sexp(indent + 1)}" - else - sexp += " #{child.inspect}" - end - end - - sexp += ")" - - sexp - end - - alias to_s to_sexp - - # Converts `self` to a s-expression ruby string. - # The code return will recreate the node, using the sexp module s() - # - # @param [Integer] indent Base indentation level. - # @return [String] - def inspect(indent=0) - indented = " " * indent - sexp = "#{indented}s(:#{@type}" - - children.each do |child| - if child.is_a?(Node) - sexp += ",\n#{child.inspect(indent + 1)}" - else - sexp += ", #{child.inspect}" - end - end - - sexp += ")" - - sexp - end - - # @return [AST::Node] self - def to_ast - self - 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] - def to_sexp_array - children_sexp_arrs = children.map do |child| - if child.is_a?(Node) - child.to_sexp_array - else - child - end - end - - [type, *children_sexp_arrs] - end - - # Enables matching for Node, where type is the first element - # and the children are remaining items. - # - # @return [Array] - def deconstruct - [type, *children] - end - - protected - - # 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] - def fancy_type - @type.to_s.gsub('_', '-') - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast/processor.rb b/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast/processor.rb deleted file mode 100644 index 622e779..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast/processor.rb +++ /dev/null @@ -1,12 +0,0 @@ -module AST - # 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. - class Processor - require_relative 'processor/mixin' - include Mixin - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast/processor/mixin.rb b/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast/processor/mixin.rb deleted file mode 100644 index 6febec8..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast/processor/mixin.rb +++ /dev/null @@ -1,288 +0,0 @@ -module AST - class Processor - # 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. - module Mixin - # 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 [AST::Node, nil] node - # @return [AST::Node, nil] - def process(node) - return if node.nil? - - node = node.to_ast - - # Invoke a specific handler - on_handler = :"on_#{node.type}" - if respond_to? on_handler - new_node = send on_handler, node - else - new_node = handler_missing(node) - end - - node = new_node if new_node - - node - end - - # {#process}es each node from `nodes` and returns an array of - # results. - # - # @param [Array] nodes - # @return [Array] - def process_all(nodes) - nodes.to_a.map do |node| - process node - end - end - - # Default handler. Does nothing. - # - # @param [AST::Node] node - # @return [AST::Node, nil] - def handler_missing(node) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast/sexp.rb b/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast/sexp.rb deleted file mode 100644 index fa8a63d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/ast-2.4.3/lib/ast/sexp.rb +++ /dev/null @@ -1,30 +0,0 @@ -module AST - # 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. - module 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. - def s(type, *children) - Node.new(type, children) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/best-practices.md b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/best-practices.md deleted file mode 100644 index b895189..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/best-practices.md +++ /dev/null @@ -1,209 +0,0 @@ -# Best Practices - -This guide gives an overview of best practices for using Async. - -## Use a top-level `Sync` to denote the root of your program - -`Async{}` has two uses: it creates an event loop if one doesn't exist, and it creates a task which runs asynchronously with respect to the parent scope. However, the top level `Async{}` block will be synchronous because it creates the event loop. In some programs, you do not care about executing asynchronously, but you still want your code to run in an event loop. `Sync{}` exists to do this efficiently. - -```ruby -require "async" - -class Packages - def initialize(urls) - @urls = urls - end - - def fetch - # A common use case is to make functions which appear synchronous, but internally use asynchronous execution: - Sync do |task| - @urls.map do |url| - task.async do - fetch(url) - end - end.map(&:wait) - end - end -end -``` - -`Sync{...}` is semantically equivalent to `Async{}.wait`, but it is more efficient. It is the preferred way to run code in an event loop at the top level of your program or to ensure some code runs in an event loop without creating a new task. The name `Sync` means "Synchronous Async", indicating that it runs synchronously with respect to the outer scope, but still allows for asynchronous execution within it. - -### Current Task - -In some scenarios, it can be invalid to call a method outside of an event loop, for example a top level `Async{...}` can block forever, which might be unexpected. - -```ruby -def wait(queue) - Async do - queue.pop - end -end -``` - -You can force callers of a method to only call the method within an asynchronous context by using a keyword argument `parent: Async::Task.current`. If no task is present, this will raise an exception. - -```ruby -def wait(queue, parent: Async::Task.current) - parent.async do - queue.pop - end -end -``` - -This expresses the intent to the caller that this method should only be invoked from within an asynchonous task. In addition, it allows the caller to substitute other parent objects, like semaphores or barriers, which can be useful for managing concurrency. - -## Use barriers to manage unbounded concurrency - -Barriers provide a way to manage an unbounded number of tasks. The top-level `Barrier` method creates a barrier with built-in load management using an `Async::Idler`. - -```ruby -Barrier do |barrier| - items.each do |item| - barrier.async do - process(item) - end - end -end -``` - -The barrier will automatically wait for all tasks to complete and stop any outstanding tasks when the block exits. By default, it uses an `Async::Idler` to prevent system overload by scheduling tasks when the system load is below 80%. - -If you want to process tasks in order of completion, you can explicitly call `wait` with a block: - -```ruby -Barrier do |barrier| - items.each do |item| - barrier.async do - process(item) - end - end - - # Process the tasks in order of completion: - barrier.wait do |task| - result = task.wait - # Do something with result. - - # If you don't want to wait for any more tasks you can break: - break - end -end -``` - -To disable load management (not recommended for unbounded concurrency), you can pass `parent: nil`: - -```ruby -Barrier(parent: nil) do |barrier| - # No load management - creates tasks as fast as possible - items.each do |item| - barrier.async do - process(item) - end - end -end -``` - -## Use a semaphore to limit the number of concurrent tasks - -Semaphores allow you to limit the level of concurrency to a fixed number of tasks. When using semaphores with barriers, the barrier should be the root of your task hierarchy, and the semaphore should be a child of the barrier: - -```ruby -Barrier(parent: nil) do |barrier| - semaphore = Async::Semaphore.new(4, parent: barrier) - - items.each do |item| - semaphore.async do - process(item) - end - end -end -``` - -In this example, we use `parent: nil` for the barrier to disable load management, since the semaphore already provides concurrency control. The semaphore limits execution to 4 concurrent tasks, and the barrier ensures all tasks are stopped when the block exits. - -### Idler - -Idlers are like semaphores but with a limit defined by current processor utilization. In other words, an idler will schedule work up to a specific ratio of idle/busy time in the scheduler. - -The top-level `Barrier` method uses an idler by default, making it safe for unbounded concurrency: - -```ruby -Barrier do |barrier| # Uses Async::Idler.new(0.8) by default - work.each do |work| - barrier.async do - work.call - end - end -end -``` - -You can also use an idler directly without a barrier: - -```ruby -Async do - # Create an idler that will aim for a load average of 80%: - idler = Async::Idler.new(0.8) - - # Some list of work to be done: - work.each do |work| - idler.async do - # Do the work: - work.call - end - end -end -``` - -The idler will try to schedule as much work such that the load of the scheduler stays at around 80% saturation. - -## Use queues to share data between tasks - -Queues allow you to share data between tasks without the risk of data corruption or deadlocks. - -```ruby -Async do |task| - queue = Async::Queue.new - - reader = task.async do - while chunk = socket.gets - queue.push(chunk) - end - - # After this point, we won't be able to add items to the queue, and popping items will eventually result in nil once all items are dequeued: - queue.close - end - - # Process items from the queue: - while line = queue.pop - process(line) - end -end -``` - -The above program may have unbounded memory use, so it can be a good idea to use a limited queue with back-pressure: - -```ruby -Async do |task| - queue = Async::LimitedQueue.new(8) - - # Everything else is the same from the queue example, except that the pushing onto the queue will block once 8 items are buffered. -end -``` - -## Use timeouts for operations that might block forever - -General timeouts can be imposed by using `task.with_timeout(duration)`. - -```ruby -Async do |task| - # This will raise an Async::TimeoutError after 1 second: - task.with_timeout(1) do |timeout| - # Timeout#duration= can be used to adjust the duration of the timeout. - # Timeout#cancel can be used to cancel the timeout completely. - - sleep 10 - end -end -``` - -It can be especially important to impose timeouts when processing user-provided data. diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/debugging.md b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/debugging.md deleted file mode 100644 index acea3d6..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/debugging.md +++ /dev/null @@ -1,63 +0,0 @@ -# Debugging - -This guide explains how to debug issues with programs that use Async. - -## Debugging Techniques - -### Debugging with `puts` - -The simplest way to debug an Async program is to use `puts` to print messages to the console. This is useful for understanding the flow of your program and the values of variables. However, it can be difficult to use `puts` to debug programs that use asynchronous code, as the output may be interleaved. To prevent this, wrap it in `Fiber.blocking{}`: - -```ruby -require "async" - -Async do - 3.times do |i| - sleep i - Fiber.blocking{puts "Slept for #{i} seconds."} - end -end -``` - -Using `Fiber.blocking{}` prevents any context switching until the block is complete, ensuring that the output is not interleaved and that flow control is strictly sequential. You should not use `Fiber.blocking{}` in production code, as it will block the reactor. - -### Debugging with IRB - -You can use IRB to debug your Async program. In some cases, you will want to stop the world and inspect the state of your program. You can do this by wrapping `binding.irb` inside a `Fiber.blocking{}` block: - -```ruby -Async do - 3.times do |i| - sleep i - # The event loop will stop at this point and you can inspect the state of your program. - Fiber.blocking{binding.irb} - end -end -``` - -If you don't use `Fiber.blocking{}`, the event loop will continue to run and you will end up with three instances of `binding.irb` running. - -### Debugging with `Async::Debug` - -The `async-debug` gem provides a visual debugger for Async programs. It is a powerful tool that allows you to inspect the state of your program and see the hierarchy of your program: - -```ruby -require "async" -require "async/debug" - -Sync do - debugger = Async::Debug.serve - - 3.times do - Async do |task| - while true - duration = rand - task.annotate("Sleeping for #{duration} second...") - sleep(duration) - end - end - end -end -``` - -When you run this program, it will start a web server on `http://localhost:9000`. You can open this URL in your browser to see the state of your program. diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/getting-started.md b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/getting-started.md deleted file mode 100644 index c2c2b33..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/getting-started.md +++ /dev/null @@ -1,213 +0,0 @@ -# Getting Started - -This guide shows how to add async to your project and run code asynchronously. - -Async is a Ruby library that provides asynchronous programming capabilities using fibers and a fiber scheduler. It allows you to write non-blocking, concurrent code that's easy to understand and maintain. - -## Installation - -Add the gem to your project: - -~~~ bash -$ bundle add async -~~~ - -## Core Concepts - -`async` has several core concepts: - -- A {ruby Async::Task} instance which captures your sequential computations. -- A {ruby Async::Reactor} instance which implements the fiber scheduler interface and event loop. -- A {ruby Fiber} is an object which executes user code with cooperative concurrency, i.e. you can transfer execution from one fiber to another and back again. - -### What is a scheduler? - -A scheduler is an interface which manages the execution of fibers. It is responsible for intercepting blocking operations and redirecting them to an event loop. - -### What is an event loop? - -An event loop is part of the implementation of a scheduler which is responsible for waiting for events to occur, and waking up fibers when they are ready to run. - -### What is a selector? - -A selector is part of the implementation of an event loop which is responsible for interacting with the operating system and waiting for specific events to occur. This is often referred to as "select"ing ready events from a set of file descriptors, but in practice has expanded to encompass a wide range of blocking operations. - -### What is a reactor? - -A reactor is a specific implementation of the scheduler interface, which includes an event loop and selector, and is responsible for managing the execution of fibers. - -## Creating an Asynchronous Task - -The main entry point for creating tasks is the {ruby Kernel#Async} method. Because this method is defined on `Kernel`, it's available in all parts of your program. - -~~~ ruby -require 'async' - -Async do |task| - puts "Hello World!" -end -~~~ - -A {ruby Async::Task} runs using a {ruby Fiber} and blocking operations e.g. `sleep`, `read`, `write` yield control until the operation can complete. When a blocking operation yields control, it means another fiber can execute, giving the illusion of simultaneous execution. - -### When should I use `Async`? - -You should use `Async` when you desire explicit concurrency in your program. That means you want to run multiple tasks at the same time, and you want to be able to wait for the results of those tasks. - -- You should use `Async` when you want to perform network operations concurrently, such as HTTP requests or database queries. -- You should use `Async` when you want to process independent requests concurrently, such as a web server. -- You should use `Async` when you want to handle multiple connections concurrently, such as a chat server. - -You should consider the boundary around your program and the request handling. For example, one task per operation, request or connection, is usually appropriate. - -### Waiting for Results - -Similar to a promise, {ruby Async::Task} produces results. In order to wait for these results, you must invoke {ruby Async::Task#wait}: - -``` ruby -require "async" - -task = Async do - rand -end - -puts "The number was: #{task.wait}" -``` - -### Comparing `Async` and `Sync` - -If you are familiar with JavaScript's `async`/`await`, `Async{...}` is similar to calling an asynchronous function: it starts the work and returns a promise-like {ruby Async::Task} that you can wait on later. - -```ruby -task = Async do - bar -end - -task.wait # Returns the value of bar. -``` - -This is similar to JavaScript code that keeps the promise: - -```javascript -const promise = bar(); - -await promise; // Returns the value of bar. -``` - -`Sync{...}` is similar to immediately awaiting that work: it runs the block in an event loop and returns the block's value directly. - -```ruby -result = Sync do - bar -end -``` - -This is similar to: - -```javascript -const result = await bar(); -``` - -The main difference is that JavaScript starts with an event loop already available, while Ruby code needs one to be provided by a fiber scheduler. `Sync{...}` is the usual way to create or reuse that event loop when the caller wants a direct return value instead of a task. - -## Creating a Fiber Scheduler - -The first (top level) async block will also create an instance of {ruby Async::Reactor} which is a subclass of {ruby Async::Scheduler} to handle the event loop. You can also do this directly using {ruby Fiber.set_scheduler}: - -~~~ ruby -require 'async/scheduler' - -scheduler = Async::Scheduler.new -Fiber.set_scheduler(scheduler) - -Fiber.schedule do - 1.upto(3) do |i| - Fiber.schedule do - sleep 1 - puts "Hello World" - end - end -end -~~~ - -## Synchronous Execution in an existing Fiber Scheduler - -Unless you need fan-out, map-reduce style concurrency, you can actually use a slightly more efficient {ruby Kernel::Sync} execution model. This method will run your block in the current event loop if one exists, or create an event loop if not. You can use it for code which uses asynchronous primitives, but itself does not need to be asynchronous with respect to other tasks. - -```ruby -require "async/http/internet" - -def fetch(url) - Sync do - internet = Async::HTTP::Internet.new - return internet.get(url).read - end -end - -# At the level of your program, this method will create an event loop: -fetch("https://example.com") - -Sync do - # The event loop already exists, and will be reused: - fetch("https://example.com") -end -``` - -In other words, `Sync{...}` is very similar in behaviour to `Async{...}.wait`, but significantly more efficient. - -## Enforcing Embedded Execution - -In some methods, you may want to implement a fan-out or map-reduce. That requires a parent scheduler. There are two ways you can do this: - -```ruby -def fetch_all(urls, parent: Async::Task.current) - urls.map do |url| - parent.async do - fetch(url) - end - end.map(&:wait) -end -``` - -or: - -```ruby -def fetch_all(urls) - Sync do |parent| - urls.map do |url| - parent.async do - fetch(url) - end - end.map(&:wait) - end -end -``` - -The former allows you to inject the parent, which could be a barrier or semaphore, while the latter will create a new parent scheduler if one does not exist. In both cases, you guarantee that the map operation will be executed in the parent task (of some sort). - -## Compatibility - -The Fiber Scheduler interface is compatible with most pure Ruby code and well-behaved C code. For example, you can use {ruby Net::HTTP} for performing concurrent HTTP requests: - -```ruby -urls = ["http://example.com", "http://example.org", "http://example.net"] - -Async do - # Perform several concurrent requests: - responses = urls.map do |url| - Async do - Net::HTTP.get(URI(url)) - end - end.map(&:wait) -end -``` - -Unfortunately, some libraries do not integrate well with the fiber scheduler: either they are blocking, processor bound, or use thread locals for execution state. To use these libraries, you may be able to use a background thread. - -```ruby -Async do - result = Thread.new do - # Code which is otherwise unsafe... - end.value # Wait for the result of the thread, internally non-blocking. -end -``` diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/index.yaml b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/index.yaml deleted file mode 100644 index 0a530d6..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/index.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# Automatically generated context index for Utopia::Project guides. -# Do not edit then files in this directory directly, instead edit the guides and then run `bake utopia:project:agent:context:update`. ---- -description: A concurrency framework for Ruby. -metadata: - bug_tracker_uri: https://github.com/socketry/async/issues - changelog_uri: https://github.com/socketry/async/blob/main/releases.md - documentation_uri: https://socketry.github.io/async/ - funding_uri: https://github.com/sponsors/ioquatix/ - source_code_uri: https://github.com/socketry/async.git -files: -- path: getting-started.md - title: Getting Started - description: This guide shows how to add async to your project and run code asynchronously. -- path: scheduler.md - title: Scheduler - description: This guide gives an overview of how the scheduler is implemented. -- path: tasks.md - title: Tasks - description: This guide explains how asynchronous tasks work and how to use them. -- path: best-practices.md - title: Best Practices - description: This guide gives an overview of best practices for using Async. -- path: debugging.md - title: Debugging - description: This guide explains how to debug issues with programs that use Async. -- path: thread-safety.md - title: Thread safety - description: This guide explains thread safety in Ruby, focusing on fibers and threads, - common pitfalls, and best practices to avoid problems like data corruption, race - conditions, and deadlocks. diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/scheduler.md b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/scheduler.md deleted file mode 100644 index d88abf3..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/scheduler.md +++ /dev/null @@ -1,109 +0,0 @@ -# Scheduler - -This guide gives an overview of how the scheduler is implemented. - -## Overview - -The {ruby Async::Scheduler} uses an event loop to execute tasks. When tasks are waiting on blocking operations like IO, the scheduler will use the operating system's native event system to wait for the operation to complete. This allows the scheduler to efficiently handle many tasks. - -### Tasks - -Tasks are the building blocks of concurrent programs. They are lightweight and can be scheduled by the event loop. Tasks can be nested, and the parent task is used to determine the current reactor. Tasks behave like promises, in the sense you can wait on them to complete, and they might fail with an exception. - -~~~ ruby -require 'async' - -def sleepy(duration, task: Async::Task.current) - task.async do |subtask| - subtask.annotate "I'm going to sleep #{duration}s..." - sleep duration - puts "I'm done sleeping!" - end -end - -def nested_sleepy(task: Async::Task.current) - task.async do |subtask| - subtask.annotate "Invoking sleepy 5 times..." - 5.times do |index| - sleepy(index, task: subtask) - end - end -end - -Async do |task| - task.annotate "Invoking nested_sleepy..." - subtask = nested_sleepy - - # Print out all running tasks in a tree: - task.print_hierarchy($stderr) - - # Kill the subtask - subtask.cancel -end -~~~ - -### Thread Safety - -Most methods of the reactor and related tasks are not thread-safe, so you'd typically have [one reactor per thread or process](https://github.com/socketry/async-container). - -### Embedding Schedulers - -{ruby Async::Scheduler#run} will run until the reactor runs out of work to do. To run a single iteration of the reactor, use {ruby Async::Scheduler#run_once}. - -~~~ ruby -require 'async' - -Console.logger.debug! -reactor = Async::Scheduler.new - -# Run the reactor for 1 second: -reactor.async do |task| - sleep 1 - puts "Finished!" -end - -while reactor.run_once - # Round and round we go! -end -~~~ - -You can use this approach to embed the reactor in another event loop. For some integrations, you may want to specify the maximum time to wait to {ruby Async::Scheduler#run_once}. - -### Cancelling a Scheduler - -{ruby Async::Scheduler#cancel} will cancel the current scheduler and all children tasks. - -### Fiber Scheduler Integration - -In order to integrate with native Ruby blocking operations, the {ruby Async::Scheduler} uses a {ruby Fiber::Scheduler} interface. - -```ruby -require "async" - -scheduler = Async::Scheduler.new -Fiber.set_scheduler(scheduler) - -Fiber.schedule do - puts "Hello World!" -end -``` - -## Design - -### Optimistic vs Pessimistic Scheduling - -There are two main strategies for scheduling tasks: optimistic and pessimistic. An optimistic scheduler is usually greedy and will try to execute tasks as soon as they are scheduled using a direct transfer of control flow. A pessimistic scheduler will schedule tasks into the event loop ready list and will only execute them on the next iteration of the event loop. - -```ruby -Async do - puts "Hello " - - Async do - puts "World" - end - - puts "!" -end -``` - -An optimstic scheduler will print "Hello World!", while a pessimistic scheduler will print "Hello !World". In practice you should not design your code to rely on the order of execution, but it's important to understand the difference. It is an unspecifed implementation detail of the scheduler. diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/tasks.md b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/tasks.md deleted file mode 100644 index 80d39fa..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/tasks.md +++ /dev/null @@ -1,453 +0,0 @@ -# Tasks - -This guide explains how asynchronous tasks work and how to use them. - -## Overview - -Tasks are the smallest unit of sequential code execution in {ruby Async}. Tasks can create other tasks, and Async tracks the parent-child relationship between tasks. When a parent task is cancelled, it will also cancel all its children tasks. The reactor always starts with one root task. - -```mermaid -graph LR - R[Reactor] --> WS - WS[Web Server Task] --> R1[Request 1 Task] - WS --> R2[Request 2 Task] - - R1 --> Q1[Database Query Task] - R1 --> H1[HTTP Client Request Task] - - R2 --> H2[HTTP Client Request Task] - R2 --> H3[HTTP Client Request Task] -``` - -### How are they different from fibers? - -A fiber is a lightweight unit of execution that can be suspended and resumed at specific points. After a fiber is suspended, it can be resumed later at the same point with the same execution state. Because only one fiber can execute at a time, they are often referred to as a mechanism for cooperative concurrency. - -A task provides extra functionality on top of fibers. A task behaves like a promise: it either succeeds with a value or fails with an exception. Tasks keep track of their parent-child relationships, and when a parent task is cancelled, it will also cancel all its children tasks. This makes it easier to create complex programs with many concurrent tasks. - -### Why does Async manipulate tasks and not fibers? - -The {ruby Async::Scheduler} actually works directly with fibers for most operations and isn't aware of tasks. However, the reactor does maintain a tree of tasks for the purpose of managing task and reactor life-cycle. For example, cancelling a parent task will cancel all its children tasks, and the reactor will exit when all tasks are finished. - -## Task Lifecycle - -Tasks represent units of work which are executed according to the following state transition diagram: - -```mermaid -stateDiagram-v2 - [*] --> initialized : Task.new - initialized --> running : run - - running --> failed : unhandled StandardError-derived exception - running --> complete : user code finished - running --> cancelled : cancel - - initialized --> cancelled : cancel - - failed --> [*] - complete --> [*] - cancelled --> [*] -``` - -Tasks are created in the `initialized` state, and are run by the reactor. During the execution, a task can either `complete` successfully, become `failed` with an unhandled `StandardError`-derived exception, or be explicitly `cancelled`. In all of these cases, you can wait for a task to complete by using {ruby Async::Task#wait}. - -1. In the case the task successfully completed, the result will be whatever value was generated by the last expression in the task. -2. In the case the task failed with an unhandled `StandardError`-derived exception, waiting on the task will re-raise the exception. -3. In the case the task was cancelled, the result will be `nil`. - -## Starting A Task - -At any point in your program, you can start a reactor and a root task using the {ruby Kernel::Async} method: - -```ruby -Async do - 1.upto(3) do |i| - sleep(i) - puts "Hello World #{i}" - end -end -``` - -This program prints "Hello World" 3 times. Before printing, it sleeps for 1, then 2, then 3 seconds. The total execution time is 6 seconds because the program executes sequentially. - -By using a nested task, we can ensure that each iteration of the loop creates a new task which runs concurrently. - -```ruby -Async do - 1.upto(3) do |i| - Async do - sleep(i) - puts "Hello World #{i}" - end - end -end -``` - -Instead of taking 6 seconds, this program takes 3 seconds in total. The main loop executes, rapidly creating 3 child tasks, and then each child task sleeps for 1, 2 and 3 seconds respectively before printing "Hello World". - -```mermaid -graph LR - R[Reactor] --> TT[Initial Task] - - TT --> H0[Hello World 0 Task] - TT --> H1[Hello World 1 Task] - TT --> H2[Hello World 2 Task] -``` - -By constructing your program correctly, it's easy to implement concurrent map-reduce: - -```ruby -Async do - # Map (create several concurrent tasks) - users_size = Async{User.size} - posts_size = Async{Post.size} - - # Reduce (wait for and merge the results) - average = posts_size.wait / users_size.wait - puts "#{users_size.wait} users created #{average} posts on average." -end -``` - -### Performance Considerations - -Task creation and execution has been heavily optimised. Do not trade program complexity to avoid creating tasks; the cost will almost always exceed the gain. - -Do consider using correct concurrency primatives like {ruby Async::Semaphore}, {ruby Async::Barrier}, etc, to ensure your program is well-behaved in the presence of large inputs (i.e. don't create an unbounded number of tasks). - -## Starting a Limited Number of Tasks - -When processing potentially unbounded data, you may want to limit the concurrency using {ruby Async::Semaphore}. - -```ruby -Async do - # Create a semaphore with a limit of 2: - semaphore = Async::Semaphore.new(2) - - file.each_line do |line| - semaphore.async do - # Only two tasks at most will be allowed to execute concurrently: - process(line) - end - end -end -``` - -## Waiting for Tasks - -Waiting for a single task is trivial: simply invoke {ruby Async::Task#wait}. To wait for multiple tasks, you may either {ruby Async::Task#wait} on each in turn, or you may want to use a {ruby Async::Barrier}. You can use {ruby Async::Barrier#async} to create multiple child tasks, and wait for them all to complete using {ruby Async::Barrier#wait}. - -```ruby -barrier = Async::Barrier.new - -Async do - jobs.each do |job| - barrier.async do - # ... process job ... - end - end - - # Wait for all jobs to complete: - barrier.wait -end -``` - -### Waiting for the First N Tasks - -Occasionally, you may need to just wait for the first task (or first several tasks) to complete. You can use a combination of {ruby Async::Waiter} and {ruby Async::Barrier} for controlling this: - -```ruby -Async do - barrier = Async::Barrier.new - - begin - jobs.each do |job| - barrier.async do - # ... process job ... - end - end - - # Wait for the first two jobs to complete: - done = [] - barrier.wait do |task| - done << task.wait - - # If you don't want to wait for any more tasks you can break: - break if done.size >= 2 - end - ensure - # The remainder of the tasks will be cancelled: - barrier.cancel - end -end -``` - -### Combining a Barrier with a Semaphore - -{ruby Async::Barrier} and {ruby Async::Semaphore} are designed to be compatible with each other, and with other tasks that nest `#async` invocations. There are other similar situations where you may want to pass in a parent task, e.g. {ruby Async::IO::Endpoint#bind}. - -~~~ ruby -barrier = Async::Barrier.new -semaphore = Async::Semaphore.new(2, parent: barrier) - -begin - jobs.each do |job| - semaphore.async do - # ... process job ... - end - end - - # Wait until all jobs are done: - barrier.wait -ensure - # Cancel any remaining jobs: - barrier.cancel -end -~~~ - -## Cancelling a Task - -When a task completes execution, it will enter the `complete` state (or the `failed` state if it raises an unhandled exception). - -There are various situations where you may want to cancel a task ({ruby Async::Task#cancel}) before it completes. The most common case is shutting down a server. A more complex example is this: you may fan out multiple (10s, 100s) of requests, wait for a subset to complete (e.g. the first 5 or all those that complete within a given deadline), and then cancel the remaining operations. - -Using the above program as an example, let's cancel all the tasks just after the first one completes. - -```ruby -Async do - tasks = 3.times.map do |i| - Async do - sleep(i) - puts "Hello World #{i}" - end - end - - # Cancel all the above tasks: - tasks.each(&:cancel) -end -``` - -### Cancelling all Tasks held in a Barrier - -To cancel all the tasks held in a barrier: - -```ruby -barrier = Async::Barrier.new - -Async do - tasks = 3.times.map do |i| - barrier.async do - sleep(i) - puts "Hello World #{i}" - end - end - - barrier.cancel -end -``` - -Unless your tasks all rescue and suppresses `StandardError`-derived exceptions, be sure to call ({ruby Async::Barrier#cancel}) to cancel the remaining tasks: - -```ruby -barrier = Async::Barrier.new - -Async do - tasks = 3.times.map do |i| - barrier.async do - sleep(i) - puts "Hello World #{i}" - end - end - - begin - barrier.wait - ensure - barrier.cancel - end -end -``` - -## Resource Management - -In order to ensure your resources are cleaned up correctly, make sure you wrap resources appropriately, e.g.: - -~~~ ruby -Async do - begin - socket = connect(remote_address) # May raise Async::Cancel - - socket.write(...) # May raise Async::Cancel - socket.read(...) # May raise Async::Cancel - ensure - socket.close if socket - end -end -~~~ - -As tasks run synchronously until they yield back to the reactor, you can guarantee this model works correctly. While in theory `IO#autoclose` allows you to automatically close file descriptors when they go out of scope via the GC, it may produce unpredictable behavour (exhaustion of file descriptors, flushing data at odd times), so it's not recommended. - -## Exception Handling - -{ruby Async::Task} captures and logs exceptions. All unhandled exceptions will cause the enclosing task to enter the `:failed` state. Non-`StandardError` exceptions are re-raised immediately and will cause the reactor to exit. This ensures that exceptions will always be visible and cause the program to fail appropriately. - -~~~ ruby -require 'async' - -task = Async do - # Exception will be logged and task will be failed. - raise "Boom" -end - -puts task.status # failed -puts task.wait # raises RuntimeError: Boom -~~~ - -### Propagating Exceptions - -If a task has finished due to an exception, calling `Task#wait` will re-raise the exception. - -~~~ ruby -require 'async' - -Async do - task = Async do - raise "Boom" - end - - begin - task.wait # Re-raises above exception. - rescue - puts "It went #{$!}!" - end -end -~~~ - -## Timeouts - -You can wrap asynchronous operations in a timeout. This allows you to put an upper bound on how long the enclosed code will run vs. potentially blocking indefinitely. If the enclosed code hasn't completed by the timeout, it will be interrupted with an {ruby Async::TimeoutError} exception. - -~~~ ruby -require 'async' - -Async do |task| - task.with_timeout(1) do - sleep(100) - rescue Async::TimeoutError - puts "I timed out 99 seconds early!" - end -end -~~~ - -### Periodic Timers - -Sometimes you need to do some recurring work in a loop. Often it's best to measure the periodic delay end-to-start, so that your process always takes a break between iterations and doesn't risk spending 100% of its time on the periodic work. In this case, simply call {ruby sleep} between iterations: - -~~~ ruby -require 'async' - -period = 30 - -Async do |task| - loop do - puts Time.now - # ... process job ... - sleep(period) - end -end -~~~ - -If you need a periodic timer that runs start-to-start, you can keep track of the `run_next` time using the monotonic clock: - -~~~ ruby -require 'async' - -period = 30 - -Async do |task| - run_next = Async::Clock.now - loop do - run_next += period - puts Time.now - # ... process job ... - if (remaining = run_next - Async::Clock.now) > 0 - sleep(remaining) - end - end -end -~~~ - -## Reactor Lifecycle - -Generally, the reactor's event loop will not exit until all tasks complete. This is informed by {ruby Async::Task#finished?} which checks if the current node has completed execution, which also includes all children. However, there is one exception to this rule: tasks flagged as being `transient` ({ruby Async::Node#transient?}). - -### Transient Tasks - -Tasks which are flagged as `transient` are identical to normal tasks, except for one key difference: they do not keep the reactor alive. They are useful for operations which are not directly related to application concurrency, but are instead an implementation detail of the application. For example, a task which is monitoring and maintaining a connection pool, pruning unused connections or possibly ensuring those connections are periodically checked for activity (ping/pong, etc). If all *other* tasks are completed, and only transient tasks remain at the root of the reactor, the reactor should exit. - -#### How To Create Transient Tasks - -Specify the `transient` option when creating a task: - -```ruby -@pruner = Async(transient: true) do - loop do - sleep(1) - prune_connection_pool - end -end -``` - -Transient tasks are similar to normal tasks, except for the following differences: - -1. They are not considered by {ruby Async::Task#finished?}, so they will not keep the reactor alive. Instead, they are cancelled (with a {ruby Async::Cancel} exception) when all other (non-transient) tasks are finished. -2. As soon as a parent task is finished, any transient child tasks will be moved up to be children of the parent's parent. This ensures that they never keep a sub-tree alive. -3. Similarly, if you `cancel` a task, any transient child tasks will be moved up the tree as above rather than being cancelled. - -The purpose of transient tasks is when a task is an implementation detail of an object or instance, rather than a concurrency process. Some examples of transient tasks: - -- A task which is reading or writing data on behalf of a stateful connection object, e.g. HTTP/2 frame reader, Redis cache invalidation, etc. -- A task which is monitoring and maintaining a connection pool, pruning unused connections or possibly ensuring those connections are periodically checked for activity (ping/pong, etc). -- A background worker or batch processing job which is independent of any specific operation, and is lazily created. -- A cache system which needs periodic expiration / revalidation of data/values. - -Here is an example that keeps a cache of the current time string since that has only 1-second granularity -and you could be handling 1000s of requests per second. -The task doing the updating in the background is an implementation detail, so it is marked as `transient`. - -```ruby -require "async" -require "thread/local" # thread-local gem. - -class TimeStringCache - extend Thread::Local # defines `instance` class method that lazy-creates a separate instance per thread - - def initialize - @current_time_string = nil - end - - def current_time_string - refresh! - - return @current_time_string - end - - private - - def refresh! - @refresh ||= Async(transient: true) do - loop do - @current_time_string = Time.now.to_s - sleep(1) - end - ensure - # When the reactor terminates all tasks, `Async::Cancel` will be raised from `sleep` and this code will be invoked. By clearing `@refresh`, we ensure that the task will be recreated if needed again: - @refresh = nil - end - end -end - -Async do - p TimeStringCache.instance.current_time_string -end -``` - -Upon exiting the top level async block, the {ruby @refresh} task will be set to `nil`. Bear in mind, you should not share these resources across threads; doing so would need some form of mutual exclusion. diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/thread-safety.md b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/thread-safety.md deleted file mode 100644 index 7a55aca..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/context/thread-safety.md +++ /dev/null @@ -1,694 +0,0 @@ -# Thread safety - -This guide explains thread safety in Ruby, focusing on fibers and threads, common pitfalls, and best practices to avoid problems like data corruption, race conditions, and deadlocks. - -## Usage - -You can use this guide to understand how to write thread-safe code in Ruby, especially when using fibers and threads. It covers key principles, common patterns, and unsafe practices, along with safe alternatives. - -### Agents - -When analyzing existing projects, you should check files one by one, looking for problematic patterns and unsafe practices as outlined in this guide. You should report these issues and suggest safe alternatives. - -## Key Issues - -- **Data corruption is the primary concern** - prevention is absolutely critical. -- **Isolation should be the default** - operations should not share mutable state. - - **Shared mutable state should be avoided**. Prefer pure functions, immutable objects, and dependency injection. -- **Assume that code will be executed concurrently** by multiple fibers, threads and processes. -- **Assume that code may context switch at any time**, but especially during I/O operations. - - I/O operations include network calls, file I/O, database queries, etc. - - Other context switch points include `Fiber.yield`, `sleep`, waiting on child processes, DNS queries, and interrupts (signal handling). -- **Fibers and threads are NOT the same thing**, however they do share similar safety requirements. -- **C extensions e.g. C/Rust etc. can block the fiber scheduler entirely**. - - Native code, when implemented correctly, is usually okay, but bugs can exist anywhere, even in mature code. - -## Quick Reference - -| Unsafe Pattern / Problem | Safe Alternative / Solution | Note / Rationale | -| :--------------------------------------------- | :----------------------------------------------------- | :------------------------------------------------- | -| `@data \|\|= load_data` | `@mutex.synchronize { @data \|\|= load_data }` | `\|\|=` is not atomic; use double-checked locking. | -| `@shared_array << item` | `Thread::Mutex` or `Thread::Queue` | Use a mutex, or better, `Queue` for coordination. | -| `@shared_hash[key] = value` | `Thread::Mutex` or `Concurrent::Map` | Use a mutex or a concurrent data structure. | -| `@@class_var` | Dependency injection / Instance state | Class vars create spooky shared state. | -| Class attribute / `class_attribute` | Constructor arg or method param | Pass state explicitly to avoid coupling. | -| Shared mutable state | Immutability / Isolation / Pure functions | Avoid sharing mutable state if possible. | -| Memoization with shared Hash | `Mutex` or `Concurrent::Map` | Hash memoization is not thread-safe. | -| Lazy init: `@mutex \|\|= Mutex.new` | Initialize eagerly | Mutex creation must itself be thread-safe. | -| Shared connection (e.g. DB client) | Connection pool | Never share non-thread-safe connections. | -| Array/Hash iteration while mutating | Synchronize all access with `Mutex` / copy for enum | Don’t mutate while enumerating. | -| `Thread.current[:key] = value` for per-request | `Fiber[:key] = value` or pass context | Prefer fiber-local or explicit context passing. | -| Waiting on state with busy-wait | `Mutex` + `ConditionVariable` | Use proper synchronization. | -| "Time of check, time of use" on files | Atomic file ops / use database / transaction | Use atomic operations to avoid TOCTOU. | -| Nested mutex acquisition | Minimise lock scope, avoid recursion | Design locking to avoid deadlocks. | -| C extensions blocking fibers | Use thread pool / offload blocking ops | Avoid blocking the event loop in async code. | - -## Fibers vs Threads in Ruby - -Fibers and threads are both primitives which allow for concurrent execution in Ruby. The main difference is that threads are preemptively scheduled by the operating system, while fibers are cooperatively scheduled by the Ruby interpreter. That makes fibers slightly more predictable in terms of execution order, but they still share many of the same safety concerns. - -### Fibers - -- **Cooperative multitasking** (usually) within a single thread. -- **No preemption** and greedy execution may cause latency issues if a fiber does not yield. -- **Explicit yield points** including I/O operations, `Fiber.yield`, `sleep`, etc. -- **Light weight context switching** due to user-space coroutine implementations. -- **Limited parallelism** if `rb_nogvl` operations can be offloaded to a worker pool. - -### Threads - -- **Preemptive multitasking** with native OS threads and within the Ruby thread scheduler. -- **Can be interrupted** at any point by the interpreter. -- **Expensive context switching** due operating system overheads and contention within the Ruby interpreter. -- **Limited parallelism** if `rb_nogvl` allows other threads to execute. - -## Common patterns with potential issues - -The most fundamental issue that underpins all "thread safety issues" is **shared mutable state**. That is because in the presence of multiple execution contexts, such as fibers or threads, shared mutable state creates a combinatorial explosion of possible execution paths, many of which may be undesirable or incorrect. Coordination primitives (like `Mutex`) exist to constrain the combinatorial explosion of possible program states, but they are not a silver bullet and can introduce their own issues like deadlocks, contention, and performance bottlenecks. - -Therefore, the best practice is to avoid shared mutable state whenever possible. Isolation, immutability, and pure functions should be the default where possible, and shared mutable state should be the exception, not the rule. - -### Shared mutable state - -Shared mutable state, including class instance variables accessed by multiple threads or fibers, is problematic and should be avoided. This includes class instance variables, module variables, and any mutable objects that are shared across threads or fibers. - -```ruby -class CurrencyConverter - def initialize - @exchange_rates = {} # Issue: Shared mutable state - end - - def update_rate(currency, rate) - # Issue: Multiple threads can modify @exchange_rates concurrently - @exchange_rates[currency] = rate - end - - def convert(amount, from_currency, to_currency) - # Issue: If @exchange_rates is modified while this method runs, it can lead to incorrect conversions - rate = @exchange_rates[from_currency] / @exchange_rates[to_currency] - amount * rate - end -end -``` - -**Why is this problematic?**: Multiple threads or fibers can modify the shared state concurrently, leading to race conditions and inconsistent data. - -#### Better alternatives - -- Do not share mutable state across threads or fibers. -- Use immutable objects or pure functions that do not rely on shared mutable state. -- Use locking (`Mutex`) or concurrent data structures (if available) to protect shared mutable state. - -### Class Variables with shared state - -Class variables (`@@variable`) and class attributes (`class_attribute`) represent a design problem because they lack isolation and can lead to unexpected behavior if mutated. As they are shared across the entire inheritance hierarchy, they can cause "spooky action at a distance" where changes in one part of the codebase affect other parts in unexpected ways. - -```ruby -class GlobalConfig - @@settings = {} # Issue: Class variables are shared across inheritance - - def set(key, value) - @@settings[key] = value - end - - def get(key) - @@settings[key] - end -end - -class UserConfig < GlobalConfig -end - -GlobalConfig.new.set(:foo, 42) -# Issue: UserConfig inherits from GlobalConfig, so it shares the same @@settings (lack of isolation): -UserConfig.new.get(:foo) # => 42 -``` - -**Why is this problematic?**: Class variables and class instance variables are shared across the entire inheritance hierarchy, creating unnecessary coupling and making it difficult to reason about state changes. This can lead to unexpected behavior, especially in larger codebases or when using libraries that modify class variables. - -#### Better alternatives - -- Inject configuration or state through method parameters or constructor arguments. -- Simply avoid if possible. - -### Lazy Initialization - -Lazy initialization is a common pattern in Ruby, but the `||=` operator is not atomic and can lead to race conditions. - -```ruby -class Loader - def self.data - @data ||= JSON.load_file("data.json") - end -end -``` - -**Why is this problematic?**: Multiple threads can see `@data` is `nil` simultaneously on shared mutable data. They will both call `JSON.load_file` concurrently, and each receive different instances of `@data` (althought only one will actually be assigned). This can lead to inconsistent data being used across threads or fibers. - -This could cause situations where `self.data != self.data` for example, or modifications to `self.data` in one thread may be lost and not visible in another thread. It should also be noted that some operations are more likely to context switch, such as I/O operations, which could exacerbate this issue. - -#### Potential fix with `Mutex` - -```ruby -class Loader - @mutex = Mutex.new - - def self.data - # Double-checked locking pattern: - return @data if @data - - @mutex.synchronize do - return @data if @data - - # Now we are sure that @data is nil, we can safely fetch it: - @data = JSON.load_file("data.json") - end - - return @data - end -end -``` - -In addition, it should be noted that lazy initialization of a `Mutex` (and other synchronization primitives) is **always** a problem and should be avoided. This is because the `Mutex` itself may not be initialized when multiple threads attempt to access it concurrently, leading to multiple threads using different mutex instances: - -```ruby -class Loader - def self.data - @mutex ||= Mutex.new # Issue: Not thread-safe - - @mutex.synchronize do - # Double-checked locking pattern: - return @data if @data - - # Now we are sure that @data is nil, we can safely fetch it: - @data = JSON.load_file("data.json") - end - - return @data - end -end -``` - -#### Safe if instances are not shared - -In the case that each instance is only accessed by a single thread or fiber, memoization can be safe: - -```ruby -class Loader - def things - # Safe: each instance has its own @things - @things ||= compute_things - end -end - -def do_something - loader = Loader.new - loader.things # Safe: only accessed by this thread/fiber -end -``` - -### Memoization with `Hash` caches - -Like lazy initialization, memoization using `Hash` caches can lead to race conditions if not handled properly. - -```ruby -class ExpensiveComputation - @cache = {} - - def self.compute(key) - @cache[key] ||= expensive_operation(key) # Issue: Not thread-safe - end -end -``` - -**Why is this problematic?**: Multiple threads can see `@cache[key]` is `nil` simultaneously, leading to multiple calls to `expensive_operation(key)` which is both inefficient and can lead to inconsistent results if the operation is not idempotent. - -#### Potential fix with `Mutex` - -Note that this mutex creates contention on all calls to `compute`, which can be a performance bottleneck if the operation is expensive and called frequently. - -```ruby -class ExpensiveComputation - @cache = {} - @mutex = Mutex.new - - def self.compute(key) - @mutex.synchronize do - @cache[key] ||= expensive_operation(key) - end - end -end -``` - -#### Potential fix with `Concurrent::Map` - -```ruby -class ExpensiveComputation - @cache = Concurrent::Map.new - - def self.compute(key) - @cache.compute_if_absent(key) do - expensive_operation(key) - end - end -end -``` - -You should avoid `Concurrent::Hash` as it's just an alias for `Hash` and does not provide any thread-safety guarantees. - -### Aggregating results with `Array` - -Aggregating results from multiple threads or fibers using shared `Array` instance is generally safe in Ruby, but can lead to issues if you are trying to coordinate completion of multiple threads or fibers. - -```ruby -done = [] -threads = [] - -5.times do |i| - threads << Thread.new do - # Simulate some work - sleep(rand(0.1..0.5)) - done << i - end -end - -# Risk: The threads may not be finished, so `done` is likely incomplete! -puts "Done: #{done.inspect}" -``` - -**Why is this problematic?**: Trying to wait for the first item (or any subset) to be added to `done` can lead to faulty behaviour as there is no actual coordination between the threads and there is no real error handling. The threads are waited on in creation order, but the items in `done` may not be in the same order, or may not even be present at all if a thread is still running. - -#### Potential fix with `Thread#join` - -Using `Thread#join` ensures that all threads have completed before accessing the results: - -```ruby -done = [] - -threads = 5.times.map do |i| - Thread.new do - # Simulate some work - sleep(rand(0.1..0.5)) - done << i - end -end - -threads.each(&:join) # Wait for all threads to complete -puts "Done: #{done.inspect}" # Output: Done: [0, 1, 2, 3, 4] -``` - -### Shared connections - -Sharing network connections, database connections, or other resources across threads or fibers can lead to invalid state or unexpected behavior. - -```ruby -client = Database.connect - -Thread.new do - results = client.query("SELECT * FROM users") -end - -Thread.new do - results = client.query("SELECT * FROM products") -end -``` - -**Why is this problematic?**: If the `client` is not thread-safe, and does not handle concurrent queries properly (e.g. by using a connection pool, or explicit multiplexing), it is unlikely that the above code will work as expected. It is possible that the queries will interfere with each other, leading to inconsistent results or even errors. - -#### Potential fix with connection pools - -Using a connection pool can help manage shared connections safely: - -```ruby -require "connection_pool" -pool = ConnectionPool.new(size: 5, timeout: 5) do - Database.connect -end - -Thread.new do - pool.with do |client| - results = client.query("SELECT * FROM users") - end -end - -Thread.new do - pool.with do |client| - results = client.query("SELECT * FROM products") - end -end -``` - -### Enumeration of shared mutable state - -Enumerating shared mutable container (e.g. `Array` or `Hash`) can cause consistency issues if the state is modified during enumeration. This can lead to unexpected behavior, such as missing or duplicated elements. - -```ruby -class SharedList - def initialize - @list = [] - end - - def add(item) - @list << item - end - - def each(&block) - # Issue: Modifications during enumeration can lead to inconsistent state - @list.each(&block) - end -end -``` - -In addition, adding or deleting items from a list while iterating over it can lead to errors or unexpected behaviour. - -**Why is this problematic?**: If another thread modifies `@list` while it is being enumerated, it can lead to missing or duplicated items, or even raise an error if the underlying data structure is modified during iteration. - -#### Potential fix with `Mutex` - -To ensure that the enumeration is safe, you can use a `Mutex` to synchronize access to the shared state: - -```ruby -class SharedList - def initialize - @list = [] - @mutex = Mutex.new - end - - def add(item) - @mutex.synchronize do - @list << item - end - end - - def each(&block) - @mutex.synchronize do - @list.each(&block) - end - end -end -``` - -#### Potential fix with deferred operations - -Alternatively, you can defer operations that modify the shared state until after the enumeration is complete: - -```ruby -stale = [] -shared_list.each do |item| - if item.stale? - stale << item - end -end - -stale.each do |item| - shared_list.remove(item) -end -``` - -Or better yet, use immutable data structures or pure functions that do not rely on shared mutable state: - -```ruby -fresh = [] -shared_list.each do |item| - fresh << item unless item.stale? -end - -shared_list.replace(fresh) # Replace the entire list with a new one -``` - -### Internal Race Conditions - -Race conditions occur when state changes in an unpredictable way due to concurrent access. This can happen with shared mutable state, lazy initialization, or any operation that modifies state without proper synchronization, leading to deadlocks or inconsistent data. - -```ruby -while system.busy? - system.wait -end -``` - -**Why is this problematic?**: If, between the call to `system.busy?` and `system.wait`, another thread modifies the state of `system`, such that it is no longer busy, the current thread may wait indefinitely, leading to a deadlock. - -#### Potential fix with `Mutex` and `ConditionVariable` - -If you are able to modify the state transition logic of the shared resource, you can use a `Mutex` and `ConditionVariable` to ensure that the state is checked and modified atomically: - -```ruby -class System - def initialize - @mutex = Mutex.new - @condition = ConditionVariable.new - @usage = 0 - end - - def release - @mutex.synchronize do - @usage -= 1 - @condition.signal if @usage == 0 - end - end - - def wait_until_free - @mutex.synchronize do - while @usage > 0 - @condition.wait(@mutex) - end - end - end -end -``` - -### External Race Conditions - -External resources can also lead to "time of check to time of use" issues, where the state of the resource changes between checking its status and using it. - -```ruby -if File.exist?("cache.json") - @data = File.read("cache.json") -else - @data = fetch_data_from_api - File.write("cache.json", @data) -end -``` - -**Why is this problematic?**: If another thread deletes `cache.json` after the check but before the read, the read will fail, leading to an error or inconsistent state. - -This can apply to any external resource, such as files, databases, or network resources and can be extremely difficult to mitigate if proper synchronization is not available (e.g. database transactions). - -#### Potential fix for external resources - -Using content-addressable storage and atomic file operations can help avoid race conditions when accessing shared resources on the filesystem - -```ruby -begin - File.read("cache.json") -rescue Errno::ENOENT - File.open("cache.json", "w") do |file| - file.flock(File::LOCK_EX) - file.write(fetch_data_from_api) - end -end -``` - -Modern systems should generally avoid using the filesystem for shared state, and instead use a database or other persistent storage that supports transactions and atomic operations. - -### Thread-local storage for "per-request" state - -Using actual thread-local storage for "per-request" state can be problematic in Ruby, especially when using fibers. This is because fibers may share the same thread, leading to unexpected behavior if the thread-local is used when "per-request" state is expected. - -```ruby -class RequestContext - def self.current - Thread.current.thread_variable_get(:request_context) || - Thread.current.thread_variable_set(:request_context, Hash.new) - end -end -``` - -**Why is this problematic?**: If fibers are used for individual requests, they may share the same thread, leading to unexpected behavior when accessing `Thread.current.thread_variable_get(:request_context)`. This can result in data being shared across requests unintentionally, leading to data corruption or unexpected behavior. - -In addition, some libraries may use `Thread.current` as a key in a hash or other data structure to store per-request state. This can be problematic for the same reason, since multiple requests may share the same thread and therefore the same key, leading to data being shared across requests unintentionally. This can be a problem for both concurrent and sequential requests, for example if the state is not cleaned up properly between requests, incorrect sharing of state can occur. - -```ruby -class Pool - def initialize - @connections = {} - @mutex = Mutex.new - end - - def current_connection - @mutex.synchronize do - @connections[Thread.current] ||= create_new_connection - end - end -end -``` - -#### Use `Fiber.attr` for per-request state - -Use `Fiber.attr :my_attribute` for storing per-request state. `Fiber.current.my_attribute` provides a clean, readable way to define fiber-scoped attributes with excellent performance characteristics. - -```ruby -# Use prefixed names to avoid namespace conflicts: -Fiber.attr :falcon_request_id - -# Set per-request state: -Fiber.current.falcon_request_id = SecureRandom.uuid - -# Access anywhere in the same fiber: -def process_data - puts "Request ID: #{Fiber.current.falcon_request_id}" -end -``` - -#### Use `Fiber[key]` for inheritable per-request state - -Use `Fiber[key]` when you need per-request state that **inherits across concurrency boundaries** (to child fibers and threads). This is particularly useful for request tracing, user context, or other state that should flow through your entire request processing pipeline. - -```ruby -Fiber[:user_id] = request.session[:user_id] -Fiber[:trace_id] = request.headers["X-Trace-ID"] - -jobs.each do |job| - Thread.new do - # Child threads inherit the fiber storage: - puts "Processing job for user #{Fiber[:user_id]} (trace: #{Fiber[:trace_id]})" - process_job(job) - end -end - -Async do |task| - # Child fibers also inherit the storage: - task.async do - puts "Background task for user: #{Fiber[:user_id]}" - end -end -``` - -Note that since this state is inherited across concurrency boundaries, any mutable objects stored here must be thread-safe or you risk data corruption. Therefore you should prefer immutable values including strings, numbers, frozen objects, or other immutable data types, and avoid mutable objects like arrays, hashes, unless they're thread-safe. - -```ruby -# Safe - immutable values: -Fiber[:user_id] = "user_123" -Fiber[:account_type] = :premium - -# Risky - mutable objects: -Fiber[:user_preferences] = {} # Could be modified concurrently -Fiber[:request_data] = SomeObject.new # Unless thread-safe -``` - -#### Use `Thread.current` for per-request state - -While `Thread.current[key]` is technically safe for per-request state in Ruby, **it has significant readability and comprehension issues** that make it a poor choice: - -```ruby -Thread.current[:connection] ||= create_new_connection -``` - -Despite the look, this is actually stored per-fiber and thus acceptable for storing per-request state. While it works, the confusion it creates makes `Fiber.attr` or `Fiber[key]` much better options. - -#### Use `Thread.attr` for actual thread-local storage - -When you specifically need **actual per-thread storage** (not per-fiber), use `Thread.attr`. This is scoped to the OS thread and is not inherited by child fibers. - -```ruby -Thread.attr :connection_pool - -# Each thread gets its own connection pool -Thread.current.connection_pool = ConnectionPool.new(size: 5) - -def get_connection - Thread.current.connection_pool.checkout -end -``` - -This approach is rarely needed in fiber-based applications and should be used sparingly, however it can be useful for state or caches that should persist across multiple fibers but is not generally thread safe. Storing an instance per thread can help mitigate thread safety issues. - -### C extensions that block the scheduler - -C extensions can block the Ruby scheduler, however the fiber scheduler has a higher risk of being blocked by C extensions than the thread scheduler. That is because `rb_nogvl` allows preemptive scheduling of threads, but fibers are not preemptively scheduled and must yield explicitly. This means that if a C extension blocks the fiber scheduler, it can lead to deadlocks or starvation of other fibers. - -### Synchronization primitives - -Synchronization primitives like `Mutex`, `ConditionVariable`, and `Queue` are essential for managing shared mutable state safely. However, they can introduce complexity and potential deadlocks if not used carefully. - -```ruby -class Counter - def initialize(count = 0) - @count = count - @mutex = Mutex.new - end - - def increment - @mutex.synchronize do - @count += 1 - end - end - - def times - @mutex.synchronize do - @count.times do |i| - yield i - end - end - end -end - -counter = Counter.new -counter.times do |i| - counter.increment # deadlock -end -``` - -In general, it is known that `Mutex` can not be composed safely. However, with careful design, it is usually safe to use `Mutex` to protect shared mutable state, as long as you are aware of the potential for deadlocks and contention. - -Using recursive mutexes is generally not recommended, as they can lead to complex and hard-to-debug issues. If you find yourself needing recursive locks, it may be a sign that you need to rethink your locking strategy or the design of your code. - -#### Potential fix with `Mutex` - -As an alternative to the above, reducing the scope of the lock can help avoid deadlocks and contention: - -```ruby -class Counter - # ... - - def times - count = @mutex.synchronize{@count} - - # Avoid holding the lock while yielding to user code: - count.times do |i| - yield i - end - end -end -``` - -## Best Practices for Concurrency in Ruby - -1. **Favor pure, isolated, and immutable objects and functions.** - The safest and easiest way to write concurrent code is to avoid shared mutable state entirely. Isolated objects and pure functions eliminate the risk of race conditions and make reasoning about code much simpler. - -2. **Use per-request (or per-fiber) state correctly.** - When you need to associate state with a request, job, or fiber, prefer explicit context passing, or use fiber-local variables (e.g. `Fiber[:key]`). Avoid using thread-local storage in fiber-based code, as fibers may share threads and this can lead to subtle bugs. - -3. **Use synchronization primitives only when sharing is truly necessary.** - If you must share mutable state (for performance, memory efficiency, or correctness), protect it with the appropriate synchronization primitives: - - * Prefer high-level, lock-free data structures (e.g. `Concurrent::Map`) when possible. - * If locks are necessary, use fine-grained locking to minimize contention and reduce deadlock risk. - * Avoid coarse-grained locks except as a last resort, as they can severely limit concurrency and hurt performance. - -### Hierarchy of Concurrency Safety - -1. **No shared state** (ideal) Isolate state to each thread, fiber, or request—no coordination needed. - -2. **Immutable shared state** (very good) Share only data that does not change after creation (constants, frozen objects, etc.). - -3. **Synchronized mutable state** (only when unavoidable) Share mutable state only with robust synchronization. - -#### When synchronization is needed: - -* **Lock-free structures (e.g. `Concurrent::Map`)** Provide safe, concurrent access with high performance and minimal contention. - -* **Fine-grained locks** Protect the smallest necessary scope of shared state; avoid holding locks while yielding or running untrusted code. - -* **Coarse-grained locks** Protect large areas of code or many data structures at once; use sparingly as this reduces concurrency. diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async.rb deleted file mode 100644 index d8dfb16..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2017-2026, by Samuel Williams. -# Copyright, 2020, by Salim Semaoune. - -require_relative "async/version" -require_relative "async/reactor" -require_relative "async/loop" - -require_relative "kernel/async" -require_relative "kernel/sync" -require_relative "kernel/barrier" diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/barrier.md b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/barrier.md deleted file mode 100644 index 482744c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/barrier.md +++ /dev/null @@ -1,41 +0,0 @@ -A synchronization primitive, which allows one task to wait for a number of other tasks to complete. It can be used in conjunction with {Semaphore}. - -## Example - -~~~ ruby -require 'async' -require 'async/barrier' - -barrier = Async::Barrier.new -Sync do - Console.info("Barrier Example: sleep sort.") - - # Generate an array of 10 numbers: - numbers = 10.times.map{rand(10)} - sorted = [] - - # Sleep sort the numbers: - numbers.each do |number| - barrier.async do |task| - sleep(number) - sorted << number - end - end - - # Wait for all the numbers to be sorted: - barrier.wait - - Console.info("Sorted", sorted) -ensure - # Ensure all the tasks are stopped when we exit: - barrier.stop -end -~~~ - -### Output - -~~~ -0.0s info: Barrier Example: sleep sort. -9.0s info: Sorted - | [3, 3, 3, 4, 4, 5, 5, 5, 8, 9] -~~~ diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/barrier.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/barrier.rb deleted file mode 100644 index d2bcf46..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/barrier.rb +++ /dev/null @@ -1,132 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2019-2026, by Samuel Williams. -# Copyright, 2026, by Tavian Barnes. - -require_relative "list" -require_relative "task" -require_relative "queue" - -module Async - # A general purpose synchronisation primitive, which allows one task to wait for a number of other tasks to complete. It can be used in conjunction with {Semaphore}. - # - # @public Since *Async v1*. - class Barrier - # Initialize the barrier. - # @parameter parent [Task | Semaphore | Nil] The parent for holding any children tasks. - # @public Since *Async v1*. - def initialize(parent: nil) - @tasks = List.new - @finished = Queue.new - @condition = Condition.new - - @parent = parent - end - - class TaskNode < List::Node - def initialize(task) - @task = task - end - - attr :task - end - - private_constant :TaskNode - - # Number of tasks being held by the barrier. - def size - @tasks.size - end - - # All tasks which have been invoked into the barrier. - attr :tasks - - # Execute a child task and add it to the barrier. - # @asynchronous Executes the given block concurrently. - # @returns [Task] The task which was created to execute the block. - def async(*arguments, parent: (@parent or Task.current), **options, &block) - raise "Barrier is stopped!" if @finished.closed? - - waiting = nil - - task = parent.async(*arguments, **options) do |task, *arguments| - # Create a new list node for the task and add it to the list of waiting tasks: - node = TaskNode.new(task) - @tasks.append(node) - - # Signal the outer async block that we have added the task to the list of waiting tasks, and that it can now wait for it to finish: - waiting = node - @condition.signal - - # Invoke the block, which may raise an error. If it does, we will still signal that the task has finished: - block.call(task, *arguments) - ensure - # Signal that the task has finished, which will unblock the waiting task: - @finished.signal(node) unless @finished.closed? - end - - # `parent.async` may yield before the child block executes, so we wait here until the child has appended itself to `@tasks`, ensuring `wait` cannot return early and miss tracking it: - @condition.wait while waiting.nil? - - return task - end - - # Whether there are any tasks being held by the barrier. - # @returns [Boolean] - def empty? - @tasks.empty? - end - - # Wait for all tasks to complete by invoking {Task#wait} on each waiting task, which may raise an error. As long as the task has completed, it will be removed from the barrier. - # - # @yields {|task| ...} If a block is given, the unwaited task is yielded. You must invoke {Task#wait} yourself. In addition, you may `break` if you have captured enough results. - # @returns [Integer | Nil] The number of tasks which were waited for, or `nil` if there were no tasks to wait for. - # - # @asynchronous Will wait for tasks to finish executing. - def wait - return nil if @tasks.empty? - count = 0 - - while true - # Wait for a task to finish (we get the task node): - break unless waiting = @finished.wait - count += 1 - - # Remove the task as it is now finishing: - @tasks.remove?(waiting) - - # Get the task: - task = waiting.task - - # If a block is given, the user can implement their own behaviour: - if block_given? - yield task - else - # Wait for it to either complete or raise an error: - task.wait - end - - break if @tasks.empty? - end - - return count - end - - # Cancel all tasks held by the barrier. - # @asynchronous May wait for tasks to finish executing. - def cancel - @tasks.each do |waiting| - waiting.task.cancel - end - - @finished.close - end - - # Backward compatibility alias for {#cancel}. - # @deprecated Use {#cancel} instead. - def stop - cancel - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/cancel.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/cancel.rb deleted file mode 100644 index d06b3bd..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/cancel.rb +++ /dev/null @@ -1,80 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2026, by Samuel Williams. - -module Async - # Raised when a task is explicitly cancelled. - class Cancel < Exception - # Represents the source of the cancel operation. - class Cause < Exception - if RUBY_VERSION >= "3.4" - # @returns [Array(Thread::Backtrace::Location)] The backtrace of the caller. - def self.backtrace - caller_locations(2..-1) - end - else - # @returns [Array(String)] The backtrace of the caller. - def self.backtrace - caller(2..-1) - end - end - - # Create a new cause of the cancel operation, with the given message. - # - # @parameter message [String] The error message. - # @returns [Cause] The cause of the cancel operation. - def self.for(message = "Task was cancelled!") - instance = self.new(message) - instance.set_backtrace(self.backtrace) - return instance - end - end - - if RUBY_VERSION < "3.5" - # Create a new cancel operation. - # - # This is a compatibility method for Ruby versions before 3.5 where cause is not propagated correctly when using {Fiber#raise} - # - # @parameter message [String | Hash] The error message or a hash containing the cause. - def initialize(message = "Task was cancelled") - - if message.is_a?(Hash) - @cause = message[:cause] - message = "Task was cancelled" - end - - super(message) - end - - # @returns [Exception] The cause of the cancel operation. - # - # This is a compatibility method for Ruby versions before 3.5 where cause is not propagated correctly when using {Fiber#raise}, we explicitly capture the cause here. - def cause - super || @cause - end - end - - # Used to defer cancelling the current task until later. - class Later - # Create a new cancel later operation. - # - # @parameter task [Task] The task to cancel later. - # @parameter cause [Exception] The cause of the cancel operation. - def initialize(task, cause = nil) - @task = task - @cause = cause - end - - # @returns [Boolean] Whether the task is alive. - def alive? - true - end - - # Transfer control to the operation - this will cancel the task. - def transfer - @task.cancel(false, cause: @cause) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/clock.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/clock.rb deleted file mode 100644 index c0c4d86..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/clock.rb +++ /dev/null @@ -1,95 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2026, by Samuel Williams. -# Copyright, 2026, by Shopify Inc. - -module Async - # A convenient wrapper around the internal monotonic clock. - # @public Since *Async v1*. - class Clock - # Get the current elapsed monotonic time. - def self.now - ::Process.clock_gettime(::Process::CLOCK_MONOTONIC) - end - - # Measure the execution of a block of code. - # @yields {...} The block to execute. - # @returns [Numeric] The total execution time. - def self.measure - start_time = self.now - - yield - - return self.now - start_time - end - - # Start measuring elapsed time from now. - # @returns [Clock] - def self.start - self.new.tap(&:start!) - end - - # Create a new clock with the initial total time. - # @parameter total [Numeric] The initial clock duration. - def initialize(total = 0) - @total = total - @started = nil - end - - # @returns [Numeric | Nil] The time when the clock was started, or nil if not started. - attr :started - - # Start measuring a duration. - def start! - @started ||= Clock.now - end - - # Stop measuring a duration and append the duration to the current total. - def stop! - if @started - @total += (Clock.now - @started) - @started = nil - end - - return @total - end - - # The total elapsed time including any current duration. - def total - total = @total - - if @started - total += (Clock.now - @started) - end - - return total - end - - # Reset the total elapsed time. If the clock is currently running, reset the start time to now. - def reset! - @total = 0 - - if @started - @started = Clock.now - end - end - - # Convert the clock to a JSON-compatible hash. - # - # @returns [Hash] The JSON-compatible hash. - def as_json(...) - { - started: self.started, - total: self.total, - } - end - - # Convert the clock to a JSON string. - # - # @returns [String] The JSON string. - def to_json(...) - self.as_json.to_json(...) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/condition.md b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/condition.md deleted file mode 100644 index ef1d44f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/condition.md +++ /dev/null @@ -1,31 +0,0 @@ -A synchronization primitive, which allows fibers to wait until a particular condition is (edge) triggered. Zero or more fibers can wait on a condition. When the condition is signalled, the fibers will be resumed in order. - -## Example - -~~~ ruby -require 'async' - -Sync do - condition = Async::Condition.new - - Async do - Console.info "Waiting for condition..." - value = condition.wait - Console.info "Condition was signalled: #{value}" - end - - Async do |task| - sleep(1) - Console.info "Signalling condition..." - condition.signal("Hello World") - end -end -~~~ - -### Output - -~~~ -0.0s info: Waiting for condition... -1.0s info: Signalling condition... -1.0s info: Condition was signalled: Hello World -~~~ diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/condition.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/condition.rb deleted file mode 100644 index 92c09a6..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/condition.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2017-2026, by Samuel Williams. -# Copyright, 2017, by Kent Gruber. -# Copyright, 2026, by Robert Mosolgo. - -require "fiber" -require_relative "list" - -module Async - # A synchronization primitive, which allows fibers to wait until a particular condition is (edge) triggered. - # @public Since *Async v1*. - class Condition - # Create a new condition. - def initialize - @ready = ::Thread::Queue.new - end - - # Queue up the current fiber and wait on yielding the task. - # @returns [Object] - def wait - @ready.pop - end - - # @returns [Boolean] If there are no fibers waiting on this condition. - def empty? - @ready.num_waiting.zero? - end - - # @returns [Boolean] Is any fiber waiting on this notification? - def waiting? - !self.empty? - end - - # @returns [Integer] Number of fibers waiting on this condition. - def waiting_count - @ready.num_waiting - end - - # Signal to a given task that it should resume operations. - # @parameter value [Object | Nil] The value to return to the waiting fibers. - def signal(value = nil) - return if empty? - - ready = self.exchange - - ready.num_waiting.times do - ready.push(value) - end - - ready.close - - return nil - end - - protected - - def exchange - ready = @ready - @ready = ::Thread::Queue.new - return ready - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/console.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/console.rb deleted file mode 100644 index 301595f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/console.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2024, by Samuel Williams. - -module Async - # Shims for the console gem, redirecting warnings and above to `Kernel#warn`. - # - # If you require this file, the `async` library will not depend on the `console` gem. - # - # That includes any gems that sit within the `Async` namespace. - # - # This is an experimental feature. - module Console - # Log a message at the debug level. The shim is silent. - def self.debug(...) - end - - # Log a message at the info level. The shim is silent. - def self.info(...) - end - - # Log a message at the warn level. The shim redirects to `Kernel#warn`. - def self.warn(*arguments, exception: nil, **options) - if exception - super(*arguments, exception.full_message, **options) - else - super(*arguments, **options) - end - end - - # Log a message at the error level. The shim redirects to `Kernel#warn`. - def self.error(...) - self.warn(...) - end - - # Log a message at the fatal level. The shim redirects to `Kernel#warn`. - def self.fatal(...) - self.warn(...) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/deadline.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/deadline.rb deleted file mode 100644 index a27528a..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/deadline.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025, by Shopify Inc. -# Copyright, 2025, by Samuel Williams. - -require_relative "clock" - -# @namespace -module Async - # Represents a deadline timeout with decrementing remaining time. - # Includes an efficient representation for zero (non-blocking) timeouts. - # @public Since *Async v2.31*. - class Deadline - # Singleton module for immediate timeouts (zero or negative). - # Avoids object allocation for fast path (non-blocking) timeouts. - module Zero - # Check if the deadline has expired. - # @returns [Boolean] Always returns true since zero timeouts are immediately expired. - def self.expired? - true - end - - # Get the remaining time. - # @returns [Integer] Always returns 0 since zero timeouts have no remaining time. - def self.remaining - 0 - end - end - - # Create a deadline for the given timeout. - # @parameter timeout [Numeric | Nil] The timeout duration, or nil for no timeout. - # @returns [Deadline | Nil] A deadline instance, Zero singleton, or nil. - def self.start(timeout) - if timeout.nil? - nil - elsif timeout <= 0 - Zero - else - self.new(timeout) - end - end - - # Create a new deadline with the specified remaining time. - # @parameter remaining [Numeric] The initial remaining time. - def initialize(remaining) - @remaining = remaining - @start = Clock.now - end - - # Get the remaining time, updating internal state. - # Each call to this method advances the internal clock and reduces - # the remaining time by the elapsed duration since the last call. - # @returns [Numeric] The remaining time (may be negative if expired). - def remaining - now = Clock.now - delta = now - @start - @start = now - - @remaining -= delta - - return @remaining - end - - # Check if the deadline has expired. - # @returns [Boolean] True if no time remains. - def expired? - self.remaining <= 0 - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/error.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/error.rb deleted file mode 100644 index 527cc0c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/error.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2026, by Samuel Williams. - -module Async - # Raised if a timeout occurs on a specific Fiber. Handled gracefully by `Task`. - # @public Since *Async v1*. - class TimeoutError < StandardError - # Create a new timeout error. - # - # @parameter message [String] The error message. - def initialize(message = "execution expired") - super - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/fork_handler.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/fork_handler.rb deleted file mode 100644 index 7661c4e..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/fork_handler.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025-2026, by Shopify Inc. -# Copyright, 2025-2026, by Samuel Williams. - -module Async - # Private module that hooks into Process._fork to handle fork events. - # - # If `Scheduler#process_fork` hook is adopted in Ruby 4, this code can be removed after Ruby < 4 is no longer supported. - module ForkHandler - def _fork(&block) - result = super - - if result.zero? - # Child process: - if Fiber.scheduler.respond_to?(:process_fork) - Fiber.scheduler.process_fork - end - end - - return result - end - end - - private_constant :ForkHandler - - # Hook into Process._fork to handle fork events automatically: - unless RUBY_VERSION > "4" - ::Process.singleton_class.prepend(ForkHandler) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/idler.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/idler.rb deleted file mode 100644 index 6d2b23f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/idler.rb +++ /dev/null @@ -1,71 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2024-2025, by Samuel Williams. - -module Async - # A load balancing mechanism that can be used process work when the system is idle. - class Idler - # Create a new idler. - # - # @public Since *Async v2*. - # - # @parameter maximum_load [Numeric] The maximum load before we start shedding work. - # @parameter backoff [Numeric] The initial backoff time, used for delaying work. - # @parameter parent [Interface(:async) | Nil] The parent task to use for async operations. - def initialize(maximum_load = 0.8, backoff: 0.001, parent: nil) - @maximum_load = maximum_load - @backoff = backoff - @current = backoff - - @parent = parent - @mutex = Mutex.new - end - - # Wait until the system is idle, then execute the given block in a new task. - # - # @asynchronous Executes the given block concurrently. - # - # @parameter arguments [Array] The arguments to pass to the block. - # @parameter parent [Interface(:async) | Nil] The parent task to use for async operations. - # @parameter options [Hash] The options to pass to the task. - # @yields {|task| ...} When the system is idle, the block will be executed in a new task. - def async(*arguments, parent: (@parent or Task.current), **options, &block) - wait - - # It is crucial that we optimistically execute the child task, so that we prevent a tight loop invoking this method from consuming all available resources. - parent.async(*arguments, **options, &block) - end - - # Wait until the system is idle, according to the maximum load specified. - # - # If the scheduler is overloaded, this method will sleep for an exponentially increasing amount of time. - def wait - @mutex.synchronize do - scheduler = Fiber.scheduler - - while true - load = scheduler.load - - if load <= @maximum_load - # Even though load is okay, if @current is high, we were recently overloaded. Sleep proportionally to prevent burst after load drop: - if @current > @backoff - # Sleep a fraction of @current to rate limit: - sleep(@current - @backoff) - - # Decay @current gently towards @backoff: - alpha = 0.99 - @current *= alpha + (1.0 - alpha) * (load / @maximum_load) - end - - break - else - # We're overloaded, so increase backoff: - @current *= (load / @maximum_load) - sleep(@current) - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/limited_queue.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/limited_queue.rb deleted file mode 100644 index a09c06c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/limited_queue.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025, by Samuel Williams. - -# The implementation lives in `queue.rb` but later we may move it here for better autoload/inference. -require_relative "queue" - -module Async - class LimitedQueue < Queue - singleton_class.remove_method(:new) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/list.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/list.rb deleted file mode 100644 index 5bc55a1..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/list.rb +++ /dev/null @@ -1,319 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2022-2025, by Samuel Williams. -# Copyright, 2025, by Shopify Inc. - -module Async - # A general doublely linked list. This is used internally by {Async::Barrier} and {Async::Condition} to manage child tasks. - class List - # Initialize a new, empty, list. - def initialize - @head = self - @tail = self - @size = 0 - end - - # @returns [String] A short summary of the list. - def to_s - sprintf("#<%s:0x%x size=%d>", self.class.name, object_id, @size) - end - - # @returns [String] A short summary of the list. - alias inspect to_s - - # Fast, safe, unbounded accumulation of children. - def to_a - items = [] - current = self - - while current.tail != self - unless current.tail.is_a?(Iterator) - items << current.tail - end - - current = current.tail - end - - return items - end - - # @attribute [Node | Nil] Points at the end of the list. - attr_accessor :head - - # @attribute [Node | Nil] Points at the start of the list. - attr_accessor :tail - - # @attribute [Integer] The number of nodes in the list. - attr :size - - # A callback that is invoked when an item is added to the list. - def added(node) - @size += 1 - return node - end - - # Append a node to the end of the list. - def append(node) - if node.head - raise ArgumentError, "Node is already in a list!" - end - - node.tail = self - @head.tail = node - node.head = @head - @head = node - - return added(node) - end - - # Prepend a node to the start of the list. - def prepend(node) - if node.head - raise ArgumentError, "Node is already in a list!" - end - - node.head = self - @tail.head = node - node.tail = @tail - @tail = node - - return added(node) - end - - # Add the node, yield, and the remove the node. - # @yields {|node| ...} Yields the node. - # @returns [Object] Returns the result of the block. - def stack(node, &block) - append(node) - return yield(node) - ensure - remove!(node) - end - - # A callback that is invoked when an item is removed from the list. - def removed(node) - @size -= 1 - return node - end - - # Remove the node if it is in a list. - # - # You should be careful to only remove nodes that are part of this list. - # - # @returns [Node] Returns the node if it was removed, otherwise nil. - def remove?(node) - if node.head - return remove!(node) - end - - return nil - end - - # Remove the node. If it was already removed, this will raise an error. - # - # You should be careful to only remove nodes that are part of this list. - # - # @raises [ArgumentError] If the node is not part of this list. - # @returns [Node] Returns the node if it was removed, otherwise nil. - def remove(node) - # One downside of this interface is we don't actually check if the node is part of the list defined by `self`. This means that there is a potential for a node to be removed from a different list using this method, which in can throw off book-keeping when lists track size, etc. - unless node.head - raise ArgumentError, "Node is not in a list!" - end - - remove!(node) - end - - private def remove!(node) - node.head.tail = node.tail - node.tail.head = node.head - - # This marks the node as being removed, and causes remove to fail if called a 2nd time. - node.head = nil - # node.tail = nil - - return removed(node) - end - - # @returns [Boolean] True if the list is empty. - def empty? - @size == 0 - end - - # def validate!(node = nil) - # previous = self - # current = @tail - # found = node.equal?(self) - - # while true - # break if current.equal?(self) - - # if current.head != previous - # raise "Invalid previous linked list node!" - # end - - # if current.is_a?(List) and !current.equal?(self) - # raise "Invalid list in list node!" - # end - - # if node - # found ||= current.equal?(node) - # end - - # previous = current - # current = current.tail - # end - - # if node and !found - # raise "Node not found in list!" - # end - # end - - # Iterate over each node in the linked list. It is generally safe to remove the current node, any previous node or any future node during iteration. - # - # @yields {|node| ...} Yields each node in the list. - # @returns [List] Returns self. - def each(&block) - return to_enum unless block_given? - - Iterator.each(self, &block) - - return self - end - - # Determine whether the given node is included in the list. - # - # @parameter needle [Node] The node to search for. - # @returns [Boolean] Returns true if the node is in the list. - def include?(needle) - self.each do |item| - return true if needle.equal?(item) - end - - return false - end - - # @returns [Node] Returns the first node in the list, if it is not empty. - def first - # validate! - - current = @tail - - while !current.equal?(self) - if current.is_a?(Iterator) - current = current.tail - else - return current - end - end - - return nil - end - - # @returns [Node] Returns the last node in the list, if it is not empty. - def last - # validate! - - current = @head - - while !current.equal?(self) - if current.is_a?(Iterator) - current = current.head - else - return current - end - end - - return nil - end - - # Shift the first node off the list, if it is not empty. - def shift - if node = first - remove!(node) - end - end - - # A linked list Node. - class Node - attr_accessor :head - attr_accessor :tail - - # @returns [String] A string representation of the node. - def to_s - sprintf("#<%s:0x%x>", self.class.name, object_id) - end - - # @returns [String] A string representation of the node. - alias inspect to_s - end - - class Iterator < Node - def initialize(list) - @list = list - - # Insert the iterator as the first item in the list: - @tail = list.tail - @tail.head = self - list.tail = self - @head = list - end - - def remove! - @head.tail = @tail - @tail.head = @head - @head = nil - @tail = nil - @list = nil - end - - def move_next - # Move to the next item (which could be an iterator or the end): - @tail.head = @head - @head.tail = @tail - @head = @tail - @tail = @tail.tail - @head.tail = self - @tail.head = self - end - - def move_current - while true - # Are we at the end of the list? - if @tail.equal?(@list) - return nil - end - - if @tail.is_a?(Iterator) - move_next - else - return @tail - end - end - end - - def each - while current = move_current - yield current - - if current.equal?(@tail) - move_next - end - end - end - - def self.each(list, &block) - return if list.empty? - - iterator = Iterator.new(list) - - iterator.each(&block) - ensure - iterator&.remove! - end - end - - private_constant :Iterator - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/loop.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/loop.rb deleted file mode 100644 index 80ceb5e..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/loop.rb +++ /dev/null @@ -1,84 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2026, by Samuel Williams. - -require "console" - -module Async - # @namespace - module Loop - # Execute a block repeatedly at quantized (time-aligned) intervals. - # - # The alignment is computed modulo the current clock time in seconds. For example, with - # `interval: 60`, executions will occur at 00:00, 01:00, 02:00, etc., regardless of when - # the loop is started. With `interval: 300` (5 minutes), executions align to 00:00, 00:05, - # 00:10, etc. - # - # This is particularly useful for tasks that should run at predictable wall-clock times, - # such as metrics collection, periodic cleanup, or scheduled jobs that need to align - # across multiple processes. - # - # If an error occurs during block execution, it is logged and the loop continues. - # - # @example Run every minute at :00 seconds: - # Async::Loop.quantized(interval: 60) do - # puts "Current time: #{Time.now}" - # end - # - # @example Run every 5 minutes aligned to the hour: - # Async::Loop.quantized(interval: 300) do - # collect_metrics - # end - # - # @parameter interval [Numeric] The interval in seconds. Executions will align to multiples of this interval based on the current time. - # @yields The block to execute at each interval. - # - # @public Since *Async v2.37*. - def self.quantized(interval: 60, &block) - while true - # Compute the wait time to the next interval: - wait = interval - (Time.now.to_f % interval) - if wait.positive? - # Sleep until the next interval boundary: - sleep(wait) - end - - begin - yield - rescue => error - Console.error(self, "Loop error:", error) - end - end - end - - # Execute a block repeatedly with a fixed delay between executions. - # - # Unlike {quantized}, this method waits for the specified interval *after* each execution - # completes. This means the actual time between the start of successive executions will be - # `interval + execution_time`. - # - # If an error occurs during block execution, it is logged and the loop continues. - # - # @example Run every 5 seconds (plus execution time): - # Async::Loop.periodic(interval: 5) do - # process_queue - # end - # - # @parameter interval [Numeric] The delay in seconds between executions. - # @yields The block to execute periodically. - # - # @public Since *Async v2.37*. - def self.periodic(interval: 60, &block) - while true - begin - yield - rescue => error - Console.error(self, "Loop error:", error) - end - - sleep(interval) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/node.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/node.rb deleted file mode 100644 index 01dd2b1..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/node.rb +++ /dev/null @@ -1,347 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2017-2026, by Samuel Williams. -# Copyright, 2017, by Kent Gruber. -# Copyright, 2022, by Shannon Skipper. -# Copyright, 2025-2026, by Shopify Inc. -# Copyright, 2026, by Kyle Tate. - -require "fiber/annotation" - -require_relative "list" - -module Async - # A list of children tasks. - class Children < List - # Create an empty list of children tasks. - def initialize - super - @transient_count = 0 - end - - # Some children may be marked as transient. Transient children do not prevent the parent from finishing. - # @returns [Boolean] Whether the node has transient children. - def transients? - @transient_count > 0 - end - - # Whether all children are considered finished. Ignores transient children. - def finished? - @size == @transient_count - end - - # Whether the children is empty, preserved for compatibility. - def nil? - empty? - end - - # Adjust the number of transient children, assuming it has changed. - # - # Despite being public, this is not intended to be called directly. It is used internally by {Node#transient=}. - # - # @parameter transient [Boolean] Whether to increment or decrement the transient count. - def adjust_transient_count(transient) - if transient - @transient_count += 1 - else - @transient_count -= 1 - end - end - - private - - def added(node) - if node.transient? - @transient_count += 1 - end - - return super - end - - def removed(node) - if node.transient? - @transient_count -= 1 - end - - return super - end - end - - # A node in a tree, used for implementing the task hierarchy. - class Node - # Create a new node in the tree. - # @parameter parent [Node | Nil] This node will attach to the given parent. - def initialize(parent = nil, annotation: nil, transient: false) - @parent = nil - @children = nil - - @annotation = annotation - @object_name = nil - - @transient = transient - - @head = nil - @tail = nil - - if parent - parent.add_child(self) - end - end - - # @returns [Node] The root node in the hierarchy. - def root - @parent&.root || self - end - - # @private - attr_accessor :head - - # @private - attr_accessor :tail - - # @attribute [Node] The parent node. - attr :parent - - # @attribute [Children | Nil] Optional list of children. - attr :children - - # @attribute [String | Nil] A useful identifier for the current node. - attr :annotation - - # Whether this node has any children. - # @returns [Boolean] - def children? - @children && !@children.empty? - end - - # Represents whether a node is transient. Transient nodes are not considered - # when determining if a node is finished. This is useful for tasks which are - # internal to an object rather than explicit user concurrency. For example, - # a child task which is pruning a connection pool is transient, because it - # is not directly related to the parent task, and should not prevent the - # parent task from finishing. - def transient? - @transient - end - - # Change the transient state of the node. - # - # A transient node is not considered when determining if a node is finished, and propagates up if the parent is consumed. - # - # @parameter value [Boolean] Whether the node is transient. - def transient=(value) - if @transient != value - @transient = value - - @parent&.children&.adjust_transient_count(value) - end - end - - # Annotate the node with a description. - # - # @parameter annotation [String] The description to annotate the node with. - def annotate(annotation) - if block_given? - begin - current_annotation = @annotation - @annotation = annotation - return yield - ensure - @annotation = current_annotation - end - else - @annotation = annotation - end - end - - # A description of the node, including the annotation and object name. - # - # @returns [String] The description of the node. - def description - @object_name ||= "#{self.class}:#{format '%#018x', object_id}#{@transient ? ' transient' : nil}" - - if annotation = self.annotation - "#{@object_name} #{annotation}" - elsif line = self.backtrace(0, 1)&.first - "#{@object_name} #{line}" - else - @object_name - end - end - - # Provides a backtrace for nodes that have an active execution context. - # - # @returns [Array(Thread::Backtrace::Locations) | Nil] The backtrace of the node, if available. - def backtrace(*arguments) - nil - end - - # @returns [String] A description of the node. - def to_s - "\#<#{self.description}>" - end - - # @returns [String] A description of the node. - alias inspect to_s - - # Change the parent of this node. - # - # @parameter parent [Node | Nil] The parent to attach to, or nil to detach. - # @returns [Node] Itself. - def parent=(parent) - return if @parent.equal?(parent) - - if @parent - @parent.remove_child(self) - @parent = nil - end - - if parent - parent.add_child(self) - end - - return self - end - - protected def set_parent(parent) - @parent = parent - end - - protected def add_child(child) - @children ||= Children.new - @children.append(child) - child.set_parent(self) - end - - protected def remove_child(child) - # In the case of a fork, the children list may be nil: - @children&.remove(child) - child.set_parent(nil) - end - - # Whether the node can be consumed (deleted) safely. By default, checks if the children set is empty. - # - # @returns [Boolean] - def finished? - @children.nil? || @children.finished? - end - - # If the node has a parent, and is {finished?}, then remove this node from - # the parent. - def consume - if parent = @parent and finished? - parent.remove_child(self) - - # If we have children, then we need to move them to our the parent if they are not finished: - if @children - while child = @children.shift - if child.finished? - child.set_parent(nil) - else - parent.add_child(child) - end - end - - @children = nil - end - - parent.consume - end - end - - # Traverse the task tree. - # - # @returns [Enumerator] An enumerator which will traverse the tree if no block is given. - # @yields {|node, level| ...} The node and the level relative to the given root. - def traverse(&block) - return enum_for(:traverse) unless block_given? - - self.traverse_recurse(&block) - end - - protected def traverse_recurse(level = 0, &block) - yield self, level - - @children&.each do |child| - child.traverse_recurse(level + 1, &block) - end - end - - # Immediately terminate all children tasks, including transient tasks. Internally invokes `stop(false)` on all children. This should be considered a last ditch effort and is used when closing the scheduler. - def terminate - # Attempt to stop the current task immediately, and all children: - stop(false) - - # If that doesn't work, take more serious action: - @children&.each do |child| - child.terminate - end - - return @children.nil? - end - - # Attempt to cancel the current node immediately, including all non-transient children. Invokes {#stop_children} to cancel all children. - # - # @parameter later [Boolean] Whether to defer cancelling until some point in the future. - # @parameter cause [Exception | Nil] The cause of the cancel operation. - def cancel(later = false, cause: $!) - # The implementation of this method may defer calling `stop_children`. - stop_children(later, cause: cause) - end - - # Backward compatibility alias for {#cancel}. - # @deprecated Use {#cancel} instead. - def stop(...) - cancel(...) - end - - # Attempt to stop all non-transient children. - private def stop_children(later = false, cause:) - @children&.each do |child| - child.cancel(later, cause: cause) unless child.transient? - end - end - - # Wait for this node to complete. By default, nodes cannot be waited on. - # Subclasses like Task override this method to provide waiting functionality. - def wait - nil - end - - # Whether the node has been cancelled. - def cancelled? - @children.nil? - end - - # Backward compatibility alias for {#cancelled?}. - # @deprecated Use {#cancelled?} instead. - def stopped? - cancelled? - end - - # Print the hierarchy of the task tree from the given node. - # - # @parameter out [IO] The output stream to write to. - # @parameter backtrace [Boolean] Whether to print the backtrace of each node. - def print_hierarchy(out = $stdout, backtrace: true) - self.traverse do |node, level| - indent = "\t" * level - - out.puts "#{indent}#{node}" - - print_backtrace(out, indent, node) if backtrace - end - end - - private - - def print_backtrace(out, indent, node) - if backtrace = node.backtrace - backtrace.each_with_index do |line, index| - out.puts "#{indent}#{index.zero? ? "→ " : " "}#{line}" - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/notification.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/notification.rb deleted file mode 100644 index 5c4df36..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/notification.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2025, by Samuel Williams. - -require_relative "condition" - -module Async - # A synchronization primitive, which allows fibers to wait until a notification is received. Does not block the task which signals the notification. Waiting tasks are resumed on next iteration of the reactor. - # @public Since *Async v1*. - class Notification < Condition - # Signal to a given task that it should resume operations. - # - # @returns [Boolean] if a task was signalled. - def signal(value = nil) - return false if empty? - - Fiber.scheduler.push Signal.new(self.exchange, value) - - return true - end - - Signal = Struct.new(:ready, :value) do - def alive? - true - end - - def transfer - ready.num_waiting.times do - ready.push(value) - end - - ready.close - end - end - - private_constant :Signal - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/priority_queue.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/priority_queue.rb deleted file mode 100644 index 695ec62..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/priority_queue.rb +++ /dev/null @@ -1,253 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025, by Shopify Inc. -# Copyright, 2025, by Samuel Williams. - -require "io/event/priority_heap" -require "thread" - -require_relative "queue" - -module Async - # A queue which allows items to be processed in priority order of consumers. - # - # Unlike a traditional priority queue where items have priorities, this queue - # assigns priorities to consumers (fibers waiting to dequeue). Higher priority - # consumers are served first when items become available. - # - # @public Since *Async v2*. - class PriorityQueue - ClosedError = Queue::ClosedError - - # A waiter represents a fiber waiting to dequeue with a given priority. - Waiter = Struct.new(:fiber, :priority, :sequence, :condition, :value) do - include Comparable - - def <=>(other) - # Higher priority comes first, then FIFO for equal priorities: - if priority == other.priority - # Use sequence for FIFO behavior (lower sequence = earlier): - sequence <=> other.sequence - else - other.priority <=> priority # Reverse for max-heap behavior - end - end - - def signal(value) - self.value = value - condition.signal - end - - def wait_for_value(mutex, timeout = nil) - condition.wait(mutex, timeout) - return self.value - end - - # Invalidate this waiter, making it unusable and detectable as abandoned. - def invalidate! - self.fiber = nil - end - - # Check if this waiter has been invalidated. - def valid? - self.fiber&.alive? - end - end - - private_constant :Waiter - - # Create a new priority queue. - # - # @parameter parent [Interface(:async) | Nil] The parent task to use for async operations. - def initialize(parent: nil) - @items = [] - @closed = false - @parent = parent - @waiting = IO::Event::PriorityHeap.new - @sequence = 0 - - @mutex = Mutex.new - end - - # Close the queue, causing all waiting tasks to return `nil`. - # Any subsequent calls to {enqueue} will raise an exception. - def close - @mutex.synchronize do - @closed = true - - # Signal all waiting fibers with nil, skipping dead/invalid ones: - while waiter = @waiting.pop - waiter.signal(nil) - end - end - end - - # @returns [Boolean] Whether the queue is closed. - def closed? - @closed - end - - # @attribute [Array] The items in the queue. - attr :items - - # @returns [Integer] The number of items in the queue. - def size - @items.size - end - - # @returns [Boolean] Whether the queue is empty. - def empty? - @items.empty? - end - - # @returns [Integer] The number of fibers waiting to dequeue. - def waiting_count - @mutex.synchronize do - @waiting.size - end - end - - # @deprecated Use {#waiting_count} instead. - alias waiting waiting_count - - # Add an item to the queue. - # - # @parameter item [Object] The item to add to the queue. - def push(item) - @mutex.synchronize do - if @closed - raise ClosedError, "Cannot push items to a closed queue." - end - - @items << item - - # Wake up the highest priority waiter if any, skipping dead/invalid waiters: - while waiter = @waiting.pop - if waiter.valid? - value = @items.shift - waiter.signal(value) - break - end - # Dead/invalid waiter discarded, try next one. - end - end - end - - # Compatibility with {::Queue#push}. - def <<(item) - self.push(item) - end - - # Add multiple items to the queue. - # - # @parameter items [Array] The items to add to the queue. - def enqueue(*items) - @mutex.synchronize do - if @closed - raise ClosedError, "Cannot enqueue items to a closed queue." - end - - @items.concat(items) - - # Wake up waiting fibers in priority order, skipping dead/invalid waiters: - while !@items.empty? && (waiter = @waiting.pop) - if waiter.valid? - value = @items.shift - waiter.signal(value) - end - # Dead/invalid waiter discarded, continue to next one. - end - end - end - - # Remove and return the next item from the queue. - # - # If the queue is empty, this method will block until an item is available or timeout expires. - # Fibers are served in priority order, with higher priority fibers receiving - # items first. - # - # @parameter priority [Numeric] The priority of this consumer (higher = served first). - # @parameter timeout [Numeric, nil] Maximum time to wait for an item. If nil, waits indefinitely. If 0, returns immediately. - # @returns [Object, nil] The next item in the queue, or nil if timeout expires. - def dequeue(priority: 0, timeout: nil) - @mutex.synchronize do - # If queue is closed and empty, return nil immediately: - if @closed && @items.empty? - return nil - end - - # Fast path: if items available and either no waiters or we have higher priority: - unless @items.empty? - head = @waiting.peek - if head.nil? or priority > head.priority - return @items.shift - end - end - - # Handle immediate timeout (non-blocking) - return nil if timeout == 0 - - # Need to wait - create our own condition variable and add to waiting queue: - sequence = @sequence - @sequence += 1 - - condition = ConditionVariable.new - - begin - waiter = Waiter.new(Fiber.current, priority, sequence, condition, nil) - @waiting.push(waiter) - - # Wait for our specific condition variable to be signaled: - return waiter.wait_for_value(@mutex, timeout) - ensure - waiter&.invalidate! - end - end - end - - # Compatibility with {::Queue#pop}. - # - # @parameter priority [Numeric] The priority of this consumer. - # @parameter timeout [Numeric, nil] Maximum time to wait for an item. If nil, waits indefinitely. If 0, returns immediately. - # @returns [Object, nil] The dequeued item, or nil if timeout expires. - def pop(priority: 0, timeout: nil) - self.dequeue(priority: priority, timeout: timeout) - end - - # Process each item in the queue. - # - # @asynchronous Executes the given block concurrently for each item. - # - # @parameter priority [Numeric] The priority for processing items. - # @parameter parent [Interface(:async) | Nil] The parent task to use for async operations. - # @parameter options [Hash] The options to pass to the task. - # @yields {|task| ...} When the system is idle, the block will be executed in a new task. - def async(priority: 0, parent: (@parent or Task.current), **options, &block) - while item = self.dequeue(priority: priority) - parent.async(item, **options, &block) - end - end - - # Enumerate each item in the queue. - # - # @parameter priority [Numeric] The priority for dequeuing items. - def each(priority: 0) - while item = self.dequeue(priority: priority) - yield item - end - end - - # Signal the queue with a value, the same as {#enqueue}. - def signal(value = nil) - self.enqueue(value) - end - - # Wait for an item to be available, the same as {#dequeue}. - # - # @parameter priority [Numeric] The priority of this consumer. - def wait(priority: 0) - self.dequeue(priority: priority) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/promise.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/promise.rb deleted file mode 100644 index ea1e1c3..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/promise.rb +++ /dev/null @@ -1,266 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025, by Shopify Inc. -# Copyright, 2025-2026, by Samuel Williams. -# Copyright, 2026, by Kyle Tate. - -require_relative "error" -require_relative "deadline" -require_relative "cancel" - -module Async - # A promise represents a value that will be available in the future. - # Unlike Condition, once resolved (or rejected), all future waits return immediately - # with the stored value or raise the stored exception. - # - # This is thread-safe and integrates with the fiber scheduler. - # - # @public Since *Async v2*. - class Promise - # Create a new promise. - def initialize - # nil = pending, :completed = success, :failed = failure, :cancelled = cancelled: - @resolved = nil - - # Stores either the result value or the exception: - @value = nil - - # Track how many fibers are currently waiting: - @waiting = 0 - - @mutex = Mutex.new - @condition = ConditionVariable.new - end - - # @returns [Boolean] Whether the promise has been resolved or rejected. - def resolved? - @mutex.synchronize{!!@resolved} - end - - # @returns [Symbol | Nil] The internal resolved state (:completed, :failed, :cancelled, or nil if pending). - # @private For internal use by Task. - def resolved - @mutex.synchronize{@resolved} - end - - # @returns [Boolean] Whether the promise has been cancelled. - def cancelled? - @mutex.synchronize{@resolved == :cancelled} - end - - # @returns [Boolean] Whether the promise failed with an exception. - def failed? - @mutex.synchronize{@resolved == :failed} - end - - # @returns [Boolean] Whether the promise has completed successfully. - def completed? - @mutex.synchronize{@resolved == :completed} - end - - # @returns [Boolean] Whether any fibers are currently waiting for this promise. - def waiting? - @mutex.synchronize{@waiting > 0} - end - - # Artificially mark that someone is waiting (useful for suppressing warnings). - # @private Internal use only. - def suppress_warnings! - @mutex.synchronize{@waiting += 1} - end - - # Non-blocking access to the current value. Returns nil if not yet resolved. - # Does not raise exceptions even if the promise was rejected or cancelled. - # For resolved promises, returns the raw stored value (result, exception, or cancel exception). - # - # @returns [Object | Nil] The stored value, or nil if pending. - def value - @mutex.synchronize{@resolved ? @value : nil} - end - - # Wait indefinitely for the promise to be resolved. - private def wait_indefinitely - until @resolved - @condition.wait(@mutex) - end - end - - # Wait for the promise to be resolved, respecting the deadline timeout. - # @parameter timeout [Numeric] The timeout duration. - # @returns [Boolean] True if resolved, false if timeout expires. - private def wait_with_timeout(timeout) - # Create deadline for timeout tracking: - deadline = Deadline.start(timeout) - - # Handle immediate timeout (non-blocking): - if deadline == Deadline::Zero && !@resolved - return false - end - - # Wait with deadline tracking: - loop do - break if @resolved - - # Get remaining time for this wait iteration: - remaining = deadline.remaining - - # Check if deadline has expired before waiting: - if remaining <= 0 - return false - end - - @condition.wait(@mutex, remaining) - end - - return true - end - - # Wait for the promise to be resolved (without raising exceptions). - # - # If already resolved, returns immediately. Otherwise, waits until resolution or timeout. - # - # @parameter timeout [Numeric | Nil] Maximum time to wait. If nil, waits indefinitely. If 0, returns immediately if not resolved. - # @returns [Boolean] True if the promise is resolved, false if timeout expires - def wait?(timeout: nil) - unless @resolved - @mutex.synchronize do - # Increment waiting count: - @waiting += 1 - - begin - # Wait for resolution if not already resolved: - unless @resolved - if timeout.nil? - wait_indefinitely - else - unless wait_with_timeout(timeout) - # We don't want to race on @resolved after exiting the mutex: - return nil - end - end - end - ensure - # Decrement waiting count when done: - @waiting -= 1 - end - end - end - - return @resolved - end - - # Wait for the promise to be resolved and return the value. - # - # If already resolved, returns immediately. If rejected, raises the stored exception. - # - # @returns [Object] The resolved value. - # @raises [Exception] The rejected or cancelled exception. - # @raises [Async::TimeoutError] If timeout expires before the promise is resolved. - def wait(...) - resolved = wait?(...) - - if resolved.nil? - raise TimeoutError, "Timeout while waiting for promise!" - elsif resolved == :completed - return @value - elsif @value - # If we aren't completed, we should have an exception or cancel reason stored: - raise @value - end - end - - # Resolve the promise with a value. - # All current and future waiters will receive this value. - # Can only be called once - subsequent calls are ignored. - # - # @parameter value [Object] The value to resolve the promise with. - def resolve(value) - @mutex.synchronize do - return if @resolved - - @resolved = :completed - @value = value - - # Wake up all waiting fibers: - @condition.broadcast - end - - return value - end - - # Reject the promise with an exception. - # All current and future waiters will receive this exception. - # Can only be called once - subsequent calls are ignored. - # - # @parameter exception [Exception] The exception to reject the promise with. - def reject(exception) - @mutex.synchronize do - return if @resolved - - @resolved = :failed - @value = exception - - # Wake up all waiting fibers: - @condition.broadcast - end - - return nil - end - - # Cancel the promise, indicating cancellation. - # All current and future waiters will receive nil. - # Can only be called on pending promises - no-op if already resolved. - def cancel(exception = Cancel.new("Promise cancelled!")) - @mutex.synchronize do - # No-op if already in any final state - return if @resolved - - @resolved = :cancelled - @value = exception - - # Wake up all waiting fibers: - @condition.broadcast - end - - return nil - end - - # Resolve the promise with the result of the block. - # If the block raises an exception, the promise will be rejected. - # If the promise was already resolved, the block will not be called. - # @yields {...} The block to call to resolve the promise. - # @returns [Object] The result of the block. - def fulfill(&block) - raise "Promise already resolved!" if @resolved - - begin - return self.resolve(yield) - rescue Cancel => exception - return self.cancel(exception) - rescue => error - return self.reject(error) - rescue Exception => exception - self.reject(exception) - raise - ensure - # Handle non-local exits (throw, etc.) that bypass normal flow: - self.resolve(nil) unless @resolved - end - end - - # If a promise is given, fulfill it with the result of the block. - # If no promise is given, simply yield to the block. - # This is useful for methods that may optionally take a promise to fulfill. - # @parameter promise [Promise | Nil] The optional promise to fulfill. - # @yields {...} The block to call to resolve the promise or return a value. - # @returns [Object] The result of the block. - def self.fulfill(promise, &block) - if promise - return promise.fulfill(&block) - else - return yield - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/queue.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/queue.rb deleted file mode 100644 index 7a5bb2e..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/queue.rb +++ /dev/null @@ -1,155 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2025, by Samuel Williams. -# Copyright, 2019, by Ryan Musgrave. -# Copyright, 2020-2022, by Bruno Sutic. -# Copyright, 2025, by Jahfer Husain. -# Copyright, 2025, by Shopify Inc. - -require_relative "notification" - -module Async - # A thread-safe queue which allows items to be processed in order. - # - # This implementation uses Thread::Queue internally for thread safety while - # maintaining compatibility with the fiber scheduler. - # - # It has a compatible interface with {Notification} and {Condition}, except that it's multi-value. - # - # @asynchronous This class is thread-safe. - # @public Since *Async v1*. - class Queue - # An error raised when trying to enqueue items to a closed queue. - # @public Since *Async v2.24*. - class ClosedError < RuntimeError - end - - # Create a new thread-safe queue. - # - # @parameter parent [Interface(:async) | Nil] The parent task to use for async operations. - def initialize(parent: nil, delegate: Thread::Queue.new) - @delegate = delegate - @parent = parent - end - - # @returns [Boolean] Whether the queue is closed. - def closed? - @delegate.closed? - end - - # Close the queue, causing all waiting tasks to return `nil`. Any subsequent calls to {enqueue} will raise an exception. - def close - @delegate.close - end - - # @returns [Integer] The number of items in the queue. - def size - @delegate.size - end - - # @returns [Boolean] Whether the queue is empty. - def empty? - @delegate.empty? - end - - # @returns [Integer] The number of tasks waiting for an item. - def waiting_count - @delegate.num_waiting - end - - # Add an item to the queue. - def push(item) - @delegate.push(item) - rescue ClosedQueueError - raise ClosedError, "Cannot enqueue items to a closed queue!" - end - - # Compatibility with {::Queue#push}. - def <<(item) - self.push(item) - end - - # Add multiple items to the queue. - def enqueue(*items) - items.each{|item| @delegate.push(item)} - rescue ClosedQueueError - raise ClosedError, "Cannot enqueue items to a closed queue!" - end - - # Remove and return the next item from the queue. - # @parameter timeout [Numeric, nil] Maximum time to wait for an item. If nil, waits indefinitely. If 0, returns immediately. - # @returns [Object, nil] The dequeued item, or nil if timeout expires. - def dequeue(timeout: nil) - @delegate.pop(timeout: timeout) - end - - # Compatibility with {::Queue#pop}. - # @parameter timeout [Numeric, nil] Maximum time to wait for an item. If nil, waits indefinitely. If 0, returns immediately. - # @returns [Object, nil] The dequeued item, or nil if timeout expires. - def pop(timeout: nil) - @delegate.pop(timeout: timeout) - end - - # Process each item in the queue. - # - # @asynchronous Executes the given block concurrently for each item. - # - # @parameter arguments [Array] The arguments to pass to the block. - # @parameter parent [Interface(:async) | Nil] The parent task to use for async operations. - # @parameter options [Hash] The options to pass to the task. - # @yields {|task| ...} When the system is idle, the block will be executed in a new task. - def async(parent: (@parent or Task.current), **options, &block) - while item = self.dequeue - parent.async(item, **options, &block) - end - end - - # Enumerate each item in the queue. - def each - while item = self.dequeue - yield item - end - end - - # Signal the queue with a value, the same as {#enqueue}. - def signal(value = nil) - self.enqueue(value) - end - - # Wait for an item to be available, the same as {#dequeue}. - def wait - self.dequeue - end - end - - # A thread-safe queue which limits the number of items that can be enqueued. - # - # @public Since *Async v1*. - class LimitedQueue < Queue - # @private This exists purely for emitting a warning. - def self.new(...) - warn("`require 'async/limited_queue'` to use `Async::LimitedQueue`.", uplevel: 1, category: :deprecated) if $VERBOSE - - super - end - - # Create a new limited queue. - # - # @parameter limit [Integer] The maximum number of items that can be enqueued. - # @parameter full [Notification] The notification to use for signaling when the queue is full. (ignored, for compatibility) - def initialize(limit = 1, **options) - super(**options, delegate: Thread::SizedQueue.new(limit)) - end - - # @attribute [Integer] The maximum number of items that can be enqueued. - def limit - @delegate.max - end - - # @returns [Boolean] Whether trying to enqueue an item would block. - def limited? - !@delegate.closed? && @delegate.size >= @delegate.max - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/reactor.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/reactor.rb deleted file mode 100644 index 508bacf..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/reactor.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2017-2025, by Samuel Williams. -# Copyright, 2017, by Kent Gruber. -# Copyright, 2018, by Sokolov Yura. - -require_relative "scheduler" - -module Async - # A wrapper around the the scheduler which binds it to the current thread automatically. - class Reactor < Scheduler - # @deprecated Replaced by {Kernel::Async}. - def self.run(...) - warn("`Async::Reactor.run{}` is deprecated, use `Async{}` instead.", uplevel: 1, category: :deprecated) if $VERBOSE - - Async(...) - end - - # Initialize the reactor and assign it to the current Fiber scheduler. - def initialize(...) - super - - Fiber.set_scheduler(self) - end - - # Close the reactor and remove it from the current Fiber scheduler. - def scheduler_close - self.close - end - - public :sleep - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/scheduler.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/scheduler.rb deleted file mode 100644 index ffdd9e1..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/scheduler.rb +++ /dev/null @@ -1,710 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2020-2026, by Samuel Williams. -# Copyright, 2020, by Jun Jiang. -# Copyright, 2021, by Julien Portalier. -# Copyright, 2025-2026, by Shopify Inc. -# Copyright, 2026, by Kyle Tate. - -require_relative "clock" -require_relative "task" -require_relative "timeout" -require_relative "fork_handler" - -require "io/event" - -require "console" -require "resolv" - -module Async - begin - require "fiber/profiler" - Profiler = Fiber::Profiler - rescue LoadError - # Fiber::Profiler is not available. - Profiler = nil - end - - # Handles scheduling of fibers. Implements the fiber scheduler interface. - class Scheduler < Node - WORKER_POOL = ENV.fetch("ASYNC_SCHEDULER_WORKER_POOL", nil).then do |value| - value == "true" ? true : nil - end - - # Raised when an operation is attempted on a closed scheduler. - class ClosedError < RuntimeError - # Create a new error. - # - # @parameter message [String] The error message. - def initialize(message = "Scheduler is closed!") - super - end - end - - # Whether the fiber scheduler is supported. - # @public Since *Async v1*. - def self.supported? - true - end - - # Used to augment the scheduler to add support for blocking operations. - module BlockingOperationWait - # Wait for the given work to be executed. - # - # @public Since *Async v2.21* and *Ruby v3.4*. - # @asynchronous May be non-blocking. - # - # @parameter work [Proc] The work to execute on a background thread. - # @returns [Object] The result of the work. - def blocking_operation_wait(work) - @worker_pool.call(work) - end - end - - private_constant :BlockingOperationWait - - if ::IO::Event.const_defined?(:WorkerPool) - WorkerPool = ::IO::Event::WorkerPool - else - WorkerPool = nil - end - - # Create a new scheduler. - # - # @public Since *Async v1*. - # @parameter parent [Node | Nil] The parent node to use for task hierarchy. - # @parameter selector [IO::Event::Selector] The selector to use for event handling. - def initialize(parent = nil, selector: nil, profiler: Profiler&.default, worker_pool: WORKER_POOL) - super(parent) - - @selector = selector || ::IO::Event::Selector.new(Fiber.current) - @profiler = profiler - - @interrupted = false - - @blocked = 0 - - @busy_time = 0.0 - @idle_time = 0.0 - - @timers = ::IO::Event::Timers.new - - if worker_pool == true - @worker_pool = WorkerPool&.new - else - @worker_pool = worker_pool - end - - if @worker_pool - self.singleton_class.prepend(BlockingOperationWait) - end - end - - # Compute the scheduler load according to the busy and idle times that are updated by the run loop. - # - # @returns [Float] The load of the scheduler. 0.0 means no load, 1.0 means fully loaded or over-loaded. - def load - total_time = @busy_time + @idle_time - - # If the total time is zero, then the load is zero: - return 0.0 if total_time.zero? - - # We normalize to a 1 second window: - if total_time > 1.0 - ratio = 1.0 / total_time - @busy_time *= ratio - @idle_time *= ratio - - # We don't need to divide here as we've already normalised it to a 1s window: - return @busy_time - else - return @busy_time / total_time - end - end - - # Invoked when the fiber scheduler is being closed. - # - # Executes the run loop until all tasks are finished, then closes the scheduler. - def scheduler_close(error = $!) - # If the execution context (thread) was handling an exception, we want to exit as quickly as possible: - unless error - self.run - end - ensure - self.close - end - - # Terminate all child tasks. - def terminate - # If that doesn't work, take more serious action: - @children&.each do |child| - child.terminate - end - - return @children.nil? - end - - # Terminate all child tasks and close the scheduler. - # @public Since *Async v1*. - def close - unless @children.nil? - self.run_loop do - until self.terminate - self.run_once! - end - end - end - - Kernel.raise "Closing scheduler with blocked operations!" if @blocked > 0 - ensure - # We want `@selector = nil` to be a visible side effect from this point forward, specifically in `#interrupt` and `#unblock`. If the selector is closed, then we don't want to push any fibers to it. - if selector = @selector - @selector = nil - selector.close - end - - if worker_pool = @worker_pool - @worker_pool = nil - worker_pool.close - end - - consume - end - - # @returns [Boolean] Whether the scheduler has been closed. - # @public Since *Async v1*. - def closed? - @selector.nil? - end - - # @returns [String] A description of the scheduler. - def to_s - "\#<#{self.description} #{@children&.size || 0} children (#{cancelled? ? 'cancelled' : 'running'})>" - end - - # Interrupt the event loop and cause it to exit. - # @asynchronous May be called from any thread. - def interrupt - @interrupted = true - @selector&.wakeup - end - - # Transfer from the calling fiber to the event loop. - def transfer - @selector.transfer - end - - # Yield the current fiber and resume it on the next iteration of the event loop. - def yield - @selector.yield - end - - # Schedule a fiber (or equivalent object) to be resumed on the next loop through the reactor. - # @parameter fiber [Fiber | Object] The object to be resumed on the next iteration of the run-loop. - def push(fiber) - @selector.push(fiber) - end - - # Raise an exception on a specified fiber with the given arguments. - # - # This internally schedules the current fiber to be ready, before raising the exception, so that it will later resume execution. - # - # @parameter fiber [Fiber] The fiber to raise the exception on. - # @parameter *arguments [Array] The arguments to pass to the fiber. - def raise(...) - @selector.raise(...) - end - - # Resume execution of the specified fiber. - # - # @parameter fiber [Fiber] The fiber to resume. - # @parameter arguments [Array] The arguments to pass to the fiber. - def resume(fiber, *arguments) - @selector.resume(fiber, *arguments) - end - - # Invoked when a fiber tries to perform a blocking operation which cannot continue. A corresponding call {unblock} must be performed to allow this fiber to continue. - # - # @public Since *Async v2*. - # @asynchronous May only be called on same thread as fiber scheduler. - # - # @parameter blocker [Object] The object that is blocking the fiber. - # @parameter timeout [Float | Nil] The maximum time to block, or if nil, indefinitely. - def block(blocker, timeout) - # $stderr.puts "block(#{blocker}, #{Fiber.current}, #{timeout})" - fiber = Fiber.current - - if timeout - timer = @timers.after(timeout) do - if fiber.alive? - fiber.transfer(false) - end - end - end - - begin - @blocked += 1 - @selector.transfer - ensure - @blocked -= 1 - end - ensure - timer&.cancel! - end - - # Unblock a fiber that was previously blocked. - # - # @public Since *Async v2* and *Ruby v3.1*. - # @asynchronous May be called from any thread. - # - # @parameter blocker [Object] The object that was blocking the fiber. - # @parameter fiber [Fiber] The fiber to unblock. - def unblock(blocker, fiber) - # Fiber.blocking{$stderr.puts "unblock(#{blocker}, #{fiber})"} - - # This operation is protected by the GVL: - if selector = @selector - selector.push(fiber) - selector.wakeup - end - end - - # Sleep for the specified duration. - # - # @public Since *Async v2* and *Ruby v3.1*. - # @asynchronous May be non-blocking. - # - # @parameter duration [Numeric | Nil] The time in seconds to sleep, or if nil, indefinitely. - def kernel_sleep(duration = nil) - # Fiber.blocking{$stderr.puts "kernel_sleep(#{duration}, #{Fiber.current})"} - - if duration - self.block(nil, duration) - else - self.transfer - end - end - - # Resolve the address of the given hostname. - # - # @public Since *Async v2*. - # @asynchronous May be non-blocking. - # - # @parameter hostname [String] The hostname to resolve. - def address_resolve(hostname) - # On some platforms, hostnames may contain a device-specific suffix (e.g. %en0). We need to strip this before resolving. - # See for more details. - hostname = hostname.split("%", 2).first - ::Resolv.getaddresses(hostname) - end - - # Wait for the specified IO to become ready for the specified events. - # - # @public Since *Async v2*. - # @asynchronous May be non-blocking. - # - # @parameter io [IO] The IO object to wait on. - # @parameter events [Integer] The events to wait for, e.g. `IO::READABLE`, `IO::WRITABLE`, etc. - # @parameter timeout [Float | Nil] The maximum time to wait, or if nil, indefinitely. - # @returns [Integer | false] The subset of events that are ready, or `false` if the timeout expires. - def io_wait(io, events, timeout = nil) - fiber = Fiber.current - expired = false - - if timeout - # If an explicit timeout is specified, we expect that the user will handle it themselves: - timer = @timers.after(timeout) do - expired = true - fiber.transfer - end - elsif timeout = io.timeout - # Otherwise, if we default to the io's timeout, we raise an exception: - timer = @timers.after(timeout) do - fiber.raise(::IO::TimeoutError, "Timeout (#{timeout}s) while waiting for IO to become ready!") - end - end - - # A selector wait may return a falsy result when the fiber is resumed without the requested IO becoming ready. For example, a deferred unblock from a previous blocking operation may arrive after the fiber has moved on to this wait. Retry these stale or spurious wake-ups without resetting the original timer. - until result = @selector.io_wait(fiber, io, events) - # If the original timer resumed the fiber, the false result represents the timeout rather than a spurious wake-up: - return false if expired - end - - return result - ensure - timer&.cancel! - end - - if ::IO::Event::Support.buffer? - # Read at most the specified number of bytes from the IO into the buffer. - # - # @public Since *Async v2* and Ruby with `IO::Buffer` support. - # @asynchronous May be non-blocking. - # - # @parameter io [IO] The IO object to read from. - # @parameter buffer [IO::Buffer] The buffer to read into. - # @parameter offset [Integer] The offset within the buffer to read into. - # @parameter length [Integer] The maximum number of bytes to read. - def io_read(io, buffer, offset, length) - fiber = Fiber.current - - if timeout = io.timeout - timer = @timers.after(timeout) do - fiber.raise(::IO::TimeoutError, "Timeout (#{timeout}s) while waiting for IO to become readable!") - end - end - - @selector.io_read(fiber, io, buffer, offset, length) - ensure - timer&.cancel! - end - - if RUBY_ENGINE != "ruby" || RUBY_VERSION >= "3.3.1" - # Write at most the specified number of bytes from the buffer to the IO. - # - # @public Since *Async v2* and *Ruby v3.3.1* with `IO::Buffer` support. - # @asynchronous May be non-blocking. - # - # @parameter io [IO] The IO object to write to. - # @parameter buffer [IO::Buffer] The buffer to write from. - # @parameter offset [Integer] The offset within the buffer to write from. - # @parameter length [Integer] The maximum number of bytes to write. - def io_write(io, buffer, offset, length) - fiber = Fiber.current - - if timeout = io.timeout - timer = @timers.after(timeout) do - fiber.raise(::IO::TimeoutError, "Timeout (#{timeout}s) while waiting for IO to become writable!") - end - end - - @selector.io_write(fiber, io, buffer, offset, length) - ensure - timer&.cancel! - end - end - end - - # Used to defer stopping the current task until later. - class FiberInterrupt - # Create a new stop later operation. - # - # @parameter task [Task] The task to stop later. - def initialize(fiber, exception) - @fiber = fiber - @exception = exception - end - - # @returns [Boolean] Whether the task is alive. - def alive? - @fiber.alive? - end - - # Transfer control to the operation - this will stop the task. - def transfer - # Fiber.blocking{$stderr.puts "FiberInterrupt#transfer(#{@fiber}, #{@exception})"} - @fiber.raise(@exception) - end - end - - # Raise an exception on the specified fiber, waking up the event loop if necessary. - def fiber_interrupt(fiber, exception) - # Fiber.blocking{$stderr.puts "fiber_interrupt(#{fiber}, #{exception})"} - unblock(nil, FiberInterrupt.new(fiber, exception)) - end - - # Wait for the specified process ID to exit. - # - # @public Since *Async v2*. - # @asynchronous May be non-blocking. - # - # @parameter pid [Integer] The process ID to wait for. - # @parameter flags [Integer] A bit-mask of flags suitable for `Process::Status.wait`. - # @returns [Process::Status] A process status instance. - # @asynchronous May be non-blocking.. - def process_wait(pid, flags) - fiber = Fiber.current - - # A native process wait may be interrupted before the child exits. io-event reports this as `false` and leaves the retry policy to the scheduler. Retry only `false`, since `nil` is a legitimate result for `Process::WNOHANG`. - while true - status = @selector.process_wait(fiber, pid, flags) - - return status unless status == false - end - end - - # Wait for the specified IOs to become ready for the specified events. - # - # @public Since *Async v2.25*. - # @asynchronous May be non-blocking. - def io_select(...) - Thread.new do - # Don't make unnecessary output, since we will propagate the exception: - Thread.current.report_on_exception = false - - ::IO.select(...) - end.value - end - - # Run one iteration of the event loop. - # - # When terminating the event loop, we already know we are finished. So we don't need to check the task tree. This is a logical requirement because `run_once` ignores transient tasks. For example, a single top level transient task is not enough to keep the reactor running, but during termination we must still process it in order to terminate child tasks. - # - # @parameter timeout [Float | Nil] The maximum timeout, or if nil, indefinite. - # @returns [Boolean] Whether there is more work to do. - private def run_once!(timeout = nil) - start_time = Async::Clock.now - - interval = @timers.wait_interval - - # If there is no interval to wait (thus no timers), and no tasks, we could be done: - if interval.nil? - # Allow the user to specify a maximum interval if we would otherwise be sleeping indefinitely: - interval = timeout - elsif interval < 0 - # We have timers ready to fire, don't sleep in the selctor: - interval = 0 - elsif timeout and interval > timeout - interval = timeout - end - - begin - @selector.select(interval) - rescue Errno::EINTR - # Ignore. - end - - @timers.fire - - # Compute load: - end_time = Async::Clock.now - total_duration = end_time - start_time - idle_duration = @selector.idle_duration - busy_duration = total_duration - idle_duration - - @busy_time += busy_duration - @idle_time += idle_duration - - # The reactor still has work to do: - return true - end - - # Run one iteration of the event loop. - # - # @public Since *Async v1*. - # @asynchronous Must be invoked from blocking (root) fiber. - # - # @parameter timeout [Float | Nil] The maximum timeout, or if nil, indefinite. - # @returns [Boolean] Whether there is more work to do. - def run_once(timeout = nil) - Kernel.raise "Running scheduler on non-blocking fiber!" unless Fiber.blocking? - - if self.finished? - self.stop - end - - # If we are finished, we stop the task tree and exit: - if @children.nil? - return false - end - - return run_once!(timeout) - end - - # Checks and clears the interrupted state of the scheduler. - # - # @returns [Boolean] Whether the reactor has been interrupted. - private def interrupted? - if @interrupted - @interrupted = false - return true - end - - if Thread.pending_interrupt? - return true - end - - return false - end - - # Cancel all children, including transient children. - # - # @public Since *Async v1*. - def cancel(later = false, cause: $!) - if @children and !cause - cause = Cancel::Cause.for("Cancelling task!") - end - - @children&.each do |child| - child.cancel(later, cause: cause) - end - end - - # Backward compatibility alias for cancel. - def stop(...) - cancel(...) - end - - # Run the event loop, until the scheduler is interrupted or finished. - # - # @parameter initial [Proc | Nil] The initial block to execute before the first loop iteration. - # @yields {...} The block to execute on each loop iteration. - # @raises {Interrupt} If the scheduler is interrupted. - private def run_loop(initial = nil, &block) - interrupt = nil - - begin - # In theory, we could use Exception here to be a little bit safer, but we've only shown the case for SignalException to be a problem, so let's not over-engineer this. - Thread.handle_interrupt(::SignalException => :never) do - if initial - begin - initial.call - ensure - initial = nil - end - end - - until self.interrupted? - # If we are finished, we need to exit: - break unless yield - end - end - rescue Interrupt => interrupt - # If an interrupt did occur during an iteration of the event loop, we need to handle it. More specifically, `self.stop` is not safe to interrupt without potentially corrupting the task tree. - Thread.handle_interrupt(::SignalException => :never) do - Console.debug(self) do |buffer| - buffer.puts "Scheduler interrupted: #{interrupt.inspect}" - self.print_hierarchy(buffer) - end - - self.stop - end - - retry - end - - # If the event loop was interrupted, and we finished exiting normally (due to the interrupt), we need to re-raise the interrupt so that the caller can handle it too. - if interrupt - Kernel.raise(interrupt) - end - end - - # Run the reactor until all tasks are finished. Proxies arguments to {#async} immediately before entering the loop, if a block is provided. - # - # Forwards all parameters to {#async} if a block is given. - # - # @public Since *Async v1*. - # - # @yields {|task| ...} The top level task, if a block is given. - # @returns [Task] The initial task that was scheduled into the reactor. - def run(...) - Kernel.raise ClosedError if @selector.nil? - - begin - @profiler&.start - - initial_task = nil - - if block_given? - initial = proc do - initial_task = self.async(...) - end - end - - self.run_loop(initial) do - run_once - end - - return initial_task - ensure - @profiler&.stop - end - end - - # Start an asynchronous task within the specified reactor. The task will be executed until the first blocking call, at which point it will yield and and this method will return. - # - # @public Since *Async v1*. - # @asynchronous May context switch immediately to new task. - # @deprecated Use {#run} or {Task#async} instead. - # - # @yields {|task| ...} Executed within the task. - # @returns [Task] The task that was scheduled into the reactor. - def async(*arguments, **options, &block) - # Since this method is called by `run`, this warning is too excessive: - # warn("Async::Scheduler#async is deprecated. Use `run` or `Task#async` instead.", uplevel: 1, category: :deprecated) if $VERBOSE - - Kernel.raise ClosedError if @selector.nil? - - task = Task.new(Task.current? || self, **options, &block) - - task.run(*arguments) - - return task - end - - # Create a new fiber and return it without starting execution. - # @returns [Fiber] The fiber that was created. - def fiber(...) - return async(...).fiber - end - - # Invoke the block, but after the specified timeout, raise {TimeoutError} in any currenly blocking operation. If the block runs to completion before the timeout occurs or there are no non-blocking operations after the timeout expires, the code will complete without any exception. - # - # @public Since *Async v1*. - # @asynchronous May raise an exception at any interruption point (e.g. blocking operations). - # - # @parameter duration [Numeric] The time in seconds, in which the task should complete. - # @parameter exception [Class] The exception class to raise. - # @parameter message [String] The message to pass to the exception. - # @yields {|timeout| ...} The block to execute with a timeout. - def with_timeout(duration, exception = TimeoutError, message = "execution expired", &block) - fiber = Fiber.current - - timer = @timers.after(duration) do - if fiber.alive? - fiber.raise(exception, message) - end - end - - if block.arity.zero? - yield - else - yield Timeout.new(@timers, timer) - end - ensure - timer&.cancel! - end - - # Invoke the block, but after the specified timeout, raise the specified exception with the given message. If the block runs to completion before the timeout occurs or there are no non-blocking operations after the timeout expires, the code will complete without any exception. - # - # @public Since *Async v1* and *Ruby v3.1*. May be invoked from `Timeout.timeout`. - # @asynchronous May raise an exception at any interruption point (e.g. blocking operations). - # - # @parameter duration [Numeric] The time in seconds, in which the task should complete. - # @parameter exception [Class] The exception class to raise. - # @parameter message [String] The message to pass to the exception. - # @yields {|duration| ...} The block to execute with a timeout. - def timeout_after(duration, exception, message, &block) - with_timeout(duration, exception, message) do - yield duration - end - end - - # Handle fork in the child process. This method is called automatically when `Process.fork` is invoked on Ruby versions < 4 and cleans up the scheduler state. On Ruby 4+, the scheduler is automatically cleaned up by the Ruby runtime. - # - # The child process starts with a clean slate - no scheduler is set. Users can create a new scheduler if needed. - # - # @public Since *Async v2.35*. - def process_fork - @profiler = nil - @children = nil - @selector = nil - @timers = nil - @blocked = 0 - - # Close the scheduler: - Fiber.set_scheduler(nil) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/semaphore.md b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/semaphore.md deleted file mode 100644 index 2524693..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/semaphore.md +++ /dev/null @@ -1,41 +0,0 @@ -A synchronization primitive, which limits access to a given resource, such as a limited number of database connections, open files, or network connections. - -## Example - -~~~ ruby -require 'async' -require 'async/semaphore' -require 'net/http' - -Sync do - # Only allow two concurrent tasks at a time: - semaphore = Async::Semaphore.new(2) - - # Generate an array of 10 numbers: - terms = ['ruby', 'python', 'go', 'java', 'c++'] - - # Search for the terms: - terms.each do |term| - semaphore.async do |task| - Console.info("Searching for #{term}...") - response = Net::HTTP.get(URI "https://www.google.com/search?q=#{term}") - Console.info("Got response #{response.size} bytes.") - end - end -end -~~~ - -### Output - -~~~ -0.0s info: Searching for ruby... [ec=0x3c] [pid=50523] -0.04s info: Searching for python... [ec=0x21c] [pid=50523] -1.7s info: Got response 182435 bytes. [ec=0x3c] [pid=50523] -1.71s info: Searching for go... [ec=0x834] [pid=50523] -3.0s info: Got response 204854 bytes. [ec=0x21c] [pid=50523] -3.0s info: Searching for java... [ec=0xf64] [pid=50523] -4.32s info: Got response 103235 bytes. [ec=0x834] [pid=50523] -4.32s info: Searching for c++... [ec=0x12d4] [pid=50523] -4.65s info: Got response 109697 bytes. [ec=0xf64] [pid=50523] -6.64s info: Got response 87249 bytes. [ec=0x12d4] [pid=50523] -~~~ diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/semaphore.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/semaphore.rb deleted file mode 100644 index cf307ab..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/semaphore.rb +++ /dev/null @@ -1,127 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2024, by Samuel Williams. - -require_relative "list" - -module Async - # A synchronization primitive, which limits access to a given resource. - # @public Since *Async v1*. - class Semaphore - # @parameter limit [Integer] The maximum number of times the semaphore can be acquired before it blocks. - # @parameter parent [Task | Semaphore | Nil] The parent for holding any children tasks. - def initialize(limit = 1, parent: nil) - @count = 0 - @limit = limit - @waiting = List.new - - @parent = parent - end - - # The current number of tasks that have acquired the semaphore. - attr :count - - # The maximum number of tasks that can acquire the semaphore. - attr :limit - - # The tasks waiting on this semaphore. - attr :waiting - - # Allow setting the limit. This is useful for cases where the semaphore is used to limit the number of concurrent tasks, but the number of tasks is not known in advance or needs to be modified. - # - # On increasing the limit, some tasks may be immediately resumed. On decreasing the limit, some tasks may execute until the count is < than the limit. - # - # @parameter limit [Integer] The new limit. - def limit= limit - difference = limit - @limit - @limit = limit - - # We can't suspend - if difference > 0 - difference.times do - break unless node = @waiting.first - - node.resume - end - end - end - - # Is the semaphore currently acquired? - def empty? - @count.zero? - end - - # Whether trying to acquire this semaphore would block. - def blocking? - @count >= @limit - end - - # Run an async task. Will wait until the semaphore is ready until spawning and running the task. - def async(*arguments, parent: (@parent or Task.current), **options) - wait - - parent.async(**options) do |task| - @count += 1 - - begin - yield task, *arguments - ensure - self.release - end - end - end - - # Acquire the semaphore, block if we are at the limit. - # If no block is provided, you must call release manually. - # @yields {...} When the semaphore can be acquired. - # @returns The result of the block if invoked. - def acquire - wait - - @count += 1 - - return unless block_given? - - begin - return yield - ensure - self.release - end - end - - # Release the semaphore. Must match up with a corresponding call to `acquire`. Will release waiting fibers in FIFO order. - def release - @count -= 1 - - while (@limit - @count) > 0 and node = @waiting.first - node.resume - end - end - - private - - class FiberNode < List::Node - def initialize(fiber) - @fiber = fiber - end - - def resume - if @fiber.alive? - Fiber.scheduler.resume(@fiber) - end - end - end - - private_constant :FiberNode - - # Wait until the semaphore becomes available. - def wait - return unless blocking? - - @waiting.stack(FiberNode.new(Fiber.current)) do - Fiber.scheduler.transfer while blocking? - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/stop.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/stop.rb deleted file mode 100644 index 6daf973..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/stop.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025-2026, by Samuel Williams. - -require_relative "cancel" - -module Async - Stop = Cancel -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/task.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/task.rb deleted file mode 100644 index 6629c0e..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/task.rb +++ /dev/null @@ -1,549 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2017-2026, by Samuel Williams. -# Copyright, 2017, by Kent Gruber. -# Copyright, 2017, by Devin Christensen. -# Copyright, 2020, by Patrik Wenger. -# Copyright, 2023, by Math Ieu. -# Copyright, 2025, by Shigeru Nakajima. -# Copyright, 2025-2026, by Shopify Inc. -# Copyright, 2026, by Kyle Tate. - -require "fiber" -require "console" - -require_relative "node" -require_relative "condition" -require_relative "error" -require_relative "promise" -require_relative "stop" - -Fiber.attr_accessor :async_task - -module Async - # Represents a sequential unit of work, defined by a block, which is executed concurrently with other tasks. A task can be in one of the following states: `initialized`, `running`, `completed`, `failed`, or `cancelled`. - # - # ```mermaid - # stateDiagram-v2 - # [*] --> Initialized - # Initialized --> Running : Run - # - # Running --> Completed : Return Value - # Running --> Failed : Exception - # - # Completed --> [*] - # Failed --> [*] - # - # Running --> Cancelled : Cancel - # Cancelled --> [*] - # Completed --> Cancelled : Cancel - # Failed --> Cancelled : Cancel - # Initialized --> Cancelled : Cancel - # ``` - # - # @example Creating a task that sleeps for 1 second. - # require "async" - # Async do |task| - # sleep(1) - # end - # - # @public Since *Async v1*. - class Task < Node - # Raised when a child task is created within a task that has finished execution. - class FinishedError < RuntimeError - # Create a new finished error. - # - # @parameter message [String] The error message. - def initialize(message = "Cannot create child task within a task that has finished execution!") - super - end - end - - # @deprecated With no replacement. - def self.yield - warn("`Async::Task.yield` is deprecated with no replacement.", uplevel: 1, category: :deprecated) if $VERBOSE - - Fiber.scheduler.transfer - end - - # Run the given block of code in a task, asynchronously, in the given scheduler. - def self.run(scheduler, *arguments, **options, &block) - self.new(scheduler, **options, &block).tap do |task| - task.run(*arguments) - end - end - - # Create a new task. - # @parameter reactor [Reactor] the reactor this task will run within. - # @parameter parent [Task] the parent task. - def initialize(parent = Task.current?, finished: nil, **options, &block) - # These instance variables are critical to the state of the task. - # In the initialized state, the @block should be set, but the @fiber should be nil. - # In the running state, the @fiber should be set, and @block should be nil. - # In a finished state, the @block should be nil, and the @fiber should be nil. - @block = block - @fiber = nil - - @promise = Promise.new - - # Handle finished: parameter for backward compatibility: - case finished - when false - # `finished: false` suppresses warnings for expected task failures: - @promise.suppress_warnings! - when nil - # `finished: nil` is the default, no special handling: - else - # All other `finished:` values are deprecated: - warn("finished: argument with non-false value is deprecated and will be removed.", uplevel: 1, category: :deprecated) if $VERBOSE - end - - @defer_cancel = nil - - # Call this after all state is initialized, as it may call `add_child` which will set the parent and make it visible to the scheduler. - super(parent, **options) - end - - # @returns [Scheduler] The scheduler for this task. - def reactor - self.root - end - - # @returns [Array(Thread::Backtrace::Location) | Nil] The backtrace of the task, if available. - def backtrace(*arguments) - @fiber&.backtrace(*arguments) - end - - # Annotate the task with a description. - # - # This will internally try to annotate the fiber if it is running, otherwise it will annotate the task itself. - # - # @parameter annotation [String] The description to annotate the task with. - def annotate(annotation, &block) - if @fiber - @fiber.annotate(annotation, &block) - else - super - end - end - - # @returns [Object] The annotation of the task. - def annotation - if @fiber - @fiber.annotation - else - super - end - end - - # @returns [String] A description of the task and it's current status. - def to_s - "\#<#{self.description} (#{self.status})>" - end - - # @deprecated Prefer {Kernel#sleep} except when compatibility with `stable-v1` is required. - def sleep(duration = nil) - Kernel.warn("`Async::Task#sleep` is deprecated, use `Kernel#sleep` instead.", uplevel: 1, category: :deprecated) if $VERBOSE - - super - end - - # Execute the given block of code, raising the specified exception if it exceeds the given duration during a non-blocking operation. - def with_timeout(duration, exception = TimeoutError, message = "execution expired", &block) - Fiber.scheduler.with_timeout(duration, exception, message, &block) - end - - # Yield back to the reactor and allow other fibers to execute. - def yield - Fiber.scheduler.yield - end - - # @attribute [Fiber] The fiber which is being used for the execution of this task. - attr :fiber - - # @returns [Boolean] Whether the internal fiber is alive, i.e. it is actively executing. - def alive? - @fiber&.alive? - end - - # Whether we can remove this node from the reactor graph. - # @returns [Boolean] - def finished? - # If the block is nil and the fiber is nil, it means the task has finished execution. This becomes true after `finish!` is called. - super && @block.nil? && @fiber.nil? - end - - # @returns [Boolean] Whether the task is running. - def running? - self.alive? - end - - # @returns [Boolean] Whether the task failed with an exception. - def failed? - @promise.failed? - end - - # @returns [Boolean] Whether the task has been cancelled. - def cancelled? - @promise.cancelled? - end - - # @returns [Boolean] Whether the task has completed execution and generated a result. - def completed? - @promise.completed? - end - - # Alias for {#completed?}. - def complete? - self.completed? - end - - # @attribute [Symbol] The status of the execution of the task, one of `:initialized`, `:running`, `:complete`, `:cancelled` or `:failed`. - def status - case @promise.resolved - when :cancelled - :cancelled - when :failed - :failed - when :completed - :completed - when nil - self.running? ? :running : :initialized - end - end - - # Begin the execution of the task. - # - # @raises [RuntimeError] If the task is already running. - def run(*arguments) - # Move from initialized to running by clearing @block - if block = @block - @block = nil - - schedule do - block.call(self, *arguments) - rescue => error - # I'm not completely happy with this overhead, but the alternative is to not log anything which makes debugging extremely difficult. Maybe we can introduce a debug wrapper which adds extra logging. - unless @promise.waiting? - warn(self, "Task may have ended with unhandled exception.", exception: error) - end - - raise - end - else - raise RuntimeError, "Task already running!" - end - end - - # Run an asynchronous task as a child of the current task. - # - # @public Since *Async v1*. - # @asynchronous May context switch immediately to the new task. - # - # @yields {|task| ...} in the context of the new task. - # @raises [FinishedError] If the task has already finished. - # @returns [Task] The child task. - def async(*arguments, **options, &block) - raise FinishedError if self.finished? - - task = Task.new(self, **options, &block) - - # When calling an async block, we deterministically execute it until the first blocking operation. We don't *have* to do this - we could schedule it for later execution, but it's useful to: - # - # - Fail at the point of the method call where possible. - # - Execute determinstically where possible. - # - Avoid scheduler overhead if no blocking operation is performed. - # - # There are different strategies (greedy vs non-greedy). We are currently using a greedy strategy. - task.run(*arguments) - - return task - end - - # Retrieve the current result of the task. Will cause the caller to wait until result is available. If the task resulted in an unhandled error (derived from `StandardError`), this will be raised. If the task was cancelled, this will return `nil`. - # - # Conceptually speaking, waiting on a task should return a result, and if it throws an exception, this is certainly an exceptional case that should represent a failure in your program, not an expected outcome. In other words, you should not design your programs to expect exceptions from `#wait` as a normal flow control, and prefer to catch known exceptions within the task itself and return a result that captures the intention of the failure, e.g. a `TimeoutError` might simply return `nil` or `false` to indicate that the operation did not generate a valid result (as a timeout was an expected outcome of the internal operation in this case). - # - # @parameter timeout [Numeric] The maximum number of seconds to wait for the result before raising a `TimeoutError`, if specified. - # @raises [RuntimeError] If the task's fiber is the current fiber. - # @returns [Object] The final expression/result of the task's block. - # @asynchronous This method is thread-safe. - def wait(...) - raise "Cannot wait on own fiber!" if Fiber.current.equal?(@fiber) - - # Wait for the task to complete: - @promise.wait(...) - end - - # For compatibility with `Thread#join` and similar interfaces. - alias join wait - - # Wait on all non-transient children to complete, recursively, then wait on the task itself, if it is not the current task. - # - # If any child task fails with an exception, that exception will be raised immediately, and remaining children may not be waited on. - # - # @example Waiting on all children. - # Async do |task| - # child = task.async do - # sleep(0.01) - # end - # task.wait_all # Will wait on the child task. - # end - # - # @raises [StandardError] If any child task failed with an exception, that exception will be raised. - # @returns [Object | Nil] The final expression/result of the task's block, or nil if called from within the task. - # @asynchronous This method is thread-safe. - def wait_all - @children&.each do |child| - # Skip transient tasks - next if child.transient? - - child.wait_all - end - - # Only wait on the task if we're not waiting on ourselves: - unless self.current? - return self.wait - end - end - - # Access the result of the task without waiting. May be nil if the task is not completed. Does not raise exceptions. - def result - value = @promise.value - - # For backward compatibility, return nil for cancelled tasks: - if @promise.cancelled? - nil - else - value - end - end - - # Cancel the task and all of its children. - # - # If `later` is false, it means that `cancel` has been invoked directly. When `later` is true, it means that `cancel` is invoked by `stop_children` or some other indirect mechanism. In that case, if we encounter the "current" fiber, we can't cancel it right away, as it's currently performing `#cancel`. Cancelling it immediately would interrupt the current cancel traversal, so we need to schedule the cancel to occur later. - # - # @parameter later [Boolean] Whether to cancel the task later, or immediately. - # @parameter cause [Exception] The cause of the cancel operation. - def cancel(later = false, cause: $!) - # On affected Ruby versions, `Thread#kill` exposes the internal `TAG_FATAL` value through `$!`, which is not a valid exception cause: - unless cause.is_a?(::Exception) - cause = nil - end - - # If no cause is given, we generate one from the current call stack: - unless cause - cause = Cancel::Cause.for("Cancelling task!") - end - - if self.cancelled? - # If the task is already cancelled, a `cancel` state transition re-enters the same state which is a no-op. However, we will also attempt to cancel any running children too. This can happen if the children did not cancel correctly the first time around. Doing this should probably be considered a bug, but it's better to be safe than sorry. - return cancelled!(cause) - end - - # If the fiber is alive, we need to cancel it: - if @fiber&.alive? - # As the task is now exiting, we want to ensure the event loop continues to execute until the task finishes. - self.transient = false - - # If we are deferring cancel... - if @defer_cancel == false - # Don't cancel now... but update the state so we know we need to cancel later. - @defer_cancel = cause - return false - end - - if self.current? - # If the fiber is current, and later is `true`, we need to schedule the fiber to be cancelled later, as it's currently invoking `cancel`: - if later - # If the fiber is the current fiber and we want to cancel it later, schedule it: - Fiber.scheduler.push(Cancel::Later.new(self, cause)) - else - # Otherwise, raise the exception directly: - raise Cancel, "Cancelling current task!", cause: cause - end - else - # If the fiber is not curent, we can raise the exception directly: - begin - # There is a chance that this will cancel the fiber that originally called cancel. If that happens, the exception handling in `#cancelled` will rescue the exception and re-raise it later. - Fiber.scheduler.raise(@fiber, Cancel, cause: cause) - rescue FiberError - # In some cases, this can cause a FiberError (it might be resumed already), so we schedule it to be cancelled later: - Fiber.scheduler.push(Cancel::Later.new(self, cause)) - end - end - else - # We are not running, but children might be, so transition directly into cancelled state: - cancel!(cause) - end - end - - # Defer the handling of cancel. During the execution of the given block, if a cancel is requested, it will be deferred until the block exits. This is useful for ensuring graceful shutdown of servers and other long-running tasks. You should wrap the response handling code in a defer_cancel block to ensure that the task is cancelled when the response is complete but not before. - # - # You can nest calls to defer_cancel, but the cancel will only be deferred until the outermost block exits. - # - # If cancel is invoked a second time, it will be immediately executed. - # - # @yields {} The block of code to execute. - # @public Since *Async v1*. - def defer_cancel - # Tri-state variable for controlling cancel: - # - nil: defer_cancel has not been called. - # - false: defer_cancel has been called and we are not cancelling. - # - true: defer_cancel has been called and we will cancel when exiting the block. - if @defer_cancel.nil? - begin - # If we are not deferring cancel already, we can defer it now: - @defer_cancel = false - - yield - rescue Cancel - # If we are exiting due to a cancel, we shouldn't try to invoke cancel again: - @defer_cancel = nil - raise - ensure - defer_cancel = @defer_cancel - - # We need to ensure the state is reset before we exit the block: - @defer_cancel = nil - - # If we were asked to cancel, we should do so now: - if defer_cancel - raise Cancel, "Cancelling current task (was deferred)!", cause: defer_cancel - end - end - else - # If we are deferring cancel already, entering it again is a no-op. - yield - end - end - - # Backward compatibility alias for {#defer_cancel}. - # @deprecated Use {#defer_cancel} instead. - def defer_stop(&block) - defer_cancel(&block) - end - - # @returns [Boolean] Whether cancel has been deferred. - def cancel_deferred? - !!@defer_cancel - end - - # Backward compatibility alias for {#cancel_deferred?}. - # @deprecated Use {#cancel_deferred?} instead. - def stop_deferred? - cancel_deferred? - end - - # Lookup the {Task} for the current fiber. Raise `RuntimeError` if none is available. - # @returns [Task] - # @raises[RuntimeError] If task was not {set!} for the current fiber. - def self.current - Fiber.current.async_task or raise RuntimeError, "No async task available!" - end - - # Check if there is a task defined for the current fiber. - # @returns [Interface(:async) | Nil] - def self.current? - Fiber.current.async_task - end - - # @returns [Boolean] Whether this task is the currently executing task. - def current? - Fiber.current.equal?(@fiber) - end - - private - - def warn(...) - Console.warn(...) - end - - # Finish the current task, moving any children to the parent. - def finish! - # Break the cycle: - @fiber&.async_task = nil - - # Don't hold references to the fiber or block after the task has finished: - @fiber = nil - @block = nil # If some how we went directly from initialized to finished. - - # Attempt to remove this node from the task tree. - consume - end - - # State transition into the completed state. - def completed!(result) - # Resolve the promise with the result: - @promise.resolve(result) - end - - # State transition into the failed state. - def failed!(exception = false) - # Reject the promise with the exception: - @promise.reject(exception) - end - - def cancelled!(cause = $!) - # Console.info(self, status:) {"Task #{self} was cancelled with #{@children&.size.inspect} children!"} - - # Cancel the promise, specify nil here so that no exception is raised when waiting on the promise: - @promise.cancel(nil) - - cancelled = false - - begin - # We are not running, but children might be so we should stop them: - stop_children(true, cause: cause) - rescue Cancel => exception - cancelled = true - cause ||= exception.cause || exception - # If we are cancelling children, and one of them tries to cancel the current task, we should ignore it. We will be cancelled later. - retry - end - - if cancelled - raise Cancel, "Cancelling current task!", cause: cause - end - end - - def stopped! - cancelled! - end - - def cancel!(cause = $!) - cancelled!(cause) - - finish! - end - - def stop! - cancel! - end - - def schedule(&block) - @fiber = Fiber.new(annotation: self.annotation) do - begin - completed!(yield) - rescue Cancel => exception - cancelled!(exception.cause || exception) - rescue StandardError => error - failed!(error) - rescue Exception => exception - failed!(exception) - - # This is a critical failure, we should stop the reactor: - raise - ensure - # Console.info(self) {"Task ensure $! = #{$!} with #{@children&.size.inspect} children!"} - finish! - end - end - - @fiber.async_task = self - - (Fiber.scheduler || self.reactor).resume(@fiber) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/timeout.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/timeout.rb deleted file mode 100644 index 412aeee..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/timeout.rb +++ /dev/null @@ -1,88 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025, by Samuel Williams. - -module Async - # Represents a flexible timeout that can be rescheduled or extended. - # @public Since *Async v2.24*. - class Timeout - # Initialize a new timeout. - def initialize(timers, handle) - @timers = timers - @handle = handle - end - - # @returns [Numeric] The time remaining until the timeout occurs, in seconds. - def duration - @handle.time - @timers.now - end - - # Update the duration of the timeout. - # - # The duration is relative to the current time, e.g. setting the duration to 5 means the timeout will occur in 5 seconds from now. - # - # @parameter value [Numeric] The new duration to assign to the timeout, in seconds. - def duration=(value) - self.reschedule(@timers.now + value) - end - - # Adjust the timeout by the specified duration. - # - # The duration is relative to the timeout time, e.g. adjusting the timeout by 5 increases the current duration by 5 seconds. - # - # @parameter duration [Numeric] The duration to adjust the timeout by, in seconds. - # @returns [Numeric] The new time at which the timeout will occur. - def adjust(duration) - self.reschedule(time + duration) - end - - # @returns [Numeric] The time at which the timeout will occur, in seconds since {now}. - def time - @handle.time - end - - # Assign a new time to the timeout, rescheduling it if necessary. - # - # @parameter value [Numeric] The new time to assign to the timeout. - # @returns [Numeric] The new time at which the timeout will occur. - def time=(value) - self.reschedule(value) - end - - # @returns [Numeric] The current time in the scheduler, relative to the time of this timeout, in seconds. - def now - @timers.now - end - - # Cancel the timeout, preventing it from executing. - def cancel! - @handle.cancel! - end - - # @returns [Boolean] Whether the timeout has been cancelled. - def cancelled? - @handle.cancelled? - end - - # Raised when attempting to reschedule a cancelled timeout. - class CancelledError < RuntimeError - end - - # Reschedule the timeout to occur at the specified time. - # - # @parameter time [Numeric] The new time to schedule the timeout for. - # @returns [Numeric] The new time at which the timeout will occur. - private def reschedule(time) - if block = @handle&.block - @handle.cancel! - - @handle = @timers.schedule(time, block) - - return time - else - raise CancelledError, "Cannot reschedule a cancelled timeout!" - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/variable.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/variable.rb deleted file mode 100644 index 54c9391..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/variable.rb +++ /dev/null @@ -1,64 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2021-2025, by Samuel Williams. -# Copyright, 2025, by Shopify Inc. - -require_relative "condition" - -module Async - # A synchronization primitive that allows one task to wait for another task to resolve a value. - # - # @deprecated Use {Async::Promise} instead. - class Variable - # Create a new variable. - # - # @parameter condition [Condition] The condition to use for synchronization. - def initialize(condition = Condition.new) - warn("`Async::Variable` is deprecated, use `Async::Promise` instead.", category: :deprecated, uplevel: 1) if $VERBOSE - - @condition = condition - @value = nil - end - - # Resolve the value. - # - # Signals all waiting tasks. - # - # @parameter value [Object] The value to resolve. - def resolve(value = true) - @value = value - condition = @condition - @condition = nil - - self.freeze - - condition.signal(value) - end - - # Alias for {#resolve}. - def value=(value) - self.resolve(value) - end - - # Whether the value has been resolved. - # - # @returns [Boolean] Whether the value has been resolved. - def resolved? - @condition.nil? - end - - # Wait for the value to be resolved. - # - # @returns [Object] The resolved value. - def wait - @condition&.wait - return @value - end - - # Alias for {#wait}. - def value - self.wait - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/version.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/version.rb deleted file mode 100644 index 199cc3d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/version.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2017-2026, by Samuel Williams. - -# @namespace -module Async - VERSION = "2.46.0" -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/waiter.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/waiter.rb deleted file mode 100644 index 930a70d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/async/waiter.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2022-2025, by Samuel Williams. -# Copyright, 2024, by Patrik Wenger. -# Copyright, 2025, by Shopify Inc. - -module Async - # A composable synchronization primitive, which allows one task to wait for a number of other tasks to complete. It can be used in conjunction with {Semaphore} and/or {Barrier}. - # - # @deprecated `Async::Waiter` is deprecated, use `Async::Barrier` instead. - class Waiter - # Create a waiter instance. - # - # @parameter parent [Interface(:async) | Nil] The parent task to use for asynchronous operations. - # @parameter finished [Async::Condition] The condition to signal when a task completes. - def initialize(parent: nil, finished: Async::Condition.new) - warn("`Async::Waiter` is deprecated, use `Async::Barrier` instead.", uplevel: 1, category: :deprecated) if $VERBOSE - - @finished = finished - @done = [] - - @parent = parent - end - - # Execute a child task and add it to the waiter. - # @asynchronous Executes the given block concurrently. - def async(parent: (@parent or Task.current), **options, &block) - parent.async(**options) do |task| - yield(task) - ensure - @done << task - @finished.signal - end - end - - # Wait for the first `count` tasks to complete. - # @parameter count [Integer | Nil] The number of tasks to wait for. - # @returns [Array(Async::Task)] If an integer is given, the tasks which have completed. - # @returns [Async::Task] Otherwise, the first task to complete. - def first(count = nil) - minimum = count || 1 - - while @done.size < minimum - @finished.wait - end - - return @done.shift(*count) - end - - # Wait for the first `count` tasks to complete. - # @parameter count [Integer | Nil] The number of tasks to wait for. - def wait(count = nil) - if count - first(count).map(&:wait) - else - first.wait - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/kernel/async.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/kernel/async.rb deleted file mode 100644 index 76387ca..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/kernel/async.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2019-2026, by Samuel Williams. -# Copyright, 2026, by Shopify Inc. - -require_relative "../async/reactor" - -module Kernel - # Run the given block of code in a task, asynchronously, creating a reactor if necessary. - # - # The preferred method to invoke asynchronous behavior at the top level. - # - # - When invoked within an existing reactor task, it will run the given block - # asynchronously. Will return the task once it has been scheduled. - # - When invoked at the top level, will create and run a reactor, and invoke - # the block as an asynchronous task. Will block until the reactor finishes - # running. - # - # @yields {|task| ...} The block that will execute asynchronously. - # @parameter task [Async::Task] The task that is executing the given block. - # - # @public Since *Async v1*. - # @asynchronous May block until given block completes executing. - def Async(...) - if current = ::Async::Task.current? - return current.async(...) - elsif scheduler = Fiber.scheduler - ::Async::Task.run(scheduler, ...) - else - Fiber.blocking do - # This calls Fiber.set_scheduler(self): - reactor = ::Async::Reactor.new - - begin - return reactor.run(...) - ensure - Fiber.set_scheduler(nil) - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/kernel/barrier.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/kernel/barrier.rb deleted file mode 100644 index 627af83..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/kernel/barrier.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025, by Samuel Williams. - -require_relative "sync" -require_relative "../async/barrier" -require_relative "../async/idler" - -module Kernel - # Create a barrier, yield it to the block, and then wait for all tasks to complete. - # - # If no scheduler is running, one will be created automatically for the duration of the block. - # - # By default, the barrier uses an `Async::Idler` to manage load, but this can be overridden by providing a different parent or `nil` to disable load management. - # - # @parameter parent [Task | Semaphore | Nil] The parent for holding any children tasks. - # @parameter **options [Hash] Additional options passed to {Kernel::Sync}. - # @public Since *Async v2.34*. - def Barrier(parent: Async::Idler.new, **options) - Sync(**options) do |task| - barrier = ::Async::Barrier.new(parent: parent) - - yield barrier - - barrier.wait - ensure - barrier&.stop - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/kernel/sync.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/kernel/sync.rb deleted file mode 100644 index 2c0f7ea..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/kernel/sync.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2019-2026, by Samuel Williams. -# Copyright, 2020, by Brian Morearty. -# Copyright, 2024, by Patrik Wenger. -# Copyright, 2025-2026, by Shopify Inc. - -require_relative "../async/reactor" - -# Extensions to all Ruby objects. -module Kernel - # Run the given block of code synchronously, but within a reactor if not already in one. - # - # @yields {|task| ...} The block that will execute asynchronously. - # @parameter task [Async::Task] The task that is executing the given block. - # - # @public Since *Async v1*. - # @asynchronous Will block until given block completes executing. - def Sync(annotation: nil, &block) - if task = ::Async::Task.current? - if annotation - task.annotate(annotation){yield task} - else - yield task - end - elsif scheduler = Fiber.scheduler - ::Async::Task.run(scheduler, &block).wait - else - Fiber.blocking do - # This calls Fiber.set_scheduler(self): - reactor = Async::Reactor.new - - begin - # Use finished: false to suppress warnings since we're handling exceptions explicitly - return reactor.run(annotation: annotation, finished: false, &block).wait - ensure - Fiber.set_scheduler(nil) - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/metrics/provider/async.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/metrics/provider/async.rb deleted file mode 100644 index a4252d4..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/metrics/provider/async.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2024, by Samuel Williams. - -require_relative "async/task" diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/metrics/provider/async/task.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/metrics/provider/async/task.rb deleted file mode 100644 index 7781f95..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/metrics/provider/async/task.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2024-2025, by Samuel Williams. - -require_relative "../../../async/task" -require "metrics/provider" - -Metrics::Provider(Async::Task) do - ASYNC_TASK_SCHEDULED = Metrics.metric("async.task.scheduled", :counter, description: "The number of tasks scheduled.") - ASYNC_TASK_FINISHED = Metrics.metric("async.task.finished", :counter, description: "The number of tasks finished.") - - def schedule(&block) - ASYNC_TASK_SCHEDULED.emit(1) - - super(&block) - ensure - ASYNC_TASK_FINISHED.emit(1) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/traces/provider/async.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/traces/provider/async.rb deleted file mode 100644 index ba4de70..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/traces/provider/async.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2024, by Samuel Williams. - -require_relative "async/task" -require_relative "async/barrier" diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/traces/provider/async/barrier.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/traces/provider/async/barrier.rb deleted file mode 100644 index 7d896fc..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/traces/provider/async/barrier.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2024-2025, by Samuel Williams. - -require_relative "../../../async/barrier" -require "traces/provider" - -Traces::Provider(Async::Barrier) do - def wait - attributes = { - "size" => self.size - } - - Traces.trace("async.barrier.wait", attributes: attributes){super} - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/traces/provider/async/task.rb b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/traces/provider/async/task.rb deleted file mode 100644 index 93d13ff..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/lib/traces/provider/async/task.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2024-2025, by Samuel Williams. - -require_relative "../../../async/task" -require "traces/provider" - -Traces::Provider(Async::Task) do - def schedule(&block) - # If we are not actively tracing anything, then we can skip this: - unless Traces.active? - return super(&block) - end - - unless self.transient? - trace_context = Traces.current_context - end - - attributes = { - # We use the instance variable as it corresponds to the user-provided block. - "block" => @block.to_s, - "transient" => self.transient?, - } - - # Run the trace in the context of the child task: - super do - Traces.with_context(trace_context) - - if annotation = self.annotation - attributes["annotation"] = annotation - end - - Traces.trace("async.task", attributes: attributes) do - # Yes, this is correct, we already called super above: - yield - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/license.md b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/license.md deleted file mode 100644 index b3c0da1..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/license.md +++ /dev/null @@ -1,58 +0,0 @@ -# MIT License - -Copyright, 2017-2026, by Samuel Williams. -Copyright, 2017, by Kent Gruber. -Copyright, 2017, by Devin Christensen. -Copyright, 2018, by Sokolov Yura. -Copyright, 2018, by Jiang Jinyang. -Copyright, 2019, by Jeremy Jung. -Copyright, 2019, by Ryan Musgrave. -Copyright, 2020-2023, by Olle Jonsson. -Copyright, 2020, by Salim Semaoune. -Copyright, 2020, by Brian Morearty. -Copyright, 2020, by Stefan Wrobel. -Copyright, 2020-2024, by Patrik Wenger. -Copyright, 2020, by Ken Muryoi. -Copyright, 2020, by Jun Jiang. -Copyright, 2020-2022, by Bruno Sutic. -Copyright, 2021, by Julien Portalier. -Copyright, 2022, by Shannon Skipper. -Copyright, 2022, by Masafumi Okura. -Copyright, 2022, by Trevor Turk. -Copyright, 2022, by Masayuki Yamamoto. -Copyright, 2023, by Leon Löchner. -Copyright, 2023, by Colin Kelley. -Copyright, 2023, by Math Ieu. -Copyright, 2023, by Emil Tin. -Copyright, 2023, by Gert Goet. -Copyright, 2024, by Dimitar Peychinov. -Copyright, 2024, by Jamie McCarthy. -Copyright, 2025, by Jahfer Husain. -Copyright, 2025, by Mark Montroy. -Copyright, 2025, by Shigeru Nakajima. -Copyright, 2025, by Alan Wu. -Copyright, 2025-2026, by Shopify Inc. -Copyright, 2025, by Josh Teeter. -Copyright, 2025, by Jatin Goyal. -Copyright, 2025, by Yuhi Sato. -Copyright, 2026, by Tavian Barnes. -Copyright, 2026, by Robert Mosolgo. -Copyright, 2026, by Kyle Tate. - -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/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/readme.md b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/readme.md deleted file mode 100644 index 758884b..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/readme.md +++ /dev/null @@ -1,118 +0,0 @@ -# ![Async](assets/logo.webp) - -Async is a composable asynchronous I/O framework for Ruby based on [io-event](https://github.com/socketry/io-event). - -> "Lately I've been looking into `async`, as one of my projects – -> [tus-ruby-server](https://github.com/janko/tus-ruby-server) – would really benefit from non-blocking I/O. It's really -> beautifully designed." *– [janko](https://github.com/janko)* - -[![Development Status](https://github.com/socketry/async/workflows/Test/badge.svg)](https://github.com/socketry/async/actions?workflow=Test) - -## Features - - - Scalable event-driven I/O for Ruby. Thousands of clients per process\! - - Light weight fiber-based concurrency. No need for callbacks\! - - Multi-thread/process containers for parallelism. - - Growing eco-system of event-driven components. - -## Usage - -Please see the [project documentation](https://socketry.github.io/async/) for more details. - - - [Getting Started](https://socketry.github.io/async/guides/getting-started/index) - This guide shows how to add async to your project and run code asynchronously. - - - [Scheduler](https://socketry.github.io/async/guides/scheduler/index) - This guide gives an overview of how the scheduler is implemented. - - - [Tasks](https://socketry.github.io/async/guides/tasks/index) - This guide explains how asynchronous tasks work and how to use them. - - - [Best Practices](https://socketry.github.io/async/guides/best-practices/index) - This guide gives an overview of best practices for using Async. - - - [Debugging](https://socketry.github.io/async/guides/debugging/index) - This guide explains how to debug issues with programs that use Async. - - - [Thread safety](https://socketry.github.io/async/guides/thread-safety/index) - This guide explains thread safety in Ruby, focusing on fibers and threads, common pitfalls, and best practices to avoid problems like data corruption, race conditions, and deadlocks. - -## Releases - -Please see the [project releases](https://socketry.github.io/async/releases/index) for all releases. - -### v2.46.0 - - - Fixed `Thread#kill` raising a `TypeError` while shutting down a thread with an active `Async::Reactor`. - -### v2.45.1 - - - Fixed `Scheduler#io_wait` returning `nil` instead of `false` when an explicit timeout expired. Native callers such as `Socket#connect` with `connect_timeout:` distinguish a timeout by checking for `false`, so the `nil` caused `TypeError: no implicit conversion from nil to integer` instead of the intended `IO::TimeoutError`. - -### v2.45.0 - - - Fixed scheduler I/O and process waits returning prematurely after stale or interrupted wake-ups. I/O waits now preserve their original timeout, while blocking process waits retry and non-blocking `Process::WNOHANG` waits still return `nil`. - -### v2.44.0 - - - Fixed scheduler cleanup after forking while other fibers are blocked. - -### v2.43.0 - - - Propagate cancellation causes through task trees so child tasks observe the original cancellation cause. - -### v2.42.0 - - - `Sync` and `Async` can now be invoked from a non-blocking fiber that has no scheduler (e.g. inside an `Enumerator` or a bare `Fiber.new`). Previously this raised `RuntimeError: Running scheduler on non-blocking fiber!`. The reactor is now run within `Fiber.blocking`, so the scheduler always runs on a blocking fiber. - -### v2.41.0 - - - **Fixed**: Protect initial task from Interrupt exceptions. - -### v2.40.0 - - - Introduce `Async::Condition#waiting_count`. This allows you to see how many tasks are currently waiting on the condition, which can be useful for debugging and monitoring purposes. - -### v2.39.0 - - - `Async::Barrier#wait` now returns the number of tasks that were waited for, or `nil` if there were no tasks to wait for. This provides better feedback about the operation, and allows you to know how many tasks were involved in the wait. - -### v2.38.1 - - - Fix `Barrier#async` when `parent.async` yields before the child block executes. Previously, `Barrier#wait` could return early and miss tracking the task entirely, because the task had not yet appended itself to the barrier's task list. - -## See Also - - - [async-http](https://github.com/socketry/async-http) — Asynchronous HTTP client/server. - - [falcon](https://github.com/socketry/falcon) — A rack compatible server built on top of `async-http`. - - [async-websocket](https://github.com/socketry/async-websocket) — Asynchronous client and server websockets. - - [async-dns](https://github.com/socketry/async-dns) — Asynchronous DNS resolver and server. - - [toolbox](https://github.com/socketry/toolbox) — GDB & LLDB extensions for debugging Ruby applications with Fibers. - -## Contributing - -We welcome contributions to this project. - -1. Fork it. -2. Create your feature branch (`git checkout -b my-new-feature`). -3. Commit your changes (`git commit -am 'Add some feature'`). -4. Push to the branch (`git push origin my-new-feature`). -5. Create new Pull Request. - -### Running Tests - -To run the test suite: - -``` shell -bundle exec sus -``` - -### Making Releases - -To make a new release: - -``` shell -bundle exec bake gem:release:patch # or minor or major -``` - -### Developer Certificate of Origin - -In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed. - -### Community Guidelines - -This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers. diff --git a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/releases.md b/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/releases.md deleted file mode 100644 index ac220bd..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-2.46.0/releases.md +++ /dev/null @@ -1,488 +0,0 @@ -# Releases - -## v2.46.0 - - - Fixed `Thread#kill` raising a `TypeError` while shutting down a thread with an active `Async::Reactor`. - -## v2.45.1 - - - Fixed `Scheduler#io_wait` returning `nil` instead of `false` when an explicit timeout expired. Native callers such as `Socket#connect` with `connect_timeout:` distinguish a timeout by checking for `false`, so the `nil` caused `TypeError: no implicit conversion from nil to integer` instead of the intended `IO::TimeoutError`. - -## v2.45.0 - - - Fixed scheduler I/O and process waits returning prematurely after stale or interrupted wake-ups. I/O waits now preserve their original timeout, while blocking process waits retry and non-blocking `Process::WNOHANG` waits still return `nil`. - -## v2.44.0 - - - Fixed scheduler cleanup after forking while other fibers are blocked. - -## v2.43.0 - - - Propagate cancellation causes through task trees so child tasks observe the original cancellation cause. - -## v2.42.0 - - - `Sync` and `Async` can now be invoked from a non-blocking fiber that has no scheduler (e.g. inside an `Enumerator` or a bare `Fiber.new`). Previously this raised `RuntimeError: Running scheduler on non-blocking fiber!`. The reactor is now run within `Fiber.blocking`, so the scheduler always runs on a blocking fiber. - -## v2.41.0 - - - **Fixed**: Protect initial task from Interrupt exceptions. - -## v2.40.0 - - - Introduce `Async::Condition#waiting_count`. This allows you to see how many tasks are currently waiting on the condition, which can be useful for debugging and monitoring purposes. - -## v2.39.0 - - - `Async::Barrier#wait` now returns the number of tasks that were waited for, or `nil` if there were no tasks to wait for. This provides better feedback about the operation, and allows you to know how many tasks were involved in the wait. - -## v2.38.1 - - - Fix `Barrier#async` when `parent.async` yields before the child block executes. Previously, `Barrier#wait` could return early and miss tracking the task entirely, because the task had not yet appended itself to the barrier's task list. - -## v2.38.0 - - - Rename `Task#stop` to `Task#cancel` for better clarity and consistency with common concurrency terminology. The old `stop` method is still available as an alias for backward compatibility, but it is recommended to use `cancel` going forward. - - Forward arguments from `Task#wait` -\> `Promise#wait`, so `task.wait(timeout: N)` is supported. - -## v2.37.0 - - - Introduce `Async::Loop` for robust, time-aligned loops. - - Add support for `Async::Promise#wait(timeout: N)`. - -## v2.36.0 - - - Introduce `Task#wait_all` which recursively waits for all children and self, excepting the current task. - - Introduce `Task#join` as an alias for `Task#wait` for compatibility with `Thread#join` and similar interfaces. - -## v2.35.3 - - - `Async::Clock` now implements `#as_json` and `#to_json` for nicer log formatting. - -## v2.35.2 - - - Improved handling of `Process.fork` on Ruby 4+. - - Improve `@promise` state handling in `Task#initialize`, preventing incomplete instances being visible to the scheduler. - -## v2.35.1 - - - Fix incorrect handling of spurious wakeups in `Async::Promise#wait`, which could lead to premature (incorrect) resolution of the promise. - -## v2.35.0 - - - `Process.fork` is now properly handled by the Async fiber scheduler, ensuring that the scheduler state is correctly reset in the child process after a fork. This prevents issues where the child process inherits the scheduler state from the parent, which could lead to unexpected behavior. - -## v2.34.0 - -### `Kernel::Barrier` Convenience Interface - -Starting multiple concurrent tasks and waiting for them to finish is a common pattern. This change introduces a small ergonomic helper, `Barrier`, defined in `Kernel`, that encapsulates this behavior: it creates an `Async::Barrier`, yields it to a block, waits for completion (using `Sync` to run a reactor if needed), and ensures remaining tasks are stopped on exit. - -``` ruby -require "async" - -Barrier do |barrier| - 3.times do |i| - barrier.async do |task| - sleep(rand * 0.1) # Simulate work - puts "Task #{i} completed" - end - end -end - -# All tasks are guaranteed to complete or be stopped when the block exits. -``` - -If an exception is raised by a task, it will be propagated to the caller, and any remaining tasks will be stopped. The `parent:` parameter can be used to specify a parent task for the barrier, otherwise it will use the current task if available, or create a new reactor if not. - -## v2.33.0 - - - Introduce `Async::Promise.fulfill` for optional promise resolution. - -## v2.32.1 - - - Fix typo in documentation. - -## v2.32.0 - - - Introduce `Queue#waiting_count` and `PriorityQueue#waiting_count`. Generally for statistics/testing purposes only. - -## v2.31.0 - - - Introduce `Async::Deadline` for precise timeout management in compound operations. - -## v2.30.0 - - - Add timeout support to `Async::Queue#dequeue` and `Async::Queue#pop` methods. - - Add timeout support to `Async::PriorityQueue#dequeue` and `Async::PriorityQueue#pop` methods. - - Add `closed?` method to `Async::PriorityQueue` for full queue interface compatibility. - - Support non-blocking operations using `timeout: 0` parameter. - -## v2.29.0 - -This release introduces thread-safety as a core concept of Async. Many core classes now have thread-safe guarantees, allowing them to be used safely across multiple threads. - - - Thread-safe `Async::Condition` and `Async::Notification`, implemented using `Thread::Queue`. - - Thread-safe `Async::Queue` and `Async::LimitedQueue`, implemented using `Thread::Queue` and `Thread::LimitedQueue` respectively. - - `Async::Variable` is deprecated in favor of `Async::Promise`. - -### Introduce `Async::Promise` - -This release introduces the new `Async::Promise` class and refactors `Async::Task` to use promises for state management internally. This architectural improvement achieves the design goal that "a task should be a promise with attached computation and cancellation handling." - - - **Thread-safe promise implementation** with immutable state transitions. - - **Consistent state management** using symbols: `:completed`, `:failed`, `:cancelled`. - - **Promise cancellation** with `cancel()` method and `Cancel` exception class. - - **Comprehensive test coverage** with 47 new test cases covering all edge cases. - - - -``` ruby -require "async/promise" - -# Basic promise usage - works independently of Async framework -promise = Async::Promise.new - -# In another thread or fiber, resolve the promise -Thread.new do - sleep(1) # Simulate some work - promise.resolve("Hello, World!") -end - -# Wait for the result -result = promise.wait -puts result # => "Hello, World!" - -# Check promise state -puts promise.resolved? # => true -puts promise.completed? # => true -``` - -Promises bridge Thread and Fiber concurrency models - a promise resolved in one thread can be awaited in a fiber, and vice versa. - -### Introduce `Async::PriorityQueue` - -The new `Async::PriorityQueue` provides a thread-safe, fiber-aware queue where consumers can specify priority levels. Higher priority consumers are served first when items become available, with FIFO ordering maintained for equal priorities. This is useful for implementing priority-based task processing systems where critical operations need to be handled before lower priority work. - -``` ruby -require "async" -require "async/priority_queue" - -Async do - queue = Async::PriorityQueue.new - - # Start consumers with different priorities - low_priority = async do - puts "Low priority consumer got: #{queue.dequeue(priority: 1)}" - end - - medium_priority = async do - puts "Medium priority consumer got: #{queue.dequeue(priority: 5)}" - end - - high_priority = async do - puts "High priority consumer got: #{queue.dequeue(priority: 10)}" - end - - # Add items to the queue - queue.push("first item") - queue.push("second item") - queue.push("third item") - - # Output: - # High priority consumer got: first item - # Medium priority consumer got: second item - # Low priority consumer got: third item -end -``` - -## v2.28.1 - - - Fix race condition between `Async::Barrier#stop` and finish signalling. - -## v2.28.0 - - - Use `Traces.current_context` and `Traces.with_context` for better integration with OpenTelemetry. - -## v2.27.4 - - - Suppress excessive warning in `Async::Scheduler#async`. - -## v2.27.3 - - - Ensure trace attributes are strings, fixes integration with OpenTelemetry. - -## v2.27.2 - - - Fix `context/index.yaml` schema. - -## v2.27.1 - - - Updated documentation and agent context. - -## v2.27.0 - - - `Async::Task#stop` supports an optional `cause:` argument (that defaults to `$!`), which allows you to specify the cause (exception) for stopping the task. - - Add thread-safety agent context. - -## v2.26.0 - - - `Async::Notification#signal` now returns `true` if a task was signaled, `false` otherwise, providing better feedback for notification operations. - - `require "async/limited_queue"` is required to use `Async::LimitedQueue` without a deprecation warning. `Async::LimitedQueue` is not deprecated, but it's usage via `async/queue` is deprecated. - - `Async::Task#sleep` is deprecated with no replacement. - - `Async::Task.yield` is deprecated with no replacement. - - `Async::Scheduler#async` is deprecated, use `Async{}`, `Sync{}` or `Async::Task#async` instead. - - Agent context is now available, via the [`agent-context` gem](https://github.com/ioquatix/agent-context). - -### `Async::Barrier` Improvements - -`Async::Barrier` now provides more flexible and predictable behavior for waiting on task completion: - - - **Completion-order waiting**: `barrier.wait` now processes tasks in the order they complete rather than the order they were created. This provides more predictable behavior when tasks have different execution times. - - **Block-based waiting**: `barrier.wait` now accepts an optional block that yields each task as it completes, allowing for custom handling of individual tasks: - - - -``` ruby -barrier = Async::Barrier.new - -# Start several tasks -3.times do |i| - barrier.async do |task| - sleep(rand * 0.1) # Random completion time - "result_#{i}" - end -end - -# Wait for all tasks, processing them as they complete -barrier.wait do |task| - result = task.wait - puts "Task completed with: #{result}" -end -``` - - - **Partial completion support**: The new block-based interface allows you to wait for only the first N tasks to complete: - - - -``` ruby -# Wait for only the first 3 tasks to complete -count = 0 -barrier.wait do |task| - task.wait - count += 1 - break if count >= 3 -end -``` - -This makes `Async::Barrier` a superset of `Async::Waiter` functionality, providing more flexible task coordination patterns, and therrefore, `Async::Waiter` is now deprecated. - -### Introduce `Async::Queue#close` - -`Async::Queue` and `Async::LimitedQueue` can now be closed, which provides better resource management and error handling: - - - **New `close` method**: Both queue types now have a `close` method that prevents further items from being added and signals any waiting tasks. - - **Consistent error handling**: All queue modification methods (`push`, `enqueue`, `<<`) now raise `Async::Queue::ClosedError` when called on a closed queue. - - **Waiting task signaling**: When a queue is closed, any tasks waiting on `dequeue` (for regular queues) or `enqueue` (for limited queues) are properly signaled and can complete. - - - -``` ruby -queue = Async::Queue.new - -# Start a task waiting for items: -waiting_task = Async do - queue.dequeue -end - -# Close the queue - this signals the waiting task -queue.close - -# These will raise Async::Queue::ClosedError -queue.push(:item) # => raises ClosedError -queue.enqueue(:item) # => raises ClosedError -queue << :item # => raises ClosedError - -# Dequeue returns nil when closed and empty -queue.dequeue # => nil -``` - -## v2.25.0 - - - Added support for `io_select` hook in the fiber scheduler, allowing non-blocking `IO.select` operations. This enables better integration with code that uses `IO.select` for multiplexing IO operations. - -### Use `IO::Event::WorkerPool` for Blocking Operations - -The `Async::WorkerPool` implementation has been removed in favor of using `IO::Event::WorkerPool` directly. This change simplifies the codebase by delegating worker pool functionality to the `io-event` gem, which provides a more efficient and well-tested implementation. - -To enable the worker pool, you can set the `ASYNC_SCHEDULER_WORKER_POOL` environment variable to `true`. This will allow the scheduler to use a worker pool for blocking operations, which can help improve performance in applications that perform a lot of CPU-bound operations (e.g. `rb_nogvl`). - -### Better handling of `IO#close` using `fiber_interrupt` - -`IO#close` interrupts fibers that are waiting on the IO using the new `fiber_interrupt` hook introduced in Ruby 3.5/4.0. This means that if you close an IO while a fiber is waiting on it, the fiber will be interrupted and will raise an `IOError`. This is a change from previous versions of Ruby, where closing an IO would not interrupt fibers waiting on it, and would instead interrupt the entire event loop (essentially a bug). - -``` ruby -r, w = IO.pipe - -Async do - child = Async do - r.gets - end - - r.close # This will interrupt the child fiber. - child.wait # This will raise an `IOError` because the IO was closed. -end -``` - -## v2.24.0 - - - Ruby v3.1 support is dropped. - - `Async::Wrapper` which was previously deprecated, is now removed. - -### Flexible Timeouts - -When `Async::Scheduler#with_timeout` is invoked with a block, it can receive a `Async::Timeout` instance. This allows you to adjust or cancel the timeout while the block is executing. This is useful for long-running tasks that may need to adjust their timeout based on external factors. - -``` ruby -Async do - Async::Scheduler.with_timeout(5) do |timeout| - # Do some work that may take a while... - - if some_condition - timeout.cancel! # Cancel the timeout - else - # Add 10 seconds to the current timeout: - timeout.adjust(10) - - # Reduce the timeout by 10 seconds: - timeout.adjust(-10) - - # Set the timeout to 10 seconds from now: - timeout.duration = 10 - - # Increase the current duration: - timeout.duration += 10 - end - end -end -``` - -## v2.23.0 - - - Rename `ASYNC_SCHEDULER_DEFAULT_WORKER_POOL` to `ASYNC_SCHEDULER_WORKER_POOL`. - -### Fiber Stall Profiler - -After several iterations of experimentation, we are officially introducing the fiber stall profiler, implemented using the optional `fiber-profiler` gem. This gem is not included by default, but can be added to your project: - -``` bash -$ bundle add fiber-profiler -``` - -After adding the gem, you can enable the fiber stall profiler by setting the `FIBER_PROFILER_CAPTURE=true` environment variable: - -``` bash -$ FIBER_PROFILER_CAPTURE=true bundle exec ruby -rasync -e 'Async{Fiber.blocking{sleep 0.1}}' -Fiber stalled for 0.105 seconds --e:1 in c-call '##blocking' (0.105s) - -e:1 in c-call 'Kernel#sleep' (0.105s) -Skipped 1 calls that were too short to be meaningful. -``` - -The fiber profiler will help you find problems with your code that cause the event loop to stall, which can be a common source of performance issues in asynchronous code. - -## v2.21.1 - -### Worker Pool - -Ruby 3.4 will feature a new fiber scheduler hook, `blocking_operation_wait` which allows the scheduler to redirect the work given to `rb_nogvl` to a worker pool. - -The Async scheduler optionally supports this feature using a worker pool, by using the following environment variable: - - ASYNC_SCHEDULER_WORKER_POOL=true - -This will cause the scheduler to use a worker pool for general blocking operations, rather than blocking the event loop. - -It should be noted that this isn't a net win, as the overhead of using a worker pool can be significant compared to the `rb_nogvl` work. As such, it is recommended to benchmark your application with and without the worker pool to determine if it is beneficial. - -## v2.20.0 - -### Traces and Metrics Providers - -Async now has [traces](https://github.com/socketry/traces) and [metrics](https://github.com/socketry/metrics) providers for various core classes. This allows you to emit traces and metrics to a suitable backend (including DataDog, New Relic, OpenTelemetry, etc.) for monitoring and debugging purposes. - -To take advantage of this feature, you will need to introduce your own `config/traces.rb` and `config/metrics.rb`. Async's own repository includes these files for testing purposes, you could copy them into your own project and modify them as needed. - -## v2.19.0 - -### `Async::Scheduler` Debugging - -Occasionally on issues, I encounter people asking for help and I need more information. Pressing Ctrl-C to exit a hung program is common, but it usually doesn't provide enough information to diagnose the problem. Setting the `CONSOLE_LEVEL=debug` environment variable will now print additional information about the scheduler when you interrupt it, including a backtrace of the current tasks. - - > CONSOLE_LEVEL=debug bundle exec ruby ./test.rb - ^C 0.0s debug: Async::Reactor [oid=0x974] [ec=0x988] [pid=9116] [2024-11-08 14:12:03 +1300] - | Scheduler interrupted: Interrupt - | # - | # - | → /Users/samuel/Developer/socketry/async/lib/async/scheduler.rb:185:in `transfer' - | /Users/samuel/Developer/socketry/async/lib/async/scheduler.rb:185:in `block' - | /Users/samuel/Developer/socketry/async/lib/async/scheduler.rb:207:in `kernel_sleep' - | /Users/samuel/Developer/socketry/async/test.rb:7:in `sleep' - | /Users/samuel/Developer/socketry/async/test.rb:7:in `sleepy' - | /Users/samuel/Developer/socketry/async/test.rb:12:in `block in ' - | /Users/samuel/Developer/socketry/async/lib/async/task.rb:197:in `block in run' - | /Users/samuel/Developer/socketry/async/lib/async/task.rb:420:in `block in schedule' - /Users/samuel/Developer/socketry/async/lib/async/scheduler.rb:317:in `select': Interrupt - ... (backtrace continues) ... - -This gives better visibility into what the scheduler is doing, and should help diagnose issues. - -### Console Shims - -The `async` gem depends on `console` gem, because my goal was to have good logging by default without thinking about it too much. However, some users prefer to avoid using the `console` gem for logging, so I've added an experimental set of shims which should allow you to bypass the `console` gem entirely. - -``` ruby -require "async/console" -require "async" - -Async {raise "Boom"} -``` - -Will now use `Kernel#warn` to print the task failure warning: - - # - Task may have ended with unhandled exception. - (irb):4:in `block in ': Boom (RuntimeError) - from /home/samuel/Developer/socketry/async/lib/async/task.rb:197:in `block in run' - from /home/samuel/Developer/socketry/async/lib/async/task.rb:420:in `block in schedule' - -## v2.18.0 - - - Add support for `Sync(annotation:)`, so that you can annotate the block with a description of what it does, even if it doesn't create a new task. - -## v2.17.0 - - - Introduce `Async::Queue#push` and `Async::Queue#pop` for compatibility with `::Queue`. - -## v2.16.0 - -### Better Handling of Async and Sync in Nested Fibers - -Interleaving bare fibers within `Async` and `Sync` blocks should not cause problems, but it presents a number of issues in the current implementation. Tracking the parent-child relationship between tasks, when they are interleaved with bare fibers, is difficult. The current implementation assumes that if there is no parent task, then it should create a new reactor. This is not always the case, as the parent task might not be visible due to nested Fibers. As a result, `Async` will create a new reactor, trying to stop the existing one, causing major internal consistency issues. - -I encountered this issue when trying to use `Async` within a streaming response in Rails. The `protocol-rack` [uses a normal fiber to wrap streaming responses](https://github.com/socketry/protocol-rack/blob/cb1ca44e9deadb9369bdb2ea03416556aa927c5c/lib/protocol/rack/body/streaming.rb#L24-L28), and if you try to use `Async` within it, it will create a new reactor, causing the server to lock up. - -Ideally, `Async` and `Sync` helpers should work when any `Fiber.scheduler` is defined. Right now, it's unrealistic to expect `Async::Task` to work in any scheduler, but at the very least, the following should work: - -``` ruby -reactor = Async::Reactor.new # internally calls Fiber.set_scheduler - -# This should run in the above reactor, rather than creating a new one. -Async do - puts "Hello World" -end -``` - -In order to do this, bare `Async` and `Sync` blocks should use `Fiber.scheduler` as a parent if possible. - -See for more details. diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/bake/async/http.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/bake/async/http.rb deleted file mode 100644 index ab7569b..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/bake/async/http.rb +++ /dev/null @@ -1,95 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2020-2024, by Samuel Williams. - -# Fetch the specified URL and print the response. -# @param url [String] the URL to parse and fetch. -# @param method [String] the HTTP method to use. -def fetch(url, method:) - require "async/http/internet" - require "kernel/sync" - - terminal = Console::Terminal.for($stdout) - terminal[:request] = terminal.style(:blue, nil, :bold) - terminal[:response] = terminal.style(:green, nil, :bold) - terminal[:length] = terminal.style(nil, nil, :bold) - - terminal[:key] = terminal.style(nil, nil, :bold) - - terminal[:chunk_0] = terminal.style(:blue) - terminal[:chunk_1] = terminal.style(:cyan) - - align = 20 - - format_body = proc do |body, terminal| - if body - if length = body.length - terminal.print(:body, "body with length ", :length, length, "B") - else - terminal.print(:body, "body without length") - end - else - terminal.print(:body, "no body") - end - end.curry - - Sync do - internet = Async::HTTP::Internet.new - - response = internet.send(method.downcase.to_sym, url) - - terminal.print_line( - :request, method.rjust(align), :reset, ": ", url - ) - - terminal.print_line( - :response, "version".rjust(align), :reset, ": ", response.version - ) - - terminal.print_line( - :response, "status".rjust(align), :reset, ": ", response.status, - ) - - terminal.print_line( - :response, "body".rjust(align), :reset, ": ", format_body[response.body], - ) - - response.headers.each do |key, value| - terminal.print_line( - :key, key.rjust(align), :reset, ": ", :value, value.inspect - ) - end - - if body = response.body - index = 0 - style = [:chunk_0, :chunk_1] - response.body.each do |chunk| - terminal.print(style[index % 2], chunk) - index += 1 - end - end - - response.finish - - if trailer = response.headers.trailer - trailer.each do |key, value| - terminal.print_line( - :key, key.rjust(align), :reset, ": ", :value, value.inspect - ) - end - end - - internet.close - end -end - -# GET the specified URL and print the response. -def get(url) - self.fetch(url, method: "GET") -end - -# HEAD the specified URL and print the response. -def head(url) - self.fetch(url, method: "HEAD") -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/bake/async/http/h2spec.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/bake/async/http/h2spec.rb deleted file mode 100644 index 0212e32..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/bake/async/http/h2spec.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2019-2025, by Samuel Williams. - -def build - # Fetch the code: - system "go get github.com/spf13/cobra" - system "go get github.com/summerwind/h2spec" - - # This builds `h2spec` into the current directory - system "go build ~/go/src/github.com/summerwind/h2spec/cmd/h2spec/h2spec.go" -end - -def test - server do - system("./h2spec", "-p", "7272") - end -end - -private - -def server - require "async" - require "async/container" - require "async/http/server" - require "io/endpoint/host_endpoint" - - endpoint = IO::Endpoint.tcp("127.0.0.1", 7272) - - container = Async::Container.new - - Console.info(self){"Starting server..."} - - container.run(count: 1) do - server = Async::HTTP::Server.for(endpoint, protocol: Async::HTTP::Protocol::HTTP2, scheme: "https") do |request| - Protocol::HTTP::Response[200, {"content-type" => "text/plain"}, ["Hello World"]] - end - - Async do - server.run - end - end - - yield if block_given? -ensure - container&.stop -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/context/choosing-a-client.md b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/context/choosing-a-client.md deleted file mode 100644 index eebba6d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/context/choosing-a-client.md +++ /dev/null @@ -1,164 +0,0 @@ -# Choosing a Client - -This guide explains how to choose between ruby:`Async::HTTP::Internet`, ruby:`Async::HTTP::Client`, and higher-level interfaces for libraries. - -ruby:`Async::HTTP::Internet` and ruby:`Async::HTTP::Client` use the same request and response model. The important differences are how destinations are selected, where connection settings are applied, and who owns the client life cycle. - -## Quick Decision - -| Situation | Interface | Why | -| --- | --- | --- | -| Requests may target different origins and the defaults are suitable. | Shared ruby:`Async::HTTP::Internet` | Selects and reuses a client for each origin automatically. | -| Requests may target different origins, but need common client options or explicit ownership. | Explicit ruby:`Async::HTTP::Internet` | Applies the same options to each managed client and can be injected or closed early. | -| Requests repeatedly target one configured origin. | ruby:`Async::HTTP::Client` | Exposes the endpoint, protocol, retry, and connection-pool configuration directly. | -| A library wraps one HTTP service directly. | Injected ruby:`Async::HTTP::Client` or `Protocol::HTTP` middleware | Leaves transport configuration, ownership, and testing under application control. | -| A library models an HTTP API as resources and representations. | [`async-rest`](https://socketry.github.io/async-rest/guides/getting-started/) | Provides higher-level API modeling over an injectable `Protocol::HTTP` delegate. | -| A library uses Faraday as its HTTP abstraction. | [`async-http-faraday`](https://socketry.github.io/async-http-faraday/guides/getting-started/) | Lets the application retain the Faraday interface while using `Async::HTTP` as the transport. | - -Application code can start with the shared `Internet` interface unless it has a specific ownership or configuration requirement. Library code should accept an explicit HTTP dependency. - -## Shared Internet for General Requests - -The shared `Internet` interface is the simplest choice for requests to arbitrary URLs. It maintains one client for each origin and reuses persistent connections: - -~~~ ruby -require "async/http/internet/instance" - -urls = [ - "https://www.ruby-lang.org/en/", - "https://example.com/", -] - -Sync do - urls.each do |url| - Async::HTTP::Internet.get(url) do |response| - puts "#{url}: #{response.status}" - end - end -end -~~~ - -The class-level interface uses a thread-local `Internet` instance. Its connection pools are bound to the event loop and close when that event loop exits. The response block closes each response after it is processed. - -Use the shared interface when: - -- The application requests URLs from multiple or dynamically selected origins. -- Default retry and connection-pool settings are suitable. -- The client does not need to be injected as an application dependency. - -## Explicit Internet for Shared Configuration - -An explicit `Internet` provides the same per-origin client selection while making ownership and client options visible. Options are passed to every client it creates; for example, `limit` applies independently to the pool for each origin: - -~~~ ruby -require "async/http/internet" - -Sync do - internet = Async::HTTP::Internet.new(retries: 1, limit: 4) - - begin - internet.get("https://www.ruby-lang.org/en/") do |response| - puts response.status - end - ensure - internet.close - end -end -~~~ - -Use an explicit `Internet` when: - -- Several origins should share the same retry or pool settings. -- The client should be injected into another object or replaced during testing. -- Connections should be released before the event loop exits. - -## Client for One Endpoint - -A `Client` targets one ruby:`Async::HTTP::Endpoint`. Use it when a remote service is a stable part of the application architecture and needs its own protocol, TLS, retry, or pool configuration: - -~~~ ruby -require "async/http" - -endpoint = Async::HTTP::Endpoint.parse("https://httpbin.org") - -Sync do - Async::HTTP::Client.open(endpoint, retries: 1, limit: 4) do |client| - response = client.get("/status/200") - - begin - puts response.status - ensure - response.close - end - end -end -~~~ - -Client convenience methods accept a path rather than a complete URL. They return a response that the caller must close. `Client.open` closes the client and its connection pool when the block exits. - -Reuse a client for repeated requests rather than creating one per request; otherwise the application cannot benefit from persistent connections. - -## Building a Library That Makes HTTP Requests - -A library should generally accept its HTTP client as an explicit dependency. This lets the application configure connection limits, retries, proxies, instrumentation, and test doubles without the library creating hidden global state: - -~~~ ruby -require "async/http" - -class StatusService - def initialize(client) - @client = client - end - - def healthy? - response = @client.get("/status/200") - response.status == 200 - ensure - response&.close - end -end - -endpoint = Async::HTTP::Endpoint.parse("https://httpbin.org") - -Sync do - Async::HTTP::Client.open(endpoint) do |client| - puts StatusService.new(client).healthy? - end -end -~~~ - -The library does not close an injected client because the caller owns it and may share it with other components. If the library also provides an `open` convenience method that constructs a client, that method should close the client it creates when its block exits. - -Define the accepted interface precisely. A ruby:`Async::HTTP::Client` is bound to one endpoint and its convenience methods accept relative paths, while ruby:`Async::HTTP::Internet` selects an endpoint from a complete URL. They should not be treated as interchangeable merely because both provide methods such as `get`. If the library constructs ruby:`Protocol::HTTP::Request` objects and only calls `call`, it can accept a `Protocol::HTTP` middleware delegate instead of requiring a concrete client. - -## Modeling Resources with async-rest - -Use [`async-rest`](https://socketry.github.io/async-rest/guides/getting-started/) when a library benefits from modeling a remote HTTP API as resources and representations rather than exposing request operations directly. - -ruby:`Async::REST::Resource` accepts a `Protocol::HTTP` middleware delegate, so the application can supply and configure the transport. Its `open` method provides the complementary convenience interface: it creates a ruby:`Async::HTTP::Client`, yields the resource, and closes the client when the block exits. - -## Supporting Faraday with async-http-faraday - -Use [`async-http-faraday`](https://socketry.github.io/async-http-faraday/guides/getting-started/) when a library uses Faraday as its public HTTP abstraction or needs compatibility with the Faraday ecosystem. A new Async-native library can usually accept a ruby:`Async::HTTP::Client` or `Protocol::HTTP` middleware delegate directly. - -If a library uses Faraday, accept a configured `Faraday::Connection` rather than changing `Faraday.default_adapter` globally. The application can then select the `Async::HTTP` adapter for that connection: - -~~~ ruby -require "async/http/faraday" - -class StatusService - def initialize(connection) - @connection = connection - end - - def healthy? - @connection.get("/status/200").success? - end -end - -connection = Faraday.new("https://httpbin.org") do |builder| - builder.adapter :async_http -end - -puts StatusService.new(connection).healthy? -~~~ diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/context/concurrent-requests.md b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/context/concurrent-requests.md deleted file mode 100644 index d784ac7..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/context/concurrent-requests.md +++ /dev/null @@ -1,134 +0,0 @@ -# Concurrent Requests and Connection Pooling - -This guide explains how to run HTTP requests concurrently while keeping request fan-out, connection usage, and resource life cycles bounded. - -Concurrent requests allow independent network operations to overlap. `Async::HTTP` combines this task concurrency with persistent connection pools, but the number of request tasks and the number of connections are separate controls. - -## Running Independent Requests Concurrently - -When several requests do not depend on each other, start one child task for each request and then wait for their results: - -~~~ ruby -require "async/http/internet/instance" -require "json" - -names = ["async", "async-http", "falcon"] - -versions = Sync do |task| - tasks = names.map do |name| - task.async do - url = "https://rubygems.org/api/v1/gems/#{name}.json" - - Async::HTTP::Internet.get(url) do |response| - raise "Could not fetch #{name}: #{response.status}" unless response.success? - - JSON.parse(response.read).fetch("version") - end - end - end - - tasks.map(&:wait) -end - -names.zip(versions) do |name, version| - puts "#{name}: #{version}" -end -~~~ - -Each request can make progress while the others are waiting for network I/O. ruby:`Async::Task#wait` returns the task result and re-raises any failure, so request errors are not silently discarded. Results are collected in the original order even if requests finish in a different order. - -The response block closes each response after its body is processed. General task creation, cancellation, and failure propagation are covered by the [`async` Tasks guide](https://socketry.github.io/async/guides/tasks/). - -## Limiting Request Concurrency - -Creating one task per item is appropriate for a small, fixed collection. A large or externally supplied collection should have an explicit concurrency limit so it cannot overwhelm the remote service or retain an unbounded number of pending operations. - -Use ruby:`Async::Semaphore` to set a fixed request limit and ruby:`Async::Barrier` to wait for all the work: - -~~~ ruby -require "async" -require "async/semaphore" -require "async/http/internet" - -names = ["async", "async-http", "falcon", "protocol-http", "io-event", "console"] - -Sync do - internet = Async::HTTP::Internet.new(limit: 2) - - begin - Barrier(parent: nil) do |barrier| - requests = Async::Semaphore.new(4, parent: barrier) - - names.each do |name| - requests.async do - url = "https://rubygems.org/api/v1/gems/#{name}.json" - - internet.get(url) do |response| - raise "Could not fetch #{name}: #{response.status}" unless response.success? - - puts "#{name}: #{response.status}" - end - end - end - end - ensure - internet.close - end -end -~~~ - -The semaphore allows at most four request operations to run at once. The barrier tracks those tasks, waits for them to finish, propagates failures, and cancels unfinished work if the block exits early. `parent: nil` disables the barrier's load-based scheduling because the semaphore already provides an explicit limit. - -See the [`async` Best Practices guide](https://socketry.github.io/async/guides/best-practices/) for general guidance on barriers, semaphores, and large workloads. - -## Request Limits and Connection Limits - -Request concurrency and pool capacity solve different problems: - -| Control | What It Limits | Scope | -| --- | --- | --- | -| ruby:`Async::Semaphore` | Concurrent request operations and their application work. | The tasks started through that semaphore. | -| `limit` passed to ruby:`Async::HTTP::Client` | Connections held by one client pool. | One configured endpoint. | -| `limit` passed to ruby:`Async::HTTP::Internet` | Connections held by each client it creates. | Applied independently to every origin. | - -The client creates connections lazily and reuses viable persistent connections. When its pool reaches `limit`, a request waits until an existing connection has capacity or is released. - -For HTTP/1, a connection normally processes one request at a time, so connection capacity also constrains active requests. HTTP/2 can multiplex several request streams over one connection, so a small connection pool may support much higher request concurrency. Use a semaphore when the application needs a protocol-independent request limit; use `limit` to control connection resources. - -## Releasing Connections for Reuse - -A response retains pool capacity until its body is finished or closed. Always close responses promptly, especially before starting more requests that use the same limited pool: - -~~~ ruby -require "async/http" - -endpoint = Async::HTTP::Endpoint.parse("https://rubygems.org") - -Sync do - Async::HTTP::Client.open(endpoint, limit: 1) do |client| - response = client.get("/api/v1/gems/async-http.json") - - begin - raise "Download failed: #{response.status}" unless response.success? - - bytes = 0 - - response.each do |chunk| - bytes += chunk.bytesize - end - - puts "Downloaded #{bytes} bytes." - ensure - response.close - end - end -end -~~~ - -The block form of ruby:`Async::HTTP::Internet` performs this cleanup automatically. When using ruby:`Async::HTTP::Client`, close the response explicitly with an `ensure` block. Holding an unread response while waiting for another request can exhaust an HTTP/1 pool and make the second request wait indefinitely. - -## Pool Life Cycle - -Connection pools are bound to the event loop in which they are used. Their internal maintenance task is transient, so it does not keep the event loop alive and closes the pool when the event loop exits. - -Use the shared ruby:`Async::HTTP::Internet` interface when connections can remain open until the event loop exits. Use ruby:`Async::HTTP::Client.open`, or explicitly close an `Internet` or `Client`, when connections should be released earlier. See [Choosing a Client](../choosing-a-client/) for the ownership trade-offs. diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/context/getting-started.md b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/context/getting-started.md deleted file mode 100644 index 5edaffb..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/context/getting-started.md +++ /dev/null @@ -1,185 +0,0 @@ -# Getting Started - -This guide explains how to make HTTP requests and serve HTTP responses with `Async::HTTP`. - -## Installation - -Add the gem to your project: - -~~~ bash -$ bundle add async-http -~~~ - -## Core Concepts - -`Async::HTTP` provides several interfaces for different kinds of HTTP applications: - -- ruby:`Async::HTTP::Internet` makes requests to arbitrary hosts and manages a client for each remote endpoint. -- ruby:`Async::HTTP::Client` manages persistent connections to a specific endpoint. -- ruby:`Async::HTTP::Server` accepts connections and dispatches requests to an HTTP application. -- ruby:`Async::HTTP::Endpoint` describes how a client connects or a server listens, including the URL, protocol, and TLS configuration. -- [`protocol-http`](https://github.com/socketry/protocol-http) provides the shared request, response, header, and body interfaces. - -Use `Internet` for general-purpose requests to different hosts. Use `Client` when your application repeatedly communicates with one endpoint or needs endpoint-specific configuration. See [Choosing a Client](../choosing-a-client/) for the ownership and configuration trade-offs. - -## Making a Request - -The shared ruby:`Async::HTTP::Internet` instance provides a convenient starting point. Run asynchronous HTTP operations inside `Sync`, which creates or reuses the event loop while returning the block result directly: - -~~~ ruby -require "async/http/internet/instance" - -Sync do - Async::HTTP::Internet.get("https://httpbin.org/get") do |response| - puts "Status: #{response.status}" - puts response.read - end -end -~~~ - -Passing a block automatically closes the response when the block exits, including when an exception is raised. Responses are streamed, so callers that do not use the block form must close the response explicitly. - -~~~ ruby -require "async/http/internet/instance" - -Sync do - response = Async::HTTP::Internet.get("https://httpbin.org/get") - puts response.read -ensure - response&.close -end -~~~ - -Convenience methods are provided for `GET`, `HEAD`, `POST`, `PUT`, `DELETE`, `CONNECT`, `OPTIONS`, `TRACE`, `PATCH`, and `QUERY` requests. - -### Connection Persistence - -`Internet` creates a ruby:`Async::HTTP::Client` for each remote endpoint and reuses its persistent connections. The underlying async pools are bound to the event loop and are closed when that event loop exits. - -An explicitly created `Internet` can also be closed early when an application wants to release all cached clients before the event loop exits: - -~~~ ruby -require "async/http/internet" - -Sync do - internet = Async::HTTP::Internet.new - - internet.get("https://example.com") do |response| - puts response.status - end -ensure - internet&.close -end -~~~ - -See [Concurrent Requests and Connection Pooling](../concurrent-requests/) to run independent requests together and configure separate limits for request tasks and connections. - -## Working with Responses - -A response contains a status, headers, and a streaming body. Check the status before processing content, and use header names in lower case: - -~~~ ruby -require "async/http/internet/instance" - -Sync do - Async::HTTP::Internet.get("https://httpbin.org/json") do |response| - if response.success? - puts response.headers["content-type"] - puts response.read - else - warn "Request failed with status #{response.status}." - end - end -end -~~~ - -For larger responses, process the body incrementally rather than reading it into one string. See the [`protocol-http` message body documentation](https://socketry.github.io/protocol-http/guides/message-body/) for the complete body interface. - -### Downloading a File - -Use `response.save` to stream a response directly to a file: - -~~~ ruby -require "async/http/internet/instance" - -Sync do - Async::HTTP::Internet.get("https://example.com/archive.zip") do |response| - raise "Download failed with status #{response.status}." unless response.success? - - response.save("archive.zip") - end -end -~~~ - -## Posting JSON - -Pass headers and a body after the request target. The body may be a string or a compatible `protocol-http` body object. - -~~~ ruby -require "async/http/internet/instance" -require "json" - -data = {life: 42} -headers = [ - ["accept", "application/json"], - ["content-type", "application/json"], -] - -Sync do - Async::HTTP::Internet.post("https://httpbin.org/anything", headers, JSON.dump(data)) do |response| - raise "Request failed with status #{response.status}." unless response.success? - - puts JSON.pretty_generate(JSON.parse(response.read)) - end -end -~~~ - -For resource-oriented HTTP APIs, consider using [`async-rest`](https://github.com/socketry/async-rest), which builds on `Async::HTTP`. - -## Applying a Timeout - -Networks can stall indefinitely, so impose a timeout around operations that must complete within a fixed duration: - -~~~ ruby -require "async/http/internet/instance" - -Sync do |task| - task.with_timeout(2) do - Async::HTTP::Internet.get("https://httpbin.org/delay/10") do |response| - puts response.read - end - end -rescue Async::TimeoutError - warn "The request timed out." -end -~~~ - -The response block still closes the response if the timeout interrupts the request while its body is being processed. - -## Making a Server - -ruby:`Async::HTTP::Server` accepts an application that maps each request to a ruby:`Protocol::HTTP::Response`. The following example starts a local server, makes one request, and then releases both client and server resources: - -~~~ ruby -require "async/http" - -endpoint = Async::HTTP::Endpoint.parse("http://localhost:9292") -server = Async::HTTP::Server.for(endpoint) do |request| - Protocol::HTTP::Response[200, {"content-type" => "text/plain"}, ["Hello World"]] -end - -Sync do - server_task = server.run - - Async::HTTP::Client.open(endpoint) do |client| - response = client.get("/") - puts response.read - ensure - response&.close - end -ensure - server_task&.stop -end -~~~ - -Use Falcon when you need to host a Rack application or deploy an HTTP server in production. Use `Async::HTTP::Server` directly when building a protocol-level server or embedding HTTP handling into another asynchronous application. diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/context/index.yaml b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/context/index.yaml deleted file mode 100644 index 78a7a88..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/context/index.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# Automatically generated context index for Utopia::Project guides. -# Do not edit then files in this directory directly, instead edit the guides and then run `bake utopia:project:agent:context:update`. ---- -description: A HTTP client and server library. -metadata: - bug_tracker_uri: https://github.com/socketry/async-http/issues - changelog_uri: https://github.com/socketry/async-http/blob/main/releases.md - documentation_uri: https://socketry.github.io/async-http/ - source_code_uri: https://github.com/socketry/async-http.git -files: -- path: getting-started.md - title: Getting Started - description: This guide explains how to make HTTP requests and serve HTTP responses - with `Async::HTTP`. -- path: choosing-a-client.md - title: Choosing a Client - description: This guide explains how to choose between ruby:`Async::HTTP::Internet`, - ruby:`Async::HTTP::Client`, and higher-level interfaces for libraries. -- path: concurrent-requests.md - title: Concurrent Requests and Connection Pooling - description: This guide explains how to run HTTP requests concurrently while keeping - request fan-out, connection usage, and resource life cycles bounded. -- path: testing.md - title: Testing - description: This guide explains how to test `Async::HTTP` clients and servers without - depending on external HTTP services. diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/context/testing.md b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/context/testing.md deleted file mode 100644 index 7b01a00..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/context/testing.md +++ /dev/null @@ -1,205 +0,0 @@ -# Testing - -This guide explains how to test `Async::HTTP` clients and servers without depending on external HTTP services. - -Real network services make tests slower and less deterministic. Prefer one of these approaches: - -- Use [`sus-fixtures-protocol-http`](https://socketry.github.io/sus-fixtures-protocol-http/guides/getting-started/) to exercise HTTP middleware directly without a client or server. -- Use `sus-fixtures-async-http` to run an application with a managed local server and client. -- Use ruby:`Async::HTTP::Mock::Endpoint` when testing a client that expects to connect to a particular remote endpoint. - -## Testing Middleware Directly - -When a test only needs to construct requests and inspect responses, `sus-fixtures-protocol-http` can call `Protocol::HTTP` middleware in-process without starting a client or server. Add the fixture to your test dependencies: - -~~~ bash -$ bundle add sus --group test -$ bundle add sus-fixtures-protocol-http --group test -~~~ - -Include `MiddlewareContext` and provide the middleware under test: - -~~~ ruby -require "sus/fixtures/protocol/http/middleware_context" - -describe "My HTTP application" do - include Sus::Fixtures::Protocol::HTTP::MiddlewareContext - - let(:middleware) do - Protocol::HTTP::Middleware.for do |request| - Protocol::HTTP::Response[200, {}, ["Hello #{request.path}"]] - end - end - - it "handles a request directly" do - response = client.get("/world") - - expect(response.status).to be == 200 - expect(response.read).to be == "Hello /world" - end -end -~~~ - -The fixture closes the final request, response, and middleware after each test. Use `sus-fixtures-async-http` when the test needs a real client/server exchange. - -## Testing with a Client and Server - -The `ServerContext` fixture manages an ephemeral listening endpoint, server task, and connected client. Add the fixture to your test dependencies: - -~~~ bash -$ bundle add sus --group test -$ bundle add sus-fixtures-async-http --group test -~~~ - -Define the application under test and make requests through the provided `client`: - -~~~ ruby -require "sus/fixtures/async/http" - -describe "My HTTP application" do - include Sus::Fixtures::Async::HTTP::ServerContext - - let(:app) do - Protocol::HTTP::Middleware.for do |request| - case request.path - when "/health" - Protocol::HTTP::Response[ - 200, - {"content-type" => "application/json"}, - ['{"status":"ok"}'], - ] - else - Protocol::HTTP::Response[404, {}, ["Not Found"]] - end - end - end - - it "serves the health endpoint" do - response = client.get("/health") - - expect(response).to be(:success?) - expect(response.headers["content-type"]).to be == "application/json" - expect(response.read).to be == '{"status":"ok"}' - ensure - response&.close - end - - it "returns not found for unknown paths" do - response = client.get("/missing") - expect(response.status).to be == 404 - ensure - response&.close - end -end -~~~ - -The fixture closes the client, stops the server, and releases the bound endpoint after each test. Override `app`, `url`, `protocol`, `endpoint_options`, or `retries` to configure a scenario. - -### Testing HTTP/2 - -Override `protocol` when behavior must be verified with a specific HTTP version: - -~~~ ruby -describe "My HTTP/2 application" do - include Sus::Fixtures::Async::HTTP::ServerContext - - let(:protocol) {Async::HTTP::Protocol::HTTP2} - - it "responds using HTTP/2" do - response = client.get("/") - expect(response.version).to be == "HTTP/2" - ensure - response&.close - end -end -~~~ - -Test normal behavior without forcing a protocol unless the distinction is relevant to the feature under test. - -## Testing a Client with a Mock Endpoint - -ruby:`Async::HTTP::Mock::Endpoint` connects the real client and server protocol implementations through a local socket pair. It does not open a network port, but requests still exercise serialization, connection handling, and response bodies. - -Use ruby:`Async::HTTP::Mock::Endpoint#wrap` to preserve the scheme and authority expected by the client: - -~~~ ruby -require "async/http" -require "async/http/mock" -require "sus/fixtures/async/reactor_context" - -describe "A remote service client" do - include Sus::Fixtures::Async::ReactorContext - - it "handles a successful response" do - mock_endpoint = Async::HTTP::Mock::Endpoint.new - server_task = Async do - mock_endpoint.run do |request| - Protocol::HTTP::Response[200, {}, ["Authority: #{request.authority}"]] - end - end - - remote_endpoint = Async::HTTP::Endpoint.parse("https://api.example.com") - client = Async::HTTP::Client.new(mock_endpoint.wrap(remote_endpoint)) - response = client.get("/status") - - expect(response.read).to be == "Authority: api.example.com" - ensure - response&.close - client&.close - server_task&.stop - end -end -~~~ - -Return different statuses, headers, bodies, delays, or malformed behavior from the mock server to exercise client error handling. - -## Transparently Replacing Client Endpoints - -Some applications construct ruby:`Async::HTTP::Client` internally. A test can wrap the constructor so those clients connect to a mock endpoint while retaining the original endpoint metadata and client options: - -~~~ ruby -require "async/http" -require "async/http/mock" -require "sus/fixtures/async/reactor_context" - -describe "A client created by application code" do - include Sus::Fixtures::Async::ReactorContext - - let(:mock_endpoint) {Async::HTTP::Mock::Endpoint.new} - - def before - super - - replacement_endpoint = mock_endpoint - mock(Async::HTTP::Client) do |wrapper| - wrapper.wrap(:new) do |original, endpoint, **options| - original.call(replacement_endpoint.wrap(endpoint), **options) - end - end - - @server_task = Async do - mock_endpoint.run do |request| - Protocol::HTTP::Response[200, {}, ["Hello, World"]] - end - end - end - - def after(error = nil) - @server_task&.stop - super - end - - it "routes the request through the mock endpoint" do - endpoint = Async::HTTP::Endpoint.parse("https://api.example.com") - client = Async::HTTP::Client.new(endpoint, retries: 1) - response = client.get("/") - - expect(response.read).to be == "Hello, World" - ensure - response&.close - client&.close - end -end -~~~ - -Always accept and forward `**options` when wrapping the constructor so the test does not silently change client configuration. diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http.rb deleted file mode 100644 index 700d011..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2017-2026, by Samuel Williams. - -require_relative "http/version" -require_relative "http/client" -require_relative "http/server" -require_relative "http/internet" -require_relative "http/endpoint" diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/body.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/body.rb deleted file mode 100644 index 1045896..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/body.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2026, by Samuel Williams. - -require "protocol/http/body/buffered" -require_relative "body/writable" - -# @namespace -module Async - # @namespace - module HTTP - # @namespace - module Body - include ::Protocol::HTTP::Body - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/body/hijack.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/body/hijack.rb deleted file mode 100644 index fa1d42c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/body/hijack.rb +++ /dev/null @@ -1,96 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2019-2026, by Samuel Williams. - -require "protocol/http/body/readable" -require "protocol/http/body/stream" - -require_relative "writable" - -module Async - module HTTP - module Body - # A body which is designed for hijacked server responses - a response which uses a block to read and write the request and response bodies respectively. - class Hijack < ::Protocol::HTTP::Body::Readable - # Create a response with this hijacked body. - # @parameter request [Protocol::HTTP::Request] The request to hijack. - # @parameter status [Integer] The HTTP status code. - # @parameter headers [Hash] The response headers. - # @returns [Protocol::HTTP::Response] The response with the hijacked body. - def self.response(request, status, headers, &block) - ::Protocol::HTTP::Response[status, headers, self.wrap(request, &block)] - end - - # Wrap a request body with a hijacked body. - # @parameter request [Protocol::HTTP::Request | Nil] The request to hijack. - # @returns [Hijack] The hijacked body instance. - def self.wrap(request = nil, &block) - self.new(block, request&.body) - end - - # Initialize the hijacked body. - # @parameter block [Proc] The block to call with the stream. - # @parameter input [Protocol::HTTP::Body::Readable | Nil] The input body to read from. - def initialize(block, input = nil) - @block = block - @input = input - - @task = nil - @stream = nil - @output = nil - end - - # We prefer streaming directly as it's the lowest overhead. - def stream? - true - end - - # Invoke the block with the given stream for bidirectional communication. - # @parameter stream [Protocol::HTTP::Body::Stream] The stream to pass to the block. - def call(stream) - @block.call(stream) - end - - attr :input - - # Has the producer called #finish and has the reader consumed the nil token? - def empty? - @output&.empty? - end - - # Whether the body has output ready to be read. - # @returns [Boolean | Nil] - def ready? - @output&.ready? - end - - # Read the next available chunk. - def read - unless @output - @output = Writable.new - @stream = ::Protocol::HTTP::Body::Stream.new(@input, @output) - - @task = Task.current.async do |task| - task.annotate "Streaming hijacked body." - - @block.call(@stream) - end - end - - return @output.read - end - - # @returns [String] A detailed representation of this body. - def inspect - "\#<#{self.class} #{@block.inspect}>" - end - - # @returns [String] A short summary of this body. - def to_s - "" - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/body/pipe.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/body/pipe.rb deleted file mode 100644 index da22177..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/body/pipe.rb +++ /dev/null @@ -1,92 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2019-2026, by Samuel Williams. -# Copyright, 2020, by Bruno Sutic. - -require_relative "writable" - -module Async - module HTTP - module Body - # A bidirectional pipe that connects an input body to an output body using a Unix socket pair. - class Pipe - # If the input stream is closed first, it's likely the output stream will also be closed. - def initialize(input, output = Writable.new, task: Task.current) - @input = input - @output = output - - head, tail = ::Socket.pair(Socket::AF_UNIX, Socket::SOCK_STREAM) - - @head = ::IO::Stream(head) - @tail = tail - - @reader = nil - @writer = nil - - task.async(transient: true, &self.method(:reader)) - task.async(transient: true, &self.method(:writer)) - end - - # @returns [IO] The underlying IO object for the tail of the pipe. - def to_io - @tail - end - - # Close the pipe and stop the reader and writer tasks. - def close - @reader&.stop - @writer&.stop - - @tail.close - end - - private - - # Read from the @input stream and write to the head of the pipe. - def reader(task) - @reader = task - - task.annotate "#{self.class} reader." - - while chunk = @input.read - @head.write(chunk) - @head.flush - end - - @head.close_write - rescue => error - ensure - @input.close(error) - - close_head if @writer&.finished? - end - - # Read from the head of the pipe and write to the @output stream. - # A write-side close on @tail produces EOF and closes @output independently of the input direction. - def writer(task) - @writer = task - - task.annotate "#{self.class} writer." - - while chunk = @head.read_partial - @output.write(chunk) - end - rescue => error - ensure - @output.close_write(error) - - close_head if @reader&.finished? - end - - def close_head - @head.close - - # Both tasks are done, don't keep references: - @reader = nil - @writer = nil - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/body/writable.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/body/writable.rb deleted file mode 100644 index 3eca79f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/body/writable.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2024, by Samuel Williams. - -require "protocol/http/body/writable" -require "async/queue" - -module Async - module HTTP - module Body - Writable = ::Protocol::HTTP::Body::Writable - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/client.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/client.rb deleted file mode 100755 index 054356e..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/client.rb +++ /dev/null @@ -1,184 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2017-2026, by Samuel Williams. -# Copyright, 2022, by Ian Ker-Seymer. - -require "io/endpoint" - -require "async/pool/controller" - -require "protocol/http/body/completable" -require "protocol/http/error" -require "protocol/http/methods" - -require_relative "protocol" - -module Async - module HTTP - DEFAULT_RETRIES = 3 - - # An HTTP client that manages persistent connections to a specific endpoint, with automatic retries for idempotent requests. - class Client < ::Protocol::HTTP::Methods - # Provides a robust interface to a server. - # * If there are no connections, it will create one. - # * If there are already connections, it will reuse it. - # * If a request fails, it will retry it up to N times if it was idempotent. - # The client object will never become unusable. It internally manages persistent connections (or non-persistent connections if that's required). - # @param endpoint [Endpoint] the endpoint to connnect to. - # @param protocol [Protocol::HTTP1 | Protocol::HTTP2 | Protocol::HTTPS] the protocol to use. - # @param scheme [String] The default scheme to set to requests. - # @param authority [String] The default authority to set to requests. - def initialize(endpoint, protocol: endpoint.protocol, scheme: endpoint.scheme, authority: endpoint.authority, retries: DEFAULT_RETRIES, **options) - @endpoint = endpoint - @protocol = protocol - - @retries = retries - @pool = make_pool(**options) - - @scheme = scheme - @authority = authority - end - - # @returns [Hash] A JSON-compatible representation of this client. - def as_json(...) - { - endpoint: @endpoint.to_s, - protocol: @protocol, - retries: @retries, - scheme: @scheme, - authority: @authority, - } - end - - # @returns [String] A JSON string representation of this client. - def to_json(...) - as_json.to_json(...) - end - - attr :endpoint - attr :protocol - - attr :retries - attr :pool - - attr :scheme - attr :authority - - # @returns [Boolean] Whether the client uses a secure (TLS) connection. - def secure? - @endpoint.secure? - end - - # Open a client and optionally yield it, ensuring it is closed afterwards. - # @parameter arguments [Array] Arguments to pass to {initialize}. - # @parameter options [Hash] Options to pass to {initialize}. - def self.open(*arguments, **options, &block) - client = self.new(*arguments, **options) - - return client unless block_given? - - begin - yield client - ensure - client.close - end - end - - # Close the client and all associated connections. - def close - @pool.wait_until_free do - Console.warn(self){"Waiting for #{@protocol} pool to drain: #{@pool}"} - end - - @pool.close - end - - # Send a request to the remote server, with automatic retries for idempotent requests. - # @parameter request [Protocol::HTTP::Request] The request to send. - # @returns [Protocol::HTTP::Response] The response from the server. - def call(request) - request.scheme ||= self.scheme - request.authority ||= self.authority - - attempt = 0 - - # We may retry the request if it is possible to do so. https://tools.ietf.org/html/draft-nottingham-httpbis-retry-01 is a good guide for how retrying requests should work. - begin - attempt += 1 - - # As we cache pool, it's possible these pool go bad (e.g. closed by remote host). In this case, we need to try again. It's up to the caller to impose a timeout on this. If this is the last attempt, we force a new connection. - connection = @pool.acquire - - response = make_response(request, connection, attempt) - - # This signals that the ensure block below should not try to release the connection, because it's bound into the response which will be returned: - connection = nil - return response - rescue ::Protocol::HTTP::RefusedError - # This is a specific case where the request was not processed by the server. So, we can resend even non-idempotent requests. - if connection - @pool.release(connection) - connection = nil - end - - if attempt < @retries and request.rewind! - retry - else - raise - end - rescue ::Protocol::HTTP::RemoteError, SocketError, IOError, EOFError, Errno::ECONNRESET, Errno::EPIPE - if connection - @pool.release(connection) - connection = nil - end - - if attempt < @retries and request.retry! - retry - else - raise - end - ensure - if connection - @pool.release(connection) - end - end - end - - # @returns [String] A summary of this client. - def inspect - "#<#{self.class} authority=#{@authority.inspect}>" - end - - protected - - def make_response(request, connection, attempt) - response = request.call(connection) - - response.pool = @pool - - return response - end - - def assign_default_tags(tags) - tags[:endpoint] = @endpoint.to_s - tags[:protocol] = @protocol.to_s - end - - def make_pool(**options) - if connection_limit = options.delete(:connection_limit) - warn "The connection_limit: option is deprecated, please use limit: instead.", uplevel: 2 - options[:limit] = connection_limit - end - - self.assign_default_tags(options[:tags] ||= {}) - - Async::Pool::Controller.wrap(**options) do - Console.debug(self){"Making connection to #{@endpoint.inspect}"} - - @protocol.client(@endpoint.connect) - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/endpoint.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/endpoint.rb deleted file mode 100644 index 469d3fe..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/endpoint.rb +++ /dev/null @@ -1,302 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2019-2026, by Samuel Williams. -# Copyright, 2021-2022, by Adam Daniels. -# Copyright, 2024, by Thomas Morgan. -# Copyright, 2024, by Igor Sidorov. -# Copyright, 2024, by Hal Brodigan. -# Copyright, 2025, by William T. Nelson. - -require "io/endpoint" -require "io/endpoint/host_endpoint" -require "io/endpoint/ssl_endpoint" - -require_relative "protocol/http" -require_relative "protocol/https" - -require "uri" - -module Async - module HTTP - # Represents a way to connect to a remote HTTP server. - class Endpoint < ::IO::Endpoint::Generic - SCHEMES = { - "http" => URI::HTTP, - "https" => URI::HTTPS, - "ws" => URI::WS, - "wss" => URI::WSS, - } - - # Parse a URL string into an endpoint. - # @parameter string [String] The URL to parse. - # @parameter endpoint [IO::Endpoint::Generic | Nil] An optional underlying endpoint to use. - # @parameter options [Hash] Additional options to pass to {initialize}. - # @returns [Endpoint] The parsed endpoint. - def self.parse(string, endpoint = nil, **options) - url = URI.parse(string).normalize - - return self.new(url, endpoint, **options) - end - - # Construct an endpoint with a specified scheme, hostname, optional path, and options. - # - # @parameter scheme [String] The scheme to use, e.g. "http" or "https". - # @parameter hostname [String] The hostname to connect to (or bind to). - # @parameter *options [Hash] Additional options, passed to {initialize}. - def self.for(scheme, hostname, path = "/", **options) - # TODO: Consider using URI.for once it becomes available: - uri_klass = SCHEMES.fetch(scheme.downcase) do - raise ArgumentError, "Unsupported scheme: #{scheme.inspect}" - end - - self.new( - uri_klass.new(scheme, nil, hostname, nil, nil, path, nil, nil, nil).normalize, - **options - ) - end - - # Coerce the given object into an endpoint. - # @parameter url [String | Endpoint] The URL or endpoint to convert. - def self.[](url) - if url.is_a?(Endpoint) - return url - else - Endpoint.parse(url.to_s) - end - end - - # @option scheme [String] the scheme to use, overrides the URL scheme. - # @option hostname [String] the hostname to connect to (or bind to), overrides the URL hostname (used for SNI). - # @option port [Integer] the port to bind to, overrides the URL port. - # @option ssl_context [OpenSSL::SSL::SSLContext] the context to use for TLS. - # @option tls_configuration [IO::Endpoint::TLS::Configuration] the transport-neutral TLS configuration. - # @option alpn_protocols [Array(String)] the alpn protocols to negotiate. - def initialize(url, endpoint = nil, **options) - super(**options) - - raise ArgumentError, "URL must be absolute (include scheme, host): #{url}" unless url.absolute? - - @url = url - - if endpoint - @endpoint = self.build_endpoint(endpoint) - else - @endpoint = nil - end - end - - # @returns [URI] The URL representation of this endpoint, including port if non-default. - def to_url - url = @url.dup - - unless default_port? - url.port = self.port - end - - return url - end - - # @returns [String] A short string representation of this endpoint. - def to_s - "\#<#{self.class} #{self.to_url} #{@options}>" - end - - # @returns [String] A detailed string representation of this endpoint. - def inspect - "\#<#{self.class} #{self.to_url} #{@options.inspect}>" - end - - attr :url - - # @returns [Addrinfo] The address of the underlying endpoint. - def address - endpoint.address - end - - # @returns [Boolean] Whether this endpoint uses a secure protocol (HTTPS or WSS). - def secure? - ["https", "wss"].include?(self.scheme) - end - - # @returns [Protocol] The protocol to use for this endpoint. - def protocol - @options.fetch(:protocol) do - if secure? - Protocol::HTTPS - else - Protocol::HTTP - end - end - end - - # @returns [Integer] The default port for this endpoint's scheme. - def default_port - secure? ? 443 : 80 - end - - # @returns [Boolean] Whether the endpoint's port is the default for its scheme. - def default_port? - port == default_port - end - - # @returns [Integer] The port number for this endpoint. - def port - @options[:port] || @url.port || default_port - end - - # The hostname is the server we are connecting to: - def hostname - @options[:hostname] || @url.hostname - end - - # @returns [String] The URL scheme, e.g. `"http"` or `"https"`. - def scheme - @options[:scheme] || @url.scheme - end - - # @returns [String] The authority component (hostname and optional port). - def authority(ignore_default_port = true) - if ignore_default_port and default_port? - @url.hostname - else - "#{@url.hostname}:#{port}" - end - end - - # Return the path and query components of the given URL. - def path - buffer = @url.path || "/" - - if query = @url.query - buffer = "#{buffer}?#{query}" - end - - return buffer - end - - # @returns [Array(String)] The ALPN protocol names for TLS negotiation. - def alpn_protocols - @options.fetch(:alpn_protocols){self.protocol.names} - end - - # @returns [Boolean] Whether the endpoint refers to a localhost address. - def localhost? - @url.hostname =~ /^(.*?\.)?localhost\.?$/ - end - - # We don't try to validate peer certificates when talking to localhost because they would always be self-signed. - def ssl_verify_mode - if self.localhost? - OpenSSL::SSL::VERIFY_NONE - else - OpenSSL::SSL::VERIFY_PEER - end - end - - # @returns [OpenSSL::SSL::SSLContext] The SSL context for TLS connections. - def ssl_context - @options[:ssl_context] || OpenSSL::SSL::SSLContext.new.tap do |context| - if alpn_protocols = self.alpn_protocols - context.alpn_protocols = alpn_protocols - end - - context.set_params( - verify_mode: self.ssl_verify_mode - ) - end - end - - # @returns [IO::Endpoint::TLS::Configuration | Nil] The transport-neutral TLS configuration. - def tls_configuration - @options[:tls_configuration] - end - - # Build a suitable endpoint, optionally wrapping in TLS for secure connections. - # @parameter endpoint [IO::Endpoint::Generic | Nil] An optional underlying endpoint to wrap. - # @returns [IO::Endpoint::Generic] The constructed endpoint. - def build_endpoint(endpoint = nil) - endpoint ||= tcp_endpoint - - if secure? - # Wrap it in SSL: - return ::IO::Endpoint::SSLEndpoint.new(endpoint, - ssl_context: self.ssl_context, - tls_configuration: self.tls_configuration, - hostname: @url.hostname, - timeout: self.timeout, - ) - end - - return endpoint - end - - # @returns [IO::Endpoint::Generic] The resolved endpoint, built on demand. - def endpoint - @endpoint ||= build_endpoint - end - - # Set the underlying endpoint, wrapping it as needed. - # @parameter endpoint [IO::Endpoint::Generic] The endpoint to assign. - def endpoint=(endpoint) - @endpoint = build_endpoint(endpoint) - end - - # Bind to the endpoint. - def bind(*arguments, &block) - endpoint.bind(*arguments, &block) - end - - # Connect to the endpoint. - def connect(&block) - endpoint.connect(&block) - end - - # Enumerate all resolved endpoints. - # @yields {|endpoint| ...} Each resolved endpoint. - # @parameter endpoint [Endpoint] The resolved endpoint. - def each - return to_enum unless block_given? - - self.tcp_endpoint.each do |endpoint| - yield self.class.new(@url, endpoint, **@options) - end - end - - # @returns [Array] A key suitable for identifying this endpoint in a hash. - def key - [@url, @options] - end - - # @returns [Boolean] Whether two endpoints are equal. - def eql? other - self.key.eql? other.key - end - - # @returns [Integer] The hash code for this endpoint. - def hash - self.key.hash - end - - protected - - def tcp_options - options = @options.dup - - options.delete(:scheme) - options.delete(:port) - options.delete(:hostname) - options.delete(:ssl_context) - options.delete(:tls_configuration) - options.delete(:alpn_protocols) - options.delete(:protocol) - - return options - end - - def tcp_endpoint - ::IO::Endpoint.tcp(self.hostname, port, **tcp_options) - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/internet.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/internet.rb deleted file mode 100644 index 87c83e4..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/internet.rb +++ /dev/null @@ -1,102 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2026, by Samuel Williams. -# Copyright, 2024, by Igor Sidorov. - -require_relative "client" -require_relative "endpoint" - -require "protocol/http/middleware" -require "protocol/http/body/buffered" -require "protocol/http/accept_encoding" - -module Async - module HTTP - # A high-level HTTP client for making requests to any URL, managing a pool of persistent connections keyed by host. - class Internet - # Initialize the internet client. - # @parameter options [Hash] Options to pass to the underlying {Client} instances. - def initialize(**options) - @clients = Hash.new - @options = options - end - - # A cache of clients. - # @attribute [Hash(URI, Client)] - attr :clients - - # Get or create a client for the given endpoint. - # @parameter endpoint [Endpoint] The endpoint to connect to. - # @returns [Client] A client suitable for making requests to the endpoint. - def client_for(endpoint) - key = host_key(endpoint) - - @clients.fetch(key) do - @clients[key] = self.make_client(endpoint) - end - end - - # Make a request to the internet with the given `method` and `url`. - # - # If you provide non-frozen headers, they may be mutated. - # - # @parameter method [String] The request method, e.g. `GET`. - # @parameter url [String] The URL to request, e.g. `https://www.codeotaku.com`. - # @parameter headers [Hash | Protocol::HTTP::Headers] The headers to send with the request. - # @parameter body [String | Protocol::HTTP::Body] The body to send with the request. - def call(verb, url, *arguments, **options, &block) - endpoint = Endpoint[url] - client = self.client_for(endpoint) - - options[:authority] ||= endpoint.authority - options[:scheme] ||= endpoint.scheme - - request = ::Protocol::HTTP::Request[verb, endpoint.path, *arguments, **options] - - response = client.call(request) - - return response unless block_given? - - begin - yield response - ensure - response.close - end - end - - # Close all cached clients and release their resources. - def close - # The order of operations here is to avoid a race condition between iterating over clients (#close may yield) and creating new clients. - clients = @clients.values - @clients.clear - - clients.each(&:close) - end - - ::Protocol::HTTP::Methods.each do |name, verb| - define_method(verb.downcase) do |url, *arguments, **options, &block| - self.call(verb, url, *arguments, **options, &block) - end - end - - protected - - def make_client(endpoint) - ::Protocol::HTTP::AcceptEncoding.new( - Client.new(endpoint, **@options) - ) - end - - def host_key(endpoint) - url = endpoint.url.dup - - url.path = "" - url.fragment = nil - url.query = nil - - return url - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/internet/instance.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/internet/instance.rb deleted file mode 100644 index bdbcfc8..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/internet/instance.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2021-2024, by Samuel Williams. - -require_relative "../internet" - -::Thread.attr_accessor :async_http_internet_instance - -module Async - module HTTP - class Internet - # The global instance of the internet. - def self.instance - ::Thread.current.async_http_internet_instance ||= self.new - end - - class << self - ::Protocol::HTTP::Methods.each do |name, verb| - define_method(verb.downcase) do |url, *arguments, **options, &block| - self.instance.call(verb, url, *arguments, **options, &block) - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/middleware/location_redirector.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/middleware/location_redirector.rb deleted file mode 100644 index 46dcf74..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/middleware/location_redirector.rb +++ /dev/null @@ -1,141 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2024-2026, by Samuel Williams. - -require "protocol/http/middleware" -require "protocol/http/body/rewindable" -require "protocol/url/reference" - -module Async - module HTTP - # @namespace - module Middleware - # A client wrapper which transparently handles redirects to a given maximum number of hops. - # - # The default implementation will only follow relative locations (i.e. those without a scheme) and will switch to GET if the original request was not a GET. - # - # The best reference for these semantics is defined by the [Fetch specification](https://fetch.spec.whatwg.org/#http-redirect-fetch). - # - # | Redirect using GET | Permanent | Temporary | - # |:-----------------------------------------:|:---------:|:---------:| - # | Allowed | 301 | 302 | - # | Preserve original method | 308 | 307 | - # - # For the specific details of the redirect handling, see: - # - 301 Moved Permanently. - # - 302 Found. - # - 307 Temporary Redirect. - # - class LocationRedirector < ::Protocol::HTTP::Middleware - # Raised when the maximum number of redirects has been exceeded. - class TooManyRedirects < StandardError - end - - # Header keys which should be deleted when changing a request from a POST to a GET as defined by . - PROHIBITED_GET_HEADERS = [ - "content-encoding", - "content-language", - "content-location", - "content-type", - ] - - # maximum_hops is the max number of redirects. Set to 0 to allow 1 request with no redirects. - def initialize(app, maximum_hops = 3) - super(app) - - @maximum_hops = maximum_hops - end - - # The maximum number of hops which will limit the number of redirects until an error is thrown. - attr :maximum_hops - - # Determine whether the redirect should switch the request method to GET. - # @parameter request [Protocol::HTTP::Request] The original request. - # @parameter response [Protocol::HTTP::Response] The redirect response. - # @returns [Boolean] Whether the method should be changed to GET. - def redirect_with_get?(request, response) - # We only want to switch to GET if the request method is something other than get, e.g. POST. - if request.method != GET - # According to the RFC, we should only switch to GET if the response is a 301 or 302: - return response.status == 301 || response.status == 302 - end - end - - # Handle a redirect to a relative location. - # - # @parameter request [Protocol::HTTP::Request] The original request, which you can modify if you want to handle the redirect. - # @parameter location [String] The relative location to redirect to. - # @returns [Boolean] True if the redirect was handled, false if it was not. - def handle_redirect(request, location) - uri = URI.parse(location) - - if uri.absolute? - return false - end - - # Update the path of the request: - request.path = ::Protocol::URL::Reference[request.path] + location - - # Follow the redirect: - return true - end - - # Make a request, transparently following redirects up to {maximum_hops} times. - # @parameter request [Protocol::HTTP::Request] The request to send. - # @returns [Protocol::HTTP::Response] The final response. - def call(request) - # We don't want to follow redirects for HEAD requests: - return super if request.head? - - body = ::Protocol::HTTP::Body::Rewindable.wrap(request) - hops = 0 - - while hops <= @maximum_hops - response = super(request) - - if response.redirection? - hops += 1 - - # Get the redirect location: - unless location = response.headers["location"] - return response - end - - response.finish - - unless handle_redirect(request, location) - return response - end - - # Ensure the request (body) is finished and set to nil before we manipulate the request: - request.finish - - if request.method == GET or response.preserve_method? - # We (might) need to rewind the body so that it can be submitted again: - body&.rewind - request.body = body - else - # We are changing the method to GET: - request.method = GET - - # We will no longer be submitting the body: - body = nil - - # Remove any headers which are not allowed in a GET request: - PROHIBITED_GET_HEADERS.each do |header| - request.headers.delete(header) - end - end - else - return response - end - end - - raise TooManyRedirects, "Redirected #{hops} times, exceeded maximum!" - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/mock.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/mock.rb deleted file mode 100644 index ec01aae..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/mock.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2024, by Samuel Williams. - -require_relative "mock/endpoint" diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/mock/endpoint.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/mock/endpoint.rb deleted file mode 100644 index e9e7b79..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/mock/endpoint.rb +++ /dev/null @@ -1,63 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2024-2026, by Samuel Williams. - -require_relative "../protocol" - -require "async/queue" - -module Async - module HTTP - # @namespace - module Mock - # This is an endpoint which bridges a client with a local server. - class Endpoint - # Initialize a mock endpoint for testing. - # @parameter protocol [Protocol] The protocol to use for connections. - # @parameter scheme [String] The URL scheme. - # @parameter authority [String] The hostname authority. - def initialize(protocol = Protocol::HTTP2, scheme = "http", authority = "localhost", queue: Queue.new) - @protocol = protocol - @scheme = scheme - @authority = authority - - @queue = queue - end - - attr :protocol - attr :scheme - attr :authority - - # Processing incoming connections - # @yield [::HTTP::Protocol::Request] the requests as they come in. - def run(parent: Task.current, &block) - while peer = @queue.dequeue - server = @protocol.server(peer) - - parent.async do - server.each(&block) - end - end - end - - # Create a new client-side connection by enqueuing the server-side socket. - # @returns [Socket] The client-side socket. - def connect - local, remote = ::Socket.pair(Socket::AF_UNIX, Socket::SOCK_STREAM) - - @queue.enqueue(remote) - - return local - end - - # Create a new mock endpoint that shares the same connection queue but adopts another endpoint's scheme and authority. - # @parameter endpoint [Endpoint] The endpoint to mirror the scheme and authority from. - # @returns [Endpoint] A new mock endpoint. - def wrap(endpoint) - self.class.new(@protocol, endpoint.scheme, endpoint.authority, queue: @queue) - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol.rb deleted file mode 100644 index 6eb5e27..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2017-2024, by Samuel Williams. - -require_relative "protocol/http1" -require_relative "protocol/https" - -module Async - module HTTP - # A protocol specifies a way in which to communicate with a remote peer. - module Protocol - # A protocol must implement the following interface: - # class Protocol - # def client(stream) -> Connection - # def server(stream) -> Connection - # end - - # A connection must implement the following interface: - # class Connection - # def concurrency -> can invoke call 1 or more times simultaneously. - # def reusable? -> can be used again/persistent connection. - - # def viable? -> Boolean - - # def call(request) -> Response - # def each -> (yield(request) -> Response) - # end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/configurable.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/configurable.rb deleted file mode 100644 index 96bbd07..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/configurable.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025-2026, by Samuel Williams. - -module Async - module HTTP - module Protocol - # A protocol wrapper that forwards pre-configured options to client and server creation. - class Configured - # Initialize with a protocol and options. - # @parameter protocol [Protocol] The underlying protocol to configure. - # @parameter options [Hash] Options to forward to client and server creation. - def initialize(protocol, **options) - @protocol = protocol - @options = options - end - - # @attribute [Protocol] The underlying protocol. - attr :protocol - - # @attribute [Hash] The options to pass to the protocol. - attr :options - - # Create a client connection using the configured protocol options. - # @parameter peer [IO] The peer to communicate with. - # @parameter options [Hash] Additional options merged with the configured defaults. - def client(peer, **options) - options = @options.merge(options) - @protocol.client(peer, **options) - end - - # Create a server connection using the configured protocol options. - # @parameter peer [IO] The peer to communicate with. - # @parameter options [Hash] Additional options merged with the configured defaults. - def server(peer, **options) - options = @options.merge(options) - @protocol.server(peer, **options) - end - - # @returns [Array(String)] The protocol names from the underlying protocol. - def names - @protocol.names - end - end - - # Provides a `new` method that creates a {Configured} wrapper, allowing protocols to be instantiated with custom options. - module Configurable - # Create a new {Configured} instance wrapping this protocol with the given options. - # @parameter options [Hash] Configuration options for client and server creation. - # @returns [Configured] A configured protocol instance. - def new(**options) - Configured.new(self, **options) - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/defaulton.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/defaulton.rb deleted file mode 100644 index d9a915b..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/defaulton.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025, by Samuel Williams. - -module Async - module HTTP - module Protocol - # This module provides a default instance of the protocol, which can be used to create clients and servers. The name is a play on "Default" + "Singleton". - module Defaulton - def self.extended(base) - base.instance_variable_set(:@default, base.new) - end - - attr_accessor :default - - # Create a client for an outbound connection, using the default instance. - def client(peer, **options) - default.client(peer, **options) - end - - # Create a server for an inbound connection, using the default instance. - def server(peer, **options) - default.server(peer, **options) - end - - # @returns [Array] The names of the supported protocol, used for Application Layer Protocol Negotiation (ALPN), using the default instance. - def names - default.names - end - end - - private_constant :Defaulton - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http.rb deleted file mode 100644 index 58884f5..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http.rb +++ /dev/null @@ -1,84 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2024, by Thomas Morgan. -# Copyright, 2024-2026, by Samuel Williams. - -require_relative "defaulton" - -require_relative "http1" -require_relative "http2" - -module Async - module HTTP - module Protocol - # HTTP is an http:// server that auto-selects HTTP/1.1 or HTTP/2 by detecting the HTTP/2 connection preface. - class HTTP - HTTP2_PREFACE = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" - HTTP2_PREFACE_SIZE = HTTP2_PREFACE.bytesize - - # Create a new HTTP protocol instance. - # - # @parameter http1 [HTTP1] The HTTP/1 protocol instance. - # @parameter http2 [HTTP2] The HTTP/2 protocol instance. - def initialize(http1: HTTP1, http2: HTTP2) - @http1 = http1 - @http2 = http2 - end - - # The names of all supported protocols. - # @returns [Array(String)] The supported protocol names. - def names - (@http2.names + @http1.names).uniq - end - - # Determine if the inbound connection is HTTP/1 or HTTP/2. - # - # @parameter stream [IO::Stream] The stream to detect the protocol for. - # @returns [Class] The protocol class to use. - def protocol_for(stream) - # Detect HTTP/2 connection preface - # https://www.rfc-editor.org/rfc/rfc9113.html#section-3.4 - preface = stream.peek do |read_buffer| - if read_buffer.bytesize >= HTTP2_PREFACE_SIZE - break read_buffer[0, HTTP2_PREFACE_SIZE] - elsif read_buffer.bytesize > 0 - # If partial read_buffer already doesn't match, no need to wait for more bytes. - break read_buffer unless HTTP2_PREFACE[read_buffer] - end - end - - if preface == HTTP2_PREFACE - @http2 - else - @http1 - end - end - - # Create a client for an outbound connection. Defaults to HTTP/1 for plaintext connections. - # - # @parameter peer [IO] The peer to communicate with. - # @parameter options [Hash] Options to pass to the protocol, keyed by protocol class. - def client(peer, **options) - options = options[@http1] || {} - - return @http1.client(peer, **options) - end - - # Create a server for an inbound connection. Able to detect HTTP1 and HTTP2. - # - # @parameter peer [IO] The peer to communicate with. - # @parameter options [Hash] Options to pass to the protocol, keyed by protocol class. - def server(peer, **options) - stream = IO::Stream(peer) - protocol = protocol_for(stream) - options = options[protocol] || {} - - return protocol.server(stream, **options) - end - - extend Defaulton - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1.rb deleted file mode 100644 index 926cbe0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2017-2026, by Samuel Williams. -# Copyright, 2024, by Thomas Morgan. - -require_relative "configurable" - -require_relative "http1/client" -require_relative "http1/server" - -require "io/stream" - -module Async - module HTTP - module Protocol - # Provides HTTP/1.0 and HTTP/1.1 client and server implementations. - module HTTP1 - extend Configurable - - VERSION = "HTTP/1.1" - - # @returns [Boolean] Whether the protocol supports bidirectional communication. - def self.bidirectional? - true - end - - # @returns [Boolean] Whether the protocol supports trailers. - def self.trailer? - true - end - - # Create a client for an outbound connection. - # - # @parameter peer [IO] The peer to communicate with. - # @parameter options [Hash] Options to pass to the client instance. - def self.client(peer, **options) - stream = ::IO::Stream(peer) - - return HTTP1::Client.new(stream, VERSION, **options) - end - - # Create a server for an inbound connection. - # - # @parameter peer [IO] The peer to communicate with. - # @parameter options [Hash] Options to pass to the server instance. - def self.server(peer, **options) - stream = ::IO::Stream(peer) - - return HTTP1::Server.new(stream, VERSION, **options) - end - - # @returns [Array] The names of the supported protocol. - def self.names - ["http/1.1", "http/1.0"] - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1/client.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1/client.rb deleted file mode 100644 index 105a2ca..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1/client.rb +++ /dev/null @@ -1,92 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2026, by Samuel Williams. - -require_relative "connection" - -module Async - module HTTP - module Protocol - module HTTP1 - # An HTTP/1 client connection that sends requests and reads responses. - class Client < Connection - # Initialize the HTTP/1 client connection. - def initialize(...) - super - - @pool = nil - end - - attr_accessor :pool - - # Called when the connection is closed, releasing it back to the pool. - def closed(error = nil) - super - - if pool = @pool - @pool = nil - # If the connection is not reusable, this will retire it from the connection pool and invoke `#close`. - pool.release(self) - end - end - - # Used by the client to send requests to the remote server. - def call(request, task: Task.current) - # Mark the start of the trailers: - trailer = request.headers.trailer! - headers = request.headers.header - - # We carefully interpret https://tools.ietf.org/html/rfc7230#section-6.3.1 to implement this correctly. - target = request.path - authority = request.authority - - # If we are using a CONNECT request, we need to use the authority as the target: - if request.connect? - target = authority - authority = nil - end - - write_request(authority, request.method, target, @version, headers) - - if request.body? - body = request.body - - if protocol = request.protocol - # This is a very tricky apect of handling HTTP/1 upgrade connections. In theory, this approach is a bit inefficient, because we spin up a task just to handle writing to the underlying stream when we could be writing to the stream directly. But we need to maintain some level of compatibility with HTTP/2. Additionally, we don't know if the upgrade request will be accepted, so starting to write the body at this point needs to be handled with care. - task.async(annotation: "Upgrading request...") do - # If this fails, this connection will be closed. - write_upgrade_body(protocol, body) - rescue => error - self.close(error) - end - elsif request.connect? - task.async(annotation: "Tunnneling request...") do - write_tunnel_body(@version, body) - rescue => error - self.close(error) - end - else - task.async(annotation: "Streaming request...") do - # Once we start writing the body, we can't recover if the request fails. That's because the body might be generated dynamically, streaming, etc. - write_body(@version, body, false, trailer) - rescue => error - self.close(error) - end - end - elsif protocol = request.protocol - write_upgrade_body(protocol) - else - write_body(@version, request.body, false, trailer) - end - - return Response.read(self, request) - rescue => error - self.close(error) - raise - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1/connection.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1/connection.rb deleted file mode 100755 index 02e4752..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1/connection.rb +++ /dev/null @@ -1,98 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2026, by Samuel Williams. - -require_relative "request" -require_relative "response" - -require "protocol/http1" -require "protocol/http/peer" - -module Async - module HTTP - module Protocol - module HTTP1 - # An HTTP/1 connection that wraps an IO stream with version and state tracking. - class Connection < ::Protocol::HTTP1::Connection - # Initialize the connection with an IO stream and HTTP version. - # @parameter stream [IO::Stream] The underlying stream. - # @parameter version [String] The negotiated HTTP version string. - # @parameter options [Hash] Additional options for the connection. - def initialize(stream, version, **options) - super(stream, **options) - - # On the client side, we need to send the HTTP version with the initial request. On the server side, there are some scenarios (bad request) where we don't know the request version. In those cases, we use this value, which is either hard coded based on the protocol being used, OR could be negotiated during the connection setup (e.g. ALPN). - @version = version - end - - # @returns [String] A string representation of this connection. - def to_s - "\#<#{self.class} negotiated #{@version}, #{@state}>" - end - - # @returns [String] A JSON-compatible representation. - def as_json(...) - to_s - end - - # @returns [String] A JSON string representation. - def to_json(...) - as_json.to_json(...) - end - - attr :version - - # @returns [Boolean] Whether this is an HTTP/1 connection. - def http1? - true - end - - # @returns [Boolean] Whether this is an HTTP/2 connection. - def http2? - false - end - - # @returns [Protocol::HTTP::Peer] The peer information for this connection. - def peer - @peer ||= ::Protocol::HTTP::Peer.for(@stream.io) - end - - attr :count - - # @returns [Integer] The maximum number of concurrent requests (always 1 for HTTP/1). - def concurrency - 1 - end - - # Can we use this connection to make requests? - def viable? - unless self.idle? - return false - end - - unless @stream - return false - end - - # `nil` indicates that the connection has no data, but is still alive. An empty string means the connection is closed, while a non-empty string indicates application data on a idle HTTP/1 connection, both are failure cases. - if @stream.peek_partial(1) - return false - end - - return @stream.readable? - rescue => error - Console.debug(self, "Connection viability probe failed!", exception: error) - - return false - end - - # @returns [Boolean] Whether the connection can be reused for another request. - def reusable? - @persistent && @stream && !@stream.closed? - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1/finishable.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1/finishable.rb deleted file mode 100644 index 6d02ba4..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1/finishable.rb +++ /dev/null @@ -1,72 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2024-2026, by Samuel Williams. -# Copyright, 2026, by Jun Jiang. - -require "protocol/http/body/wrapper" -require "async/promise" - -module Async - module HTTP - module Protocol - module HTTP1 - # Keeps track of whether a body is being read, and if so, waits for it to be closed. - class Finishable < ::Protocol::HTTP::Body::Wrapper - # Initialize the finishable wrapper. - # @parameter body [Protocol::HTTP::Body::Readable] The body to wrap. - def initialize(body) - super(body) - - @closed = Async::Promise.new - @error = nil - - @reading = false - end - - # @returns [Boolean] Whether the body has started reading. - def reading? - @reading - end - - # Read the next chunk from the body. - # @returns [String | Nil] The next chunk of data. - def read - @reading = true - - super - end - - # Close the body and signal any waiting tasks. - def close(error = nil) - super - - unless @closed.resolved? - @error = error - @closed.resolve(true) - end - end - - # Wait for the body to be fully consumed or discard it. - # @parameter persistent [Boolean] Whether the connection will be reused. - def wait(persistent = true) - if @reading - @closed.wait - elsif persistent - # If the connection can be reused, let's gracefully discard the body: - self.discard - else - # Else, we don't care about the body, so we can close it immediately: - self.close - end - end - - # @returns [String] A detailed representation of this finishable body. - def inspect - "#<#{self.class} closed=#{@closed} error=#{@error}> | #{super}" - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1/request.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1/request.rb deleted file mode 100644 index 93de844..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1/request.rb +++ /dev/null @@ -1,95 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2026, by Samuel Williams. - -require_relative "../request" - -module Async - module HTTP - module Protocol - module HTTP1 - # An incoming HTTP/1 request parsed from the connection. - class Request < Protocol::Request - # Check whether the given request target is a valid path. - # @parameter target [String] The request target to validate. - # @returns [Boolean] Whether the target is a valid path. - def self.valid_path?(target) - if target.start_with?("/") - return true - elsif target == "*" - return true - else - return false - end - end - - URI_PATTERN = %r{\A(?[^:/]+)://(?[^/]+)(?.*)\z} - - # Read and parse the next request from the connection. - # @parameter connection [Connection] The HTTP/1 connection to read from. - # @returns [Request | Nil] The parsed request, or `nil` if the connection is closed. - def self.read(connection) - connection.read_request do |authority, method, target, version, headers, body| - if method == ::Protocol::HTTP::Methods::CONNECT - # We put the target into the authority field for CONNECT requests, as per HTTP/2 semantics. - self.new(connection, nil, target, method, nil, version, headers, body) - elsif valid_path?(target) - # This is a valid request. - self.new(connection, nil, authority, method, target, version, headers, body) - elsif match = target.match(URI_PATTERN) - # We map the incoming absolute URI target to the scheme, authority, and path fields of the request. - self.new(connection, match[:scheme], match[:authority], method, match[:path], version, headers, body) - else - # This is an invalid request. - raise ::Protocol::HTTP1::BadRequest.new("Invalid request target: #{target}") - end - end - end - - UPGRADE = "upgrade" - - # Initialize the request from the parsed components. - # @parameter connection [Connection] The underlying connection. - # @parameter scheme [String | Nil] The request scheme. - # @parameter authority [String | Nil] The request authority. - # @parameter method [String] The HTTP method. - # @parameter path [String | Nil] The request path. - # @parameter version [String] The HTTP version. - # @parameter headers [Protocol::HTTP::Headers] The request headers. - # @parameter body [Protocol::HTTP::Body::Readable | Nil] The request body. - def initialize(connection, scheme, authority, method, path, version, headers, body) - @connection = connection - - # HTTP/1 requests with an upgrade header (which can contain zero or more values) are extracted into the protocol field of the request, and we expect a response to select one of those protocols with a status code of 101 Switching Protocols. - protocol = headers.delete("upgrade") - - super(scheme, authority, method, path, version, headers, body, protocol, self.public_method(:write_interim_response)) - end - - # @returns [Connection] The underlying HTTP/1 connection. - def connection - @connection - end - - # @returns [Boolean] Whether connection hijacking is supported. - def hijack? - true - end - - # Hijack the underlying connection for bidirectional communication. - def hijack! - @connection.hijack! - end - - # Write an interim (1xx) response to the client. - # @parameter status [Integer] The interim HTTP status code. - # @parameter headers [Hash | Nil] Optional interim response headers. - def write_interim_response(status, headers = nil) - @connection.write_interim_response(@version, status, headers) - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1/response.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1/response.rb deleted file mode 100644 index bfcadce..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1/response.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2026, by Samuel Williams. -# Copyright, 2023, by Josh Huber. - -require_relative "../response" - -module Async - module HTTP - module Protocol - module HTTP1 - # An HTTP/1 response received from a server. - class Response < Protocol::Response - # Read the response from the connection, handling interim responses. - # @parameter connection [Connection] The HTTP/1 connection to read from. - # @parameter request [Request] The original request. - # @returns [Response | Nil] The final response. - def self.read(connection, request) - while parts = connection.read_response(request.method) - response = self.new(connection, *parts) - - if response.final? - return response - else - request.send_interim_response(response.status, response.headers) - end - end - end - - UPGRADE = "upgrade" - - # @attribute [String] The HTTP response line reason. - attr :reason - - # @parameter reason [String] HTTP response line reason phrase. - def initialize(connection, version, status, reason, headers, body) - @connection = connection - @reason = reason - - # Technically, there should never be more than one value for the upgrade header, but we'll just take the first one to avoid complexity. - protocol = headers.delete(UPGRADE)&.first - - super(version, status, headers, body, protocol) - end - - # Assign the connection pool, releasing the connection if it is already idle or closed. - # @parameter pool [Async::Pool::Controller] The connection pool. - def pool=(pool) - if @connection.idle? or @connection.closed? - pool.release(@connection) - else - @connection.pool = pool - end - end - - # @returns [Connection] The underlying HTTP/1 connection. - def connection - @connection - end - - # @returns [Boolean] Whether connection hijacking is available (when the body is `nil`). - def hijack? - @body.nil? - end - - # Hijack the underlying connection for bidirectional communication. - def hijack! - @connection.hijack! - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1/server.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1/server.rb deleted file mode 100644 index b4a438c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http1/server.rb +++ /dev/null @@ -1,183 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2026, by Samuel Williams. -# Copyright, 2020, by Igor Sidorov. -# Copyright, 2023, by Thomas Morgan. -# Copyright, 2024, by Anton Zhuravsky. -# Copyright, 2025, by Jean Boussier. - -require_relative "connection" -require_relative "finishable" - -require "async/promise" -require "console/event/failure" -require "protocol/http/body/buffered" - -module Async - module HTTP - module Protocol - module HTTP1 - # An HTTP/1 server connection that receives requests and sends responses. - class Server < Connection - # Initialize the HTTP/1 server connection. - def initialize(...) - super - - @ready = Async::Promise.new - end - - # Called when the connection is closed, signalling any waiting tasks. - def closed(error = nil) - super - - @ready.resolve(nil) - end - - # Write a failure response with the given status code and error class name. - # @parameter status [Integer] The HTTP status code to send. - # @parameter error [Exception] The error which caused the request to fail. - def fail_request(status, error) - body = ::Protocol::HTTP::Body::Buffered.wrap(error.class.name) - - @persistent = false - write_response(@version, status, {"content-type" => "text/plain; charset=utf-8"}) - write_body(@version, body) - rescue => error - # At this point, there is very little we can do to recover: - Console.debug(self, "Failed to write failure response!", error) - end - - # Read the next incoming request from the connection. - # @returns [Request | Nil] The next request, or `nil` if the connection is closed. - def next_request - if closed? - return nil - elsif !idle? - @ready.wait - end - - # Read an incoming request: - return unless request = Request.read(self) - - unless persistent?(request.version, request.method, request.headers) - @persistent = false - end - - return request - rescue ::Protocol::HTTP::BadRequest => error - fail_request(400, error) - # Conceivably we could retry here, but we don't really know how bad the error is, so it's better to just fail: - raise - end - - # Server loop. - def each(task: Task.current) - task.annotate("Reading #{self.version} requests for #{self.class}.") - - while request = next_request - # We have received complete request (line + headers), so defer stop until the response is generated. - task.defer_stop do - if body = request.body - finishable = Finishable.new(body) - request.body = finishable - end - - response = yield(request, self) - version = request.version - body = response&.body - - if hijacked? - body&.close - return - end - - # If a response was generated, send it: - if response - trailer = response.headers.trailer! - headers = response.headers.header - - # Some operations in this method are long running, that is, it's expected that `body.call(stream)` could literally run indefinitely. In order to facilitate garbage collection, we want to nullify as many local variables before calling the streaming body. This ensures that the garbage collection can clean up as much state as possible during the long running operation, so we don't retain objects that are no longer needed. - - if body and protocol = response.protocol - # We force a 101 response if the protocol is upgraded - HTTP/2 CONNECT will return 200 for success, but this won't be understood by HTTP/1 clients: - write_response(@version, 101, headers) - - # At this point, the request body is hijacked, so we don't want to call #finish below. - request = nil - response = nil - - if body.stream? - return body.call(write_upgrade_body(protocol)) - else - write_upgrade_body(protocol, body) - end - elsif response.status == 101 - # This code path is to support legacy behavior where the response status is set to 101, but the protocol is not upgraded. This may not be a valid use case, but it is supported for compatibility. We expect the response headers to contain the `upgrade` header. - write_response(@version, response.status, headers) - - # Same as above: - request = nil - response = nil - - if body.stream? - return body.call(write_tunnel_body(version)) - else - write_tunnel_body(version, body) - end - else - write_response(@version, response.status, headers) - - if request.connect? and response.success? - # Same as above: - request = nil - response = nil - - if body.stream? - return body.call(write_tunnel_body(version)) - else - write_tunnel_body(version, body) - end - else - head = request.head? - - # Same as above: - request = nil - response = nil - - write_body(version, body, head, trailer) - end - end - - # We are done with the body: - body = nil - else - # If the request failed to generate a response, it was an internal server error: - write_response(@version, 500, {}) - write_body(version, nil) - - request&.finish - end - - if finishable - finishable.wait(@persistent) - else - # Do not remove this line or you will unleash the gods of concurrency hell. - task.yield - end - rescue ::Protocol::HTTP::RemoteError => error - Console.debug(self, "Remote endpoint disconnected!", exception: error) - return - rescue => error - # We store error (as a local variable) for later use in the ensure block. - raise - ensure - body&.close(error) - end - end - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http10.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http10.rb deleted file mode 100755 index 5aa2acc..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http10.rb +++ /dev/null @@ -1,55 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2017-2026, by Samuel Williams. -# Copyright, 2024, by Thomas Morgan. - -require_relative "http1" - -module Async - module HTTP - module Protocol - # Provides an HTTP/1.0 client and server protocol implementation. - module HTTP10 - extend Configurable - - VERSION = "HTTP/1.0" - - # @returns [Boolean] Whether the protocol supports bidirectional communication. - def self.bidirectional? - false - end - - # @returns [Boolean] Whether the protocol supports trailers. - def self.trailer? - false - end - - # Create a client for an outbound connection. - # - # @parameter peer [IO] The peer to communicate with. - # @parameter options [Hash] Options to pass to the client instance. - def self.client(peer, **options) - stream = ::IO::Stream(peer) - - return HTTP1::Client.new(stream, VERSION, **options) - end - - # Create a server for an inbound connection. - # - # @parameter peer [IO] The peer to communicate with. - # @parameter options [Hash] Options to pass to the server instance. - def self.server(peer, **options) - stream = ::IO::Stream(peer) - - return HTTP1::Server.new(stream, VERSION, **options) - end - - # @returns [Array] The names of the supported protocol. - def self.names - ["http/1.0"] - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http11.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http11.rb deleted file mode 100644 index 7aa7eb3..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http11.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2017-2026, by Samuel Williams. -# Copyright, 2018, by Janko Marohnić. -# Copyright, 2024, by Thomas Morgan. - -require_relative "http1" - -module Async - module HTTP - module Protocol - # Provides an HTTP/1.1 client and server protocol implementation. - module HTTP11 - extend Configurable - - VERSION = "HTTP/1.1" - - # @returns [Boolean] Whether the protocol supports bidirectional communication. - def self.bidirectional? - true - end - - # @returns [Boolean] Whether the protocol supports trailers. - def self.trailer? - true - end - - # Create a client for an outbound connection. - # - # @parameter peer [IO] The peer to communicate with. - # @parameter options [Hash] Options to pass to the client instance. - def self.client(peer, **options) - stream = ::IO::Stream(peer) - - return HTTP1::Client.new(stream, VERSION, **options) - end - - # Create a server for an inbound connection. - # - # @parameter peer [IO] The peer to communicate with. - # @parameter options [Hash] Options to pass to the server instance. - def self.server(peer, **options) - stream = ::IO::Stream(peer) - - return HTTP1::Server.new(stream, VERSION, **options) - end - - # @returns [Array] The names of the supported protocol. - def self.names - ["http/1.1"] - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2.rb deleted file mode 100644 index eb4486a..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2.rb +++ /dev/null @@ -1,86 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2026, by Samuel Williams. -# Copyright, 2024, by Thomas Morgan. - -require_relative "configurable" - -require_relative "http2/client" -require_relative "http2/server" - -require "io/stream" - -module Async - module HTTP - module Protocol - # Provides an HTTP/2 client and server protocol implementation. - module HTTP2 - extend Configurable - - VERSION = "HTTP/2" - - # @returns [Boolean] Whether the protocol supports bidirectional communication. - def self.bidirectional? - true - end - - # @returns [Boolean] Whether the protocol supports trailers. - def self.trailer? - true - end - - # The default settings for the client. - CLIENT_SETTINGS = { - ::Protocol::HTTP2::Settings::ENABLE_PUSH => 0, - ::Protocol::HTTP2::Settings::MAXIMUM_FRAME_SIZE => 0x100000, - ::Protocol::HTTP2::Settings::INITIAL_WINDOW_SIZE => 0x800000, - ::Protocol::HTTP2::Settings::NO_RFC7540_PRIORITIES => 1, - } - - # The default settings for the server. - SERVER_SETTINGS = { - # We choose a lower maximum concurrent streams to avoid overloading a single connection/thread. - ::Protocol::HTTP2::Settings::MAXIMUM_CONCURRENT_STREAMS => 128, - ::Protocol::HTTP2::Settings::MAXIMUM_FRAME_SIZE => 0x100000, - ::Protocol::HTTP2::Settings::INITIAL_WINDOW_SIZE => 0x800000, - ::Protocol::HTTP2::Settings::ENABLE_CONNECT_PROTOCOL => 1, - ::Protocol::HTTP2::Settings::NO_RFC7540_PRIORITIES => 1, - } - - # Create a client for an outbound connection. - # - # @parameter peer [IO] The peer to communicate with. - # @parameter options [Hash] Options to pass to the client instance. - def self.client(peer, settings: CLIENT_SETTINGS) - stream = ::IO::Stream(peer) - client = Client.new(stream) - - client.send_connection_preface(settings) - client.start_connection - - return client - end - - # Create a server for an inbound connection. - # - # @parameter peer [IO] The peer to communicate with. - # @parameter options [Hash] Options to pass to the server instance. - def self.server(peer, settings: SERVER_SETTINGS) - stream = ::IO::Stream(peer) - server = Server.new(stream) - - server.read_connection_preface(settings) - server.start_connection - - return server - end - - # @returns [Array] The names of the supported protocol. - def self.names - ["h2"] - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/client.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/client.rb deleted file mode 100644 index bf1ca4a..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/client.rb +++ /dev/null @@ -1,67 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2026, by Samuel Williams. -# Copyright, 2026, by Denis Talakevich. - -require_relative "connection" -require_relative "response" - -require "protocol/http2/client" - -module Async - module HTTP - module Protocol - module HTTP2 - # An HTTP/2 client connection that sends requests and reads responses. - class Client < ::Protocol::HTTP2::Client - include Connection - - # Initialize the HTTP/2 client with an IO stream. - # @parameter stream [IO::Stream] The underlying stream. - def initialize(stream) - @stream = stream - - framer = ::Protocol::HTTP2::Framer.new(@stream) - - super(framer) - end - - # Create a new response stream for the next request. - # @returns [Response] The response object to be populated. - def create_response - Response::Stream.create(self, self.next_stream_id).response - end - - # Used by the client to send requests to the remote server. - def call(request) - # The remote peer has sent a GOAWAY frame, so it will not process any new streams on this connection. The request has not been sent yet, so it is safe to retry it on a new connection, even if it is not idempotent. This is checked first, because a connection with no streams left to drain is closed by the GOAWAY itself. - raise ::Protocol::HTTP::RefusedError, "Connection is going away!" if self.goaway_received? - - # The connection can close after being acquired from the pool. No stream has been created yet, so the request has not been written and is safe to retry. - raise ::Protocol::HTTP::RefusedError, "Connection closed!" if self.closed? - - response = create_response - write_request(response, request) - read_response(response) - - return response - end - - # Write a request to the remote server via the given response stream. - # @parameter response [Response] The response stream to write through. - # @parameter request [Protocol::HTTP::Request] The request to send. - def write_request(response, request) - response.send_request(request) - end - - # Wait for the response headers to arrive. - # @parameter response [Response] The response to wait on. - def read_response(response) - response.wait - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/connection.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/connection.rb deleted file mode 100644 index 37142ff..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/connection.rb +++ /dev/null @@ -1,175 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2026, by Samuel Williams. -# Copyright, 2020, by Bruno Sutic. -# Copyright, 2025, by Jean Boussier. -# Copyright, 2026, by Denis Talakevich. - -require_relative "stream" - -require "protocol/http/peer" -require "async/semaphore" - -module Async - module HTTP - module Protocol - module HTTP2 - HTTPS = "https".freeze - SCHEME = ":scheme".freeze - METHOD = ":method".freeze - PATH = ":path".freeze - AUTHORITY = ":authority".freeze - STATUS = ":status".freeze - PROTOCOL = ":protocol".freeze - - CONTENT_LENGTH = "content-length".freeze - CONNECTION = "connection".freeze - TRAILER = "trailer".freeze - - # Provides shared connection behaviour for HTTP/2 client and server connections. - module Connection - # Initialize the connection state. - def initialize(...) - super - - @reader = nil - - # Writing multiple frames at the same time can cause odd problems if frames are only partially written. So we use a semaphore to ensure frames are written in their entirety. - @write_frame_guard = Async::Semaphore.new(1) - end - - # Synchronize write access to the connection. - # @yields {|...| ...} The block to execute while holding the write lock. - def synchronize(&block) - @write_frame_guard.acquire(&block) - end - - # Write a single frame, deferring stop until the frame is written. - def write_frame(frame) - Task.current.defer_stop{super} - end - - # Write multiple frames, deferring stop until the frames are written. - def write_frames - Task.current.defer_stop{super} - end - - # @returns [String] A string representation of this connection. - def to_s - "\#<#{self.class} #{@streams.count} active streams>" - end - - # @returns [String] A JSON-compatible representation. - def as_json(...) - to_s - end - - # @returns [String] A JSON string representation. - def to_json(...) - as_json.to_json(...) - end - - attr :stream - - # @returns [Boolean] Whether this is an HTTP/1 connection. - def http1? - false - end - - # @returns [Boolean] Whether this is an HTTP/2 connection. - def http2? - true - end - - # Start the background reader task if it is not already running. - def start_connection - @reader || read_in_background - end - - # Close the connection and stop the background reader. - def close(error = nil) - if reader = @reader - @reader = nil - - # The reader task can close the connection itself, e.g. when the last stream completes and the connection is released back to the pool. Stopping it here would cancel the current task in the middle of this method, leaving the underlying stream open, so we let it unwind by itself: `closed?` is now true, so the read loop exits. - reader.stop unless reader.current? - end - - super - end - - # The connection has finished draining the streams which the remote peer accepted before its graceful GOAWAY. - # - # The last of those streams can complete on the sending side, in a task other than the background reader - the response arrived first and the request body was still being written. The reader is then parked in a blocking read and will never notice that the connection is closed, so we stop it and let its `ensure` close the connection. - def close_if_drained! - super - - if self.closed? and (reader = @reader) and !reader.current? - reader.stop - end - end - - # Start a transient background task that reads frames from the connection. - def read_in_background(parent: Task.current) - raise RuntimeError, "Connection is closed!" if closed? - - parent.async(transient: true) do |task| - @reader = task - - task.annotate("#{version} reading data for #{self.class}.") - - # We don't need to defer stop here as this is already a transient task (ignores stop): - begin - while !self.closed? - self.consume_window - self.read_frame - end - rescue => error - # Close with error. - ensure - # Don't call #close twice. - if @reader - @reader = nil - - self.close(error) - end - end - end - end - - attr :promises - - # @returns [Protocol::HTTP::Peer] The peer information for this connection. - def peer - @peer ||= ::Protocol::HTTP::Peer.for(@stream.io) - end - - attr :count - - # @returns [Integer] The maximum number of concurrent streams allowed. - def concurrency - self.maximum_concurrent_streams - end - - # Can we use this connection to make requests? - def viable? - !self.goaway_received? && @stream&.readable? - end - - # @returns [Boolean] Whether the connection can be reused. - # - # Once the remote peer has sent a GOAWAY frame, it will not process any new streams on this connection, so it must not be handed out for another request, even while the streams it accepted are still being drained. - def reusable? - !self.closed? && !self.goaway_received? - end - - # @returns [String] The HTTP version string. - def version - VERSION - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/input.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/input.rb deleted file mode 100644 index 7a50ba8..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/input.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2020-2026, by Samuel Williams. - -require "protocol/http/body/writable" - -module Async - module HTTP - module Protocol - module HTTP2 - # A writable body which requests window updates when data is read from it. - class Input < ::Protocol::HTTP::Body::Writable - # Initialize the input body. - # @parameter stream [Stream] The HTTP/2 stream to read from. - # @parameter length [Integer | Nil] The expected content length. - def initialize(stream, length) - super(length) - - @stream = stream - @remaining = length - end - - # Read the next chunk of data, requesting window updates as needed. - # @returns [String | Nil] The next chunk, or `nil` if the body is complete. - def read - if chunk = super - # If we read a chunk from the stream, we want to extend the window if required so more data will be provided. - @stream&.request_window_update - end - - # We track the expected length and check we got what we were expecting. - if @remaining - if chunk - @remaining -= chunk.bytesize - elsif @remaining > 0 - raise EOFError, "Expected #{self.length} bytes, #{@remaining} bytes short!" - elsif @remaining < 0 - raise EOFError, "Expected #{self.length} bytes, #{@remaining} bytes over!" - end - end - - return chunk - end - - # Close the application-facing input body and notify the stream that incoming data is no longer being consumed. While local output is active, the HTTP/2 stream remains open. Once output also closes, the remaining wire stream is terminated without an error. - # @parameter error [Exception | Nil] The error that caused the input to be closed, if any. - def close(error = nil) - super - - if stream = @stream - @stream = nil - stream.finish_input(self, error) - end - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/output.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/output.rb deleted file mode 100644 index ea7019a..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/output.rb +++ /dev/null @@ -1,171 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2020-2026, by Samuel Williams. - -require "protocol/http/body/stream" - -module Async - module HTTP - module Protocol - module HTTP2 - # Writes body data to an HTTP/2 stream, respecting flow control windows. - class Output - # Initialize the output handler. - # @parameter stream [Stream] The HTTP/2 stream to write to. - # @parameter body [Protocol::HTTP::Body::Readable] The body to read from. - # @parameter trailer [Protocol::HTTP::Headers | Nil] Optional trailing headers. - def initialize(stream, body, trailer = nil) - @stream = stream - @body = body - @trailer = trailer - - @task = nil - - @guard = ::Mutex.new - @window_updated = ::ConditionVariable.new - end - - attr :trailer - - # Start an asynchronous task to write the body to the stream. - def start(parent: Task.current) - raise "Task already started!" if @task - - if @body.stream? - @task = parent.async(&self.method(:stream)) - else - @task = parent.async(&self.method(:passthrough)) - end - end - - # Signal that the flow control window has been updated. - # @parameter size [Integer] The new window size. - # @returns [Boolean] Always returns `true`. - def window_updated(size) - @guard.synchronize do - @window_updated.signal - end - - return true - end - - # Write a chunk of data to the HTTP/2 stream, respecting flow control. - # @parameter chunk [String] The data to write. - def write(chunk) - until chunk.empty? - stream = @stream or raise IOError, "HTTP/2 stream is closed!" - maximum_size = stream.available_frame_size - - # We try to avoid synchronization if possible: - if maximum_size <= 0 - @guard.synchronize do - maximum_size = stream.available_frame_size - - while maximum_size <= 0 - @window_updated.wait(@guard) - - stream = @stream or raise IOError, "HTTP/2 stream is closed!" - maximum_size = stream.available_frame_size - end - end - end - - break unless chunk = send_data(stream, chunk, maximum_size) - end - end - - # Finish writing to the stream. - # @parameter error [Exception | Nil] An optional error that caused the close. - def close_write(error = nil) - if stream = @stream - @stream = nil - stream.finish_output(error) - end - end - - # This method should only be called from within the context of the output task. - def close(error = nil) - close_write(error) - stop(error) - end - - # This method should only be called from within the context of the HTTP/2 stream. - def stop(error) - if task = @task - @task = nil - task.stop(error) - end - end - - # Close the wire output without cancelling a streamable body. This allows bidirectional bodies to observe an orderly input closure and finish normally. A non-streaming producer has no input side through which closure can propagate, so it is stopped directly. - def close_stream - if @body.stream? - @stream = nil - - @guard.synchronize do - @window_updated.broadcast - end - else - stop(nil) - end - end - - private - - def stream(task) - task.annotate("Streaming #{@body} to #{@stream}.") - - input = @stream.wait_for_input - stream = ::Protocol::HTTP::Body::Stream.new(input, self) - - @body.call(stream) - rescue => error - self.close(error) - raise - end - - # Reads chunks from the given body and writes them to the stream as fast as possible. - def passthrough(task) - task.annotate("Writing #{@body} to #{@stream}.") - - while chunk = @body&.read - self.write(chunk) - # TODO this reduces memory usage? - # chunk.clear unless chunk.frozen? - # GC.start - end - rescue Async::Cancel, StandardError => error - raise - ensure - # Ensure the body we are reading from is fully closed: - if body = @body - @body = nil - body.close(error) - end - - # Ensure the output of this body is closed: - self.close_write(error) - end - - # Send `maximum_size` bytes of data using the specified `stream`. If the buffer has no more chunks, `END_STREAM` will be sent on the final chunk. - # @param maximum_size [Integer] send up to this many bytes of data. - # @param stream [Stream] the stream to use for sending data frames. - # @return [String, nil] any data that could not be written. - def send_data(stream, chunk, maximum_size) - if chunk.bytesize <= maximum_size - stream.send_data(chunk, maximum_size: maximum_size) - else - stream.send_data(chunk.byteslice(0, maximum_size), maximum_size: maximum_size) - - # The window was not big enough to send all the data, so we save it for next time: - return chunk.byteslice(maximum_size, chunk.bytesize - maximum_size) - end - - return nil - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/request.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/request.rb deleted file mode 100644 index 05b9fd0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/request.rb +++ /dev/null @@ -1,205 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2026, by Samuel Williams. - -require_relative "../request" -require_relative "stream" - -module Async - module HTTP - module Protocol - module HTTP2 - # Typically used on the server side to represent an incoming request, and write the response. - class Request < Protocol::Request - # Represents the HTTP/2 stream associated with an incoming server-side request. - class Stream < HTTP2::Stream - # Initialize the request stream. - def initialize(*) - super - - @enqueued = false - @request = Request.new(self) - end - - attr :request - - # Write a failure response with the given status code and error class name. - # @parameter status [Integer] The HTTP status code to send. - # @parameter error [Exception] The error which caused the request to fail. - def fail_request(status, error) - body = error.class.name - headers = [ - [STATUS, status.to_s], - ["content-type", "text/plain; charset=utf-8"], - ] - - if @request.head? - send_headers(headers, ::Protocol::HTTP2::END_STREAM) - else - send_headers(headers) - send_data(body, ::Protocol::HTTP2::END_STREAM) - end - - # The peer may still be sending a request body. The response is complete, so release the stream without reporting a protocol error. - send_reset_stream(::Protocol::HTTP2::Error::NO_ERROR) unless closed? - rescue => error - Console.debug(self, "Failed to write failure response!", error) - end - - # Process the initial headers received from the client and construct the request. - # @parameter headers [Array] The list of header key-value pairs. - # @parameter end_stream [Boolean] Whether the stream is complete after these headers. - def receive_initial_headers(headers, end_stream) - @headers = ::Protocol::HTTP::Headers.new - - headers.each do |key, value| - if key == SCHEME - raise ::Protocol::HTTP2::HeaderError, "Request scheme already specified!" if @request.scheme - - @request.scheme = value - elsif key == AUTHORITY - raise ::Protocol::HTTP2::HeaderError, "Request authority already specified!" if @request.authority - - @request.authority = value - elsif key == METHOD - raise ::Protocol::HTTP2::HeaderError, "Request method already specified!" if @request.method - - @request.method = value - elsif key == PATH - raise ::Protocol::HTTP2::HeaderError, "Request path is empty!" if value.empty? - raise ::Protocol::HTTP2::HeaderError, "Request path already specified!" if @request.path - - @request.path = value - elsif key == PROTOCOL - raise ::Protocol::HTTP2::HeaderError, "Request protocol already specified!" if @request.protocol - - @request.protocol = value - elsif key == CONTENT_LENGTH - raise ::Protocol::HTTP2::HeaderError, "Request content length already specified!" if @length - - @length = Integer(value) - elsif key == CONNECTION - raise ::Protocol::HTTP2::HeaderError, "Connection header is not allowed!" - elsif key.start_with? ":" - raise ::Protocol::HTTP2::HeaderError, "Invalid pseudo-header #{key}!" - elsif key =~ /[A-Z]/ - raise ::Protocol::HTTP2::HeaderError, "Invalid characters in header #{key}!" - else - add_header(key, value) - end - end - - unless @request.valid? - raise ::Protocol::HTTP2::HeaderError, "Request is missing required headers!" - else - # Validate structured headers before exposing the request to the application: - @headers.to_h - @request.headers = @headers - - # We only construct the input/body if data is coming. - unless end_stream - @request.body = prepare_input(@length) - end - - # We are ready for processing: - @connection.requests.enqueue(@request) - end - - return headers - rescue ::Protocol::HTTP::BadRequest => error - fail_request(400, error) - end - - # Called when the stream is closed. - # @parameter error [Exception | Nil] The error that caused the close, if any. - def closed(error) - @request = nil - - super - end - end - - # Initialize the request from an HTTP/2 stream. - # @parameter stream [Stream] The HTTP/2 stream for this request. - def initialize(stream) - super(nil, nil, nil, nil, VERSION, nil, nil, nil, self.public_method(:write_interim_response)) - - @stream = stream - end - - attr :stream - - # @returns [Connection] The underlying HTTP/2 connection. - def connection - @stream.connection - end - - # @returns [Boolean] Whether the request has the required pseudo-headers. - def valid? - @scheme and @method and (@path or @method == ::Protocol::HTTP::Methods::CONNECT) - end - - # @returns [Boolean] Whether connection hijacking is supported (not available for HTTP/2). - def hijack? - false - end - - NO_RESPONSE = [ - [STATUS, "500"], - ] - - # Send a response back to the client via the HTTP/2 stream. - # @parameter response [Protocol::HTTP::Response | Nil] The response to send. - def send_response(response) - if response.nil? - return @stream.send_headers(NO_RESPONSE, ::Protocol::HTTP2::END_STREAM) - end - - protocol_headers = [ - [STATUS, response.status], - ] - - if length = response.body&.length - protocol_headers << [CONTENT_LENGTH, length] - end - - headers = ::Protocol::HTTP::Headers::Merged.new( - protocol_headers, - response.headers.header - ) - - if body = response.body and !self.head? - # This function informs the headers object that any subsequent headers are going to be trailer. Therefore, it must be called *before* sending the headers, to avoid any race conditions. - trailer = response.headers.trailer! - - @stream.send_headers(headers) - - @stream.send_body(body, trailer) - else - # Ensure the response body is closed if we are ending the stream: - response.close - - @stream.send_headers(headers, ::Protocol::HTTP2::END_STREAM) - end - end - - # Write an interim (1xx) response to the client. - # @parameter status [Integer] The interim HTTP status code. - # @parameter headers [Hash | Nil] Optional interim response headers. - def write_interim_response(status, headers = nil) - interim_response_headers = [ - [STATUS, status] - ] - - if headers - interim_response_headers = ::Protocol::HTTP::Headers::Merged.new(interim_response_headers, headers) - end - - @stream.send_headers(interim_response_headers) - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/response.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/response.rb deleted file mode 100644 index 7941140..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/response.rb +++ /dev/null @@ -1,282 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2026, by Samuel Williams. - -require_relative "../response" -require_relative "stream" - -require "async/promise" - -module Async - module HTTP - module Protocol - module HTTP2 - # Typically used on the client side for writing a request and reading the incoming response. - class Response < Protocol::Response - # Represents the HTTP/2 stream associated with an outgoing client-side response. - class Stream < HTTP2::Stream - # Initialize the response stream. - def initialize(*) - super - - @response = Response.new(self) - - @ready = Async::Promise.new - end - - attr :response - - # Wait for the response headers and return the response body. - # @returns [Protocol::HTTP::Body::Readable | Nil] The response body. - def wait_for_input - response = @response - - # The input isn't ready until the response headers have been received: - response.wait - - # There is a possible race condition if you try to access @input - it might already be closed and nil. - return response.body - end - - # Handle a push promise stream from the server. - # @parameter promised_stream_id [Integer] The stream ID for the promised resource. - # @parameter headers [Array] The promise headers. - def accept_push_promise_stream(promised_stream_id, headers) - raise ProtocolError, "Cannot accept push promise stream!" - end - - # This should be invoked from the background reader, and notifies the task waiting for the headers that we are done. - def receive_initial_headers(headers, end_stream) - # While in theory, the response pseudo-headers may be extended in the future, currently they only response pseudo-header is :status, so we can assume it is always the first header. - status_header = headers.shift - - if status_header.first != ":status" - raise ProtocolError, "Invalid response headers: #{headers.inspect}" - end - - status = Integer(status_header.last) - - if status >= 100 && status < 200 - return receive_interim_headers(status, headers) - end - - @response.status = status - @headers = ::Protocol::HTTP::Headers.new - - # If the protocol request was successful, ensure the response protocol matches: - if status == 200 and protocol = @response.request.protocol - @response.protocol = Array(protocol).first - end - - headers.each do |key, value| - # It's guaranteed that this should be the first header: - if key == CONTENT_LENGTH - @length = Integer(value) - else - add_header(key, value) - end - end - - @response.headers = @headers - - if @response.valid? - if !end_stream - # We only construct the input/body if data is coming. - @response.body = prepare_input(@length) - elsif @response.head? - @response.body = ::Protocol::HTTP::Body::Head.new(@length) - end - else - send_reset_stream(::Protocol::HTTP2::Error::PROTOCOL_ERROR) - end - - @ready.resolve(nil) - - return headers - end - - # Process interim (1xx) response headers. - # @parameter status [Integer] The interim status code. - # @parameter headers [Array] The interim response headers. - def receive_interim_headers(status, headers) - if headers.any? - headers = ::Protocol::HTTP::Headers[headers] - else - headers = nil - end - - @response.request.send_interim_response(status, headers) - end - - # Wait for the headers to be received or for stream reset. - def wait - @ready.wait - rescue ::Protocol::HTTP2::StreamError => error - if error.code == ::Protocol::HTTP2::Error::INTERNAL_ERROR - raise ::Protocol::HTTP::RemoteError, error.message - end - - raise - end - - # Called when the stream is closed. - # @parameter error [Exception | Nil] The error that caused the close, if any. - def closed(error) - super - - if @response - @response = nil - end - - unless @ready.resolved? - error ||= EOFError.new("Stream closed before response headers were received!") - @ready.reject(error) - end - end - end - - # Initialize the response from an HTTP/2 stream. - # @parameter stream [Stream] The HTTP/2 stream for this response. - def initialize(stream) - super(stream.connection.version, nil, nil) - - @stream = stream - @request = nil - end - - attr :stream - attr :request - - # Assign the connection pool, releasing the connection when the stream is closed. - # @parameter pool [Async::Pool::Controller] The connection pool. - def pool=(pool) - # If we are already closed, the stream can be released now: - if @stream.closed? - pool.release(@stream.connection) - else - # Otherwise, we will release the stream when it is closed: - @stream.pool = pool - end - end - - # @returns [Connection] The underlying HTTP/2 connection. - def connection - @stream.connection - end - - # Wait for the response headers to be received. - def wait - @stream.wait - end - - # Close this response as quickly as possible. If the response body is still active, cancel the HTTP/2 exchange rather than draining it. - # @parameter error [Exception | Nil] The error which closed the response. - def close(error = nil) - if @body && !@stream.closed? - code = error ? ::Protocol::HTTP2::Error::INTERNAL_ERROR : ::Protocol::HTTP2::Error::CANCEL - @stream.send_reset_stream(code) - end - - super - end - - # @returns [Boolean] Whether the original request was a HEAD request. - def head? - @request&.head? - end - - # @returns [Boolean] Whether the response has a valid status. - def valid? - !!@status - end - - # Build a request object from push promise headers. - # @parameter headers [Array] The push promise pseudo-headers and headers. - # @returns [Protocol::HTTP::Request] The constructed request. - def build_request(headers) - request = ::Protocol::HTTP::Request.new - request.headers = ::Protocol::HTTP::Headers.new - - headers.each do |key, value| - if key == SCHEME - raise ::Protocol::HTTP2::HeaderError, "Request scheme already specified!" if request.scheme - - request.scheme = value - elsif key == AUTHORITY - raise ::Protocol::HTTP2::HeaderError, "Request authority already specified!" if request.authority - - request.authority = value - elsif key == METHOD - raise ::Protocol::HTTP2::HeaderError, "Request method already specified!" if request.method - - request.method = value - elsif key == PATH - raise ::Protocol::HTTP2::HeaderError, "Request path is empty!" if value.empty? - raise ::Protocol::HTTP2::HeaderError, "Request path already specified!" if request.path - - request.path = value - elsif key.start_with? ":" - raise ::Protocol::HTTP2::HeaderError, "Invalid pseudo-header #{key}!" - else - request.headers[key] = value - end - end - - @request = request - end - - # Send a request and read it into this response. - def send_request(request) - @request = request - - # https://http2.github.io/http2-spec/#rfc.section.8.1.2.3 - # All HTTP/2 requests MUST include exactly one valid value for the :method, :scheme, and :path pseudo-header fields, unless it is a CONNECT request (Section 8.3). An HTTP request that omits mandatory pseudo-header fields is malformed (Section 8.1.2.6). - pseudo_headers = [ - [SCHEME, request.scheme], - [METHOD, request.method], - ] - - if path = request.path - pseudo_headers << [PATH, path] - end - - # To ensure that the HTTP/1.1 request line can be reproduced accurately, this pseudo-header field MUST be omitted when translating from an HTTP/1.1 request that has a request target in origin or asterisk form (see [RFC7230], Section 5.3). Clients that generate HTTP/2 requests directly SHOULD use the :authority pseudo-header field instead of the Host header field. - if authority = request.authority - pseudo_headers << [AUTHORITY, authority] - end - - if protocol = request.protocol - pseudo_headers << [PROTOCOL, protocol] - end - - headers = ::Protocol::HTTP::Headers::Merged.new( - pseudo_headers, - request.headers.header - ) - - if request.body.nil? - @stream.send_headers(headers, ::Protocol::HTTP2::END_STREAM) - else - if length = request.body.length - # This puts it at the end of the pseudo-headers: - pseudo_headers << [CONTENT_LENGTH, length] - end - - # This function informs the headers object that any subsequent headers are going to be trailer. Therefore, it must be called *before* sending the headers, to avoid any race conditions. - trailer = request.headers.trailer! - - begin - @stream.send_headers(headers) - rescue - raise ::Protocol::HTTP::RefusedError - end - - @stream.send_body(request.body, trailer) - end - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/server.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/server.rb deleted file mode 100644 index dfc59c4..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/server.rb +++ /dev/null @@ -1,88 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2026, by Samuel Williams. - -require_relative "connection" -require_relative "request" - -require "async/barrier" -require "protocol/http2/server" - -module Async - module HTTP - module Protocol - module HTTP2 - # An HTTP/2 server connection that receives requests and sends responses. - class Server < ::Protocol::HTTP2::Server - include Connection - - # Initialize the HTTP/2 server with an IO stream. - # @parameter stream [IO::Stream] The underlying stream. - def initialize(stream) - # Used by some generic methods in Connetion: - @stream = stream - - framer = ::Protocol::HTTP2::Framer.new(stream) - - super(framer) - - @requests = Async::Queue.new - end - - attr :requests - - # Accept a new stream from a client. - # @parameter stream_id [Integer] The stream ID assigned by the client. - def accept_stream(stream_id) - super do - Request::Stream.create(self, stream_id) - end - end - - # Close the server connection and stop accepting requests. - def close(error = nil) - @requests.close - - super - end - - # Enumerate incoming requests, yielding each one for processing. - # @yields {|request| ...} Each incoming request. - # @parameter request [Request] The incoming HTTP/2 request. - def each(task: Task.current) - task.annotate("Reading #{version} requests for #{self.class}.") - barrier = Async::Barrier.new(parent: task) - - # It's possible the connection has died before we get here... - @requests.async(parent: barrier) do |task, request| - task.annotate("Incoming request: #{request.method} #{request.path.inspect}.") - - response = nil - - task.defer_stop do - response = yield(request) - rescue - # We need to close the stream if the user code blows up while generating a response: - request.stream.send_reset_stream(::Protocol::HTTP2::INTERNAL_ERROR) - - raise - else - request.send_response(response) - # If send response is successful, we clear it so that we don't close it below. - response = nil - ensure - # If some failure occurs and we didn't send the response correctly, ensure that it's closed: - response&.close - end - end - - barrier.wait - ensure - barrier&.stop - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/stream.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/stream.rb deleted file mode 100644 index 2ca4207..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/http2/stream.rb +++ /dev/null @@ -1,253 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2026, by Samuel Williams. -# Copyright, 2022, by Marco Concetto Rudilosso. -# Copyright, 2023, by Thomas Morgan. - -require "protocol/http2/stream" - -require_relative "input" -require_relative "output" - -module Async - module HTTP - module Protocol - module HTTP2 - # An HTTP/2 stream that manages headers, input data, and output data for a single request/response exchange. - class Stream < ::Protocol::HTTP2::Stream - # Initialize the stream state. - def initialize(*) - super - - @headers = nil - - @pool = nil - - # Input buffer, reading request body, or response body (receive_data): - @length = nil - @input = nil - - # The application can close its input before the peer finishes sending. HTTP/2 cannot close only the receiving side of a stream, so incoming data is discarded until local output also finishes. At that point, a no-error reset terminates the remaining wire stream. - @input_closed = false - - # Output buffer, writing request body or response body (window_updated): - @output = nil - end - - attr_accessor :headers - - attr_accessor :pool - - attr :input - - # Add a header to the stream, validating against HTTP/2 constraints. - # @parameter key [String] The header name. - # @parameter value [String] The header value. - def add_header(key, value, trailer: false) - if key == CONNECTION - raise ::Protocol::HTTP2::HeaderError, "Connection header is not allowed!" - elsif key.start_with? ":" - raise ::Protocol::HTTP2::HeaderError, "Invalid pseudo-header #{key}!" - elsif key =~ /[A-Z]/ - raise ::Protocol::HTTP2::HeaderError, "Invalid upper-case characters in header #{key}!" - else - @headers.add(key, value, trailer: trailer) - end - end - - # Process trailing headers received after the body. - # @parameter headers [Array] The trailing header key-value pairs. - # @parameter end_stream [Boolean] Whether the stream ends after these headers. - def receive_trailing_headers(headers, end_stream) - headers.each do |key, value| - add_header(key, value, trailer: true) - end - end - - # Process an incoming HEADERS frame, dispatching to initial or trailing header handling. - # @parameter frame [Protocol::HTTP2::HeadersFrame] The headers frame to process. - def process_headers(frame) - if @headers and frame.end_stream? - self.receive_trailing_headers(super, frame.end_stream?) - else - self.receive_initial_headers(super, frame.end_stream?) - end - - if @input and frame.end_stream? - @input.close_write - end - rescue ::Protocol::HTTP::InvalidTrailerError => error - Console.warn(self, error) - - send_reset_stream(::Protocol::HTTP2::Error::PROTOCOL_ERROR) - rescue ::Protocol::HTTP2::HeaderError => error - Console.debug(self, "Error while processing headers!", error) - - send_reset_stream(error.code) - end - - # @returns [Input | Nil] The input body for this stream, if available. - def wait_for_input - return @input - end - - # Prepare the input stream which will be used for incoming data frames. - # @return [Input] the input body. - def prepare_input(length) - if @input.nil? - @input = Input.new(self, length) - else - raise ArgumentError, "Input body already prepared!" - end - end - - # Update the local flow control window after receiving data. - # @parameter frame [Protocol::HTTP2::DataFrame] The received data frame. - def update_local_window(frame) - consume_local_window(frame) - - # This is done on demand in `Input#read`: - # request_window_update - end - - # Process an incoming DATA frame and write it to the input body. - # @parameter frame [Protocol::HTTP2::DataFrame] The data frame to process. - # @returns [String] The unpacked data. - def process_data(frame) - data = frame.unpack - - if input = @input - unless data.empty? - input.write(data) - end - - if frame.end_stream? - input.close_write - end - else - # The application has closed the input, so discard incoming data while maintaining flow control for the stream. - request_window_update - end - - return data - rescue ::Protocol::HTTP2::ProtocolError - raise - rescue # Anything else... - send_reset_stream(::Protocol::HTTP2::Error::INTERNAL_ERROR) - end - - # Close the application-facing receiving side of the stream. While local output remains active, incoming data is discarded with flow-control updates. Once local output is also closed, the remaining wire stream is terminated without an error. - # @parameter input [Input] The input body being closed. - # @parameter error [Exception | Nil] The error which closed the input. - def finish_input(input, error = nil) - if @input.equal?(input) - @input = nil - @input_closed = true - - if error - send_reset_stream(::Protocol::HTTP2::Error::INTERNAL_ERROR) - else - close_if_finished - end - end - end - - # Set the body and begin sending it. - def send_body(body, trailer = nil) - @output = Output.new(self, body, trailer) - - @output.start - end - - # Called when the output terminates normally. - def finish_output(error = nil) - return if self.closed? - - trailer = @output&.trailer - - @output = nil - - if error - send_reset_stream(::Protocol::HTTP2::Error::INTERNAL_ERROR) - else - # Write trailer? - if trailer&.any? - send_headers(trailer, ::Protocol::HTTP2::END_STREAM) - else - send_data(nil, ::Protocol::HTTP2::END_STREAM) - end - end - end - - # Called when the flow control window is updated. - # @parameter size [Integer] The new window size. - # @returns [Boolean] Always returns `true`. - def window_updated(size) - super - - @output&.window_updated(size) - - return true - end - - # Send headers and apply any pending application-side closure. - def send_headers(...) - result = super - close_if_finished - return result - end - - # Send data and apply any pending application-side closure. - def send_data(...) - result = super - close_if_finished - return result - end - - # When the stream transitions to the closed state, this method is called. There are roughly two ways this can happen: - # - A frame is received which causes this stream to enter the closed state. This method will be invoked from the background reader task. - # - A frame is sent which causes this stream to enter the closed state. This method will be invoked from that task. - # While the input stream is relatively straight forward, the output stream can trigger the second case above - def closed(error) - if error.is_a?(::Protocol::HTTP2::StreamError) && error.code == ::Protocol::HTTP2::Error::NO_ERROR - error = nil - end - - super - - if input = @input - @input = nil - input.close_write(error) - end - - if output = @output - @output = nil - - if error - output.stop(error) - else - output.close_stream - end - end - - if pool = @pool and @connection - pool.release(@connection) - end - - return self - end - - private - - # If both application-facing directions are closed but the peer has not finished, terminate the remaining wire stream without an error. - def close_if_finished - if @input_closed && @state == :half_closed_local - send_reset_stream(::Protocol::HTTP2::Error::NO_ERROR) - end - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/https.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/https.rb deleted file mode 100644 index 0e7c1e4..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/https.rb +++ /dev/null @@ -1,93 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2026, by Samuel Williams. -# Copyright, 2019, by Brian Morearty. - -require_relative "defaulton" - -require_relative "http10" -require_relative "http11" -require_relative "http2" - -module Async - module HTTP - module Protocol - # A server that supports both HTTP1.0 and HTTP1.1 semantics by detecting the version of the request. - class HTTPS - # The protocol classes for each supported protocol. - HANDLERS = { - "h2" => HTTP2, - "http/1.1" => HTTP11, - "http/1.0" => HTTP10, - nil => HTTP11, - } - - # Initialize the HTTPS protocol negotiator. - # @parameter handlers [Hash] A mapping of ALPN protocol names to protocol classes. - # @parameter options [Hash] Per-protocol options keyed by protocol class. - def initialize(handlers = HANDLERS, **options) - @handlers = handlers - @options = options - end - - # Register a protocol handler for a given ALPN protocol name. - # @parameter name [String] The ALPN protocol name. - # @parameter protocol [Class] The protocol class to handle connections. - # @parameter options [Hash] Options to pass when creating client or server instances. - def add(name, protocol, **options) - @handlers[name] = protocol - @options[protocol] = options - end - - # Determine the protocol of the peer and return the appropriate protocol class. - # - # Use TLS Application Layer Protocol Negotiation (ALPN) to determine the protocol. - # - # @parameter peer [IO] The peer to communicate with. - # @returns [Class] The protocol class to use. - def protocol_for(peer) - # alpn_protocol is only available if openssl v1.0.2+ - name = peer.alpn_protocol - - Console.debug(self){"Negotiating protocol #{name.inspect}..."} - - if protocol = HANDLERS[name] - return protocol - else - raise ArgumentError, "Could not determine protocol for connection (#{name.inspect})." - end - end - - # Create a client for an outbound connection. - # - # @parameter peer [IO] The peer to communicate with. - # @parameter options [Hash] Options to pass to the client instance. - def client(peer, **options) - protocol = protocol_for(peer) - options = options[protocol] || {} - - protocol.client(peer, **options) - end - - # Create a server for an inbound connection. - # - # @parameter peer [IO] The peer to communicate with. - # @parameter options [Hash] Options to pass to the server instance. - def server(peer, **options) - protocol = protocol_for(peer) - options = options[protocol] || {} - - protocol.server(peer, **options) - end - - # @returns [Array] The names of the supported protocol, used for Application Layer Protocol Negotiation (ALPN). - def names - @handlers.keys.compact - end - - extend Defaulton - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/request.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/request.rb deleted file mode 100644 index 94381c2..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/request.rb +++ /dev/null @@ -1,49 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2017-2026, by Samuel Williams. - -require "protocol/http/request" -require "protocol/http/headers" - -require_relative "../body/writable" - -module Async - module HTTP - module Protocol - # An incoming HTTP request generated by server protocol implementations. - class Request < ::Protocol::HTTP::Request - # @returns [Connection | Nil] The underlying protocol connection. - def connection - nil - end - - # @returns [Boolean] Whether this request supports connection hijacking. - def hijack? - false - end - - # Write an interim (1xx) response back to the client. - # @parameter status [Integer] The interim HTTP status code. - # @parameter headers [Hash | Nil] Optional headers to include. - def write_interim_response(status, headers = nil) - end - - # @returns [Protocol::HTTP::Peer | Nil] The peer associated with this connection. - def peer - self.connection&.peer - end - - # @returns [Addrinfo | Nil] The remote address of the peer. - def remote_address - self.peer&.address - end - - # @returns [String] A string representation of the request. - def inspect - "#<#{self.class}:0x#{self.object_id.to_s(16)} method=#{method} path=#{path} version=#{version}>" - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/response.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/response.rb deleted file mode 100644 index 4d35970..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/protocol/response.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2017-2026, by Samuel Williams. - -require "protocol/http/response" - -require_relative "../body/writable" - -module Async - module HTTP - module Protocol - # An HTTP response received from a server via client protocol implementations. - class Response < ::Protocol::HTTP::Response - # @returns [Connection | Nil] The underlying protocol connection. - def connection - nil - end - - # @returns [Boolean] Whether this response supports connection hijacking. - def hijack? - false - end - - # @returns [Protocol::HTTP::Peer | Nil] The peer associated with this connection. - def peer - self.connection&.peer - end - - # @returns [Addrinfo | Nil] The remote address of the peer. - def remote_address - self.peer&.remote_address - end - - # @returns [String] A string representation of the response. - def inspect - "#<#{self.class}:0x#{self.object_id.to_s(16)} status=#{status}>" - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/proxy.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/proxy.rb deleted file mode 100644 index 4f295f7..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/proxy.rb +++ /dev/null @@ -1,126 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2019-2026, by Samuel Williams. - -require_relative "client" -require_relative "endpoint" - -require_relative "body/pipe" - -module Async - module HTTP - # Wraps a client, address and headers required to initiate a connectio to a remote host using the CONNECT verb. - # Behaves like a TCP endpoint for the purposes of connecting to a remote host. - class Proxy - # Raised when a CONNECT tunnel through a proxy cannot be established. - class ConnectFailure < StandardError - # Initialize the failure with the unsuccessful response. - # @parameter response [Protocol::HTTP::Response] The failed response from the proxy. - def initialize(response) - super "Failed to connect: #{response.status}" - @response = response - end - - attr :response - end - - # Extends {Async::HTTP::Client} with proxy capabilities. - module Client - # Create a proxy instance for the given endpoint. - # @parameter endpoint [Endpoint] The target endpoint to tunnel to. - # @parameter headers [Hash | Nil] Optional headers to send with the CONNECT request. - # @returns [Proxy] A proxy instance for establishing tunnels. - def proxy(endpoint, headers = nil) - Proxy.new(self, endpoint.authority(false), headers) - end - - # Create a client that will proxy requests through the current client. - def proxied_client(endpoint, headers = nil) - proxy = self.proxy(endpoint, headers) - - return self.class.new(proxy.wrap_endpoint(endpoint)) - end - - # Create an endpoint that connects via this proxy. - # @parameter endpoint [Endpoint] The target endpoint. - # @parameter headers [Hash | Nil] Optional headers for the CONNECT request. - # @returns [Endpoint] An endpoint that tunnels through the proxy. - def proxied_endpoint(endpoint, headers = nil) - proxy = self.proxy(endpoint, headers) - - return proxy.wrap_endpoint(endpoint) - end - end - - # Prepare and endpoint which can establish a TCP connection to the remote system. - # @param client [Async::HTTP::Client] the client which will be used as a proxy server. - # @param host [String] the hostname or address to connect to. - # @param port [String] the port number to connect to. - # @param headers [Array] an optional list of headers to use when establishing the connection. - # @see IO::Endpoint#tcp - def self.tcp(client, host, port, headers = nil) - self.new(client, "#{host}:#{port}", headers) - end - - # Construct a endpoint that will use the given client as a proxy for HTTP requests. - # @param client [Async::HTTP::Client] the client which will be used as a proxy server. - # @param endpoint [Async::HTTP::Endpoint] the endpoint to connect to. - # @param headers [Array] an optional list of headers to use when establishing the connection. - def self.endpoint(client, endpoint, headers = nil) - proxy = self.new(client, endpoint.authority(false), headers) - - return proxy.endpoint(endpoint.url) - end - - # @param client [Async::HTTP::Client] the client which will be used as a proxy server. - # @param address [String] the address to connect to. - # @param headers [Array] an optional list of headers to use when establishing the connection. - def initialize(client, address, headers = nil) - @client = client - @address = address - @headers = ::Protocol::HTTP::Headers[headers].freeze - end - - attr :client - - # Close the underlying client connection. - def close - @client.close - end - - # Establish a TCP connection to the specified host. - # @return [Socket] a connected bi-directional socket. - def connect(&block) - input = Body::Writable.new - - response = @client.connect(authority: @address, headers: @headers, body: input) - - if response.success? - pipe = Body::Pipe.new(response.body, input) - - return pipe.to_io unless block_given? - - begin - yield pipe.to_io - ensure - pipe.close - end - else - # This ensures we don't leave a response dangling: - input.close - response.close - - raise ConnectFailure, response - end - end - - # @return [Async::HTTP::Endpoint] an endpoint that connects via the specified proxy. - def wrap_endpoint(endpoint) - Endpoint.new(endpoint.url, self, **endpoint.options) - end - end - - Client.prepend(Proxy::Client) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/relative_location.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/relative_location.rb deleted file mode 100644 index 42ce9e8..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/relative_location.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2024, by Samuel Williams. -# Copyright, 2019-2020, by Brian Morearty. - -require_relative "middleware/location_redirector" - -warn "`Async::HTTP::RelativeLocation` is deprecated and will be removed in the next release. Please use `Async::HTTP::Middleware::LocationRedirector` instead.", uplevel: 1 - -module Async - module HTTP - module Middleware - RelativeLocation = Middleware::LocationRedirector - TooManyRedirects = RelativeLocation::TooManyRedirects - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/server.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/server.rb deleted file mode 100755 index 12a44f0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/server.rb +++ /dev/null @@ -1,90 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2017-2026, by Samuel Williams. -# Copyright, 2019, by Brian Morearty. - -require "async" -require "io/endpoint" -require "protocol/http/middleware" - -require_relative "protocol" - -module Async - module HTTP - # An HTTP server that accepts connections on a specific endpoint and dispatches requests to an application handler. - class Server < ::Protocol::HTTP::Middleware - # Create a server using a block as the application handler. - # @parameter arguments [Array] Arguments to pass to {initialize}. - # @parameter options [Hash] Options to pass to {initialize}. - def self.for(*arguments, **options, &block) - self.new(block, *arguments, **options) - end - - # Initialize the server with an application handler and endpoint. - # @parameter app [Protocol::HTTP::Middleware] The Rack-compatible application to serve. - # @parameter endpoint [Endpoint] The endpoint to bind to. - # @parameter protocol [Protocol] The protocol to use for incoming connections. - # @parameter scheme [String] The default scheme to set on requests. - def initialize(app, endpoint, protocol: endpoint.protocol, scheme: endpoint.scheme) - super(app) - - @endpoint = endpoint - @protocol = protocol - @scheme = scheme - end - - # @returns [Hash] A JSON-compatible representation of this server. - def as_json(...) - { - endpoint: @endpoint.to_s, - protocol: @protocol, - scheme: @scheme, - } - end - - # @returns [String] A JSON string representation of this server. - def to_json(...) - as_json.to_json(...) - end - - attr :endpoint - attr :protocol - attr :scheme - - # Accept an incoming connection and process requests. - # @parameter peer [IO] The connected peer. - # @parameter address [Addrinfo] The remote address of the peer. - def accept(peer, address, task: Task.current) - connection = @protocol.server(peer) - - Console.debug(self){"Incoming connnection from #{address.inspect} to #{@protocol}"} - - connection.each do |request| - # We set the default scheme unless it was otherwise specified. - # https://tools.ietf.org/html/rfc7230#section-5.5 - request.scheme ||= self.scheme - - # Console.debug(self) {"Incoming request from #{address.inspect}: #{request.method} #{request.path}"} - - # If this returns nil, we assume that the connection has been hijacked. - self.call(request) - end - rescue ::Protocol::HTTP::BadRequest - # Ignore bad requests, just close the connection. - ensure - connection&.close - end - - # @returns [Async::Task] The task that is running the server. - def run - Async do |task| - @endpoint.accept(&self.method(:accept)) - - # Wait for all children to finish: - task.children.each(&:wait) - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/statistics.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/statistics.rb deleted file mode 100644 index 6293a0f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/statistics.rb +++ /dev/null @@ -1,136 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2018-2026, by Samuel Williams. - -require "protocol/http/body/wrapper" - -require "async/clock" - -module Async - module HTTP - # Tracks response timing statistics including time to first byte and total duration. - class Statistics - # Start tracking statistics from the current time. - # @returns [Statistics] A new statistics instance. - def self.start - self.new(Clock.now) - end - - # Initialize the statistics tracker. - # @parameter start_time [Float] The start time for measuring durations. - def initialize(start_time) - @start_time = start_time - end - - # Wrap a response body with a statistics-collecting wrapper. - # @parameter response [Protocol::HTTP::Response] The response to wrap. - # @returns [Protocol::HTTP::Response] The wrapped response. - def wrap(response, &block) - if response and response.body - response.body = Body::Statistics.new(@start_time, response.body, block) - end - - return response - end - end - - module Body - # Invokes a callback once the body has finished reading. - class Statistics < ::Protocol::HTTP::Body::Wrapper - # Initialize the statistics body wrapper. - # @parameter start_time [Float] The start time for measuring durations. - # @parameter body [Protocol::HTTP::Body::Readable] The body to wrap. - # @parameter callback [Proc] A callback to invoke when the body is closed. - def initialize(start_time, body, callback) - super(body) - - @sent = 0 - - @start_time = start_time - @first_chunk_time = nil - @end_time = nil - - @callback = callback - end - - attr :start_time - attr :first_chunk_time - attr :end_time - - attr :sent - - # @returns [Float | Nil] The total duration from start to close, in seconds. - def total_duration - if @end_time - @end_time - @start_time - end - end - - # @returns [Float | Nil] The duration from start until the first chunk was read, in seconds. - def first_chunk_duration - if @first_chunk_time - @first_chunk_time - @start_time - end - end - - # Close the body and record the end time. - def close(error = nil) - complete_statistics(error) - - super - end - - # Read the next chunk from the body, tracking timing and bytes sent. - # @returns [String | Nil] The next chunk of data. - def read - chunk = super - - @first_chunk_time ||= Clock.now - - if chunk - @sent += chunk.bytesize - end - - return chunk - end - - # @returns [String] A human-readable summary of the statistics. - def to_s - parts = ["sent #{@sent} bytes"] - - if duration = self.total_duration - parts << "took #{format_duration(duration)} in total" - end - - if duration = self.first_chunk_duration - parts << "took #{format_duration(duration)} until first chunk" - end - - return parts.join("; ") - end - - # @returns [String] A detailed representation including the wrapped body. - def inspect - "#{super} | \#<#{self.class} #{self.to_s}>" - end - - private - - def complete_statistics(error = nil) - @end_time = Clock.now - - @callback.call(self, error) if @callback - end - - def format_duration(seconds) - if seconds < 1.0 - return "#{(seconds * 1000.0).round(2)}ms" - else - return "#{seconds.round(1)}s" - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/version.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/version.rb deleted file mode 100644 index f32685b..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/async/http/version.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2017-2026, by Samuel Williams. - -# @namespace -module Async - # @namespace - module HTTP - VERSION = "0.105.0" - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/metrics/provider/async/http.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/metrics/provider/async/http.rb deleted file mode 100644 index 53c4cb9..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/metrics/provider/async/http.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025, by Samuel Williams. - -require_relative "http/client" -require_relative "http/server" diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/metrics/provider/async/http/client.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/metrics/provider/async/http/client.rb deleted file mode 100644 index 3931c36..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/metrics/provider/async/http/client.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025, by Samuel Williams. - -require_relative "../../../../async/http/client" -require "metrics/provider" - -Metrics::Provider(Async::HTTP::Client) do - ASYNC_HTTP_CLIENT_REQUEST_INITIATED = Metrics.metric("async.http.client.request.initiated", :counter, description: "The number of HTTP client requests initiated.") - ASYNC_HTTP_CLIENT_REQUEST_FINISHED = Metrics.metric("async.http.client.request.finished", :counter, description: "The number of HTTP client requests finished.") - - def make_response(request, connection, attempt) - ASYNC_HTTP_CLIENT_REQUEST_INITIATED.emit(1, tags: ["method:#{request.method}"]) - - response = super(request, connection, attempt) - - ASYNC_HTTP_CLIENT_REQUEST_FINISHED.emit(1, tags: ["method:#{request.method}", "status:#{response.status}"]) - - return response - ensure - unless response - ASYNC_HTTP_CLIENT_REQUEST_FINISHED.emit(1, tags: ["method:#{request.method}", "status:failed"]) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/metrics/provider/async/http/server.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/metrics/provider/async/http/server.rb deleted file mode 100644 index 36aefff..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/metrics/provider/async/http/server.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025, by Samuel Williams. - -require_relative "../../../../async/http/server" -require "metrics/provider" - -Metrics::Provider(Async::HTTP::Server) do - ASYNC_HTTP_SERVER_REQUEST_INITIATED = Metrics.metric("async.http.server.request.initiated", :counter, description: "The number of HTTP server requests initiated.") - ASYNC_HTTP_SERVER_REQUEST_FINISHED = Metrics.metric("async.http.server.request.finished", :counter, description: "The number of HTTP server requests finished.") - - def call(request) - ASYNC_HTTP_SERVER_REQUEST_INITIATED.emit(1, tags: ["method:#{request.method}"]) - - if response = super(request) - ASYNC_HTTP_SERVER_REQUEST_FINISHED.emit(1, tags: ["method:#{request.method}", "status:#{response.status}"]) - return response - else - return nil - end - ensure - unless response - ASYNC_HTTP_SERVER_REQUEST_FINISHED.emit(1, tags: ["method:#{request.method}", "status:failed"]) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/traces/provider/async/http.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/traces/provider/async/http.rb deleted file mode 100644 index 53c4cb9..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/traces/provider/async/http.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025, by Samuel Williams. - -require_relative "http/client" -require_relative "http/server" diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/traces/provider/async/http/client.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/traces/provider/async/http/client.rb deleted file mode 100644 index 4a83e37..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/traces/provider/async/http/client.rb +++ /dev/null @@ -1,57 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025-2026, by Samuel Williams. - -require_relative "../../../../async/http/client" -require "traces/provider" - -Traces::Provider(Async::HTTP::Client) do - def call(request) - attributes = { - 'http.method': request.method, - 'http.authority': request.authority || self.authority, - 'http.scheme': request.scheme || self.scheme, - 'http.path': request.path, - } - - if protocol = request.protocol - attributes["http.protocol"] = protocol - end - - if length = request.body&.length - attributes["http.request.length"] = length - end - - Traces.trace("async.http.client.call", attributes: attributes) do |span| - if context = Traces.trace_context - request.headers["traceparent"] = context.to_s - # request.headers['tracestate'] = context.state - end - - super.tap do |response| - if version = response&.version - span["http.version"] = version - end - - if status = response&.status - span["http.status_code"] = status - end - - if length = response.body&.length - span["http.response.length"] = length - end - end - end - end - - def make_response(request, connection, attempt) - attributes = { - attempt: attempt, - } - - Traces.trace("async.http.client.make_response", attributes: attributes) do - super - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/traces/provider/async/http/protocol/http1/client.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/traces/provider/async/http/protocol/http1/client.rb deleted file mode 100644 index 4e76d02..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/traces/provider/async/http/protocol/http1/client.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025-2026, by Samuel Williams. - -require_relative "../../../../../../async/http/protocol/http1/client" -require "traces/provider" - -Traces::Provider(Async::HTTP::Protocol::HTTP1::Client) do - def write_request(...) - Traces.trace("async.http.protocol.http1.client.write_request") do - super - end - end - - def read_response(...) - Traces.trace("async.http.protocol.http1.client.read_response") do - super - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/traces/provider/async/http/protocol/http2/client.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/traces/provider/async/http/protocol/http2/client.rb deleted file mode 100644 index 5020cf5..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/traces/provider/async/http/protocol/http2/client.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025-2026, by Samuel Williams. - -require_relative "../../../../../../async/http/protocol/http2/client" -require "traces/provider" - -Traces::Provider(Async::HTTP::Protocol::HTTP2::Client) do - def write_request(...) - Traces.trace("async.http.protocol.http2.client.write_request") do - super - end - end - - def read_response(...) - Traces.trace("async.http.protocol.http2.client.read_response") do - super - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/traces/provider/async/http/server.rb b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/traces/provider/async/http/server.rb deleted file mode 100644 index b4735a0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/lib/traces/provider/async/http/server.rb +++ /dev/null @@ -1,44 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025-2026, by Samuel Williams. - -require_relative "../../../../async/http/server" -require "traces/provider" - -Traces::Provider(Async::HTTP::Server) do - def call(request) - if trace_parent = request.headers["traceparent"] - Traces.trace_context = Traces::Context.parse(trace_parent.join, request.headers["tracestate"], remote: true) - end - - attributes = { - 'http.version': request.version, - 'http.method': request.method, - 'http.authority': request.authority, - 'http.scheme': request.scheme, - 'http.path': request.path, - 'http.user_agent': request.headers["user-agent"], - } - - if length = request.body&.length - attributes["http.request.length"] = length - end - - if protocol = request.protocol - attributes["http.protocol"] = protocol - end - - Traces.trace("async.http.server.call", attributes: attributes) do |span| - super.tap do |response| - if status = response&.status - span["http.status_code"] = status - end - - if length = response&.body&.length - span["http.response.length"] = length - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/license.md b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/license.md deleted file mode 100644 index 5fc6a89..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/license.md +++ /dev/null @@ -1,46 +0,0 @@ -# MIT License - -Copyright, 2017-2026, by Samuel Williams. -Copyright, 2018, by Viacheslav Koval. -Copyright, 2018, by Janko Marohnić. -Copyright, 2019-2026, by Denis Talakevich. -Copyright, 2019-2020, by Brian Morearty. -Copyright, 2019, by Cyril Roelandt. -Copyright, 2020, by Stefan Wrobel. -Copyright, 2020-2024, by Igor Sidorov. -Copyright, 2020, by Bruno Sutic. -Copyright, 2020, by Sam Shadwell. -Copyright, 2020, by Orgad Shaneh. -Copyright, 2021, by Trevor Turk. -Copyright, 2021, by Olle Jonsson. -Copyright, 2021-2022, by Adam Daniels. -Copyright, 2022, by Ian Ker-Seymer. -Copyright, 2022, by Marco Concetto Rudilosso. -Copyright, 2022, by Tim Meusel. -Copyright, 2023-2024, by Thomas Morgan. -Copyright, 2023, by dependabot[bot]. -Copyright, 2023, by Josh Huber. -Copyright, 2024, by Anton Zhuravsky. -Copyright, 2024, by Hal Brodigan. -Copyright, 2025, by Jean Boussier. -Copyright, 2025, by Yuuji Yaginuma. -Copyright, 2025, by William T. Nelson. -Copyright, 2026, by Jun Jiang. - -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/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/readme.md b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/readme.md deleted file mode 100644 index 06dba05..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/readme.md +++ /dev/null @@ -1,104 +0,0 @@ -# Async::HTTP - -An asynchronous client and server implementation of HTTP/1.0, HTTP/1.1 and HTTP/2 including TLS. Support for streaming requests and responses. Built on top of [async](https://github.com/socketry/async), [io-endpoint](https://github.com/socketry/io-endpoint) and [io-stream](https://github.com/socketry/io-stream). [falcon](https://github.com/socketry/falcon) provides a rack-compatible server. - -[![Development Status](https://github.com/socketry/async-http/workflows/Test/badge.svg)](https://github.com/socketry/async-http/actions?workflow=Test) - -## Usage - -Please see the [project documentation](https://socketry.github.io/async-http/) for more details. - - - [Getting Started](https://socketry.github.io/async-http/guides/getting-started/index) - This guide explains how to make HTTP requests and serve HTTP responses with `Async::HTTP`. - - - [Choosing a Client](https://socketry.github.io/async-http/guides/choosing-a-client/index) - This guide explains how to choose between ruby:`Async::HTTP::Internet`, ruby:`Async::HTTP::Client`, and higher-level interfaces for libraries. - - - [Concurrent Requests and Connection Pooling](https://socketry.github.io/async-http/guides/concurrent-requests/index) - This guide explains how to run HTTP requests concurrently while keeping request fan-out, connection usage, and resource life cycles bounded. - - - [Testing](https://socketry.github.io/async-http/guides/testing/index) - This guide explains how to test `Async::HTTP` clients and servers without depending on external HTTP services. - -## Releases - -Please see the [project releases](https://socketry.github.io/async-http/releases/index) for all releases. - -### v0.105.0 - - - Respond with `400 Bad Request` for any `Protocol::HTTP::BadRequest` raised while parsing HTTP/1 or HTTP/2 requests, include the exception class name without reflecting request data, and avoid reporting them as unhandled server errors. - -### v0.103.0 - - - Handle `RST_STREAM(NO_ERROR)` as an orderly HTTP/2 stream closure while still failing requests whose streams close before any response headers are received. - -### v0.102.0 - - - Requests assigned to an HTTP/2 connection which has already closed are refused before being written, allowing them to be retried safely. - - HTTP/2 connections which received a graceful `GOAWAY` are removed from availability immediately, but remain in the pool until the server has finished answering the streams it accepted. The connection is closed after its final user releases it, so those requests no longer fail with `EOFError: Connection closed with N active stream(s)!`. - -### v0.101.0 - - - Handle remote disconnects in `Async::HTTP::Protocol::HTTP1::Server#each` without reporting them as server failures. - -### v0.100.0 - - - Added transport-neutral TLS configuration support to `Async::HTTP::Endpoint`. - -### v0.99.0 - - - Retry safe requests when a remote HTTP/2 endpoint resets the stream with `INTERNAL_ERROR` before returning a response. - -### v0.98.1 - - - Probe idle HTTP/1 connections before reuse, avoiding requests on connections already closed by the peer. - -### v0.98.0 - - - Rewind request bodies before retrying requests. - -### v0.97.0 - - - Exposed all supported protocol names from the plaintext HTTP protocol negotiator. - -### v0.96.0 - - - Made `metrics` and `traces` optional runtime dependencies. Applications that use the providers should depend on the corresponding gem and require the provider explicitly. - -## See Also - - - [benchmark-http](https://github.com/socketry/benchmark-http) — A benchmarking tool to report on web server concurrency. - - [falcon](https://github.com/socketry/falcon) — A rack compatible server built on top of `async-http`. - - [async-websocket](https://github.com/socketry/async-websocket) — Asynchronous client and server websockets. - - [async-rest](https://github.com/socketry/async-rest) — A RESTful resource layer built on top of `async-http`. - - [async-http-faraday](https://github.com/socketry/async-http-faraday) — A faraday adapter to use `async-http`. - -## Contributing - -We welcome contributions to this project. - -1. Fork the repository. -2. Create your feature branch (`git checkout -b my-new-feature`). -3. Commit your changes (`git commit -am 'Add some feature.'`). -4. Push to the branch (`git push origin my-new-feature`). -5. Create a new pull request. - -### Running Tests - -To run the test suite: - -``` bash -$ bundle exec sus -``` - -### Making Releases - -To make a new release: - -``` bash -$ bundle exec bake gem:release:patch # or minor or major -``` - -### Developer Certificate of Origin - -In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed. - -### Community Guidelines - -This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers. diff --git a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/releases.md b/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/releases.md deleted file mode 100644 index f56fb22..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-http-0.105.0/releases.md +++ /dev/null @@ -1,243 +0,0 @@ -# Releases - -## v0.105.0 - - - Respond with `400 Bad Request` for any `Protocol::HTTP::BadRequest` raised while parsing HTTP/1 or HTTP/2 requests, include the exception class name without reflecting request data, and avoid reporting them as unhandled server errors. - -## v0.103.0 - - - Handle `RST_STREAM(NO_ERROR)` as an orderly HTTP/2 stream closure while still failing requests whose streams close before any response headers are received. - -## v0.102.0 - - - Requests assigned to an HTTP/2 connection which has already closed are refused before being written, allowing them to be retried safely. - - HTTP/2 connections which received a graceful `GOAWAY` are removed from availability immediately, but remain in the pool until the server has finished answering the streams it accepted. The connection is closed after its final user releases it, so those requests no longer fail with `EOFError: Connection closed with N active stream(s)!`. - -## v0.101.0 - - - Handle remote disconnects in `Async::HTTP::Protocol::HTTP1::Server#each` without reporting them as server failures. - -## v0.100.0 - - - Added transport-neutral TLS configuration support to `Async::HTTP::Endpoint`. - -## v0.99.0 - - - Retry safe requests when a remote HTTP/2 endpoint resets the stream with `INTERNAL_ERROR` before returning a response. - -## v0.98.1 - - - Probe idle HTTP/1 connections before reuse, avoiding requests on connections already closed by the peer. - -## v0.98.0 - - - Rewind request bodies before retrying requests. - -## v0.97.0 - - - Exposed all supported protocol names from the plaintext HTTP protocol negotiator. - -## v0.96.0 - - - Made `metrics` and `traces` optional runtime dependencies. Applications that use the providers should depend on the corresponding gem and require the provider explicitly. - -## v0.95.1 - - - Fix handling of reset stream causing complete connection failure. - -## v0.95.0 - - - Use `Protocol::HTTP::RefusedError` for safe retry of requests not processed by the server, including non-idempotent methods like PUT. - - Remove `Async::HTTP::Protocol::RequestFailed` in favour of `Protocol::HTTP::RefusedError`. - - HTTP/1: Delegate request write failure handling to `protocol-http1`. - - HTTP/2: Handle GOAWAY and REFUSED\_STREAM via `protocol-http2`, enabling automatic retry of unprocessed requests. - -## v0.94.3 - - - Fix response body leak in HTTP/2 server when stream is reset before `send_response` completes (e.g. client-side gRPC cancellation). The response body's `close` was never called, leaking any resources tied to body lifecycle (such as `rack.response_finished` callbacks and utilization metrics). - -## v0.94.1 - - - Fix `defer_stop` usage in `HTTP1::Server`, improving server graceful shutdown behavior. - -## v0.94.0 - - - Propagate all errors from background reader to active streams so that they are closed correctly (e.g. errors are not missed). - -## v0.92.2 - - - Better handling of trailers. If invalid trailers are received, the connection (HTTP/1) or stream (HTTP/2) is reset. - -## v0.92.0 - - - **Breaking**: Remove `Async::HTTP::Reference`. Use `Protocol::URL::Reference` directly instead. - -## v0.91.0 - - - Move all default trace providers into `traces/provider/async/http`. - -## v0.90.2 - - - Don't emit `resource:` keyword argument in traces - it's unsupported by OpenTelemetry. - -## v0.88.0 - -### Support custom protocols with options - -{ruby Async::HTTP::Protocol} contains classes for specific protocols, e.g. {ruby Async::HTTP::Protocol::HTTP1} and {ruby Async::HTTP::Protocol::HTTP2}. It also contains classes for aggregating protocols, e.g. {ruby Async::HTTP::Protocol::HTTP} and {ruby Async::HTTP::Protocol::HTTPS}. They serve as factories for creating client and server instances. - -These classes are now configurable with various options, which are passed as keyword arguments to the relevant connection classes. For example, to configure an HTTP/1.1 protocol without keep-alive: - -``` ruby -protocol = Async::HTTP::Protocol::HTTP1.new(persistent: false, maximum_line_length: 32) -endpoint = Async::HTTP::Endpoint.parse("http://localhost:9292", protocol: protocol) -server = Async::HTTP::Server.for(endpoint) do |request| - Protocol::HTTP::Response[200, {}, ["Hello, world"]] -end.run -``` - -Making a request to the server will now close the connection after the response is received: - - > curl -v http://localhost:9292 - * Host localhost:9292 was resolved. - * IPv6: ::1 - * IPv4: 127.0.0.1 - * Trying [::1]:9292... - * Connected to localhost (::1) port 9292 - * using HTTP/1.x - > GET / HTTP/1.1 - > Host: localhost:9292 - > User-Agent: curl/8.12.1 - > Accept: */* - > - * Request completely sent off - < HTTP/1.1 200 OK - < connection: close - < content-length: 12 - < - * shutting down connection #0 - Hello, world - -In addition, any line longer than 32 bytes will be rejected: - - curl -v http://localhost:9292/012345678901234567890123456789012 - * Host localhost:9292 was resolved. - * IPv6: ::1 - * IPv4: 127.0.0.1 - * Trying [::1]:9292... - * Connected to localhost (::1) port 9292 - * using HTTP/1.x - > GET /012345678901234567890123456789012 HTTP/1.1 - > Host: localhost:9292 - > User-Agent: curl/8.12.1 - > Accept: */* - > - * Request completely sent off - * Empty reply from server - * shutting down connection #0 - curl: (52) Empty reply from server - -## v0.87.0 - -### Unify HTTP/1 and HTTP/2 `CONNECT` semantics - -HTTP/1 has a request line "target" which takes different forms depending on the kind of request. For `CONNECT` requests, the target is the authority (host and port) of the target server, e.g. - - CONNECT example.com:443 HTTP/1.1 - -In HTTP/2, the `CONNECT` method uses the `:authority` pseudo-header to specify the target, e.g. - -``` http -[HEADERS FRAME] -:method: connect -:authority: example.com:443 -``` - -In HTTP/1, the `Request#path` attribute was previously used to store the target, and this was incorrectly mapped to the `:path` pseudo-header in HTTP/2. This has been corrected, and the `Request#authority` attribute is now used to store the target for both HTTP/1 and HTTP/2, and mapped accordingly. Thus, to make a `CONNECT` request, you should set the `Request#authority` attribute, e.g. - -``` ruby -response = client.connect(authority: "example.com:443") -``` - -For HTTP/1, the authority is mapped back to the request line target, and for HTTP/2, it is mapped to the `:authority` pseudo-header. - -## v0.86.0 - - - Add support for HTTP/2 `NO_RFC7540_PRIORITIES`. See for more details. - -## v0.84.0 - - - Minor consistency fixes to `Async::HTTP::Internet` singleton methods. - -## v0.82.0 - - - `protocol-http1` introduces a line length limit for request line, response line, header lines and chunk length lines. - -## v0.81.0 - - - Expose `protocol` and `endpoint` as tags to `async-pool` for improved instrumentation. - -## v0.77.0 - - - Improved HTTP/1 connection handling. - - The input stream is no longer closed when the output stream is closed. - -## v0.76.0 - - - `Async::HTTP::Body::Writable` is moved to `Protocol::HTTP::Body::Writable`. - - Remove `Async::HTTP::Body::Delayed` with no replacement. - - Remove `Async::HTTP::Body::Slowloris` with no replacement. - -## v0.75.0 - - - Better handling of HTTP/1 \<-\> HTTP/2 proxying, specifically upgrade/CONNECT requests. - -## v0.74.0 - -### `Async::HTTP::Internet` accepts keyword arguments - -`Async::HTTP::Internet` now accepts keyword arguments for making a request, e.g. - -``` ruby -internet = Async::HTTP::Internet.instance - -# This will let you override the authority (HTTP/1.1 host header, HTTP/2 :authority header): -internet.get("https://proxy.local", authority: "example.com") - -# This will let you override the scheme: -internet.get("https://example.com", scheme: "http") -``` - -## v0.73.0 - -### Update support for `interim_response` - -`Protocol::HTTP::Request` now supports an `interim_response` callback, which will be called with the interim response status and headers. This works on both the client and the server: - -``` ruby -# Server side: -def call(request) - if request.headers["expect"].include?("100-continue") - request.send_interim_response(100) - end - - # ... -end - -# Client side: -body = Async::HTTP::Body::Writable.new - -interim_repsonse = proc do |status, headers| - if status == 100 - # Continue sending the body... - body.write("Hello, world!") - body.close - end -end - -Async::HTTP::Internet.instance.post("https://example.com", body, interim_response: interim_response) do |response| - unless response.success? - body.close - end -end -``` diff --git a/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/lib/async/pool.rb b/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/lib/async/pool.rb deleted file mode 100644 index 029eabb..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/lib/async/pool.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2019-2024, by Samuel Williams. - -require_relative "pool/version" -require_relative "pool/controller" - -# @namespace -module Async - # @namespace - module Pool - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/lib/async/pool/controller.rb b/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/lib/async/pool/controller.rb deleted file mode 100644 index 3fb1b24..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/lib/async/pool/controller.rb +++ /dev/null @@ -1,401 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2019-2026, by Samuel Williams. -# Copyright, 2020, by Simon Perepelitsa. -# Copyright, 2024, by Thomas Morgan. -# Copyright, 2025, by Jean Boussier. -# Copyright, 2026, by William T. Nelson. - -require "console/logger" - -require "async" -require "async/semaphore" - -require "set" -require "thread" - -module Async - module Pool - # A resource pool controller. - class Controller - # Create a new resource pool, using the given block to create new resources. - def self.wrap(**options, &block) - self.new(block, **options) - end - - # Create a new resource pool. - # - # @parameter constructor [Proc] A block which creates a new resource. - # @parameter limit [Integer | Nil] The maximum number of resources that this pool can have at any given time. If nil, the pool can have an unlimited number of resources. - # @parameter concurrency [Integer] The maximum number of concurrent tasks that can be creating a new resource. Defaults to 1 to ensure the pool limit is enforced. Higher values may result in more resources being created than the limit under high load. - # @parameter policy [Policy] The pool policy. - def initialize(constructor, limit: nil, concurrency: 1, policy: nil, tags: nil) - @constructor = constructor - @limit = limit - - # This semaphore is used to limit the number of concurrent tasks which are creating new resources. - @guard = Async::Semaphore.new(concurrency) - - @policy = policy - @gardener = nil - - @tags = tags - - # All allocated resources. Each resource is tracked by identity, irrespective of any value equality it may define: - @resources = {}.compare_by_identity - - # Resources which may be available to be acquired. Resources are compared by identity and acquired in insertion order. Adding an existing resource preserves its position; a fully utilized resource is removed and reinserted at the end when capacity becomes available again. - # This set may contain false positives, or resources which were okay but have since entered a state which is unusable. - @available = Set.new.compare_by_identity - - # Used to signal when a resource has been released: - @mutex = Thread::Mutex.new - @condition = Thread::ConditionVariable.new - end - - # @attribute [Proc] The constructor used to create new resources. - attr :constructor - - # @attribute [Integer] The maximum number of resources that this pool can have at any given time. - attr_accessor :limit - - # Generate a human-readable representation of the pool. - def to_s - if @resources.empty? - "\#<#{self.class}(#{usage_string})>" - else - "\#<#{self.class}(#{usage_string}) #{availability_summary.join(';')}>" - end - end - - # Generate a JSON representation of the pool. - def as_json(...) - { - limit: @limit, - concurrency: @guard.limit, - usage: @resources.size, - availability_summary: self.availability_summary, - } - end - - # Generate a JSON representation of the pool. - def to_json(...) - as_json.to_json(...) - end - - # @attribute [Integer] The maximum number of concurrent tasks that can be creating a new resource. - def concurrency - @guard.limit - end - - # Set the maximum number of concurrent tasks that can be creating a new resource. - def concurrency= value - @guard.limit = value - end - - # @attribute [Policy] The pool policy. - attr_accessor :policy - - # @attribute [Hash(Resource, Integer)] all allocated resources, and their associated usage. - attr :resources - - # @attribute [Array(String)] The name of the pool. - attr_accessor :tags - - # The number of resources in the pool. - def size - @resources.size - end - - # Whether the pool has any active resources. - def active? - !@resources.empty? - end - - # Whether there are resources which are currently in use. - def busy? - @resources.collect do |_, usage| - return true if usage > 0 - end - - return false - end - - # Whether there are available resources, i.e. whether {#acquire} can reuse an existing resource. - def available? - @available.any? - end - - # Wait until a pool resource has been freed. - # @deprecated Use {wait_until_free} instead. - def wait - @mutex.synchronize do - @condition.wait(@mutex) - end - end - - # Wait until the pool is not busy (no resources in use). - def wait_until_free - @mutex.synchronize do - if busy? - yield self if block_given? - - # Wait until the pool is not busy: - @condition.wait(@mutex) while busy? - end - end - end - - # Whether the pool is empty. - def empty? - @resources.empty? - end - - # Acquire a resource from the pool. If a block is provided, the resource will be released after the block has been executed. - def acquire - resource = wait_for_resource - - return resource unless block_given? - - begin - yield resource - ensure - release(resource) - end - end - - # Make the resource resources and let waiting tasks know that there is something resources. - def release(resource) - unless usage = decrement_usage(resource) - return false - end - - if resource.reusable? - @available.add(resource) - else - # The resource must not be acquired again, but it cannot be retired until all existing users have released it: - @available.delete(resource) - - if usage.zero? - retire(resource) - resource = nil - return true - end - end - - @mutex.synchronize{@condition.broadcast} - - # @policy.released(self, resource) - - resource = nil - return true - ensure - retire(resource) if resource - end - - # Drain the pool, closing all resources. - def drain - Console.debug(self, "Draining pool...", size: @resources.size) - - # Enumerate all existing resources and retire them: - while resource = acquire_existing_resource - retire(resource) - end - end - - # Drain the pool, clear all resources, and stop the gardener. - def close - self.drain - - @available.clear - @gardener&.stop - end - - # Retire (and close) all unused resources. If a block is provided, it should implement the desired functionality for unused resources. - # @parameter retain [Integer] the minimum number of resources to retain. - # @yields {|resource| ...} Any unused resource. - def prune(retain = 0) - unused = [] - - # This code must not context switch: - @resources.each do |resource, usage| - if usage.zero? - unused << resource - end - end - - # It's okay for this to context switch: - unused.each do |resource| - if block_given? - yield resource - else - retire(resource) - end - - break if @resources.size <= retain - end - - # Update availability list: - @available.clear - @resources.each do |resource, usage| - if usage < resource.concurrency and resource.reusable? - @available << resource - end - end - - return unused.size - end - - # Retire a specific resource. - def retire(resource) - Console.debug(self){"Retire #{resource}"} - - return false unless @resources.delete(resource) - - resource.close - - @mutex.synchronize{@condition.broadcast} - - return true - end - - protected - - def start_gardener - return if @gardener - - @gardener = true - - Async(transient: true, annotation: "#{self.class} Gardener") do |task| - @gardener = task - - while true - @policy&.call(self) - self.wait - end - ensure - @gardener = nil - self.close - end - end - - def usage_string - "#{@resources.size}/#{@limit || '∞'}" - end - - def availability_summary - @resources.collect do |resource, usage| - "#{usage}/#{resource.concurrency}#{resource.viable? ? nil : '*'}/#{resource.count}" - end - end - - # def usage - # @resources.count{|resource, usage| usage > 0} - # end - # - # def free - # @resources.count{|resource, usage| usage == 0} - # end - - def wait_for_resource - # If we fail to create a resource (below), we will end up waiting for one to become resources. - until resource = available_resource - @mutex.synchronize{@condition.wait(@mutex)} - end - # Be careful not to context switch or fail here. - return resource - end - - # @returns [Object] A new resource in a "used" state. - def create_resource - self.start_gardener - - # This might return nil, which means creating the resource failed. - if resource = @constructor.call - @resources[resource] = 1 - - # Make the resource available if it can be used multiple times: - if resource.concurrency > 1 - @available.add(resource) - end - end - - # @policy.created(self, resource) - - return resource - end - - # @returns [Object] An existing resource in a "used" state. - def available_resource - resource = nil - - @guard.acquire do - resource = acquire_or_create_resource - end - - return resource - rescue Exception - release(resource) if resource - raise - end - - private - - def decrement_usage(resource) - usage = @resources[resource] - return unless usage - - if usage.zero? - raise "Trying to reuse unacquired resource: #{resource}!" - end - - return @resources[resource] = usage - 1 - end - - # Acquire an existing resource with zero usage. - # If there are resources that are in use, wait until they are released. - def acquire_existing_resource - while @resources.any? - @resources.each do |resource, usage| - if usage == 0 - return resource - end - end - @mutex.synchronize{@condition.wait(@mutex)} - end - # Only when the pool has been completely drained, return nil: - return nil - end - - def acquire_or_create_resource - while resource = @available.first - if usage = @resources[resource] and usage < resource.concurrency - if resource.viable? - usage = (@resources[resource] += 1) - - if usage == resource.concurrency - # The resource is used up to it's limit: - @available.delete(resource) - end - - return resource - else - @available.delete(resource) - retire(resource) if usage.zero? - end - else - # The resource has been removed already, so skip it and remove it from the availability list. - @available.delete(resource) - end - end - - if @limit.nil? or @resources.size < @limit - Console.debug(self){"No available resources, allocating new one..."} - - return create_resource - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/lib/async/pool/resource.rb b/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/lib/async/pool/resource.rb deleted file mode 100644 index 061ca62..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/lib/async/pool/resource.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2019-2024, by Samuel Williams. - -require "console/logger" - -require "async/notification" -require "async/semaphore" - -module Async - module Pool - # The basic interface required by a pool resource. - class Resource - # Constructs a resource. - def self.call - self.new - end - - # Create a new resource. - # - # @parameter concurrency [Integer] The concurrency of this resource. - def initialize(concurrency = 1) - @concurrency = concurrency - @closed = false - @count = 0 - end - - # @attr [Integer] The concurrency of this resource, 1 (singleplex) or more (multiplex). - attr :concurrency - - # @attr [Integer] The number of times this resource has been used. - attr :count - - # Whether this resource can be acquired. - # @return [Boolean] whether the resource can actually be used. - def viable? - !@closed - end - - # Whether the resource has been closed by the user. - # @return [Boolean] whether the resource has been closed or has failed. - def closed? - @closed - end - - # Close the resource explicitly, e.g. the pool is being closed. - def close - @closed = true - end - - # Whether this resource can be reused. Used when releasing resources back into the pool. - def reusable? - !@closed - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/lib/async/pool/version.rb b/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/lib/async/pool/version.rb deleted file mode 100644 index 1d6881c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/lib/async/pool/version.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2019-2026, by Samuel Williams. - -module Async - module Pool - VERSION = "0.12.0" - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/lib/traces/provider/async/pool/controller.rb b/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/lib/traces/provider/async/pool/controller.rb deleted file mode 100644 index a0e5771..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/lib/traces/provider/async/pool/controller.rb +++ /dev/null @@ -1,59 +0,0 @@ -# frozen_string_literal: true - -# Released under the MIT License. -# Copyright, 2025, by Samuel Williams. - -require_relative "../../../../async/pool/controller" - -Traces::Provider(Async::Pool::Controller) do - def create_resource(...) - attributes = { - concurrency: @guard.limit, - } - - attributes.merge!(@tags) if @tags - - Traces.trace("async.pool.create", attributes: attributes){super} - end - - def drain(...) - attributes = { - size: @resources.size, - } - - attributes.merge!(@tags) if @tags - - Traces.trace("async.pool.drain", attributes: attributes){super} - end - - def acquire(...) - attributes = { - size: @resources.size, - limit: @limit, - } - - attributes.merge!(@tags) if @tags - - Traces.trace("async.pool.acquire", attributes: attributes){super} - end - - def release(...) - attributes = { - size: @resources.size, - } - - attributes.merge!(@tags) if @tags - - Traces.trace("async.pool.release", attributes: attributes){super} - end - - def retire(...) - attributes = { - size: @resources.size, - } - - attributes.merge!(@tags) if @tags - - Traces.trace("async.pool.retire", attributes: attributes){super} - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/license.md b/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/license.md deleted file mode 100644 index 816a952..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/license.md +++ /dev/null @@ -1,26 +0,0 @@ -# MIT License - -Copyright, 2019-2026, by Samuel Williams. -Copyright, 2020, by Simon Perepelitsa. -Copyright, 2021, by Olle Jonsson. -Copyright, 2024, by Thomas Morgan. -Copyright, 2025, by Jean Boussier. -Copyright, 2026, by William T. Nelson. - -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/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/readme.md b/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/readme.md deleted file mode 100644 index 9dba1f5..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/readme.md +++ /dev/null @@ -1,55 +0,0 @@ -# Async::Pool - -Provides support for connection pooling both singleplex and multiplex resources. - -[![Development Status](https://github.com/socketry/async-pool/workflows/Test/badge.svg)](https://github.com/socketry/async-pool/actions?workflow=Test) - -## Usage - -Please see the [project documentation](https://socketry.github.io/async-pool/) for more details. - - - [Getting Started](https://socketry.github.io/async-pool/guides/getting-started/index) - This guide explains how to use the `async-pool` gem to manage connection pooling. - -## Releases - -Please see the [project releases](https://socketry.github.io/async-pool/releases/index) for all releases. - -### v0.12.0 - - - Use identity-based tracking for pooled resources and preserve insertion order when selecting available resources. - -### v0.11.2 - -## Contributing - -We welcome contributions to this project. - -1. Fork the repository. -2. Create your feature branch (`git checkout -b my-new-feature`). -3. Commit your changes (`git commit -am 'Add some feature.'`). -4. Push to the branch (`git push origin my-new-feature`). -5. Create a new pull request. - -### Running Tests - -To run the test suite: - -``` bash -$ bundle exec sus -``` - -### Making Releases - -To make a new release: - -``` bash -$ bundle exec bake gem:release:patch # or minor or major -``` - -### Developer Certificate of Origin - -In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed. - -### Community Guidelines - -This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers. diff --git a/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/releases.md b/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/releases.md deleted file mode 100644 index 32d870f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/async-pool-0.12.0/releases.md +++ /dev/null @@ -1,7 +0,0 @@ -# Releases - -## v0.12.0 - - - Use identity-based tracking for pooled resources and preserve insertion order when selecting available resources. - -## v0.11.2 diff --git a/vendor/bundle/ruby/3.3.0/gems/base64-0.3.0/BSDL b/vendor/bundle/ruby/3.3.0/gems/base64-0.3.0/BSDL deleted file mode 100644 index 66d9359..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/base64-0.3.0/BSDL +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. diff --git a/vendor/bundle/ruby/3.3.0/gems/base64-0.3.0/COPYING b/vendor/bundle/ruby/3.3.0/gems/base64-0.3.0/COPYING deleted file mode 100644 index 48e5a96..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/base64-0.3.0/COPYING +++ /dev/null @@ -1,56 +0,0 @@ -Ruby is copyrighted free software by Yukihiro Matsumoto . -You can redistribute it and/or modify it under either the terms of the -2-clause BSDL (see the file BSDL), 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 binaries 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 binary form, - provided that you do at least ONE of the following: - - a. distribute the binaries 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 binaries 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/vendor/bundle/ruby/3.3.0/gems/base64-0.3.0/LEGAL b/vendor/bundle/ruby/3.3.0/gems/base64-0.3.0/LEGAL deleted file mode 100644 index f2d8014..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/base64-0.3.0/LEGAL +++ /dev/null @@ -1,60 +0,0 @@ -# -*- rdoc -*- - -= LEGAL NOTICE INFORMATION --------------------------- - -All the files in this distribution are covered under either the Ruby's -license (see the file COPYING) or public-domain except some files -mentioned below. - -== MIT License ->>> - 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. - -== Old-style BSD license ->>> - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name of the University nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. - - IMPORTANT NOTE:: - - From ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change - paragraph 3 above is now null and void. diff --git a/vendor/bundle/ruby/3.3.0/gems/base64-0.3.0/README.md b/vendor/bundle/ruby/3.3.0/gems/base64-0.3.0/README.md deleted file mode 100644 index a29c58e..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/base64-0.3.0/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# Base64 - -The Base64 module provides for the encoding (`#encode64`, `#strict_encode64`, -`#urlsafe_encode64`) and decoding (`#decode64`, `#strict_decode64`, -`#urlsafe_decode64`) of binary data using a Base64 representation. - -## Installation - -Add this line to your application's Gemfile: - -```ruby -gem 'base64' -``` - -And then execute: - - $ bundle install - -Or install it yourself as: - - $ gem install base64 - -## Usage - -A simple encoding and decoding. - -```ruby -require "base64" - -enc = Base64.encode64('Send reinforcements') - # -> "U2VuZCByZWluZm9yY2VtZW50cw==\n" -plain = Base64.decode64(enc) - # -> "Send reinforcements" -``` - -The purpose of using base64 to encode data is that it translates any -binary data into purely printable characters. - -## Development - -After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. - -To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). - -## Contributing - -Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/base64. - diff --git a/vendor/bundle/ruby/3.3.0/gems/base64-0.3.0/lib/base64.rb b/vendor/bundle/ruby/3.3.0/gems/base64-0.3.0/lib/base64.rb deleted file mode 100644 index 8c0145d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/base64-0.3.0/lib/base64.rb +++ /dev/null @@ -1,381 +0,0 @@ -# frozen_string_literal: true -# -# \Module \Base64 provides methods for: -# -# - \Encoding a binary string (containing non-ASCII characters) -# as a string of printable ASCII characters. -# - Decoding such an encoded string. -# -# \Base64 is commonly used in contexts where binary data -# is not allowed or supported: -# -# - Images in HTML or CSS files, or in URLs. -# - Email attachments. -# -# A \Base64-encoded string is about one-third larger that its source. -# See the {Wikipedia article}[https://en.wikipedia.org/wiki/Base64] -# for more information. -# -# This module provides three pairs of encode/decode methods. -# Your choices among these methods should depend on: -# -# - Which character set is to be used for encoding and decoding. -# - Whether "padding" is to be used. -# - Whether encoded strings are to contain newlines. -# -# Note: Examples on this page assume that the including program has executed: -# -# require 'base64' -# -# == \Encoding Character Sets -# -# A \Base64-encoded string consists only of characters from a 64-character set: -# -# - ('A'..'Z'). -# - ('a'..'z'). -# - ('0'..'9'). -# - =, the 'padding' character. -# - Either: -# - %w[+ /]: -# {RFC-2045-compliant}[https://datatracker.ietf.org/doc/html/rfc2045]; -# _not_ safe for URLs. -# - %w[- _]: -# {RFC-4648-compliant}[https://datatracker.ietf.org/doc/html/rfc4648]; -# safe for URLs. -# -# If you are working with \Base64-encoded strings that will come from -# or be put into URLs, you should choose this encoder-decoder pair -# of RFC-4648-compliant methods: -# -# - Base64.urlsafe_encode64 and Base64.urlsafe_decode64. -# -# Otherwise, you may choose any of the pairs in this module, -# including the pair above, or the RFC-2045-compliant pairs: -# -# - Base64.encode64 and Base64.decode64. -# - Base64.strict_encode64 and Base64.strict_decode64. -# -# == Padding -# -# \Base64-encoding changes a triplet of input bytes -# into a quartet of output characters. -# -# Padding in Encode Methods -# -# Padding -- extending an encoded string with zero, one, or two trailing -# = characters -- is performed by methods Base64.encode64, -# Base64.strict_encode64, and, by default, Base64.urlsafe_encode64: -# -# Base64.encode64('s') # => "cw==\n" -# Base64.strict_encode64('s') # => "cw==" -# Base64.urlsafe_encode64('s') # => "cw==" -# Base64.urlsafe_encode64('s', padding: false) # => "cw" -# -# When padding is performed, the encoded string is always of length 4n, -# where +n+ is a non-negative integer: -# -# - Input bytes of length 3n generate unpadded output characters -# of length 4n: -# -# # n = 1: 3 bytes => 4 characters. -# Base64.strict_encode64('123') # => "MDEy" -# # n = 2: 6 bytes => 8 characters. -# Base64.strict_encode64('123456') # => "MDEyMzQ1" -# -# - Input bytes of length 3n+1 generate padded output characters -# of length 4(n+1), with two padding characters at the end: -# -# # n = 1: 4 bytes => 8 characters. -# Base64.strict_encode64('1234') # => "MDEyMw==" -# # n = 2: 7 bytes => 12 characters. -# Base64.strict_encode64('1234567') # => "MDEyMzQ1Ng==" -# -# - Input bytes of length 3n+2 generate padded output characters -# of length 4(n+1), with one padding character at the end: -# -# # n = 1: 5 bytes => 8 characters. -# Base64.strict_encode64('12345') # => "MDEyMzQ=" -# # n = 2: 8 bytes => 12 characters. -# Base64.strict_encode64('12345678') # => "MDEyMzQ1Njc=" -# -# When padding is suppressed, for a positive integer n: -# -# - Input bytes of length 3n generate unpadded output characters -# of length 4n: -# -# # n = 1: 3 bytes => 4 characters. -# Base64.urlsafe_encode64('123', padding: false) # => "MDEy" -# # n = 2: 6 bytes => 8 characters. -# Base64.urlsafe_encode64('123456', padding: false) # => "MDEyMzQ1" -# -# - Input bytes of length 3n+1 generate unpadded output characters -# of length 4n+2, with two padding characters at the end: -# -# # n = 1: 4 bytes => 6 characters. -# Base64.urlsafe_encode64('1234', padding: false) # => "MDEyMw" -# # n = 2: 7 bytes => 10 characters. -# Base64.urlsafe_encode64('1234567', padding: false) # => "MDEyMzQ1Ng" -# -# - Input bytes of length 3n+2 generate unpadded output characters -# of length 4n+3, with one padding character at the end: -# -# # n = 1: 5 bytes => 7 characters. -# Base64.urlsafe_encode64('12345', padding: false) # => "MDEyMzQ" -# # m = 2: 8 bytes => 11 characters. -# Base64.urlsafe_encode64('12345678', padding: false) # => "MDEyMzQ1Njc" -# -# Padding in Decode Methods -# -# All of the \Base64 decode methods support (but do not require) padding. -# -# \Method Base64.decode64 does not check the size of the padding: -# -# Base64.decode64("MDEyMzQ1Njc") # => "01234567" -# Base64.decode64("MDEyMzQ1Njc=") # => "01234567" -# Base64.decode64("MDEyMzQ1Njc==") # => "01234567" -# -# \Method Base64.strict_decode64 strictly enforces padding size: -# -# Base64.strict_decode64("MDEyMzQ1Njc") # Raises ArgumentError -# Base64.strict_decode64("MDEyMzQ1Njc=") # => "01234567" -# Base64.strict_decode64("MDEyMzQ1Njc==") # Raises ArgumentError -# -# \Method Base64.urlsafe_decode64 allows padding in the encoded string, -# which if present, must be correct: -# see {Padding}[Base64.html#module-Base64-label-Padding], above: -# -# Base64.urlsafe_decode64("MDEyMzQ1Njc") # => "01234567" -# Base64.urlsafe_decode64("MDEyMzQ1Njc=") # => "01234567" -# Base64.urlsafe_decode64("MDEyMzQ1Njc==") # Raises ArgumentError. -# -# == Newlines -# -# An encoded string returned by Base64.encode64 or Base64.urlsafe_encode64 -# has an embedded newline character -# after each 60-character sequence, and, if non-empty, at the end: -# -# # No newline if empty. -# encoded = Base64.encode64("\x00" * 0) -# encoded.index("\n") # => nil -# -# # Newline at end of short output. -# encoded = Base64.encode64("\x00" * 1) -# encoded.size # => 4 -# encoded.index("\n") # => 4 -# -# # Newline at end of longer output. -# encoded = Base64.encode64("\x00" * 45) -# encoded.size # => 60 -# encoded.index("\n") # => 60 -# -# # Newlines embedded and at end of still longer output. -# encoded = Base64.encode64("\x00" * 46) -# encoded.size # => 65 -# encoded.rindex("\n") # => 65 -# encoded.split("\n").map {|s| s.size } # => [60, 4] -# -# The string to be encoded may itself contain newlines, -# which are encoded as \Base64: -# -# # Base64.encode64("\n\n\n") # => "CgoK\n" -# s = "This is line 1\nThis is line 2\n" -# Base64.encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n" -# -module Base64 - - VERSION = "0.3.0" - - module_function - - # :call-seq: - # Base64.encode64(string) -> encoded_string - # - # Returns a string containing the RFC-2045-compliant \Base64-encoding of +string+. - # - # Per RFC 2045, the returned string may contain the URL-unsafe characters - # + or /; - # see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above: - # - # Base64.encode64("\xFB\xEF\xBE") # => "++++\n" - # Base64.encode64("\xFF\xFF\xFF") # => "////\n" - # - # The returned string may include padding; - # see {Padding}[Base64.html#module-Base64-label-Padding] above. - # - # Base64.encode64('*') # => "Kg==\n" - # - # The returned string ends with a newline character, and if sufficiently long - # will have one or more embedded newline characters; - # see {Newlines}[Base64.html#module-Base64-label-Newlines] above: - # - # Base64.encode64('*') # => "Kg==\n" - # Base64.encode64('*' * 46) - # # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq\nKg==\n" - # - # The string to be encoded may itself contain newlines, - # which will be encoded as ordinary \Base64: - # - # Base64.encode64("\n\n\n") # => "CgoK\n" - # s = "This is line 1\nThis is line 2\n" - # Base64.encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n" - # - def encode64(bin) - [bin].pack("m") - end - - # :call-seq: - # Base64.decode(encoded_string) -> decoded_string - # - # Returns a string containing the decoding of an RFC-2045-compliant - # \Base64-encoded string +encoded_string+: - # - # s = "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n" - # Base64.decode64(s) # => "This is line 1\nThis is line 2\n" - # - # Non-\Base64 characters in +encoded_string+ are ignored; - # see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above: - # these include newline characters and characters - and /: - # - # Base64.decode64("\x00\n-_") # => "" - # - # Padding in +encoded_string+ (even if incorrect) is ignored: - # - # Base64.decode64("MDEyMzQ1Njc") # => "01234567" - # Base64.decode64("MDEyMzQ1Njc=") # => "01234567" - # Base64.decode64("MDEyMzQ1Njc==") # => "01234567" - # - def decode64(str) - str.unpack1("m") - end - - # :call-seq: - # Base64.strict_encode64(string) -> encoded_string - # - # Returns a string containing the RFC-2045-compliant \Base64-encoding of +string+. - # - # Per RFC 2045, the returned string may contain the URL-unsafe characters - # + or /; - # see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above: - # - # Base64.strict_encode64("\xFB\xEF\xBE") # => "++++\n" - # Base64.strict_encode64("\xFF\xFF\xFF") # => "////\n" - # - # The returned string may include padding; - # see {Padding}[Base64.html#module-Base64-label-Padding] above. - # - # Base64.strict_encode64('*') # => "Kg==\n" - # - # The returned string will have no newline characters, regardless of its length; - # see {Newlines}[Base64.html#module-Base64-label-Newlines] above: - # - # Base64.strict_encode64('*') # => "Kg==" - # Base64.strict_encode64('*' * 46) - # # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg==" - # - # The string to be encoded may itself contain newlines, - # which will be encoded as ordinary \Base64: - # - # Base64.strict_encode64("\n\n\n") # => "CgoK" - # s = "This is line 1\nThis is line 2\n" - # Base64.strict_encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK" - # - def strict_encode64(bin) - [bin].pack("m0") - end - - # :call-seq: - # Base64.strict_decode64(encoded_string) -> decoded_string - # - # Returns a string containing the decoding of an RFC-2045-compliant - # \Base64-encoded string +encoded_string+: - # - # s = "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK" - # Base64.strict_decode64(s) # => "This is line 1\nThis is line 2\n" - # - # Non-\Base64 characters in +encoded_string+ are not allowed; - # see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above: - # these include newline characters and characters - and /: - # - # Base64.strict_decode64("\n") # Raises ArgumentError - # Base64.strict_decode64('-') # Raises ArgumentError - # Base64.strict_decode64('_') # Raises ArgumentError - # - # Padding in +encoded_string+, if present, must be correct: - # - # Base64.strict_decode64("MDEyMzQ1Njc") # Raises ArgumentError - # Base64.strict_decode64("MDEyMzQ1Njc=") # => "01234567" - # Base64.strict_decode64("MDEyMzQ1Njc==") # Raises ArgumentError - # - def strict_decode64(str) - str.unpack1("m0") - end - - # :call-seq: - # Base64.urlsafe_encode64(string) -> encoded_string - # - # Returns the RFC-4648-compliant \Base64-encoding of +string+. - # - # Per RFC 4648, the returned string will not contain the URL-unsafe characters - # + or /, - # but instead may contain the URL-safe characters - # - and _; - # see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above: - # - # Base64.urlsafe_encode64("\xFB\xEF\xBE") # => "----" - # Base64.urlsafe_encode64("\xFF\xFF\xFF") # => "____" - # - # By default, the returned string may have padding; - # see {Padding}[Base64.html#module-Base64-label-Padding], above: - # - # Base64.urlsafe_encode64('*') # => "Kg==" - # - # Optionally, you can suppress padding: - # - # Base64.urlsafe_encode64('*', padding: false) # => "Kg" - # - # The returned string will have no newline characters, regardless of its length; - # see {Newlines}[Base64.html#module-Base64-label-Newlines] above: - # - # Base64.urlsafe_encode64('*') # => "Kg==" - # Base64.urlsafe_encode64('*' * 46) - # # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg==" - # - def urlsafe_encode64(bin, padding: true) - str = strict_encode64(bin) - str.chomp!("==") or str.chomp!("=") unless padding - str.tr!("+/", "-_") - str - end - - # :call-seq: - # Base64.urlsafe_decode64(encoded_string) -> decoded_string - # - # Returns the decoding of an RFC-4648-compliant \Base64-encoded string +encoded_string+: - # - # +encoded_string+ may not contain non-Base64 characters; - # see {Encoding Character Set}[Base64.html#module-Base64-label-Encoding+Character+Sets] above: - # - # Base64.urlsafe_decode64('+') # Raises ArgumentError. - # Base64.urlsafe_decode64('/') # Raises ArgumentError. - # Base64.urlsafe_decode64("\n") # Raises ArgumentError. - # - # Padding in +encoded_string+, if present, must be correct: - # see {Padding}[Base64.html#module-Base64-label-Padding], above: - # - # Base64.urlsafe_decode64("MDEyMzQ1Njc") # => "01234567" - # Base64.urlsafe_decode64("MDEyMzQ1Njc=") # => "01234567" - # Base64.urlsafe_decode64("MDEyMzQ1Njc==") # Raises ArgumentError. - # - def urlsafe_decode64(str) - # NOTE: RFC 4648 does say nothing about unpadded input, but says that - # "the excess pad characters MAY also be ignored", so it is inferred that - # unpadded input is also acceptable. - if !str.end_with?("=") && str.length % 4 != 0 - str = str.ljust((str.length + 3) & ~3, "=") - str.tr!("-_", "+/") - else - str = str.tr("-_", "+/") - end - strict_decode64(str) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/base64-0.3.0/sig/base64.rbs b/vendor/bundle/ruby/3.3.0/gems/base64-0.3.0/sig/base64.rbs deleted file mode 100644 index 147e874..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/base64-0.3.0/sig/base64.rbs +++ /dev/null @@ -1,355 +0,0 @@ -# -# Module Base64 provides methods for: -# -# * Encoding a binary string (containing non-ASCII characters) as a string of -# printable ASCII characters. -# * Decoding such an encoded string. -# -# Base64 is commonly used in contexts where binary data is not allowed or -# supported: -# -# * Images in HTML or CSS files, or in URLs. -# * Email attachments. -# -# A Base64-encoded string is about one-third larger that its source. See the -# [Wikipedia article](https://en.wikipedia.org/wiki/Base64) for more -# information. -# -# This module provides three pairs of encode/decode methods. Your choices among -# these methods should depend on: -# -# * Which character set is to be used for encoding and decoding. -# * Whether "padding" is to be used. -# * Whether encoded strings are to contain newlines. -# -# Note: Examples on this page assume that the including program has executed: -# -# require 'base64' -# -# ## Encoding Character Sets -# -# A Base64-encoded string consists only of characters from a 64-character set: -# -# * `('A'..'Z')`. -# * `('a'..'z')`. -# * `('0'..'9')`. -# * `=`, the 'padding' character. -# * Either: -# * `%w[+ /]`: -# [RFC-2045-compliant](https://datatracker.ietf.org/doc/html/rfc2045); -# *not* safe for URLs. -# * `%w[- _]`: -# [RFC-4648-compliant](https://datatracker.ietf.org/doc/html/rfc4648); -# safe for URLs. -# -# If you are working with Base64-encoded strings that will come from or be put -# into URLs, you should choose this encoder-decoder pair of RFC-4648-compliant -# methods: -# -# * Base64.urlsafe_encode64 and Base64.urlsafe_decode64. -# -# Otherwise, you may choose any of the pairs in this module, including the pair -# above, or the RFC-2045-compliant pairs: -# -# * Base64.encode64 and Base64.decode64. -# * Base64.strict_encode64 and Base64.strict_decode64. -# -# ## Padding -# -# Base64-encoding changes a triplet of input bytes into a quartet of output -# characters. -# -# **Padding in Encode Methods** -# -# Padding -- extending an encoded string with zero, one, or two trailing `=` -# characters -- is performed by methods Base64.encode64, Base64.strict_encode64, -# and, by default, Base64.urlsafe_encode64: -# -# Base64.encode64('s') # => "cw==\n" -# Base64.strict_encode64('s') # => "cw==" -# Base64.urlsafe_encode64('s') # => "cw==" -# Base64.urlsafe_encode64('s', padding: false) # => "cw" -# -# When padding is performed, the encoded string is always of length *4n*, where -# `n` is a non-negative integer: -# -# * Input bytes of length *3n* generate unpadded output characters of length -# *4n*: -# -# # n = 1: 3 bytes => 4 characters. -# Base64.strict_encode64('123') # => "MDEy" -# # n = 2: 6 bytes => 8 characters. -# Base64.strict_encode64('123456') # => "MDEyMzQ1" -# -# * Input bytes of length *3n+1* generate padded output characters of length -# *4(n+1)*, with two padding characters at the end: -# -# # n = 1: 4 bytes => 8 characters. -# Base64.strict_encode64('1234') # => "MDEyMw==" -# # n = 2: 7 bytes => 12 characters. -# Base64.strict_encode64('1234567') # => "MDEyMzQ1Ng==" -# -# * Input bytes of length *3n+2* generate padded output characters of length -# *4(n+1)*, with one padding character at the end: -# -# # n = 1: 5 bytes => 8 characters. -# Base64.strict_encode64('12345') # => "MDEyMzQ=" -# # n = 2: 8 bytes => 12 characters. -# Base64.strict_encode64('12345678') # => "MDEyMzQ1Njc=" -# -# When padding is suppressed, for a positive integer *n*: -# -# * Input bytes of length *3n* generate unpadded output characters of length -# *4n*: -# -# # n = 1: 3 bytes => 4 characters. -# Base64.urlsafe_encode64('123', padding: false) # => "MDEy" -# # n = 2: 6 bytes => 8 characters. -# Base64.urlsafe_encode64('123456', padding: false) # => "MDEyMzQ1" -# -# * Input bytes of length *3n+1* generate unpadded output characters of length -# *4n+2*, with two padding characters at the end: -# -# # n = 1: 4 bytes => 6 characters. -# Base64.urlsafe_encode64('1234', padding: false) # => "MDEyMw" -# # n = 2: 7 bytes => 10 characters. -# Base64.urlsafe_encode64('1234567', padding: false) # => "MDEyMzQ1Ng" -# -# * Input bytes of length *3n+2* generate unpadded output characters of length -# *4n+3*, with one padding character at the end: -# -# # n = 1: 5 bytes => 7 characters. -# Base64.urlsafe_encode64('12345', padding: false) # => "MDEyMzQ" -# # m = 2: 8 bytes => 11 characters. -# Base64.urlsafe_encode64('12345678', padding: false) # => "MDEyMzQ1Njc" -# -# **Padding in Decode Methods** -# -# All of the Base64 decode methods support (but do not require) padding. -# -# Method Base64.decode64 does not check the size of the padding: -# -# Base64.decode64("MDEyMzQ1Njc") # => "01234567" -# Base64.decode64("MDEyMzQ1Njc=") # => "01234567" -# Base64.decode64("MDEyMzQ1Njc==") # => "01234567" -# -# Method Base64.strict_decode64 strictly enforces padding size: -# -# Base64.strict_decode64("MDEyMzQ1Njc") # Raises ArgumentError -# Base64.strict_decode64("MDEyMzQ1Njc=") # => "01234567" -# Base64.strict_decode64("MDEyMzQ1Njc==") # Raises ArgumentError -# -# Method Base64.urlsafe_decode64 allows padding in `str`, which if present, must -# be correct: see [Padding](Base64.html#module-Base64-label-Padding), above: -# -# Base64.urlsafe_decode64("MDEyMzQ1Njc") # => "01234567" -# Base64.urlsafe_decode64("MDEyMzQ1Njc=") # => "01234567" -# Base64.urlsafe_decode64("MDEyMzQ1Njc==") # Raises ArgumentError. -# -# ## Newlines -# -# An encoded string returned by Base64.encode64 or Base64.urlsafe_encode64 has -# an embedded newline character after each 60-character sequence, and, if -# non-empty, at the end: -# -# # No newline if empty. -# encoded = Base64.encode64("\x00" * 0) -# encoded.index("\n") # => nil -# -# # Newline at end of short output. -# encoded = Base64.encode64("\x00" * 1) -# encoded.size # => 4 -# encoded.index("\n") # => 4 -# -# # Newline at end of longer output. -# encoded = Base64.encode64("\x00" * 45) -# encoded.size # => 60 -# encoded.index("\n") # => 60 -# -# # Newlines embedded and at end of still longer output. -# encoded = Base64.encode64("\x00" * 46) -# encoded.size # => 65 -# encoded.rindex("\n") # => 65 -# encoded.split("\n").map {|s| s.size } # => [60, 4] -# -# The string to be encoded may itself contain newlines, which are encoded as -# Base64: -# -# # Base64.encode64("\n\n\n") # => "CgoK\n" -# s = "This is line 1\nThis is line 2\n" -# Base64.encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n" -# -module Base64 - # - # Returns a string containing the decoding of an RFC-2045-compliant - # Base64-encoded string `str`: - # - # s = "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n" - # Base64.decode64(s) # => "This is line 1\nThis is line 2\n" - # - # Non-Base64 characters in `str` are ignored; see [Encoding Character - # Set](Base64.html#module-Base64-label-Encoding+Character+Sets) above: these - # include newline characters and characters `-` and `/`: - # - # Base64.decode64("\x00\n-_") # => "" - # - # Padding in `str` (even if incorrect) is ignored: - # - # Base64.decode64("MDEyMzQ1Njc") # => "01234567" - # Base64.decode64("MDEyMzQ1Njc=") # => "01234567" - # Base64.decode64("MDEyMzQ1Njc==") # => "01234567" - # - def self?.decode64: (String str) -> String - - # - # Returns a string containing the RFC-2045-compliant Base64-encoding of `bin`. - # - # Per RFC 2045, the returned string may contain the URL-unsafe characters `+` or - # `/`; see [Encoding Character - # Set](Base64.html#module-Base64-label-Encoding+Character+Sets) above: - # - # Base64.encode64("\xFB\xEF\xBE") # => "++++\n" - # Base64.encode64("\xFF\xFF\xFF") # => "////\n" - # - # The returned string may include padding; see - # [Padding](Base64.html#module-Base64-label-Padding) above. - # - # Base64.encode64('*') # => "Kg==\n" - # - # The returned string ends with a newline character, and if sufficiently long - # will have one or more embedded newline characters; see - # [Newlines](Base64.html#module-Base64-label-Newlines) above: - # - # Base64.encode64('*') # => "Kg==\n" - # Base64.encode64('*' * 46) - # # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq\nKg==\n" - # - # The string to be encoded may itself contain newlines, which will be encoded as - # ordinary Base64: - # - # Base64.encode64("\n\n\n") # => "CgoK\n" - # s = "This is line 1\nThis is line 2\n" - # Base64.encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK\n" - # - def self?.encode64: (String bin) -> String - - # - # Returns a string containing the decoding of an RFC-2045-compliant - # Base64-encoded string `str`: - # - # s = "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK" - # Base64.strict_decode64(s) # => "This is line 1\nThis is line 2\n" - # - # Non-Base64 characters in `str` not allowed; see [Encoding Character - # Set](Base64.html#module-Base64-label-Encoding+Character+Sets) above: these - # include newline characters and characters `-` and `/`: - # - # Base64.strict_decode64("\n") # Raises ArgumentError - # Base64.strict_decode64('-') # Raises ArgumentError - # Base64.strict_decode64('_') # Raises ArgumentError - # - # Padding in `str`, if present, must be correct: - # - # Base64.strict_decode64("MDEyMzQ1Njc") # Raises ArgumentError - # Base64.strict_decode64("MDEyMzQ1Njc=") # => "01234567" - # Base64.strict_decode64("MDEyMzQ1Njc==") # Raises ArgumentError - # - def self?.strict_decode64: (String str) -> String - - # - # Returns a string containing the RFC-2045-compliant Base64-encoding of `bin`. - # - # Per RFC 2045, the returned string may contain the URL-unsafe characters `+` or - # `/`; see [Encoding Character - # Set](Base64.html#module-Base64-label-Encoding+Character+Sets) above: - # - # Base64.strict_encode64("\xFB\xEF\xBE") # => "++++\n" - # Base64.strict_encode64("\xFF\xFF\xFF") # => "////\n" - # - # The returned string may include padding; see - # [Padding](Base64.html#module-Base64-label-Padding) above. - # - # Base64.strict_encode64('*') # => "Kg==\n" - # - # The returned string will have no newline characters, regardless of its length; - # see [Newlines](Base64.html#module-Base64-label-Newlines) above: - # - # Base64.strict_encode64('*') # => "Kg==" - # Base64.strict_encode64('*' * 46) - # # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg==" - # - # The string to be encoded may itself contain newlines, which will be encoded as - # ordinary Base64: - # - # Base64.strict_encode64("\n\n\n") # => "CgoK" - # s = "This is line 1\nThis is line 2\n" - # Base64.strict_encode64(s) # => "VGhpcyBpcyBsaW5lIDEKVGhpcyBpcyBsaW5lIDIK" - # - def self?.strict_encode64: (String bin) -> String - - # - # Returns the decoding of an RFC-4648-compliant Base64-encoded string `str`: - # - # `str` may not contain non-Base64 characters; see [Encoding Character - # Set](Base64.html#module-Base64-label-Encoding+Character+Sets) above: - # - # Base64.urlsafe_decode64('+') # Raises ArgumentError. - # Base64.urlsafe_decode64('/') # Raises ArgumentError. - # Base64.urlsafe_decode64("\n") # Raises ArgumentError. - # - # Padding in `str`, if present, must be correct: see - # [Padding](Base64.html#module-Base64-label-Padding), above: - # - # Base64.urlsafe_decode64("MDEyMzQ1Njc") # => "01234567" - # Base64.urlsafe_decode64("MDEyMzQ1Njc=") # => "01234567" - # Base64.urlsafe_decode64("MDEyMzQ1Njc==") # Raises ArgumentError. - # - def self?.urlsafe_decode64: (String str) -> String - - # - # Returns the RFC-4648-compliant Base64-encoding of `bin`. - # - # Per RFC 4648, the returned string will not contain the URL-unsafe characters - # `+` or `/`, but instead may contain the URL-safe characters `-` and `_`; see - # [Encoding Character - # Set](Base64.html#module-Base64-label-Encoding+Character+Sets) above: - # - # Base64.urlsafe_encode64("\xFB\xEF\xBE") # => "----" - # Base64.urlsafe_encode64("\xFF\xFF\xFF") # => "____" - # - # By default, the returned string may have padding; see - # [Padding](Base64.html#module-Base64-label-Padding), above: - # - # Base64.urlsafe_encode64('*') # => "Kg==" - # - # Optionally, you can suppress padding: - # - # Base64.urlsafe_encode64('*', padding: false) # => "Kg" - # - # The returned string will have no newline characters, regardless of its length; - # see [Newlines](Base64.html#module-Base64-label-Newlines) above: - # - # Base64.urlsafe_encode64('*') # => "Kg==" - # Base64.urlsafe_encode64('*' * 46) - # # => "KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg==" - # - def self?.urlsafe_encode64: (String bin, ?padding: boolish) -> String -end diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/LICENSE b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/LICENSE deleted file mode 100644 index a1f19ff..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/LICENSE +++ /dev/null @@ -1,56 +0,0 @@ -Ruby is copyrighted free software by Yukihiro Matsumoto . -You can redistribute it and/or modify it under either the terms of the -2-clause BSDL (see the file BSDL), 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 binaries 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 binary form, - provided that you do at least ONE of the following: - - a) distribute the binaries 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 binaries 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/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/bigdecimal.gemspec b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/bigdecimal.gemspec deleted file mode 100644 index b5c3c25..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/bigdecimal.gemspec +++ /dev/null @@ -1,64 +0,0 @@ -# coding: utf-8 - -name = File.basename(__FILE__, '.*') -source_version = ["", "ext/#{name}/"].find do |dir| - begin - break File.foreach(File.join(__dir__, "#{dir}#{name}.c")) {|line| - break $1.sub("-", ".") if /^#define\s+#{name.upcase}_VERSION\s+"(.+)"/o =~ line - } - rescue Errno::ENOENT - end -end or raise "can't find #{name.upcase}_VERSION" - -Gem::Specification.new do |s| - s.name = name - s.version = source_version - s.authors = ["Kenta Murata", "Zachary Scott", "Shigeo Kobayashi"] - s.email = ["mrkn@mrkn.jp"] - - s.summary = "Arbitrary-precision decimal floating-point number library." - s.description = "This library provides arbitrary-precision decimal floating-point number class." - s.homepage = "https://github.com/ruby/bigdecimal" - s.licenses = ["Ruby", "BSD-2-Clause"] - - s.require_paths = %w[lib] - s.files = %w[ - LICENSE - bigdecimal.gemspec - lib/bigdecimal.rb - lib/bigdecimal/jacobian.rb - lib/bigdecimal/ludcmp.rb - lib/bigdecimal/math.rb - lib/bigdecimal/math/erf.rb - lib/bigdecimal/math/gamma.rb - lib/bigdecimal/newton.rb - lib/bigdecimal/util.rb - sample/linear.rb - sample/nlsolve.rb - sample/pi.rb - sig/big_decimal_util.rbs - sig/big_decimal.rbs - sig/big_math.rbs - ] - if Gem::Platform === s.platform and s.platform =~ 'java' or RUBY_ENGINE == 'jruby' - s.platform = 'java' - else - s.extensions = %w[ext/bigdecimal/extconf.rb] - s.files += %w[ - ext/bigdecimal/bigdecimal.c - ext/bigdecimal/bigdecimal.h - ext/bigdecimal/bits.h - ext/bigdecimal/div.h - ext/bigdecimal/feature.h - ext/bigdecimal/missing.c - ext/bigdecimal/missing.h - ext/bigdecimal/ntt.h - ext/bigdecimal/missing/dtoa.c - ext/bigdecimal/static_assert.h - ] - end - - s.required_ruby_version = Gem::Requirement.new(">= 2.6.0") - - s.metadata["changelog_uri"] = s.homepage + "/blob/master/CHANGES.md" -end diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/Makefile b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/Makefile deleted file mode 100644 index af54452..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/Makefile +++ /dev/null @@ -1,270 +0,0 @@ - -SHELL = /bin/sh - -# V=0 quiet, V=1 verbose. other values don't work. -V = 0 -V0 = $(V:0=) -Q1 = $(V:1=) -Q = $(Q1:0=@) -ECHO1 = $(V:1=@ :) -ECHO = $(ECHO1:0=@ echo) -NULLCMD = : - -#### Start of system configuration section. #### - -srcdir = . -topdir = /opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0 -hdrdir = $(topdir) -arch_hdrdir = /opt/hostedtoolcache/Ruby/3.3.13/x64/include/ruby-3.3.0/x86_64-linux -PATH_SEPARATOR = : -VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby -prefix = $(DESTDIR)/opt/hostedtoolcache/Ruby/3.3.13/x64 -rubysitearchprefix = $(rubylibprefix)/$(sitearch) -rubyarchprefix = $(rubylibprefix)/$(arch) -rubylibprefix = $(libdir)/$(RUBY_BASE_NAME) -exec_prefix = $(prefix) -vendorarchhdrdir = $(vendorhdrdir)/$(sitearch) -sitearchhdrdir = $(sitehdrdir)/$(sitearch) -rubyarchhdrdir = $(rubyhdrdir)/$(arch) -vendorhdrdir = $(rubyhdrdir)/vendor_ruby -sitehdrdir = $(rubyhdrdir)/site_ruby -rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME) -vendorarchdir = $(vendorlibdir)/$(sitearch) -vendorlibdir = $(vendordir)/$(ruby_version) -vendordir = $(rubylibprefix)/vendor_ruby -sitearchdir = $(sitelibdir)/$(sitearch) -sitelibdir = $(sitedir)/$(ruby_version) -sitedir = $(rubylibprefix)/site_ruby -rubyarchdir = $(rubylibdir)/$(arch) -rubylibdir = $(rubylibprefix)/$(ruby_version) -sitearchincludedir = $(includedir)/$(sitearch) -archincludedir = $(includedir)/$(arch) -sitearchlibdir = $(libdir)/$(sitearch) -archlibdir = $(libdir)/$(arch) -ridir = $(datarootdir)/$(RI_BASE_NAME) -mandir = $(datarootdir)/man -localedir = $(datarootdir)/locale -libdir = $(exec_prefix)/lib -psdir = $(docdir) -pdfdir = $(docdir) -dvidir = $(docdir) -htmldir = $(docdir) -infodir = $(datarootdir)/info -docdir = $(datarootdir)/doc/$(PACKAGE) -oldincludedir = $(DESTDIR)/usr/include -includedir = $(prefix)/include -runstatedir = $(localstatedir)/run -localstatedir = $(prefix)/var -sharedstatedir = $(prefix)/com -sysconfdir = $(prefix)/etc -datadir = $(datarootdir) -datarootdir = $(prefix)/share -libexecdir = $(exec_prefix)/libexec -sbindir = $(exec_prefix)/sbin -bindir = $(exec_prefix)/bin -archdir = $(rubyarchdir) - - -CC_WRAPPER = -CC = gcc -CXX = g++ -LIBRUBY = $(LIBRUBY_SO) -LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a -LIBRUBYARG_SHARED = -Wl,-rpath,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME) -LIBRUBYARG_STATIC = -Wl,-rpath,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)-static $(MAINLIBS) -empty = -OUTFLAG = -o $(empty) -COUTFLAG = -o $(empty) -CSRCFLAG = $(empty) - -RUBY_EXTCONF_H = -cflags = $(optflags) $(debugflags) $(warnflags) -cxxflags = -optflags = -O3 -fno-fast-math -debugflags = -ggdb3 -warnflags = -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wold-style-definition -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wmisleading-indentation -Wundef -cppflags = -CCDLFLAGS = -fPIC -CFLAGS = $(CCDLFLAGS) $(cflags) -fPIC $(ARCH_FLAG) -INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir) -DEFS = -CPPFLAGS = -DHAVE_BUILTIN___BUILTIN_CLZ -DHAVE_BUILTIN___BUILTIN_CLZL -DHAVE_BUILTIN___BUILTIN_CLZLL -DHAVE_FLOAT_H -DHAVE_MATH_H -DHAVE_STDBOOL_H -DHAVE_STDLIB_H -DHAVE_X86INTRIN_H -DHAVE_RUBY_ATOMIC_H -DHAVE_RUBY_INTERNAL_HAS_BUILTIN_H -DHAVE_RUBY_INTERNAL_STATIC_ASSERT_H -DHAVE_RB_COMPLEX_REAL -DHAVE_RB_COMPLEX_IMAG -DHAVE_RB_OPTS_EXCEPTION_P -DHAVE_RB_CATEGORY_WARN -DHAVE_CONST_RB_WARN_CATEGORY_DEPRECATED -DHAVE_CONST_RUBY_TYPED_EMBEDDABLE -DENABLE_PATH_CHECK=0 $(DEFS) $(cppflags) -CXXFLAGS = $(CCDLFLAGS) $(ARCH_FLAG) -ldflags = -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed -dldflags = -Wl,--compress-debug-sections=zlib -ARCH_FLAG = -DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG) -LDSHARED = $(CC) -shared -LDSHAREDXX = $(CXX) -shared -AR = gcc-ar -EXEEXT = - -RUBY_INSTALL_NAME = $(RUBY_BASE_NAME) -RUBY_SO_NAME = ruby -RUBYW_INSTALL_NAME = -RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version) -RUBYW_BASE_NAME = rubyw -RUBY_BASE_NAME = ruby - -arch = x86_64-linux -sitearch = $(arch) -ruby_version = 3.3.0 -ruby = $(bindir)/$(RUBY_BASE_NAME) -RUBY = $(ruby) -BUILTRUBY = $(bindir)/$(RUBY_BASE_NAME) -ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h - -RM = rm -f -RM_RF = rm -fr -RMDIRS = rmdir --ignore-fail-on-non-empty -p -MAKEDIRS = /usr/bin/mkdir -p -INSTALL = /usr/bin/install -c -INSTALL_PROG = $(INSTALL) -m 0755 -INSTALL_DATA = $(INSTALL) -m 644 -COPY = cp -TOUCH = exit > - -#### End of system configuration section. #### - -preload = -libpath = . $(libdir) -LIBPATH = -L. -L$(libdir) -Wl,-rpath,$(libdir) -DEFFILE = - -CLEANFILES = mkmf.log -DISTCLEANFILES = -DISTCLEANDIRS = - -extout = -extout_prefix = -target_prefix = -LOCAL_LIBS = -LIBS = $(LIBRUBYARG_SHARED) -lm -lpthread -lc -ORIG_SRCS = bigdecimal.c missing.c -SRCS = $(ORIG_SRCS) -OBJS = bigdecimal.o missing.o -HDRS = $(srcdir)/bigdecimal.h $(srcdir)/bits.h $(srcdir)/div.h $(srcdir)/feature.h $(srcdir)/missing.h $(srcdir)/ntt.h $(srcdir)/static_assert.h -LOCAL_HDRS = -TARGET = bigdecimal -TARGET_NAME = bigdecimal -TARGET_ENTRY = Init_$(TARGET_NAME) -DLLIB = $(TARGET).so -EXTSTATIC = -STATIC_LIB = - -TIMESTAMP_DIR = . -BINDIR = $(bindir) -RUBYCOMMONDIR = $(sitedir)$(target_prefix) -RUBYLIBDIR = $(sitelibdir)$(target_prefix) -RUBYARCHDIR = $(sitearchdir)$(target_prefix) -HDRDIR = $(sitehdrdir)$(target_prefix) -ARCHHDRDIR = $(sitearchhdrdir)$(target_prefix) -TARGET_SO_DIR = -TARGET_SO = $(TARGET_SO_DIR)$(DLLIB) -CLEANLIBS = $(TARGET_SO) false -CLEANOBJS = $(OBJS) *.bak -TARGET_SO_DIR_TIMESTAMP = $(TIMESTAMP_DIR)/.sitearchdir.time -BIGDECIMAL_RB = $(srcdir)/../../lib/bigdecimal.rb - -all: $(DLLIB) -static: $(STATIC_LIB) -.PHONY: all install static install-so install-rb -.PHONY: clean clean-so clean-static clean-rb - -clean-static:: -clean-rb-default:: -clean-rb:: -clean-so:: -clean: clean-so clean-static clean-rb-default clean-rb - -$(Q)$(RM_RF) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time - -distclean-rb-default:: -distclean-rb:: -distclean-so:: -distclean-static:: -distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb - -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log - -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES) - -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true - -realclean: distclean -install: install-so install-rb - -install-so: $(DLLIB) $(TARGET_SO_DIR_TIMESTAMP) - $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR) -clean-static:: - -$(Q)$(RM) $(STATIC_LIB) -install-rb: pre-install-rb do-install-rb install-rb-default -install-rb-default: pre-install-rb-default do-install-rb-default -pre-install-rb: Makefile -pre-install-rb-default: Makefile -do-install-rb: -do-install-rb-default: -pre-install-rb-default: - @$(NULLCMD) -$(TARGET_SO_DIR_TIMESTAMP): - $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR) - $(Q) $(TOUCH) $@ - -site-install: site-install-so site-install-rb -site-install-so: install-so -site-install-rb: install-rb - -.SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S - -.cc.o: - $(ECHO) compiling $(<) - $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$< - -.cc.S: - $(ECHO) translating $(<) - $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$< - -.mm.o: - $(ECHO) compiling $(<) - $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$< - -.mm.S: - $(ECHO) translating $(<) - $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$< - -.cxx.o: - $(ECHO) compiling $(<) - $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$< - -.cxx.S: - $(ECHO) translating $(<) - $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$< - -.cpp.o: - $(ECHO) compiling $(<) - $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$< - -.cpp.S: - $(ECHO) translating $(<) - $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$< - -.c.o: - $(ECHO) compiling $(<) - $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$< - -.c.S: - $(ECHO) translating $(<) - $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$< - -.m.o: - $(ECHO) compiling $(<) - $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$< - -.m.S: - $(ECHO) translating $(<) - $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$< - -$(TARGET_SO): $(OBJS) Makefile - $(ECHO) linking shared-object $(DLLIB) - -$(Q)$(RM) $(@) - $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS) - - - -$(OBJS): $(HDRS) $(ruby_headers) diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/bigdecimal.c b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/bigdecimal.c deleted file mode 100644 index e934e34..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/bigdecimal.c +++ /dev/null @@ -1,6223 +0,0 @@ -/* - * - * Ruby BigDecimal(Variable decimal precision) extension library. - * - * Copyright(C) 2002 by Shigeo Kobayashi(shigeo@tinyforest.gr.jp) - * - */ - -/* #define BIGDECIMAL_DEBUG 1 */ - -#include "bigdecimal.h" -#include "ruby/util.h" - -#ifndef BIGDECIMAL_DEBUG -# undef NDEBUG -# define NDEBUG -#endif -#include - -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_IEEEFP_H -#include -#endif - -#include "bits.h" -#include "ntt.h" -#include "div.h" -#include "static_assert.h" - -#define BIGDECIMAL_VERSION "4.1.3" - -/* Make sure VPMULT_BATCH_SIZE*BASE*BASE does not overflow DECDIG_DBL */ -#define VPMULT_BATCH_SIZE 16 -#define NTT_MULTIPLICATION_THRESHOLD 450 -#define NEWTON_RAPHSON_DIVISION_THRESHOLD 100 -#define SIGNED_VALUE_MAX INTPTR_MAX -#define SIGNED_VALUE_MIN INTPTR_MIN -#define MUL_OVERFLOW_SIGNED_VALUE_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, SIGNED_VALUE_MIN, SIGNED_VALUE_MAX) -#define ADD_OVERFLOW_SIGNED_VALUE_P(a, b) ADD_OVERFLOW_SIGNED_INTEGER_P(a, b, SIGNED_VALUE_MIN, SIGNED_VALUE_MAX) - -/* max_value = 0.9999_9999_9999E[exponent], exponent <= SIGNED_VALUE_MAX */ -#define VP_EXPONENT_MAX (SIGNED_VALUE_MAX / BASE_FIG) -/* min_value = 0.0001_0000_0000E[exponent], exponent-(BASE_FIG-1) >= SIGNED_VALUE_MIN */ -#define VP_EXPONENT_MIN ((SIGNED_VALUE_MIN + BASE_FIG - 1) / BASE_FIG) -#define EXPONENT_MAX (VP_EXPONENT_MAX * BASE_FIG) -#define EXPONENT_MIN (VP_EXPONENT_MIN * BASE_FIG - (BASE_FIG - 1)) - -VALUE rb_cBigDecimal; - -static ID id_BigDecimal_exception_mode; -static ID id_BigDecimal_rounding_mode; -static ID id_BigDecimal_precision_limit; - -static ID id_up; -static ID id_down; -static ID id_truncate; -static ID id_half_up; -static ID id_default; -static ID id_half_down; -static ID id_half_even; -static ID id_banker; -static ID id_ceiling; -static ID id_ceil; -static ID id_floor; -static ID id_eq; -static ID id_half; - -#define RBD_NUM_ROUNDING_MODES 11 - -static struct { - ID id; - uint8_t mode; -} rbd_rounding_modes[RBD_NUM_ROUNDING_MODES]; - -static inline BDVALUE -bdvalue_nonnullable(NULLABLE_BDVALUE v) -{ - assert(v.real_or_null != NULL); - return (BDVALUE) { v.bigdecimal_or_nil, v.real_or_null }; -} - -static inline NULLABLE_BDVALUE -bdvalue_nullable(BDVALUE v) -{ - return (NULLABLE_BDVALUE) { v.bigdecimal, v.real }; -} - -#define BASE_FIG BIGDECIMAL_COMPONENT_FIGURES -#define BASE BIGDECIMAL_BASE - -#define HALF_BASE (BASE/2) -#define BASE1 (BASE/10) - -#ifndef MAYBE_UNUSED -# define MAYBE_UNUSED(x) x -#endif - -#define BIGDECIMAL_POSITIVE_P(bd) ((bd)->sign > 0) -#define BIGDECIMAL_NEGATIVE_P(bd) ((bd)->sign < 0) - -/* - * ================== Memory allocation ============================ - */ - -#ifdef BIGDECIMAL_DEBUG -static size_t rbd_allocation_count = 0; /* Memory allocation counter */ -static inline void -atomic_allocation_count_inc(void) -{ - RUBY_ATOMIC_SIZE_INC(rbd_allocation_count); -} -static inline void -atomic_allocation_count_dec_nounderflow(void) -{ - if (rbd_allocation_count == 0) return; - RUBY_ATOMIC_SIZE_DEC(rbd_allocation_count); -} -static void -check_allocation_count_nonzero(void) -{ - if (rbd_allocation_count != 0) return; - rb_bug("[bigdecimal][rbd_free_struct] Too many memory free calls"); -} -#else -# define atomic_allocation_count_inc() /* nothing */ -# define atomic_allocation_count_dec_nounderflow() /* nothing */ -# define check_allocation_count_nonzero() /* nothing */ -#endif /* BIGDECIMAL_DEBUG */ - -/* VpMult VpDivd helpers */ -#define VPMULT_RESULT_PREC(a, b) (a->Prec + b->Prec) -/* To calculate VpDivd with n-digits precision, quotient needs n+2*BASE_FIG-1 digits space */ -/* In the worst precision case 0001_1111_1111 / 9999 = 0000_0001_1112, there are 2*BASE_FIG-1 leading zeros */ -#define VPDIVD_QUO_DIGITS(required_digits) ((required_digits) + 2 * BASE_FIG - 1) -/* Required r.MaxPrec for calculating VpDivd(c, r, a, b) */ -#define VPDIVD_REM_PREC(a, b, c) Max(a->Prec, b->Prec + c->MaxPrec - 1) - -static NULLABLE_BDVALUE -CreateFromString(const char *str, VALUE klass, bool strict_p, bool raise_exception); - -PUREFUNC(static inline size_t rbd_struct_size(size_t const)); - -static inline size_t -rbd_struct_size(size_t const internal_digits) -{ - size_t const frac_len = (internal_digits == 0) ? 1 : internal_digits; - return offsetof(Real, frac) + frac_len * sizeof(DECDIG); -} - -/* - * ================== Ruby Interface part ========================== - */ -#define DoSomeOne(x,y,f) rb_num_coerce_bin(x,y,f) - -/* - * VP routines used in BigDecimal part - */ -static unsigned short VpGetException(void); -static void VpSetException(unsigned short f); -static void VpCheckException(Real *p, bool always); -static VALUE CheckGetValue(BDVALUE v); -static void VpInternalRound(Real *c, size_t ixDigit, DECDIG vPrev, DECDIG v); -static int VpLimitRound(Real *c, size_t ixDigit); -static int VPrint(FILE *fp,const char *cntl_chr,Real *a); - -/* - * **** BigDecimal part **** - */ - -static VALUE BigDecimal_nan(void); -static VALUE BigDecimal_positive_infinity(void); -static VALUE BigDecimal_negative_infinity(void); -static VALUE BigDecimal_positive_zero(void); -static VALUE BigDecimal_negative_zero(void); -static VALUE BigDecimal_addsub_with_coerce(VALUE self, VALUE r, size_t prec, int operation); -static VALUE BigDecimal_mult_with_coerce(VALUE self, VALUE r, size_t prec); - -#ifndef HAVE_RB_EXT_RACTOR_SAFE -# undef RUBY_TYPED_FROZEN_SHAREABLE -# define RUBY_TYPED_FROZEN_SHAREABLE 0 -#endif - -#ifdef RUBY_TYPED_EMBEDDABLE -# define HAVE_RUBY_TYPED_EMBEDDABLE 1 -#else -# ifdef HAVE_CONST_RUBY_TYPED_EMBEDDABLE -# define RUBY_TYPED_EMBEDDABLE RUBY_TYPED_EMBEDDABLE -# define HAVE_RUBY_TYPED_EMBEDDABLE 1 -# else -# define RUBY_TYPED_EMBEDDABLE 0 -# endif -#endif - -static size_t -BigDecimal_memsize(const void *ptr) -{ -#ifdef HAVE_RUBY_TYPED_EMBEDDABLE - return 0; // Entirely embedded -#else - const Real *pv = ptr; - return (sizeof(*pv) + pv->MaxPrec * sizeof(DECDIG)); -#endif -} - -#ifndef RUBY_TYPED_THREAD_SAFE_FREE -#define RUBY_TYPED_THREAD_SAFE_FREE RUBY_TYPED_FREE_IMMEDIATELY -#endif - -static const rb_data_type_t BigDecimal_data_type = { - .wrap_struct_name = "BigDecimal", - .function = { - .dmark = 0, - .dfree = RUBY_DEFAULT_FREE, - .dsize = BigDecimal_memsize, - }, - .flags = RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_FROZEN_SHAREABLE | RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_EMBEDDABLE, -}; - -static VALUE -BigDecimal_allocate(size_t const internal_digits) -{ - const size_t size = rbd_struct_size(internal_digits); - VALUE bd = rb_data_typed_object_zalloc(rb_cBigDecimal, size, &BigDecimal_data_type); - Real *vp; - TypedData_Get_Struct(bd, Real, &BigDecimal_data_type, vp); - vp->MaxPrec = internal_digits; - RB_OBJ_FREEZE(bd); - return bd; -} - -static VALUE -BigDecimal_allocate_decimal_digits(size_t const decimal_digits) -{ - return BigDecimal_allocate(roomof(decimal_digits, BASE_FIG)); -} - -static Real * -VpPtr(VALUE obj) -{ - Real *vp; - TypedData_Get_Struct(obj, Real, &BigDecimal_data_type, vp); - return vp; -} - -MAYBE_UNUSED(static inline BDVALUE rbd_allocate_struct_zero_wrap(int sign, size_t const digits)); -#define NewZeroWrap rbd_allocate_struct_zero_wrap -static BDVALUE -rbd_allocate_struct_zero_wrap(int sign, size_t const digits) -{ - VALUE obj = BigDecimal_allocate_decimal_digits(digits); - Real *real = VpPtr(obj); - VpSetZero(real, sign); - return (BDVALUE) { obj, real }; -} - -static inline int -is_kind_of_BigDecimal(VALUE const v) -{ - return rb_typeddata_is_kind_of(v, &BigDecimal_data_type); -} - -NORETURN(static void cannot_be_coerced_into_BigDecimal(VALUE, VALUE)); - -static void -cannot_be_coerced_into_BigDecimal(VALUE exc_class, VALUE v) -{ - VALUE str; - - if (rb_special_const_p(v)) { - str = rb_inspect(v); - } - else { - str = rb_class_name(rb_obj_class(v)); - } - - str = rb_str_cat2(rb_str_dup(str), " can't be coerced into BigDecimal"); - rb_exc_raise(rb_exc_new3(exc_class, str)); -} - -static inline VALUE BigDecimal_div2(VALUE, VALUE, VALUE); -static VALUE rb_inum_convert_to_BigDecimal(VALUE val); -static VALUE rb_float_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception); -static VALUE rb_rational_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception); -static VALUE rb_cstr_convert_to_BigDecimal(const char *c_str, int raise_exception); -static VALUE rb_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception); - -static NULLABLE_BDVALUE -GetBDValueWithPrecInternal(VALUE v, size_t prec, int must) -{ - switch(TYPE(v)) { - case T_FLOAT: - v = rb_float_convert_to_BigDecimal(v, 0, true); - break; - - case T_RATIONAL: - v = rb_rational_convert_to_BigDecimal(v, prec, true); - break; - - case T_DATA: - if (!is_kind_of_BigDecimal(v)) { - goto SomeOneMayDoIt; - } - break; - - case T_FIXNUM: - case T_BIGNUM: { - v = rb_inum_convert_to_BigDecimal(v); - break; - } - - default: - goto SomeOneMayDoIt; - } - - Real *vp = VpPtr(v); - return (NULLABLE_BDVALUE) { v, vp }; - -SomeOneMayDoIt: - if (must) { - cannot_be_coerced_into_BigDecimal(rb_eTypeError, v); - } - return (NULLABLE_BDVALUE) { Qnil, NULL }; /* NULL means to coerce */ -} - -static inline NULLABLE_BDVALUE -GetBDValueWithPrec(VALUE v, size_t prec) -{ - return GetBDValueWithPrecInternal(v, prec, 0); -} - - -static inline BDVALUE -GetBDValueWithPrecMust(VALUE v, size_t prec) -{ - return bdvalue_nonnullable(GetBDValueWithPrecInternal(v, prec, 1)); -} - -// self must be a receiver of BigDecimal instance method or a gc guarded BigDecimal object. -static inline Real* -GetSelfVpValue(VALUE self) -{ - return GetBDValueWithPrecMust(self, 0).real; -} - -static inline BDVALUE -GetBDValueMust(VALUE v) -{ - return GetBDValueWithPrecMust(v, 0); -} - -/* call-seq: - * BigDecimal.double_fig -> integer - * - * Returns the number of digits a Float object is allowed to have; - * the result is system-dependent: - * - * BigDecimal.double_fig # => 16 - * - */ -static inline VALUE -BigDecimal_double_fig(VALUE self) -{ - return INT2FIX(BIGDECIMAL_DOUBLE_FIGURES); -} - -static void -VpCountPrecisionAndScale(Real *p, ssize_t *out_precision, ssize_t *out_scale) -{ - if (out_precision == NULL && out_scale == NULL) - return; - if (VpIsZero(p) || !VpIsDef(p)) { - zero: - if (out_precision) *out_precision = 0; - if (out_scale) *out_scale = 0; - return; - } - - DECDIG x; - - ssize_t n = p->Prec; /* The length of frac without zeros. */ - while (n > 0 && p->frac[n-1] == 0) --n; - if (n == 0) goto zero; - - int nlz = BASE_FIG; - for (x = p->frac[0]; x > 0; x /= 10) --nlz; - - int ntz = 0; - for (x = p->frac[n-1]; x > 0 && x % 10 == 0; x /= 10) ++ntz; - - /* - * Calculate the precision and the scale - * ------------------------------------- - * - * The most significant digit is frac[0], and the least significant digit - * is frac[Prec-1]. When the exponent is zero, the decimal point is - * located just before frac[0]. - * - * When the exponent is negative, the decimal point moves to leftward. - * In this case, the precision can be calculated by - * - * precision = BASE_FIG * (-exponent + n) - ntz, - * - * and the scale is the same as precision. - * - * 0 . 0000 0000 | frac[0] ... frac[n-1] | - * |<----------| exponent == -2 | - * |---------------------------------->| precision - * |---------------------------------->| scale - * - * - * Conversely, when the exponent is positive, the decimal point moves to - * rightward. In this case, the scale equals to - * - * BASE_FIG * (n - exponent) - ntz. - * - * the precision equals to - * - * scale + BASE_FIG * exponent - nlz. - * - * | frac[0] frac[1] . frac[2] ... frac[n-1] | - * |---------------->| exponent == 2 | - * | |---------------------->| scale - * |---------------------------------------->| precision - */ - - ssize_t ex = p->exponent; - - /* Count the number of decimal digits before frac[1]. */ - ssize_t n_digits_head = BASE_FIG; - if (ex < 0) { - n_digits_head += (-ex) * BASE_FIG; /* The number of leading zeros before frac[0]. */ - ex = 0; - } - else if (ex > 0) { - /* Count the number of decimal digits without the leading zeros in - * the most significant digit in the integral part. - */ - n_digits_head -= nlz; /* Make the number of digits */ - } - - if (out_precision) { - ssize_t precision = n_digits_head; - - /* Count the number of decimal digits after frac[0]. */ - if (ex > (ssize_t)n) { - /* In this case the number is an integer with some trailing zeros. */ - precision += (ex - 1) * BASE_FIG; - } - else if (n > 0) { - precision += (n - 1) * BASE_FIG; - - if (ex < (ssize_t)n) { - precision -= ntz; - } - } - - *out_precision = precision; - } - - if (out_scale) { - ssize_t scale = 0; - - if (p->exponent < 0) { - scale = n_digits_head + (n - 1) * BASE_FIG - ntz; - } - else if (n > p->exponent) { - scale = (n - p->exponent) * BASE_FIG - ntz; - } - - *out_scale = scale; - } -} - -static void -BigDecimal_count_precision_and_scale(VALUE self, ssize_t *out_precision, ssize_t *out_scale) -{ - BDVALUE v = GetBDValueMust(self); - VpCountPrecisionAndScale(v.real, out_precision, out_scale); - RB_GC_GUARD(v.bigdecimal); -} - -/* - * call-seq: - * precision -> integer - * - * Returns the number of decimal digits in +self+: - * - * BigDecimal("0").precision # => 0 - * BigDecimal("1").precision # => 1 - * BigDecimal("1.1").precision # => 2 - * BigDecimal("3.1415").precision # => 5 - * BigDecimal("-1e20").precision # => 21 - * BigDecimal("1e-20").precision # => 20 - * BigDecimal("Infinity").precision # => 0 - * BigDecimal("-Infinity").precision # => 0 - * BigDecimal("NaN").precision # => 0 - * - */ -static VALUE -BigDecimal_precision(VALUE self) -{ - ssize_t precision; - BigDecimal_count_precision_and_scale(self, &precision, NULL); - return SSIZET2NUM(precision); -} - -/* - * call-seq: - * scale -> integer - * - * Returns the number of decimal digits following the decimal digits in +self+. - * - * BigDecimal("0").scale # => 0 - * BigDecimal("1").scale # => 0 - * BigDecimal("1.1").scale # => 1 - * BigDecimal("3.1415").scale # => 4 - * BigDecimal("-1e20").scale # => 0 - * BigDecimal("1e-20").scale # => 20 - * BigDecimal("Infinity").scale # => 0 - * BigDecimal("-Infinity").scale # => 0 - * BigDecimal("NaN").scale # => 0 - */ -static VALUE -BigDecimal_scale(VALUE self) -{ - ssize_t scale; - BigDecimal_count_precision_and_scale(self, NULL, &scale); - return SSIZET2NUM(scale); -} - -/* - * call-seq: - * precision_scale -> [integer, integer] - * - * Returns a 2-length array; the first item is the result of - * BigDecimal#precision and the second one is of BigDecimal#scale. - * - * See BigDecimal#precision. - * See BigDecimal#scale. - */ -static VALUE -BigDecimal_precision_scale(VALUE self) -{ - ssize_t precision, scale; - BigDecimal_count_precision_and_scale(self, &precision, &scale); - return rb_assoc_new(SSIZET2NUM(precision), SSIZET2NUM(scale)); -} - -/* - * call-seq: - * n_significant_digits -> integer - * - * Returns the number of decimal significant digits in +self+. - * - * BigDecimal("0").n_significant_digits # => 0 - * BigDecimal("1").n_significant_digits # => 1 - * BigDecimal("1.1").n_significant_digits # => 2 - * BigDecimal("3.1415").n_significant_digits # => 5 - * BigDecimal("-1e20").n_significant_digits # => 1 - * BigDecimal("1e-20").n_significant_digits # => 1 - * BigDecimal("Infinity").n_significant_digits # => 0 - * BigDecimal("-Infinity").n_significant_digits # => 0 - * BigDecimal("NaN").n_significant_digits # => 0 - */ -static VALUE -BigDecimal_n_significant_digits(VALUE self) -{ - BDVALUE v = GetBDValueMust(self); - if (VpIsZero(v.real) || !VpIsDef(v.real)) { - return INT2FIX(0); - } - - ssize_t n = v.real->Prec; /* The length of frac without trailing zeros. */ - for (n = v.real->Prec; n > 0 && v.real->frac[n-1] == 0; --n); - if (n == 0) return INT2FIX(0); - - DECDIG x; - int nlz = BASE_FIG; - for (x = v.real->frac[0]; x > 0; x /= 10) --nlz; - - int ntz = 0; - for (x = v.real->frac[n-1]; x > 0 && x % 10 == 0; x /= 10) ++ntz; - - RB_GC_GUARD(v.bigdecimal); - ssize_t n_significant_digits = BASE_FIG*n - nlz - ntz; - return SSIZET2NUM(n_significant_digits); -} - -/* - * call-seq: - * hash -> integer - * - * Returns the integer hash value for +self+. - * - * Two instances of \BigDecimal have the same hash value if and only if - * they have equal: - * - * - Sign. - * - Fractional part. - * - Exponent. - * - */ -static VALUE -BigDecimal_hash(VALUE self) -{ - BDVALUE v = GetBDValueMust(self); - st_index_t hash = (st_index_t)v.real->sign; - /* hash!=2: the case for 0(1),NaN(0) or +-Infinity(3) is sign itself */ - if(hash == 2 || hash == (st_index_t)-2) { - hash ^= rb_memhash(v.real->frac, sizeof(DECDIG)*v.real->Prec); - hash += v.real->exponent; - } - RB_GC_GUARD(v.bigdecimal); - return ST2FIX(hash); -} - -/* - * call-seq: - * _dump -> string - * - * Returns a string representing the marshalling of +self+. - * See module Marshal. - * - * inf = BigDecimal('Infinity') # => Infinity - * dumped = inf._dump # => "9:Infinity" - * BigDecimal._load(dumped) # => Infinity - * - */ -static VALUE -BigDecimal_dump(int argc, VALUE *argv, VALUE self) -{ - BDVALUE v; - char *psz; - VALUE dummy; - volatile VALUE dump; - size_t len; - - rb_scan_args(argc, argv, "01", &dummy); - v = GetBDValueMust(self); - dump = rb_str_new(0, VpNumOfChars(v.real, "E")+50); - psz = RSTRING_PTR(dump); - snprintf(psz, RSTRING_LEN(dump), "%"PRIuSIZE":", v.real->Prec*VpBaseFig()); - len = strlen(psz); - VpToString(v.real, psz+len, RSTRING_LEN(dump)-len, 0, 0); - rb_str_resize(dump, strlen(psz)); - - RB_GC_GUARD(v.bigdecimal); - return dump; -} - -/* - * Internal method used to provide marshalling support. See the Marshal module. - */ -static VALUE -BigDecimal_load(VALUE self, VALUE str) -{ - BDVALUE v; - unsigned char *pch; - unsigned char ch; - - pch = (unsigned char *)StringValueCStr(str); - /* First skip max prec. Don't trust the value. */ - while((*pch) != (unsigned char)'\0' && (ch = *pch++) != (unsigned char)':') { - if(!ISDIGIT(ch)) { - rb_raise(rb_eTypeError, "load failed: invalid character in the marshaled string"); - } - } - v = bdvalue_nonnullable(CreateFromString((char *)pch, self, true, true)); - RB_GC_GUARD(str); - return CheckGetValue(v); -} - -static unsigned short -check_rounding_mode_option(VALUE const opts) -{ - VALUE mode; - char const *s; - long l; - - assert(RB_TYPE_P(opts, T_HASH)); - - if (NIL_P(opts)) - goto no_opt; - - mode = rb_hash_lookup2(opts, ID2SYM(id_half), Qundef); - if (mode == Qundef || NIL_P(mode)) - goto no_opt; - - if (SYMBOL_P(mode)) - mode = rb_sym2str(mode); - else if (!RB_TYPE_P(mode, T_STRING)) { - VALUE str_mode = rb_check_string_type(mode); - if (NIL_P(str_mode)) - goto invalid; - mode = str_mode; - } - s = RSTRING_PTR(mode); - l = RSTRING_LEN(mode); - switch (l) { - case 2: - if (strncasecmp(s, "up", 2) == 0) - return VP_ROUND_HALF_UP; - break; - case 4: - if (strncasecmp(s, "even", 4) == 0) - return VP_ROUND_HALF_EVEN; - else if (strncasecmp(s, "down", 4) == 0) - return VP_ROUND_HALF_DOWN; - break; - default: - break; - } - - invalid: - rb_raise(rb_eArgError, "invalid rounding mode (%"PRIsVALUE")", mode); - - no_opt: - return VpGetRoundMode(); -} - -static unsigned short -check_rounding_mode(VALUE const v) -{ - unsigned short sw; - ID id; - if (RB_TYPE_P(v, T_SYMBOL)) { - int i; - id = SYM2ID(v); - for (i = 0; i < RBD_NUM_ROUNDING_MODES; ++i) { - if (rbd_rounding_modes[i].id == id) { - return rbd_rounding_modes[i].mode; - } - } - rb_raise(rb_eArgError, "invalid rounding mode (%"PRIsVALUE")", v); - } - else { - sw = NUM2USHORT(v); - if (!VpIsRoundMode(sw)) { - rb_raise(rb_eArgError, "invalid rounding mode (%"PRIsVALUE")", v); - } - return sw; - } -} - -/* call-seq: - * BigDecimal.mode(mode, setting = nil) -> integer - * - * Returns an integer representing the mode settings - * for exception handling and rounding. - * - * These modes control exception handling: - * - * - \BigDecimal::EXCEPTION_NaN. - * - \BigDecimal::EXCEPTION_INFINITY. - * - \BigDecimal::EXCEPTION_UNDERFLOW. - * - \BigDecimal::EXCEPTION_OVERFLOW. - * - \BigDecimal::EXCEPTION_ZERODIVIDE. - * - \BigDecimal::EXCEPTION_ALL. - * - * Values for +setting+ for exception handling: - * - * - +true+: sets the given +mode+ to +true+. - * - +false+: sets the given +mode+ to +false+. - * - +nil+: does not modify the mode settings. - * - * You can use method BigDecimal.save_exception_mode - * to temporarily change, and then automatically restore, exception modes. - * - * For clarity, some examples below begin by setting all - * exception modes to +false+. - * - * This mode controls the way rounding is to be performed: - * - * - \BigDecimal::ROUND_MODE - * - * You can use method BigDecimal.save_rounding_mode - * to temporarily change, and then automatically restore, the rounding mode. - * - * NaNs - * - * Mode \BigDecimal::EXCEPTION_NaN controls behavior - * when a \BigDecimal NaN is created. - * - * Settings: - * - * - +false+ (default): Returns BigDecimal('NaN'). - * - +true+: Raises FloatDomainError. - * - * Examples: - * - * BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0 - * BigDecimal('NaN') # => NaN - * BigDecimal.mode(BigDecimal::EXCEPTION_NaN, true) # => 2 - * BigDecimal('NaN') # Raises FloatDomainError - * - * Infinities - * - * Mode \BigDecimal::EXCEPTION_INFINITY controls behavior - * when a \BigDecimal Infinity or -Infinity is created. - * Settings: - * - * - +false+ (default): Returns BigDecimal('Infinity') - * or BigDecimal('-Infinity'). - * - +true+: Raises FloatDomainError. - * - * Examples: - * - * BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0 - * BigDecimal('Infinity') # => Infinity - * BigDecimal('-Infinity') # => -Infinity - * BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, true) # => 1 - * BigDecimal('Infinity') # Raises FloatDomainError - * BigDecimal('-Infinity') # Raises FloatDomainError - * - * Underflow - * - * Mode \BigDecimal::EXCEPTION_UNDERFLOW controls behavior - * when a \BigDecimal underflow occurs. - * Settings: - * - * - +false+ (default): Returns BigDecimal('0') - * or BigDecimal('-Infinity'). - * - +true+: Raises FloatDomainError. - * - * Examples: - * - * BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0 - * def flow_under - * x = BigDecimal('0.1') - * 100.times { x *= x } - * end - * flow_under # => 100 - * BigDecimal.mode(BigDecimal::EXCEPTION_UNDERFLOW, true) # => 4 - * flow_under # Raises FloatDomainError - * - * Overflow - * - * Mode \BigDecimal::EXCEPTION_OVERFLOW controls behavior - * when a \BigDecimal overflow occurs. - * Settings: - * - * - +false+ (default): Returns BigDecimal('Infinity') - * or BigDecimal('-Infinity'). - * - +true+: Raises FloatDomainError. - * - * Examples: - * - * BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0 - * def flow_over - * x = BigDecimal('10') - * 100.times { x *= x } - * end - * flow_over # => 100 - * BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, true) # => 1 - * flow_over # Raises FloatDomainError - * - * Zero Division - * - * Mode \BigDecimal::EXCEPTION_ZERODIVIDE controls behavior - * when a zero-division occurs. - * Settings: - * - * - +false+ (default): Returns BigDecimal('Infinity') - * or BigDecimal('-Infinity'). - * - +true+: Raises FloatDomainError. - * - * Examples: - * - * BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0 - * one = BigDecimal('1') - * zero = BigDecimal('0') - * one / zero # => Infinity - * BigDecimal.mode(BigDecimal::EXCEPTION_ZERODIVIDE, true) # => 16 - * one / zero # Raises FloatDomainError - * - * All Exceptions - * - * Mode \BigDecimal::EXCEPTION_ALL controls all of the above: - * - * BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0 - * BigDecimal.mode(BigDecimal::EXCEPTION_ALL, true) # => 23 - * - * Rounding - * - * Mode \BigDecimal::ROUND_MODE controls the way rounding is to be performed; - * its +setting+ values are: - * - * - +ROUND_UP+: Round away from zero. - * Aliased as +:up+. - * - +ROUND_DOWN+: Round toward zero. - * Aliased as +:down+ and +:truncate+. - * - +ROUND_HALF_UP+: Round toward the nearest neighbor; - * if the neighbors are equidistant, round away from zero. - * Aliased as +:half_up+ and +:default+. - * - +ROUND_HALF_DOWN+: Round toward the nearest neighbor; - * if the neighbors are equidistant, round toward zero. - * Aliased as +:half_down+. - * - +ROUND_HALF_EVEN+ (Banker's rounding): Round toward the nearest neighbor; - * if the neighbors are equidistant, round toward the even neighbor. - * Aliased as +:half_even+ and +:banker+. - * - +ROUND_CEILING+: Round toward positive infinity. - * Aliased as +:ceiling+ and +:ceil+. - * - +ROUND_FLOOR+: Round toward negative infinity. - * Aliased as +:floor:+. - * - */ -static VALUE -BigDecimal_mode(int argc, VALUE *argv, VALUE self) -{ - VALUE which; - VALUE val; - unsigned long f,fo; - - rb_scan_args(argc, argv, "11", &which, &val); - f = (unsigned long)NUM2INT(which); - - if (f & VP_EXCEPTION_ALL) { - /* Exception mode setting */ - fo = VpGetException(); - if (val == Qnil) return INT2FIX(fo); - if (val != Qfalse && val!=Qtrue) { - rb_raise(rb_eArgError, "second argument must be true or false"); - return Qnil; /* Not reached */ - } - if (f & VP_EXCEPTION_INFINITY) { - VpSetException((unsigned short)((val == Qtrue) ? (fo | VP_EXCEPTION_INFINITY) : - (fo & (~VP_EXCEPTION_INFINITY)))); - } - fo = VpGetException(); - if (f & VP_EXCEPTION_NaN) { - VpSetException((unsigned short)((val == Qtrue) ? (fo | VP_EXCEPTION_NaN) : - (fo & (~VP_EXCEPTION_NaN)))); - } - fo = VpGetException(); - if (f & VP_EXCEPTION_UNDERFLOW) { - VpSetException((unsigned short)((val == Qtrue) ? (fo | VP_EXCEPTION_UNDERFLOW) : - (fo & (~VP_EXCEPTION_UNDERFLOW)))); - } - fo = VpGetException(); - if(f & VP_EXCEPTION_ZERODIVIDE) { - VpSetException((unsigned short)((val == Qtrue) ? (fo | VP_EXCEPTION_ZERODIVIDE) : - (fo & (~VP_EXCEPTION_ZERODIVIDE)))); - } - fo = VpGetException(); - return INT2FIX(fo); - } - if (VP_ROUND_MODE == f) { - /* Rounding mode setting */ - unsigned short sw; - fo = VpGetRoundMode(); - if (NIL_P(val)) return INT2FIX(fo); - sw = check_rounding_mode(val); - fo = VpSetRoundMode(sw); - return INT2FIX(fo); - } - rb_raise(rb_eTypeError, "first argument for BigDecimal.mode invalid"); - return Qnil; -} - -static size_t -GetAddSubPrec(Real *a, Real *b) -{ - if (VpIsZero(a) || VpIsZero(b)) return Max(a->Prec, b->Prec); - ssize_t min_a = a->exponent - a->Prec; - ssize_t min_b = b->exponent - b->Prec; - return Max(a->exponent, b->exponent) - Min(min_a, min_b); -} - -static inline SIGNED_VALUE -check_int_precision(VALUE v) -{ - SIGNED_VALUE n; -#if SIZEOF_VALUE <= SIZEOF_LONG - n = (SIGNED_VALUE)NUM2LONG(v); -#elif SIZEOF_VALUE <= SIZEOF_LONG_LONG - n = (SIGNED_VALUE)NUM2LL(v); -#else -# error SIZEOF_VALUE is too large -#endif - if (n < 0) { - rb_raise(rb_eArgError, "negative precision"); - } - return n; -} - -static NULLABLE_BDVALUE -CreateFromString(const char *str, VALUE klass, bool strict_p, bool raise_exception) -{ - return VpAlloc(str, strict_p, raise_exception); -} - -void -VpMemCopy(Real *pv, Real const* const x) -{ - pv->MaxPrec = x->MaxPrec; - pv->Prec = x->Prec; - pv->exponent = x->exponent; - pv->sign = x->sign; - pv->flag = x->flag; - MEMCPY(pv->frac, x->frac, DECDIG, pv->MaxPrec); -} - -/* Returns True if the value is Not a Number. */ -static VALUE -BigDecimal_IsNaN(VALUE self) -{ - Real *p = GetSelfVpValue(self); - if (VpIsNaN(p)) return Qtrue; - return Qfalse; -} - -/* Returns nil, -1, or +1 depending on whether the value is finite, - * -Infinity, or +Infinity. - */ -static VALUE -BigDecimal_IsInfinite(VALUE self) -{ - Real *p = GetSelfVpValue(self); - if (VpIsPosInf(p)) return INT2FIX(1); - if (VpIsNegInf(p)) return INT2FIX(-1); - return Qnil; -} - -/* Returns True if the value is finite (not NaN or infinite). */ -static VALUE -BigDecimal_IsFinite(VALUE self) -{ - Real *p = GetSelfVpValue(self); - if (VpIsNaN(p)) return Qfalse; - if (VpIsInf(p)) return Qfalse; - return Qtrue; -} - -static void -BigDecimal_check_num(Real *p) -{ - VpCheckException(p, true); -} - -/* Returns the value as an Integer. - * - * If the BigDecimal is infinity or NaN, raises FloatDomainError. - */ -static VALUE -BigDecimal_to_i(VALUE self) -{ - BDVALUE v; - VALUE ret; - - v = GetBDValueMust(self); - BigDecimal_check_num(v.real); - - if (v.real->exponent <= 0) return INT2FIX(0); - if (v.real->exponent == 1) { - ret = LONG2NUM((long)(VpGetSign(v.real) * (DECDIG_DBL_SIGNED)v.real->frac[0])); - } - else { - VALUE fix = (ssize_t)v.real->Prec > v.real->exponent ? BigDecimal_fix(self) : self; - VALUE digits = RARRAY_AREF(BigDecimal_split(fix), 1); - ssize_t dpower = VpExponent10(v.real) - (ssize_t)RSTRING_LEN(digits); - ret = rb_funcall(digits, rb_intern("to_i"), 0); - - if (BIGDECIMAL_NEGATIVE_P(v.real)) { - ret = rb_funcall(ret, '*', 1, INT2FIX(-1)); - } - if (dpower) { - VALUE pow10 = rb_funcall(INT2FIX(10), rb_intern("**"), 1, SSIZET2NUM(dpower)); - // In Ruby < 3.4, int**int may return Float::INFINITY - if (RB_TYPE_P(pow10, T_FLOAT)) rb_raise(rb_eFloatDomainError, "Infinity"); - - ret = rb_funcall(ret, '*', 1, pow10); - } - } - - RB_GC_GUARD(v.bigdecimal); - return ret; -} - -/* Returns a new Float object having approximately the same value as the - * BigDecimal number. Normal accuracy limits and built-in errors of binary - * Float arithmetic apply. - */ -static VALUE -BigDecimal_to_f(VALUE self) -{ - double d; - SIGNED_VALUE e; - char *buf; - volatile VALUE str; - BDVALUE v = GetBDValueMust(self); - bool negative = BIGDECIMAL_NEGATIVE_P(v.real); - - if (VpVtoD(&d, &e, v.real) != 1) - return rb_float_new(d); - if (e > (SIGNED_VALUE)(DBL_MAX_10_EXP+BASE_FIG)) - goto overflow; - if (e < (SIGNED_VALUE)(DBL_MIN_10_EXP-DBL_DIG)) - goto underflow; - - str = rb_str_new(0, VpNumOfChars(v.real, "E")); - buf = RSTRING_PTR(str); - VpToString(v.real, buf, RSTRING_LEN(str), 0, 0); - - RB_GC_GUARD(v.bigdecimal); - - errno = 0; - d = strtod(buf, 0); - if (errno == ERANGE) { - if (d == 0.0) goto underflow; - if (fabs(d) >= HUGE_VAL) goto overflow; - } - return rb_float_new(d); - -overflow: - VpException(VP_EXCEPTION_OVERFLOW, "BigDecimal to Float conversion", 0); - if (negative) - return rb_float_new(VpGetDoubleNegInf()); - else - return rb_float_new(VpGetDoublePosInf()); - -underflow: - VpException(VP_EXCEPTION_UNDERFLOW, "BigDecimal to Float conversion", 0); - if (negative) - return rb_float_new(-0.0); - else - return rb_float_new(0.0); -} - - -/* Converts a BigDecimal to a Rational. - */ -static VALUE -BigDecimal_to_r(VALUE self) -{ - BDVALUE v; - ssize_t sign, power, denomi_power; - VALUE a, digits, numerator; - - v = GetBDValueMust(self); - BigDecimal_check_num(v.real); - sign = VpGetSign(v.real); - power = VpExponent10(v.real); - RB_GC_GUARD(v.bigdecimal); - - a = BigDecimal_split(self); - digits = RARRAY_AREF(a, 1); - denomi_power = power - RSTRING_LEN(digits); - numerator = rb_funcall(digits, rb_intern("to_i"), 0); - - if (sign < 0) { - numerator = rb_funcall(numerator, '*', 1, INT2FIX(-1)); - } - if (denomi_power < 0) { - return rb_Rational(numerator, - rb_funcall(INT2FIX(10), rb_intern("**"), 1, - INT2FIX(-denomi_power))); - } - else { - return rb_Rational1(rb_funcall(numerator, '*', 1, - rb_funcall(INT2FIX(10), rb_intern("**"), 1, - INT2FIX(denomi_power)))); - } -} - -static size_t -GetCoercePrec(Real *a, size_t prec) -{ - if (prec == 0) prec = a->Prec * BASE_FIG; - if (prec < 2 * BIGDECIMAL_DOUBLE_FIGURES) prec = 2 * BIGDECIMAL_DOUBLE_FIGURES; - return prec; -} - -/* The coerce method provides support for Ruby type coercion. It is not - * enabled by default. - * - * This means that binary operations like + * / or - can often be performed - * on a BigDecimal and an object of another type, if the other object can - * be coerced into a BigDecimal value. - * - * e.g. - * a = BigDecimal("1.0") - * b = a / 2.0 #=> 0.5 - * - * Note that coercing a String to a BigDecimal is not supported by default; - * it requires a special compile-time option when building Ruby. - */ -static VALUE -BigDecimal_coerce(VALUE self, VALUE other) -{ - Real* pv = VpPtr(self); - BDVALUE b = GetBDValueWithPrecMust(other, GetCoercePrec(pv, 0)); - return rb_assoc_new(CheckGetValue(b), self); -} - -/* - * call-seq: - * +big_decimal -> self - * - * Returns +self+: - * - * +BigDecimal(5) # => 0.5e1 - * +BigDecimal(-5) # => -0.5e1 - * - */ - -static VALUE -BigDecimal_uplus(VALUE self) -{ - return self; -} - -static bool -is_coerceable_to_BigDecimal(VALUE r) -{ - return is_kind_of_BigDecimal(r) || - RB_INTEGER_TYPE_P(r) || - RB_TYPE_P(r, T_FLOAT) || - RB_TYPE_P(r, T_RATIONAL); -} - - /* - * call-seq: - * self + value -> bigdecimal - * - * Returns the \BigDecimal sum of +self+ and +value+: - * - * b = BigDecimal('111111.111') # => 0.111111111e6 - * b + 2 # => 0.111113111e6 - * b + 2.0 # => 0.111113111e6 - * b + Rational(2, 1) # => 0.111113111e6 - * b + Complex(2, 0) # => (0.111113111e6+0i) - * - * See the {Note About Precision}[BigDecimal.html#class-BigDecimal-label-A+Note+About+Precision]. - * - */ - -static VALUE -BigDecimal_add(VALUE self, VALUE r) -{ - if (!is_coerceable_to_BigDecimal(r)) return DoSomeOne(self, r, '+'); - return BigDecimal_addsub_with_coerce(self, r, 0, +1); -} - -static VALUE -BigDecimal_addsub_with_coerce(VALUE self, VALUE r, size_t prec, int operation) -{ - BDVALUE a, b, c; - size_t mx; - - a = GetBDValueMust(self); - b = GetBDValueWithPrecMust(r, GetCoercePrec(a.real, prec)); - - if (VpIsNaN(a.real)) return CheckGetValue(a); - if (VpIsNaN(b.real)) return CheckGetValue(b); - - if (VpIsInf(a.real) || VpIsInf(b.real)) { - c = NewZeroWrap(1, BASE_FIG); - VpAddSub(c.real, a.real, b.real, operation); - } - else { - - // Optimization when exponent difference is large - // (1.234e+1000).add(5.678e-1000, 10) == (1.234e+1000).add(0.1e+990, 10) in every rounding mode - if (prec && !VpIsZero(a.real) && !VpIsZero(b.real)) { - size_t precRoom = roomof(prec, BASE_FIG); - if (a.real->exponent - (ssize_t)Max(a.real->Prec, precRoom) - 1 > b.real->exponent) { - BDVALUE b2 = NewZeroWrap(1, BASE_FIG); - VpSetOne(b2.real) - VpSetSign(b2.real, b.real->sign); - b2.real->exponent = a.real->exponent - (ssize_t)Max(a.real->Prec, precRoom) - 1; - b = b2; - } else if (b.real->exponent - (ssize_t)Max(b.real->Prec, precRoom) - 1 > a.real->exponent) { - BDVALUE a2 = NewZeroWrap(1, BASE_FIG); - VpSetOne(a2.real) - VpSetSign(a2.real, a.real->sign); - a2.real->exponent = b.real->exponent - (ssize_t)Max(b.real->Prec, precRoom) - 1; - a = a2; - } - } - - mx = GetAddSubPrec(a.real, b.real); - c = NewZeroWrap(1, (mx + 1) * BASE_FIG); - size_t pl = VpGetPrecLimit(); - if (prec) VpSetPrecLimit(prec); - // Let VpAddSub round the result - VpAddSub(c.real, a.real, b.real, operation); - if (prec) VpSetPrecLimit(pl); - } - - RB_GC_GUARD(a.bigdecimal); - RB_GC_GUARD(b.bigdecimal); - return CheckGetValue(c); -} - - /* - * call-seq: - * self - value -> bigdecimal - * - * Returns the \BigDecimal difference of +self+ and +value+: - * - * b = BigDecimal('333333.333') # => 0.333333333e6 - * b - 2 # => 0.333331333e6 - * b - 2.0 # => 0.333331333e6 - * b - Rational(2, 1) # => 0.333331333e6 - * b - Complex(2, 0) # => (0.333331333e6+0i) - * - * See the {Note About Precision}[BigDecimal.html#class-BigDecimal-label-A+Note+About+Precision]. - * - */ -static VALUE -BigDecimal_sub(VALUE self, VALUE r) -{ - if (!is_coerceable_to_BigDecimal(r)) return DoSomeOne(self, r, '-'); - return BigDecimal_addsub_with_coerce(self, r, 0, -1); -} - -static VALUE -BigDecimalCmp(VALUE self, VALUE r,char op) -{ - SIGNED_VALUE e; - BDVALUE a = GetBDValueMust(self); - NULLABLE_BDVALUE b = GetBDValueWithPrec(r, GetCoercePrec(a.real, 0)); - - if (b.real_or_null == NULL) { - ID f = 0; - - switch (op) { - case '*': - return rb_num_coerce_cmp(self, r, rb_intern("<=>")); - - case '=': - return RTEST(rb_num_coerce_cmp(self, r, rb_intern("=="))) ? Qtrue : Qfalse; - - case 'G': - f = rb_intern(">="); - break; - - case 'L': - f = rb_intern("<="); - break; - - case '>': - /* fall through */ - case '<': - f = (ID)op; - break; - - default: - break; - } - return rb_num_coerce_relop(self, r, f); - } - e = VpComp(a.real, b.real_or_null); - - RB_GC_GUARD(a.bigdecimal); - RB_GC_GUARD(b.bigdecimal_or_nil); - - if (e == 999) - return (op == '*') ? Qnil : Qfalse; - switch (op) { - case '*': - return INT2FIX(e); /* any op */ - - case '=': - if (e == 0) return Qtrue; - return Qfalse; - - case 'G': - if (e >= 0) return Qtrue; - return Qfalse; - - case '>': - if (e > 0) return Qtrue; - return Qfalse; - - case 'L': - if (e <= 0) return Qtrue; - return Qfalse; - - case '<': - if (e < 0) return Qtrue; - return Qfalse; - - default: - break; - } - - rb_bug("Undefined operation in BigDecimalCmp()"); - - UNREACHABLE; -} - -/* Returns True if the value is zero. */ -static VALUE -BigDecimal_zero(VALUE self) -{ - Real *a = GetSelfVpValue(self); - return VpIsZero(a) ? Qtrue : Qfalse; -} - -/* Returns self if the value is non-zero, nil otherwise. */ -static VALUE -BigDecimal_nonzero(VALUE self) -{ - Real *a = GetSelfVpValue(self); - return VpIsZero(a) ? Qnil : self; -} - -/* The comparison operator. - * a <=> b is 0 if a == b, 1 if a > b, -1 if a < b. - */ -static VALUE -BigDecimal_comp(VALUE self, VALUE r) -{ - return BigDecimalCmp(self, r, '*'); -} - -/* - * Tests for value equality; returns true if the values are equal. - * - * The == and === operators and the eql? method have the same implementation - * for BigDecimal. - * - * Values may be coerced to perform the comparison: - * - * BigDecimal('1.0') == 1.0 #=> true - */ -static VALUE -BigDecimal_eq(VALUE self, VALUE r) -{ - return BigDecimalCmp(self, r, '='); -} - -/* call-seq: - * self < other -> true or false - * - * Returns +true+ if +self+ is less than +other+, +false+ otherwise: - * - * b = BigDecimal('1.5') # => 0.15e1 - * b < 2 # => true - * b < 2.0 # => true - * b < Rational(2, 1) # => true - * b < 1.5 # => false - * - * Raises an exception if the comparison cannot be made. - * - */ -static VALUE -BigDecimal_lt(VALUE self, VALUE r) -{ - return BigDecimalCmp(self, r, '<'); -} - -/* call-seq: - * self <= other -> true or false - * - * Returns +true+ if +self+ is less or equal to than +other+, +false+ otherwise: - * - * b = BigDecimal('1.5') # => 0.15e1 - * b <= 2 # => true - * b <= 2.0 # => true - * b <= Rational(2, 1) # => true - * b <= 1.5 # => true - * b < 1 # => false - * - * Raises an exception if the comparison cannot be made. - * - */ -static VALUE -BigDecimal_le(VALUE self, VALUE r) -{ - return BigDecimalCmp(self, r, 'L'); -} - -/* call-seq: - * self > other -> true or false - * - * Returns +true+ if +self+ is greater than +other+, +false+ otherwise: - * - * b = BigDecimal('1.5') - * b > 1 # => true - * b > 1.0 # => true - * b > Rational(1, 1) # => true - * b > 2 # => false - * - * Raises an exception if the comparison cannot be made. - * - */ -static VALUE -BigDecimal_gt(VALUE self, VALUE r) -{ - return BigDecimalCmp(self, r, '>'); -} - -/* call-seq: - * self >= other -> true or false - * - * Returns +true+ if +self+ is greater than or equal to +other+, +false+ otherwise: - * - * b = BigDecimal('1.5') - * b >= 1 # => true - * b >= 1.0 # => true - * b >= Rational(1, 1) # => true - * b >= 1.5 # => true - * b > 2 # => false - * - * Raises an exception if the comparison cannot be made. - * - */ -static VALUE -BigDecimal_ge(VALUE self, VALUE r) -{ - return BigDecimalCmp(self, r, 'G'); -} - -/* - * call-seq: - * -self -> bigdecimal - * - * Returns the \BigDecimal negation of self: - * - * b0 = BigDecimal('1.5') - * b1 = -b0 # => -0.15e1 - * b2 = -b1 # => 0.15e1 - * - */ - -static VALUE -BigDecimal_neg(VALUE self) -{ - BDVALUE a = GetBDValueMust(self); - BDVALUE c = NewZeroWrap(1, a.real->Prec * BASE_FIG); - VpAsgn(c.real, a.real, -10); - RB_GC_GUARD(a.bigdecimal); - return CheckGetValue(c); -} - -/* - * call-seq: - * a * b -> bigdecimal - * - * Multiply by the specified value. - * - * The result precision will be the precision of the sum of each precision. - * - * See BigDecimal#mult. - */ -static VALUE -BigDecimal_mult(VALUE self, VALUE r) -{ - if (!is_coerceable_to_BigDecimal(r)) return DoSomeOne(self, r, '*'); - return BigDecimal_mult_with_coerce(self, r, 0); -} - -static VALUE -BigDecimal_mult_with_coerce(VALUE self, VALUE r, size_t prec) -{ - BDVALUE a, b, c; - - a = GetBDValueMust(self); - b = GetBDValueWithPrecMust(r, GetCoercePrec(a.real, prec)); - - c = NewZeroWrap(1, VPMULT_RESULT_PREC(a.real, b.real) * BASE_FIG); - VpMult(c.real, a.real, b.real); - if (prec) { - VpLeftRound(c.real, VpGetRoundMode(), prec); - } - else { - VpLimitRound(c.real, 0); - } - - RB_GC_GUARD(a.bigdecimal); - RB_GC_GUARD(b.bigdecimal); - return CheckGetValue(c); -} - -static bool BigDecimal_DoDivmod(VALUE self, VALUE r, NULLABLE_BDVALUE *div, NULLABLE_BDVALUE *mod, bool truncate); - -/* call-seq: - * a / b -> bigdecimal - * - * Divide by the specified value. - * - * The result precision will be the precision of the larger operand, - * but its minimum is 2*Float::DIG. - * - * See BigDecimal#div. - * See BigDecimal#quo. - */ -static VALUE -BigDecimal_div(VALUE self, VALUE r) -/* For c = self/r: with round operation */ -{ - if (!is_coerceable_to_BigDecimal(r)) return DoSomeOne(self, r, '/'); - return BigDecimal_div2(self, r, INT2FIX(0)); -} - -static VALUE BigDecimal_round(int argc, VALUE *argv, VALUE self); - -/* call-seq: - * quo(value) -> bigdecimal - * quo(value, digits) -> bigdecimal - * - * Divide by the specified value. - * - * digits:: If specified and less than the number of significant digits of - * the result, the result is rounded to the given number of digits, - * according to the rounding mode indicated by BigDecimal.mode. - * - * If digits is 0 or omitted, the result is the same as for the - * / operator. - * - * See BigDecimal#/. - * See BigDecimal#div. - */ -static VALUE -BigDecimal_quo(int argc, VALUE *argv, VALUE self) -{ - VALUE value, digits, result; - SIGNED_VALUE n = -1; - - argc = rb_scan_args(argc, argv, "11", &value, &digits); - if (argc > 1) { - n = check_int_precision(digits); - } - - if (n > 0) { - result = BigDecimal_div2(self, value, digits); - } - else { - result = BigDecimal_div(self, value); - } - - return result; -} - -/* - * %: mod = a%b = a - (a.to_f/b).floor * b - * div = (a.to_f/b).floor - * In truncate mode, use truncate instead of floor. - */ -static bool -BigDecimal_DoDivmod(VALUE self, VALUE r, NULLABLE_BDVALUE *div, NULLABLE_BDVALUE *mod, bool truncate) -{ - BDVALUE a, b, dv, md, res; - NULLABLE_BDVALUE b2; - ssize_t a_exponent, b_exponent; - size_t mx, rx, pl; - - a = GetBDValueMust(self); - - b2 = GetBDValueWithPrec(r, GetCoercePrec(a.real, 0)); - if (!b2.real_or_null) return false; - b = bdvalue_nonnullable(b2); - - if (VpIsNaN(a.real) || VpIsNaN(b.real) || (VpIsInf(a.real) && VpIsInf(b.real))) { - VALUE nan = BigDecimal_nan(); - *div = *mod = (NULLABLE_BDVALUE) { nan, VpPtr(nan) }; - goto Done; - } - if (VpIsZero(b.real)) { - rb_raise(rb_eZeroDivError, "divided by 0"); - } - if (VpIsInf(a.real)) { - if (VpGetSign(a.real) == VpGetSign(b.real)) { - VALUE inf = BigDecimal_positive_infinity(); - *div = (NULLABLE_BDVALUE) { inf, VpPtr(inf) }; - } - else { - VALUE inf = BigDecimal_negative_infinity(); - *div = (NULLABLE_BDVALUE) { inf, VpPtr(inf) }; - } - VALUE nan = BigDecimal_nan(); - *mod = (NULLABLE_BDVALUE) { nan, VpPtr(nan) }; - goto Done; - } - if (VpIsZero(a.real)) { - VALUE zero = BigDecimal_positive_zero(); - *div = (NULLABLE_BDVALUE) { zero, VpPtr(zero) }; - *mod = bdvalue_nullable(a); - goto Done; - } - if (VpIsInf(b.real)) { - if (!truncate && VpGetSign(a.real) * VpGetSign(b.real) < 0) { - BDVALUE minus_one = NewZeroWrap(1, BASE_FIG); - VpSetOne(minus_one.real); - VpSetSign(minus_one.real, -1); - RB_GC_GUARD(minus_one.bigdecimal); - *div = bdvalue_nullable(minus_one); - *mod = bdvalue_nullable(b); - } else { - VALUE zero = BigDecimal_positive_zero(); - *div = (NULLABLE_BDVALUE) { zero, VpPtr(zero) }; - *mod = bdvalue_nullable(a); - } - goto Done; - } - - a_exponent = VpExponent10(a.real); - b_exponent = VpExponent10(b.real); - mx = a_exponent > b_exponent ? a_exponent - b_exponent + 1 : 1; - dv = NewZeroWrap(1, VPDIVD_QUO_DIGITS(mx)); - - /* res is reused for VpDivd remainder and VpMult result */ - rx = VPDIVD_REM_PREC(a.real, b.real, dv.real); - mx = VPMULT_RESULT_PREC(dv.real, b.real); - res = NewZeroWrap(1, Max(rx, mx) * BASE_FIG); - /* AddSub needs one more prec */ - md = NewZeroWrap(1, (res.real->MaxPrec + 1) * BASE_FIG); - - VpDivd(dv.real, res.real, a.real, b.real); - VpMidRound(dv.real, VP_ROUND_DOWN, 0); - VpMult(res.real, dv.real, b.real); - pl = VpGetPrecLimit(); - VpSetPrecLimit(0); - VpAddSub(md.real, a.real, res.real, -1); - VpSetPrecLimit(pl); - - if (!truncate && !VpIsZero(md.real) && (VpGetSign(a.real) * VpGetSign(b.real) < 0)) { - /* result adjustment for negative case */ - BDVALUE dv2 = NewZeroWrap(1, (dv.real->MaxPrec + 1) * BASE_FIG); - BDVALUE md2 = NewZeroWrap(1, (GetAddSubPrec(md.real, b.real) + 1) * BASE_FIG); - VpSetPrecLimit(0); - VpAddSub(dv2.real, dv.real, VpOne(), -1); - VpAddSub(md2.real, md.real, b.real, 1); - VpSetPrecLimit(pl); - *div = bdvalue_nullable(dv2); - *mod = bdvalue_nullable(md2); - RB_GC_GUARD(dv2.bigdecimal); - RB_GC_GUARD(md2.bigdecimal); - } - else { - *div = bdvalue_nullable(dv); - *mod = bdvalue_nullable(md); - } - RB_GC_GUARD(dv.bigdecimal); - RB_GC_GUARD(md.bigdecimal); - RB_GC_GUARD(res.bigdecimal); - -Done: - RB_GC_GUARD(a.bigdecimal); - RB_GC_GUARD(b.bigdecimal); - return true; -} - -/* call-seq: - * a % b - * a.modulo(b) - * - * Returns the modulus from dividing by b. - * - * See BigDecimal#divmod. - */ -static VALUE -BigDecimal_mod(VALUE self, VALUE r) /* %: a%b = a - (a.to_f/b).floor * b */ -{ - NULLABLE_BDVALUE div, mod; - - if (BigDecimal_DoDivmod(self, r, &div, &mod, false)) { - return CheckGetValue(bdvalue_nonnullable(mod)); - } - return DoSomeOne(self, r, '%'); -} - -/* call-seq: - * remainder(value) - * - * Returns the remainder from dividing by the value. - * - * x.remainder(y) means x-y*(x/y).truncate - */ -static VALUE -BigDecimal_remainder(VALUE self, VALUE r) /* remainder */ -{ - NULLABLE_BDVALUE div, mod = { Qnil, NULL }; - - if (BigDecimal_DoDivmod(self, r, &div, &mod, true)) { - return CheckGetValue(bdvalue_nonnullable(mod)); - } - return DoSomeOne(self, r, rb_intern("remainder")); -} - -/* call-seq: - * divmod(value) - * - * Divides by the specified value, and returns the quotient and modulus - * as BigDecimal numbers. The quotient is rounded towards negative infinity. - * - * For example: - * - * require 'bigdecimal' - * - * a = BigDecimal("42") - * b = BigDecimal("9") - * - * q, m = a.divmod(b) - * - * c = q * b + m - * - * a == c #=> true - * - * The quotient q is (a/b).floor, and the modulus is the amount that must be - * added to q * b to get a. - */ -static VALUE -BigDecimal_divmod(VALUE self, VALUE r) -{ - NULLABLE_BDVALUE div, mod; - - if (BigDecimal_DoDivmod(self, r, &div, &mod, false)) { - return rb_assoc_new(BigDecimal_to_i(CheckGetValue(bdvalue_nonnullable(div))), CheckGetValue(bdvalue_nonnullable(mod))); - } - return DoSomeOne(self,r,rb_intern("divmod")); -} - -/* - * Do the same manner as Float#div when n is nil. - * Do the same manner as BigDecimal#quo when n is 0. - */ -static inline VALUE -BigDecimal_div2(VALUE self, VALUE b, VALUE n) -{ - SIGNED_VALUE ix; - BDVALUE av, bv, cv, res; - - if (NIL_P(n)) { /* div in Float sense */ - NULLABLE_BDVALUE div; - NULLABLE_BDVALUE mod; - if (BigDecimal_DoDivmod(self, b, &div, &mod, false)) { - return BigDecimal_to_i(CheckGetValue(bdvalue_nonnullable(div))); - } - return DoSomeOne(self, b, rb_intern("div")); - } - - /* div in BigDecimal sense */ - ix = check_int_precision(n); - - av = GetBDValueMust(self); - bv = GetBDValueWithPrecMust(b, GetCoercePrec(av.real, ix)); - - if (ix == 0) { - ssize_t a_prec, b_prec, limit = VpGetPrecLimit(); - VpCountPrecisionAndScale(av.real, &a_prec, NULL); - VpCountPrecisionAndScale(bv.real, &b_prec, NULL); - ix = ((a_prec > b_prec) ? a_prec : b_prec) + BIGDECIMAL_DOUBLE_FIGURES; - if (2 * BIGDECIMAL_DOUBLE_FIGURES > ix) - ix = 2 * BIGDECIMAL_DOUBLE_FIGURES; - if (limit && limit < ix) ix = limit; - } - - // Needs to calculate 1 extra digit for rounding. - cv = NewZeroWrap(1, VPDIVD_QUO_DIGITS(ix + 1)); - res = NewZeroWrap(1, VPDIVD_REM_PREC(av.real, bv.real, cv.real) * BASE_FIG); - VpDivd(cv.real, res.real, av.real, bv.real); - - if (!VpIsZero(res.real)) { - // Remainder value affects rounding result. - // ROUND_UP cv = 0.1e0 with idx=10 will be: - // 0.1e0 if remainder == 0 - // 0.1000000001e0 if remainder != 0 - size_t idx = roomof(ix, BASE_FIG); - while (cv.real->Prec <= idx) cv.real->frac[cv.real->Prec++] = 0; - if (cv.real->frac[idx] == 0 || cv.real->frac[idx] == HALF_BASE) cv.real->frac[idx]++; - } - VpLeftRound(cv.real, VpGetRoundMode(), ix); - - RB_GC_GUARD(av.bigdecimal); - RB_GC_GUARD(bv.bigdecimal); - RB_GC_GUARD(res.bigdecimal); - return CheckGetValue(cv); -} - - /* - * Document-method: BigDecimal#div - * - * call-seq: - * div(value) -> integer - * div(value, digits) -> bigdecimal or integer - * - * Divide by the specified value. - * - * digits:: If specified and less than the number of significant digits of the - * result, the result is rounded to that number of digits, according - * to BigDecimal.mode. - * - * If digits is 0, the result is the same as for the / operator - * or #quo. - * - * If digits is not specified, the result is an integer, - * by analogy with Float#div; see also BigDecimal#divmod. - * - * See BigDecimal#/. - * See BigDecimal#quo. - * - * Examples: - * - * a = BigDecimal("4") - * b = BigDecimal("3") - * - * a.div(b, 3) # => 0.133e1 - * - * a.div(b, 0) # => 0.1333333333333333333e1 - * a / b # => 0.1333333333333333333e1 - * a.quo(b) # => 0.1333333333333333333e1 - * - * a.div(b) # => 1 - */ -static VALUE -BigDecimal_div3(int argc, VALUE *argv, VALUE self) -{ - VALUE b,n; - - rb_scan_args(argc, argv, "11", &b, &n); - - return BigDecimal_div2(self, b, n); -} - - /* - * call-seq: - * add(value, ndigits) -> new_bigdecimal - * - * Returns the \BigDecimal sum of +self+ and +value+ - * with a precision of +ndigits+ decimal digits. - * - * When +ndigits+ is less than the number of significant digits - * in the sum, the sum is rounded to that number of digits, - * according to the current rounding mode; see BigDecimal.mode. - * - * Examples: - * - * # Set the rounding mode. - * BigDecimal.mode(BigDecimal::ROUND_MODE, :half_up) - * b = BigDecimal('111111.111') - * b.add(1, 0) # => 0.111112111e6 - * b.add(1, 3) # => 0.111e6 - * b.add(1, 6) # => 0.111112e6 - * b.add(1, 15) # => 0.111112111e6 - * b.add(1.0, 15) # => 0.111112111e6 - * b.add(Rational(1, 1), 15) # => 0.111112111e6 - * - */ - -static VALUE -BigDecimal_add2(VALUE self, VALUE b, VALUE n) -{ - return BigDecimal_addsub_with_coerce(self, b, check_int_precision(n), +1); -} - -/* call-seq: - * sub(value, digits) -> bigdecimal - * - * Subtract the specified value. - * - * e.g. - * c = a.sub(b,n) - * - * digits:: If specified and less than the number of significant digits of the - * result, the result is rounded to that number of digits, according - * to BigDecimal.mode. - * - */ -static VALUE -BigDecimal_sub2(VALUE self, VALUE b, VALUE n) -{ - return BigDecimal_addsub_with_coerce(self, b, check_int_precision(n), -1); -} - - /* - * call-seq: - * mult(other, ndigits) -> bigdecimal - * - * Returns the \BigDecimal product of +self+ and +value+ - * with a precision of +ndigits+ decimal digits. - * - * When +ndigits+ is less than the number of significant digits - * in the sum, the sum is rounded to that number of digits, - * according to the current rounding mode; see BigDecimal.mode. - * - * Examples: - * - * # Set the rounding mode. - * BigDecimal.mode(BigDecimal::ROUND_MODE, :half_up) - * b = BigDecimal('555555.555') - * b.mult(3, 0) # => 0.1666666665e7 - * b.mult(3, 3) # => 0.167e7 - * b.mult(3, 6) # => 0.166667e7 - * b.mult(3, 15) # => 0.1666666665e7 - * b.mult(3.0, 0) # => 0.1666666665e7 - * b.mult(Rational(3, 1), 0) # => 0.1666666665e7 - * b.mult(Complex(3, 0), 0) # => (0.1666666665e7+0.0i) - * - */ - -static VALUE -BigDecimal_mult2(VALUE self, VALUE b, VALUE n) -{ - return BigDecimal_mult_with_coerce(self, b, check_int_precision(n)); -} - -/* - * call-seq: - * abs -> bigdecimal - * - * Returns the \BigDecimal absolute value of +self+: - * - * BigDecimal('5').abs # => 0.5e1 - * BigDecimal('-3').abs # => 0.3e1 - * - */ - -static VALUE -BigDecimal_abs(VALUE self) -{ - BDVALUE a = GetBDValueMust(self); - BDVALUE c = NewZeroWrap(1, a.real->Prec * BASE_FIG); - VpAsgn(c.real, a.real, 10); - VpChangeSign(c.real, 1); - RB_GC_GUARD(a.bigdecimal); - return CheckGetValue(c); -} - -/* Return the integer part of the number, as a BigDecimal. - */ -static VALUE -BigDecimal_fix(VALUE self) -{ - BDVALUE a = GetBDValueMust(self); - BDVALUE c = NewZeroWrap(1, (a.real->Prec + 1) * BASE_FIG); - VpActiveRound(c.real, a.real, VP_ROUND_DOWN, 0); /* 0: round off */ - RB_GC_GUARD(a.bigdecimal); - return CheckGetValue(c); -} - -/* call-seq: - * round(n, mode) - * - * Round to the nearest integer (by default), returning the result as a - * BigDecimal if n is specified and positive, or as an Integer if it isn't. - * - * BigDecimal('3.14159').round #=> 3 - * BigDecimal('8.7').round #=> 9 - * BigDecimal('-9.9').round #=> -10 - * - * BigDecimal('3.14159').round(2).class.name #=> "BigDecimal" - * BigDecimal('3.14159').round.class.name #=> "Integer" - * BigDecimal('3.14159').round(0).class.name #=> "Integer" - * - * If n is specified and positive, the fractional part of the result has no - * more than that many digits. - * - * If n is specified and negative, at least that many digits to the left of the - * decimal point will be 0 in the result, and return value will be an Integer. - * - * BigDecimal('3.14159').round(3) #=> 3.142 - * BigDecimal('13345.234').round(-2) #=> 13300 - * - * The value of the optional mode argument can be used to determine how - * rounding is performed; see BigDecimal.mode. - */ -static VALUE -BigDecimal_round(int argc, VALUE *argv, VALUE self) -{ - BDVALUE c, a; - int iLoc = 0; - VALUE vLoc; - VALUE vRound; - int round_to_int = 0; - size_t mx; - - unsigned short sw = VpGetRoundMode(); - - switch (rb_scan_args(argc, argv, "02", &vLoc, &vRound)) { - case 0: - iLoc = 0; - round_to_int = 1; - break; - case 1: - if (RB_TYPE_P(vLoc, T_HASH)) { - sw = check_rounding_mode_option(vLoc); - } - else { - iLoc = NUM2INT(vLoc); - if (iLoc < 1) round_to_int = 1; - } - break; - case 2: - iLoc = NUM2INT(vLoc); - if (RB_TYPE_P(vRound, T_HASH)) { - sw = check_rounding_mode_option(vRound); - } - else { - sw = check_rounding_mode(vRound); - } - break; - default: - break; - } - - a = GetBDValueMust(self); - mx = (a.real->Prec + 1) * BASE_FIG; - c = NewZeroWrap(1, mx); - - VpActiveRound(c.real, a.real, sw, iLoc); - - RB_GC_GUARD(a.bigdecimal); - - if (round_to_int) { - return BigDecimal_to_i(CheckGetValue(c)); - } - return CheckGetValue(c); -} - -static VALUE -BigDecimal_truncate_floor_ceil(int argc, VALUE *argv, VALUE self, unsigned short rounding_mode) -{ - BDVALUE c, a; - int iLoc; - VALUE vLoc; - size_t mx; - - if (rb_scan_args(argc, argv, "01", &vLoc) == 0) { - iLoc = 0; - } - else { - iLoc = NUM2INT(vLoc); - } - - a = GetBDValueMust(self); - mx = (a.real->Prec + 1) * BASE_FIG; - c = NewZeroWrap(1, mx); - VpActiveRound(c.real, a.real, rounding_mode, iLoc); - - RB_GC_GUARD(a.bigdecimal); - - if (argc == 0) { - return BigDecimal_to_i(CheckGetValue(c)); - } - return CheckGetValue(c); -} - -/* call-seq: - * truncate(n) - * - * Truncate to the nearest integer (by default), returning the result as a - * BigDecimal. - * - * BigDecimal('3.14159').truncate #=> 3 - * BigDecimal('8.7').truncate #=> 8 - * BigDecimal('-9.9').truncate #=> -9 - * - * If n is specified and positive, the fractional part of the result has no - * more than that many digits. - * - * If n is specified and negative, at least that many digits to the left of the - * decimal point will be 0 in the result. - * - * BigDecimal('3.14159').truncate(3) #=> 3.141 - * BigDecimal('13345.234').truncate(-2) #=> 13300.0 - */ -static VALUE -BigDecimal_truncate(int argc, VALUE *argv, VALUE self) -{ - return BigDecimal_truncate_floor_ceil(argc, argv, self, VP_ROUND_DOWN); -} - -/* Return the fractional part of the number, as a BigDecimal. - */ -static VALUE -BigDecimal_frac(VALUE self) -{ - BDVALUE a = GetBDValueMust(self); - BDVALUE c = NewZeroWrap(1, (a.real->Prec + 1) * BASE_FIG); - VpFrac(c.real, a.real); - RB_GC_GUARD(a.bigdecimal); - return CheckGetValue(c); -} - -/* call-seq: - * floor(n) - * - * Return the largest integer less than or equal to the value, as a BigDecimal. - * - * BigDecimal('3.14159').floor #=> 3 - * BigDecimal('-9.1').floor #=> -10 - * - * If n is specified and positive, the fractional part of the result has no - * more than that many digits. - * - * If n is specified and negative, at least that - * many digits to the left of the decimal point will be 0 in the result. - * - * BigDecimal('3.14159').floor(3) #=> 3.141 - * BigDecimal('13345.234').floor(-2) #=> 13300.0 - */ -static VALUE -BigDecimal_floor(int argc, VALUE *argv, VALUE self) -{ - return BigDecimal_truncate_floor_ceil(argc, argv, self, VP_ROUND_FLOOR); -} - -/* call-seq: - * ceil(n) - * - * Return the smallest integer greater than or equal to the value, as a BigDecimal. - * - * BigDecimal('3.14159').ceil #=> 4 - * BigDecimal('-9.1').ceil #=> -9 - * - * If n is specified and positive, the fractional part of the result has no - * more than that many digits. - * - * If n is specified and negative, at least that - * many digits to the left of the decimal point will be 0 in the result. - * - * BigDecimal('3.14159').ceil(3) #=> 3.142 - * BigDecimal('13345.234').ceil(-2) #=> 13400.0 - */ -static VALUE -BigDecimal_ceil(int argc, VALUE *argv, VALUE self) -{ - return BigDecimal_truncate_floor_ceil(argc, argv, self, VP_ROUND_CEIL); -} - -/* call-seq: - * to_s(s) - * - * Converts the value to a string. - * - * The default format looks like 0.xxxxEnn. - * - * The optional parameter s consists of either an integer; or an optional '+' - * or ' ', followed by an optional number, followed by an optional 'E' or 'F'. - * - * If there is a '+' at the start of s, positive values are returned with - * a leading '+'. - * - * A space at the start of s returns positive values with a leading space. - * - * If s contains a number, a space is inserted after each group of that many - * digits, starting from '.' and counting outwards. - * - * If s ends with an 'E', scientific notation (0.xxxxEnn) is used. - * - * If s ends with an 'F', conventional floating point notation is used. - * - * Examples: - * - * BigDecimal('-1234567890123.45678901234567890').to_s('5F') - * #=> '-123 45678 90123.45678 90123 45678 9' - * - * BigDecimal('1234567890123.45678901234567890').to_s('+8F') - * #=> '+12345 67890123.45678901 23456789' - * - * BigDecimal('1234567890123.45678901234567890').to_s(' F') - * #=> ' 1234567890123.4567890123456789' - */ -static VALUE -BigDecimal_to_s(int argc, VALUE *argv, VALUE self) -{ - int fmt = 0; /* 0: E format, 1: F format */ - int fPlus = 0; /* 0: default, 1: set ' ' before digits, 2: set '+' before digits. */ - BDVALUE v; - volatile VALUE str; - char *psz; - char ch; - size_t nc, mc = 0; - SIGNED_VALUE m; - VALUE f; - - v = GetBDValueMust(self); - - if (rb_scan_args(argc, argv, "01", &f) == 1) { - if (RB_TYPE_P(f, T_STRING)) { - psz = StringValueCStr(f); - if (*psz == ' ') { - fPlus = 1; - psz++; - } - else if (*psz == '+') { - fPlus = 2; - psz++; - } - while ((ch = *psz++) != 0) { - if (ISSPACE(ch)) { - continue; - } - if (!ISDIGIT(ch)) { - if (ch == 'F' || ch == 'f') { - fmt = 1; /* F format */ - } - break; - } - mc = mc*10 + ch - '0'; - } - } - else { - m = NUM2INT(f); - if (m <= 0) { - rb_raise(rb_eArgError, "argument must be positive"); - } - mc = (size_t)m; - } - } - if (fmt) { - nc = VpNumOfChars(v.real, "F"); - } - else { - nc = VpNumOfChars(v.real, "E"); - } - if (mc > 0) { - nc += (nc + mc - 1) / mc + 1; - } - - str = rb_usascii_str_new(0, nc); - psz = RSTRING_PTR(str); - - if (fmt) { - VpToFString(v.real, psz, RSTRING_LEN(str), mc, fPlus); - } - else { - VpToString (v.real, psz, RSTRING_LEN(str), mc, fPlus); - } - rb_str_resize(str, strlen(psz)); - - RB_GC_GUARD(v.bigdecimal); - return str; -} - -/* Splits a BigDecimal number into four parts, returned as an array of values. - * - * The first value represents the sign of the BigDecimal, and is -1 or 1, or 0 - * if the BigDecimal is Not a Number. - * - * The second value is a string representing the significant digits of the - * BigDecimal, with no leading zeros. - * - * The third value is the base used for arithmetic (currently always 10) as an - * Integer. - * - * The fourth value is an Integer exponent. - * - * If the BigDecimal can be represented as 0.xxxxxx*10**n, then xxxxxx is the - * string of significant digits with no leading zeros, and n is the exponent. - * - * From these values, you can translate a BigDecimal to a float as follows: - * - * sign, significant_digits, base, exponent = a.split - * f = sign * "0.#{significant_digits}".to_f * (base ** exponent) - * - * (Note that the to_f method is provided as a more convenient way to translate - * a BigDecimal to a Float.) - */ -static VALUE -BigDecimal_split(VALUE self) -{ - BDVALUE v; - VALUE obj,str; - ssize_t e, s; - char *psz1; - - v = GetBDValueMust(self); - str = rb_str_new(0, VpNumOfChars(v.real, "E")); - psz1 = RSTRING_PTR(str); - VpSzMantissa(v.real, psz1, RSTRING_LEN(str)); - s = 1; - if(psz1[0] == '-') { - size_t len = strlen(psz1 + 1); - - memmove(psz1, psz1 + 1, len); - psz1[len] = '\0'; - s = -1; - } - if (psz1[0] == 'N') s = 0; /* NaN */ - e = VpExponent10(v.real); - obj = rb_ary_new2(4); - rb_ary_push(obj, INT2FIX(s)); - rb_ary_push(obj, str); - rb_str_resize(str, strlen(psz1)); - rb_ary_push(obj, INT2FIX(10)); - rb_ary_push(obj, SSIZET2NUM(e)); - - RB_GC_GUARD(v.bigdecimal); - return obj; -} - -/* Returns the exponent of the BigDecimal number, as an Integer. - * - * If the number can be represented as 0.xxxxxx*10**n where xxxxxx is a string - * of digits with no leading zeros, then n is the exponent. - */ -static VALUE -BigDecimal_exponent(VALUE self) -{ - ssize_t e = VpExponent10(GetSelfVpValue(self)); - return SSIZET2NUM(e); -} - -/* Returns a string representation of self. - * - * BigDecimal("1234.5678").inspect - * #=> "0.12345678e4" - */ -static VALUE -BigDecimal_inspect(VALUE self) -{ - BDVALUE v; - volatile VALUE str; - size_t nc; - - v = GetBDValueMust(self); - nc = VpNumOfChars(v.real, "E"); - - str = rb_str_new(0, nc); - VpToString(v.real, RSTRING_PTR(str), RSTRING_LEN(str), 0, 0); - rb_str_resize(str, strlen(RSTRING_PTR(str))); - - RB_GC_GUARD(v.bigdecimal); - return str; -} - -/* Returns self * 10**v without changing the precision. - * This method is currently for internal use. - * - * BigDecimal("0.123e10")._decimal_shift(20) #=> "0.123e30" - * BigDecimal("0.123e10")._decimal_shift(-20) #=> "0.123e-10" - */ -static VALUE -BigDecimal_decimal_shift(VALUE self, VALUE v) -{ - BDVALUE a, c; - ssize_t shift, exponentShift; - bool shiftDown; - size_t prec; - DECDIG ex, iex; - - a = GetBDValueMust(self); - shift = NUM2SSIZET(rb_to_int(v)); - - if (VpIsZero(a.real) || VpIsNaN(a.real) || VpIsInf(a.real) || shift == 0) return CheckGetValue(a); - - exponentShift = shift > 0 ? shift / BASE_FIG : (shift + 1) / BASE_FIG - 1; - shift -= exponentShift * BASE_FIG; - ex = 1; - for (int i = 0; i < shift; i++) ex *= 10; - shiftDown = a.real->frac[0] * (DECDIG_DBL)ex >= BASE; - iex = BASE / ex; - - prec = a.real->Prec + shiftDown; - c = NewZeroWrap(1, prec * BASE_FIG); - if (shift == 0) { - VpAsgn(c.real, a.real, 10); - } else if (shiftDown) { - DECDIG carry = 0; - exponentShift++; - for (size_t i = 0; i < a.real->Prec; i++) { - DECDIG v = a.real->frac[i]; - c.real->frac[i] = carry * ex + v / iex; - carry = v % iex; - } - c.real->frac[a.real->Prec] = carry * ex; - } else { - DECDIG carry = 0; - for (ssize_t i = a.real->Prec - 1; i >= 0; i--) { - DECDIG v = a.real->frac[i]; - c.real->frac[i] = v % iex * ex + carry; - carry = v / iex; - } - } - while (c.real->frac[prec - 1] == 0) prec--; - c.real->Prec = prec; - c.real->sign = a.real->sign; - c.real->exponent = a.real->exponent; - AddExponent(c.real, exponentShift); - RB_GC_GUARD(a.bigdecimal); - return CheckGetValue(c); -} - -inline static int -is_zero(VALUE x) -{ - VALUE num; - - switch (TYPE(x)) { - case T_FIXNUM: - return FIX2LONG(x) == 0; - - case T_BIGNUM: - return Qfalse; - - case T_RATIONAL: - num = rb_rational_num(x); - return FIXNUM_P(num) && FIX2LONG(num) == 0; - - default: - break; - } - - return RTEST(rb_funcall(x, id_eq, 1, INT2FIX(0))); -} - -/* :nodoc: */ -static VALUE -BigDecimal_clone(VALUE self) -{ - return self; -} - -#ifdef HAVE_RB_OPTS_EXCEPTION_P -int rb_opts_exception_p(VALUE opts, int default_value); -#define opts_exception_p(opts) rb_opts_exception_p((opts), 1) -#else -static int -opts_exception_p(VALUE opts) -{ - static ID kwds[1]; - VALUE exception; - if (!kwds[0]) { - kwds[0] = rb_intern_const("exception"); - } - if (!rb_get_kwargs(opts, kwds, 0, 1, &exception)) return 1; - switch (exception) { - case Qtrue: case Qfalse: - break; - default: - rb_raise(rb_eArgError, "true or false is expected as exception: %+"PRIsVALUE, - exception); - } - return exception != Qfalse; -} -#endif - -static VALUE -check_exception(VALUE bd) -{ - assert(is_kind_of_BigDecimal(bd)); - - VpCheckException(VpPtr(bd), false); - - return bd; -} - -static VALUE -rb_uint64_convert_to_BigDecimal(uint64_t uval) -{ - VALUE bd; - Real *vp; - if (uval == 0) { - bd = BigDecimal_allocate(1); - vp = VpPtr(bd); - vp->Prec = 1; - vp->exponent = 1; - VpSetZero(vp, 1); - vp->frac[0] = 0; - } - else if (uval < BASE) { - bd = BigDecimal_allocate(1); - vp = VpPtr(bd); - vp->Prec = 1; - vp->exponent = 1; - VpSetSign(vp, 1); - vp->frac[0] = (DECDIG)uval; - } - else { - DECDIG buf[BIGDECIMAL_INT64_MAX_LENGTH] = {0,}; - DECDIG r = uval % BASE; - size_t len = 0, ntz = 0; - if (r == 0) { - // Count and skip trailing zeros - for (; r == 0 && uval > 0; ++ntz) { - uval /= BASE; - r = uval % BASE; - } - } - for (; uval > 0; ++len) { - // Store digits - buf[BIGDECIMAL_INT64_MAX_LENGTH - len - 1] = r; - uval /= BASE; - r = uval % BASE; - } - - const size_t exp = len + ntz; - bd = BigDecimal_allocate(len); - vp = VpPtr(bd); - vp->Prec = len; - vp->exponent = exp; - VpSetSign(vp, 1); - MEMCPY(vp->frac, buf + BIGDECIMAL_INT64_MAX_LENGTH - len, DECDIG, len); - } - - return bd; -} - -static VALUE -rb_int64_convert_to_BigDecimal(int64_t ival) -{ - const uint64_t uval = (ival < 0) ? (((uint64_t)-(ival+1))+1) : (uint64_t)ival; - VALUE bd = rb_uint64_convert_to_BigDecimal(uval); - if (ival < 0) { - Real *vp = VpPtr(bd); - VpSetSign(vp, -1); - } - return bd; -} - -static VALUE -rb_big_convert_to_BigDecimal(VALUE val) -{ - assert(RB_TYPE_P(val, T_BIGNUM)); - - int leading_zeros; - size_t size = rb_absint_size(val, &leading_zeros); - int sign = FIX2INT(rb_big_cmp(val, INT2FIX(0))); - if (sign < 0 && leading_zeros == 0) { - size += 1; - } - if (size <= sizeof(long)) { - if (sign < 0) { - return rb_int64_convert_to_BigDecimal(NUM2LONG(val)); - } - else { - return rb_uint64_convert_to_BigDecimal(NUM2ULONG(val)); - } - } -#if defined(SIZEOF_LONG_LONG) && SIZEOF_LONG < SIZEOF_LONG_LONG - else if (size <= sizeof(LONG_LONG)) { - if (sign < 0) { - return rb_int64_convert_to_BigDecimal(NUM2LL(val)); - } - else { - return rb_uint64_convert_to_BigDecimal(NUM2ULL(val)); - } - } -#endif - else { - VALUE str = rb_big2str(val, 10); - BDVALUE v = bdvalue_nonnullable(CreateFromString( - RSTRING_PTR(str), - rb_cBigDecimal, - true, - true - )); - RB_GC_GUARD(str); - return CheckGetValue(v); - } -} - -static VALUE -rb_inum_convert_to_BigDecimal(VALUE val) -{ - assert(RB_INTEGER_TYPE_P(val)); - if (FIXNUM_P(val)) { - return rb_int64_convert_to_BigDecimal(FIX2LONG(val)); - } - else { - return rb_big_convert_to_BigDecimal(val); - } -} - -static VALUE -rb_float_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception) -{ - assert(RB_FLOAT_TYPE_P(val)); - - double d = RFLOAT_VALUE(val); - - if (isnan(d)) { - VALUE obj = BigDecimal_nan(); - return check_exception(obj); - } - else if (isinf(d)) { - VALUE obj; - if (d > 0) { - obj = BigDecimal_positive_infinity(); - } - else { - obj = BigDecimal_negative_infinity(); - } - return check_exception(obj); - } - else if (d == 0.0) { - if (1/d < 0.0) { - return BigDecimal_negative_zero(); - } - else { - return BigDecimal_positive_zero(); - } - } - - if (digs == SIZE_MAX) { - digs = 0; - } - else if (digs > BIGDECIMAL_DOUBLE_FIGURES) { - if (!raise_exception) - return Qnil; - rb_raise(rb_eArgError, "precision too large."); - } - - /* Use the same logic in flo_to_s to convert a float to a decimal string */ - char buf[BIGDECIMAL_DOUBLE_FIGURES + BASE_FIG + 2 + 1]; /* sizeof(buf) == 28 in the typical case */ - int decpt, negative_p; - char *e; - const int mode = digs == 0 ? 0 : 2; - char *p = BigDecimal_dtoa(d, mode, (int)digs, &decpt, &negative_p, &e); - int len10 = (int)(e - p); - if (len10 > BIGDECIMAL_DOUBLE_FIGURES) { - /* TODO: Presumably, rounding should be done here. */ - len10 = BIGDECIMAL_DOUBLE_FIGURES; - } - memcpy(buf, p, len10); - free(p); - - VALUE inum; - size_t RB_UNUSED_VAR(prec) = 0; - SIGNED_VALUE exp = 0; - if (decpt > 0) { - if (decpt < len10) { - /* - * len10 |---------------| - * : |-------| frac_len10 = len10 - decpt - * decpt |-------| |--| ntz10 = BASE_FIG - frac_len10 % BASE_FIG - * : : : - * 00 dd dddd.dddd dd 00 - * prec |-----.----.----.-----| prec = exp + roomof(frac_len, BASE_FIG) - * exp |-----.----| exp = roomof(decpt, BASE_FIG) - */ - const size_t frac_len10 = len10 - decpt; - const size_t ntz10 = BASE_FIG - frac_len10 % BASE_FIG; - memset(buf + len10, '0', ntz10); - buf[len10 + ntz10] = '\0'; - inum = rb_cstr_to_inum(buf, 10, false); - - exp = roomof(decpt, BASE_FIG); - prec = exp + roomof(frac_len10, BASE_FIG); - } - else { - /* - * decpt |-----------------------| - * len10 |----------| : - * : |------------| exp10 - * : : : - * 00 dd dddd dd 00 0000 0000.0 - * : : : : - * : |--| ntz10 = exp10 % BASE_FIG - * prec |-----.----.-----| : - * : |----.----| exp10 / BASE_FIG - * exp |-----.----.-----.----.----| - */ - const size_t exp10 = decpt - len10; - const size_t ntz10 = exp10 % BASE_FIG; - - memset(buf + len10, '0', ntz10); - buf[len10 + ntz10] = '\0'; - inum = rb_cstr_to_inum(buf, 10, false); - - prec = roomof(len10 + ntz10, BASE_FIG); - exp = prec + exp10 / BASE_FIG; - } - } - else if (decpt == 0) { - /* - * len10 |------------| - * : : - * 0.dddd dddd dd 00 - * : : : - * : |--| ntz10 = prec * BASE_FIG - len10 - * prec |----.----.-----| roomof(len10, BASE_FIG) - */ - prec = roomof(len10, BASE_FIG); - const size_t ntz10 = prec * BASE_FIG - len10; - - memset(buf + len10, '0', ntz10); - buf[len10 + ntz10] = '\0'; - inum = rb_cstr_to_inum(buf, 10, false); - } - else { - /* - * len10 |---------------| - * : : - * decpt |-------| |--| ntz10 = prec * BASE_FIG - nlz10 - len10 - * : : : - * 0.0000 00 dd dddd dddd dd 00 - * : : : - * nlz10 |--| : decpt % BASE_FIG - * prec |-----.----.----.-----| roomof(decpt + len10, BASE_FIG) - exp - * exp |----| decpt / BASE_FIG - */ - decpt = -decpt; - - const size_t nlz10 = decpt % BASE_FIG; - exp = decpt / BASE_FIG; - prec = roomof(decpt + len10, BASE_FIG) - exp; - const size_t ntz10 = prec * BASE_FIG - nlz10 - len10; - - if (nlz10 > 0) { - memmove(buf + nlz10, buf, len10); - memset(buf, '0', nlz10); - } - memset(buf + nlz10 + len10, '0', ntz10); - buf[nlz10 + len10 + ntz10] = '\0'; - inum = rb_cstr_to_inum(buf, 10, false); - - exp = -exp; - } - - VALUE bd = rb_inum_convert_to_BigDecimal(inum); - Real *vp = VpPtr(bd); - assert(vp->Prec == prec); - vp->exponent = exp; - - if (negative_p) VpSetSign(vp, -1); - return bd; -} - -static VALUE -rb_rational_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception) -{ - assert(RB_TYPE_P(val, T_RATIONAL)); - - if (digs == SIZE_MAX) { - if (!raise_exception) - return Qnil; - rb_raise(rb_eArgError, - "can't omit precision for a %"PRIsVALUE".", - CLASS_OF(val)); - } - - VALUE num = rb_inum_convert_to_BigDecimal(rb_rational_num(val)); - VALUE d = BigDecimal_div2(num, rb_rational_den(val), SIZET2NUM(digs)); - return d; -} - -static VALUE -rb_cstr_convert_to_BigDecimal(const char *c_str, int raise_exception) -{ - NULLABLE_BDVALUE v = CreateFromString(c_str, rb_cBigDecimal, true, raise_exception); - if (v.bigdecimal_or_nil == Qnil) return Qnil; - return CheckGetValue(bdvalue_nonnullable(v)); -} - -static inline VALUE -rb_str_convert_to_BigDecimal(VALUE val, int raise_exception) -{ - StringValue(val); - rb_must_asciicompat(val); - if (!raise_exception && memchr(RSTRING_PTR(val), '\0', RSTRING_LEN(val))) return Qnil; - const char *c_str = StringValueCStr(val); - VALUE bd = rb_cstr_convert_to_BigDecimal(c_str, raise_exception); - RB_GC_GUARD(val); - return bd; -} - -static VALUE -rb_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception) -{ - switch (val) { - case Qnil: - case Qtrue: - case Qfalse: - if (raise_exception) { - const char *cname = NIL_P(val) ? "nil" : - val == Qtrue ? "true" : - val == Qfalse ? "false" : - NULL; - rb_raise(rb_eTypeError, - "can't convert %s into BigDecimal", cname); - } - return Qnil; - - default: - break; - } - - if (is_kind_of_BigDecimal(val)) { - if (digs == SIZE_MAX) - return check_exception(val); - - Real *vp = VpPtr(val); - - VALUE copy = BigDecimal_allocate(vp->MaxPrec); - Real *vp_copy = VpPtr(copy); - - VpMemCopy(vp_copy, vp); - - RB_GC_GUARD(val); - - /* TODO: rounding */ - return check_exception(copy); - } - else if (RB_INTEGER_TYPE_P(val)) { - return rb_inum_convert_to_BigDecimal(val); - } - else if (RB_FLOAT_TYPE_P(val)) { - return rb_float_convert_to_BigDecimal(val, digs, raise_exception); - } - else if (RB_TYPE_P(val, T_RATIONAL)) { - return rb_rational_convert_to_BigDecimal(val, digs, raise_exception); - } - else if (RB_TYPE_P(val, T_COMPLEX)) { - VALUE im = rb_complex_imag(val); - if (!is_zero(im)) { - if (!raise_exception) return Qnil; - rb_raise(rb_eArgError, - "Unable to make a BigDecimal from non-zero imaginary number"); - } - return rb_convert_to_BigDecimal(rb_complex_real(val), digs, raise_exception); - } - else if (RB_TYPE_P(val, T_STRING)) { - return rb_str_convert_to_BigDecimal(val, raise_exception); - } - - /* TODO: chheck to_d */ - /* TODO: chheck to_int */ - - VALUE str = rb_check_convert_type(val, T_STRING, "String", "to_str"); - if (!RB_TYPE_P(str, T_STRING)) { - if (raise_exception) { - rb_raise(rb_eTypeError, - "can't convert %"PRIsVALUE" into BigDecimal", rb_obj_class(val)); - } - return Qnil; - } - return rb_str_convert_to_BigDecimal(str, raise_exception); -} - -/* call-seq: - * BigDecimal(value, exception: true) -> bigdecimal - * BigDecimal(value, ndigits, exception: true) -> bigdecimal - * - * Returns the \BigDecimal converted from +value+ - * with a precision of +ndigits+ decimal digits. - * - * When +ndigits+ is less than the number of significant digits - * in the value, the result is rounded to that number of digits, - * according to the current rounding mode; see BigDecimal.mode. - * - * When +ndigits+ is 0, the number of digits to correctly represent a float number - * is determined automatically. - * - * Returns +value+ converted to a \BigDecimal, depending on the type of +value+: - * - * - Integer, Float, Rational, Complex, or BigDecimal: converted directly: - * - * # Integer, Complex, Float, or BigDecimal value does not require ndigits; ignored if given. - * BigDecimal(2) # => 0.2e1 - * BigDecimal(Complex(2, 0)) # => 0.2e1 - * BigDecimal(BigDecimal(2)) # => 0.2e1 - * BigDecimal(2.0) # => 0.2e1 - * # Rational value requires ndigits. - * BigDecimal(Rational(2, 1), 0) # => 0.2e1 - * - * - String: converted by parsing if it contains an integer or floating-point literal; - * leading and trailing whitespace is ignored: - * - * # String does not require ndigits; ignored if given. - * BigDecimal('2') # => 0.2e1 - * BigDecimal('2.0') # => 0.2e1 - * BigDecimal('0.2e1') # => 0.2e1 - * BigDecimal(' 2.0 ') # => 0.2e1 - * - * - Other type that responds to method :to_str: - * first converted to a string, then converted to a \BigDecimal, as above. - * - * - Other type: - * - * - Raises an exception if keyword argument +exception+ is +true+. - * - Returns +nil+ if keyword argument +exception+ is +false+. - * - * Raises an exception if +value+ evaluates to a Float - * and +digits+ is larger than Float::DIG + 1. - * - */ -static VALUE -f_BigDecimal(int argc, VALUE *argv, VALUE self) -{ - VALUE val, digs_v, opts = Qnil; - argc = rb_scan_args(argc, argv, "11:", &val, &digs_v, &opts); - int exception = opts_exception_p(opts); - - size_t digs = SIZE_MAX; /* this means digs is omitted */ - if (argc > 1) { - digs_v = rb_to_int(digs_v); - if (FIXNUM_P(digs_v)) { - long n = FIX2LONG(digs_v); - if (n < 0) - goto negative_digs; - digs = (size_t)n; - } - else { - if (RBIGNUM_NEGATIVE_P(digs_v)) { - negative_digs: - if (!exception) - return Qnil; - rb_raise(rb_eArgError, "negative precision"); - } - digs = NUM2SIZET(digs_v); - } - } - - return rb_convert_to_BigDecimal(val, digs, exception); -} - -/* call-seq: - * BigDecimal.interpret_loosely(string) -> bigdecimal - * - * Returns the +BigDecimal+ converted loosely from +string+. - */ - -static VALUE -BigDecimal_s_interpret_loosely(VALUE klass, VALUE str) -{ - StringValue(str); - rb_must_asciicompat(str); - /* Like String#to_f, ignore everything after an embedded NUL */ - const char *p = RSTRING_PTR(str); - const char *nul = memchr(p, '\0', RSTRING_LEN(str)); - if (nul) str = rb_str_subseq(str, 0, nul - p); - char const *c_str = StringValueCStr(str); - NULLABLE_BDVALUE v = CreateFromString(c_str, klass, false, true); - RB_GC_GUARD(str); - if (v.bigdecimal_or_nil == Qnil) - return Qnil; - else - return CheckGetValue(bdvalue_nonnullable(v)); -} - - /* - * call-seq: - * BigDecimal.limit(digits) - * - * Limit the number of significant digits in newly created BigDecimal - * numbers to the specified value. Rounding is performed as necessary, - * as specified by BigDecimal.mode. - * - * A limit of 0, the default, means no upper limit. - * - * The limit specified by this method takes less priority over any limit - * specified to instance methods such as ceil, floor, truncate, or round. - */ -static VALUE -BigDecimal_limit(int argc, VALUE *argv, VALUE self) -{ - VALUE nFig; - VALUE nCur = SIZET2NUM(VpGetPrecLimit()); - - if (rb_scan_args(argc, argv, "01", &nFig) == 1) { - int nf; - if (NIL_P(nFig)) return nCur; - nf = NUM2INT(nFig); - if (nf < 0) { - rb_raise(rb_eArgError, "argument must be positive"); - } - VpSetPrecLimit(nf); - } - return nCur; -} - -/* Returns the sign of the value. - * - * Returns a positive value if > 0, a negative value if < 0. - * It behaves the same with zeros - - * it returns a positive value for a positive zero (BigDecimal('0')) and - * a negative value for a negative zero (BigDecimal('-0')). - * - * The specific value returned indicates the type and sign of the BigDecimal, - * as follows: - * - * BigDecimal::SIGN_NaN:: value is Not a Number - * BigDecimal::SIGN_POSITIVE_ZERO:: value is +0 - * BigDecimal::SIGN_NEGATIVE_ZERO:: value is -0 - * BigDecimal::SIGN_POSITIVE_INFINITE:: value is +Infinity - * BigDecimal::SIGN_NEGATIVE_INFINITE:: value is -Infinity - * BigDecimal::SIGN_POSITIVE_FINITE:: value is positive - * BigDecimal::SIGN_NEGATIVE_FINITE:: value is negative - */ -static VALUE -BigDecimal_sign(VALUE self) -{ /* sign */ - int s = GetSelfVpValue(self)->sign; - return INT2FIX(s); -} - -/* - * call-seq: BigDecimal.save_exception_mode { ... } - * - * Execute the provided block, but preserve the exception mode - * - * BigDecimal.save_exception_mode do - * BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) - * BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) - * - * BigDecimal(BigDecimal('Infinity')) - * BigDecimal(BigDecimal('-Infinity')) - * BigDecimal(BigDecimal('NaN')) - * end - * - * For use with the BigDecimal::EXCEPTION_* - * - * See BigDecimal.mode - */ -static VALUE -BigDecimal_save_exception_mode(VALUE self) -{ - unsigned short const exception_mode = VpGetException(); - int state; - VALUE ret = rb_protect(rb_yield, Qnil, &state); - VpSetException(exception_mode); - if (state) rb_jump_tag(state); - return ret; -} - -/* - * call-seq: BigDecimal.save_rounding_mode { ... } - * - * Execute the provided block, but preserve the rounding mode - * - * BigDecimal.save_rounding_mode do - * BigDecimal.mode(BigDecimal::ROUND_MODE, :up) - * puts BigDecimal.mode(BigDecimal::ROUND_MODE) - * end - * - * For use with the BigDecimal::ROUND_* - * - * See BigDecimal.mode - */ -static VALUE -BigDecimal_save_rounding_mode(VALUE self) -{ - unsigned short const round_mode = VpGetRoundMode(); - int state; - VALUE ret = rb_protect(rb_yield, Qnil, &state); - VpSetRoundMode(round_mode); - if (state) rb_jump_tag(state); - return ret; -} - -/* - * call-seq: BigDecimal.save_limit { ... } - * - * Execute the provided block, but preserve the precision limit - * - * BigDecimal.limit(100) - * puts BigDecimal.limit - * BigDecimal.save_limit do - * BigDecimal.limit(200) - * puts BigDecimal.limit - * end - * puts BigDecimal.limit - * - */ -static VALUE -BigDecimal_save_limit(VALUE self) -{ - size_t const limit = VpGetPrecLimit(); - int state; - VALUE ret = rb_protect(rb_yield, Qnil, &state); - VpSetPrecLimit(limit); - if (state) rb_jump_tag(state); - return ret; -} - -static VALUE BIGDECIMAL_NAN = Qnil; - -static VALUE -BigDecimal_nan(void) -{ - return BIGDECIMAL_NAN; -} - -static VALUE BIGDECIMAL_POSITIVE_INFINITY = Qnil; - -static VALUE -BigDecimal_positive_infinity(void) -{ - return BIGDECIMAL_POSITIVE_INFINITY; -} - -static VALUE BIGDECIMAL_NEGATIVE_INFINITY = Qnil; - -static VALUE -BigDecimal_negative_infinity(void) -{ - return BIGDECIMAL_NEGATIVE_INFINITY; -} - -static VALUE BIGDECIMAL_POSITIVE_ZERO = Qnil; - -static VALUE -BigDecimal_positive_zero(void) -{ - return BIGDECIMAL_POSITIVE_ZERO; -} - -static VALUE BIGDECIMAL_NEGATIVE_ZERO = Qnil; - -static VALUE -BigDecimal_negative_zero(void) -{ - return BIGDECIMAL_NEGATIVE_ZERO; -} - -static inline VALUE -BigDecimal_literal(const char *str) -{ - VALUE arg = rb_str_new_cstr(str); - VALUE val = f_BigDecimal(1, &arg, rb_cBigDecimal); - rb_gc_register_mark_object(val); - return val; -} - -#define BIGDECIMAL_LITERAL(var, val) (BIGDECIMAL_ ## var = BigDecimal_literal(#val)) - -#ifdef BIGDECIMAL_USE_VP_TEST_METHODS -VALUE -BigDecimal_vpdivd_generic(VALUE self, VALUE r, VALUE cprec, void (*vpdivd_func)(Real*, Real*, Real*, Real*)) { - BDVALUE a, b, c, d; - size_t cn = NUM2INT(cprec); - a = GetBDValueMust(self); - b = GetBDValueMust(r); - c = NewZeroWrap(1, cn * BASE_FIG); - d = NewZeroWrap(1, VPDIVD_REM_PREC(a.real, b.real, c.real) * BASE_FIG); - vpdivd_func(c.real, d.real, a.real, b.real); - RB_GC_GUARD(a.bigdecimal); - RB_GC_GUARD(b.bigdecimal); - return rb_assoc_new(c.bigdecimal, d.bigdecimal); -} - -void -VpDivdNormal(Real *c, Real *r, Real *a, Real *b) { - VpDivd(c, r, a, b); -} - -VALUE -BigDecimal_vpdivd(VALUE self, VALUE r, VALUE cprec) { - return BigDecimal_vpdivd_generic(self, r, cprec, VpDivdNormal); -} - -VALUE -BigDecimal_vpdivd_newton(VALUE self, VALUE r, VALUE cprec) { - return BigDecimal_vpdivd_generic(self, r, cprec, VpDivdNewton); -} - -VALUE -BigDecimal_newton_raphson_inverse(VALUE self, VALUE prec) { - return newton_raphson_inverse(self, NUM2SIZET(prec)); -} - -VALUE -BigDecimal_vpmult(VALUE self, VALUE v) { - BDVALUE a,b,c; - a = GetBDValueMust(self); - b = GetBDValueMust(v); - c = NewZeroWrap(1, VPMULT_RESULT_PREC(a.real, b.real) * BASE_FIG); - VpMult(c.real, a.real, b.real); - RB_GC_GUARD(a.bigdecimal); - RB_GC_GUARD(b.bigdecimal); - return c.bigdecimal; -} - -VALUE -BigDecimal_nttmult(VALUE self, VALUE v) { - BDVALUE a,b,c; - a = GetBDValueMust(self); - b = GetBDValueMust(v); - c = NewZeroWrap(1, VPMULT_RESULT_PREC(a.real, b.real) * BASE_FIG); - ntt_multiply(a.real->Prec, b.real->Prec, a.real->frac, b.real->frac, c.real->frac); - VpSetSign(c.real, a.real->sign * b.real->sign); - c.real->exponent = a.real->exponent + b.real->exponent; - c.real->Prec = a.real->Prec + b.real->Prec; - VpNmlz(c.real); - RB_GC_GUARD(a.bigdecimal); - RB_GC_GUARD(b.bigdecimal); - return c.bigdecimal; -} - -#endif /* BIGDECIMAL_USE_VP_TEST_METHODS */ - -/* Document-class: BigDecimal - * BigDecimal provides arbitrary-precision floating point decimal arithmetic. - * - * == Introduction - * - * Ruby provides built-in support for arbitrary precision integer arithmetic. - * - * For example: - * - * 42**13 #=> 1265437718438866624512 - * - * BigDecimal provides similar support for very large or very accurate floating - * point numbers. - * - * Decimal arithmetic is also useful for general calculation, because it - * provides the correct answers people expect--whereas normal binary floating - * point arithmetic often introduces subtle errors because of the conversion - * between base 10 and base 2. - * - * For example, try: - * - * sum = 0 - * 10_000.times do - * sum = sum + 0.0001 - * end - * print sum #=> 0.9999999999999062 - * - * and contrast with the output from: - * - * require 'bigdecimal' - * - * sum = BigDecimal("0") - * 10_000.times do - * sum = sum + BigDecimal("0.0001") - * end - * print sum #=> 0.1E1 - * - * Similarly: - * - * (BigDecimal("1.2") - BigDecimal("1.0")) == BigDecimal("0.2") #=> true - * - * (1.2 - 1.0) == 0.2 #=> false - * - * == A Note About Precision - * - * For a calculation using a \BigDecimal and another +value+, - * the precision of the result depends on the type of +value+: - * - * - If +value+ is a \Float, - * the precision is Float::DIG + 1. - * - If +value+ is a \Rational, the precision is larger than Float::DIG + 1. - * - If +value+ is a \BigDecimal, the precision is +value+'s precision in the - * internal representation, which is platform-dependent. - * - If +value+ is other object, the precision is determined by the result of +BigDecimal(value)+. - * - * == Special features of accurate decimal arithmetic - * - * Because BigDecimal is more accurate than normal binary floating point - * arithmetic, it requires some special values. - * - * === Infinity - * - * BigDecimal sometimes needs to return infinity, for example if you divide - * a value by zero. - * - * BigDecimal("1.0") / BigDecimal("0.0") #=> Infinity - * BigDecimal("-1.0") / BigDecimal("0.0") #=> -Infinity - * - * You can represent infinite numbers to BigDecimal using the strings - * 'Infinity', '+Infinity' and - * '-Infinity' (case-sensitive) - * - * === Not a Number - * - * When a computation results in an undefined value, the special value +NaN+ - * (for 'not a number') is returned. - * - * Example: - * - * BigDecimal("0.0") / BigDecimal("0.0") #=> NaN - * - * You can also create undefined values. - * - * NaN is never considered to be the same as any other value, even NaN itself: - * - * n = BigDecimal('NaN') - * n == 0.0 #=> false - * n == n #=> false - * - * === Positive and negative zero - * - * If a computation results in a value which is too small to be represented as - * a BigDecimal within the currently specified limits of precision, zero must - * be returned. - * - * If the value which is too small to be represented is negative, a BigDecimal - * value of negative zero is returned. - * - * BigDecimal("1.0") / BigDecimal("-Infinity") #=> -0.0 - * - * If the value is positive, a value of positive zero is returned. - * - * BigDecimal("1.0") / BigDecimal("Infinity") #=> 0.0 - * - * (See BigDecimal.mode for how to specify limits of precision.) - * - * Note that +-0.0+ and +0.0+ are considered to be the same for the purposes of - * comparison. - * - * Note also that in mathematics, there is no particular concept of negative - * or positive zero; true mathematical zero has no sign. - * - * == bigdecimal/util - * - * When you require +bigdecimal/util+, the #to_d method will be - * available on BigDecimal and the native Integer, Float, Rational, - * String, Complex, and NilClass classes: - * - * require 'bigdecimal/util' - * - * 42.to_d # => 0.42e2 - * 0.5.to_d # => 0.5e0 - * (2/3r).to_d(3) # => 0.667e0 - * "0.5".to_d # => 0.5e0 - * Complex(0.1234567, 0).to_d(4) # => 0.1235e0 - * nil.to_d # => 0.0 - * - * == Methods for Working with \JSON - * - * - {::json_create}[https://docs.ruby-lang.org/en/master/BigDecimal.html#method-c-json_create]: - * Returns a new \BigDecimal object constructed from the given object. - * - {#as_json}[https://docs.ruby-lang.org/en/master/BigDecimal.html#method-i-as_json]: - * Returns a 2-element hash representing +self+. - * - {#to_json}[https://docs.ruby-lang.org/en/master/BigDecimal.html#method-i-to_json]: - * Returns a \JSON string representing +self+. - * - * These methods are provided by the {JSON gem}[https://github.com/flori/json]. To make these methods available: - * - * require 'json/add/bigdecimal' - * - * * == License - * - * Copyright (C) 2002 by Shigeo Kobayashi . - * - * BigDecimal is released under the Ruby and 2-clause BSD licenses. - * See LICENSE.txt for details. - * - * Maintained by mrkn and ruby-core members. - * - * Documented by zzak , mathew , and - * many other contributors. - */ -void -Init_bigdecimal(void) -{ -#ifdef HAVE_RB_EXT_RACTOR_SAFE - rb_ext_ractor_safe(true); -#endif - - id_BigDecimal_exception_mode = rb_intern_const("BigDecimal.exception_mode"); - id_BigDecimal_rounding_mode = rb_intern_const("BigDecimal.rounding_mode"); - id_BigDecimal_precision_limit = rb_intern_const("BigDecimal.precision_limit"); - - /* Initialize VP routines */ - VpInit(0UL); - - /* Class and method registration */ - rb_cBigDecimal = rb_define_class("BigDecimal", rb_cNumeric); - - /* Global function */ - rb_define_global_function("BigDecimal", f_BigDecimal, -1); - - /* Class methods */ - rb_undef_alloc_func(rb_cBigDecimal); - rb_undef_method(CLASS_OF(rb_cBigDecimal), "new"); - rb_define_singleton_method(rb_cBigDecimal, "interpret_loosely", BigDecimal_s_interpret_loosely, 1); - rb_define_singleton_method(rb_cBigDecimal, "mode", BigDecimal_mode, -1); - rb_define_singleton_method(rb_cBigDecimal, "limit", BigDecimal_limit, -1); - rb_define_singleton_method(rb_cBigDecimal, "double_fig", BigDecimal_double_fig, 0); - rb_define_singleton_method(rb_cBigDecimal, "_load", BigDecimal_load, 1); - - rb_define_singleton_method(rb_cBigDecimal, "save_exception_mode", BigDecimal_save_exception_mode, 0); - rb_define_singleton_method(rb_cBigDecimal, "save_rounding_mode", BigDecimal_save_rounding_mode, 0); - rb_define_singleton_method(rb_cBigDecimal, "save_limit", BigDecimal_save_limit, 0); - - /* Constants definition */ - - /* - * The version of bigdecimal library - */ - rb_define_const(rb_cBigDecimal, "VERSION", rb_str_new2(BIGDECIMAL_VERSION)); - - /* - * Base value used in internal calculations. On a 32 bit system, BASE - * is 10000, indicating that calculation is done in groups of 4 digits. - * (If it were larger, BASE**2 wouldn't fit in 32 bits, so you couldn't - * guarantee that two groups could always be multiplied together without - * overflow.) - */ - rb_define_const(rb_cBigDecimal, "BASE", INT2FIX((SIGNED_VALUE)BASE)); - - /* Exceptions */ - - /* - * 0xff: Determines whether overflow, underflow or zero divide result in - * an exception being thrown. See BigDecimal.mode. - */ - rb_define_const(rb_cBigDecimal, "EXCEPTION_ALL", INT2FIX(VP_EXCEPTION_ALL)); - - /* - * 0x02: Determines what happens when the result of a computation is not a - * number (NaN). See BigDecimal.mode. - */ - rb_define_const(rb_cBigDecimal, "EXCEPTION_NaN", INT2FIX(VP_EXCEPTION_NaN)); - - /* - * 0x01: Determines what happens when the result of a computation is - * infinity. See BigDecimal.mode. - */ - rb_define_const(rb_cBigDecimal, "EXCEPTION_INFINITY", INT2FIX(VP_EXCEPTION_INFINITY)); - - /* - * 0x04: Determines what happens when the result of a computation is an - * underflow (a result too small to be represented). See BigDecimal.mode. - */ - rb_define_const(rb_cBigDecimal, "EXCEPTION_UNDERFLOW", INT2FIX(VP_EXCEPTION_UNDERFLOW)); - - /* - * 0x01: Determines what happens when the result of a computation is an - * overflow (a result too large to be represented). See BigDecimal.mode. - */ - rb_define_const(rb_cBigDecimal, "EXCEPTION_OVERFLOW", INT2FIX(VP_EXCEPTION_OVERFLOW)); - - /* - * 0x10: Determines what happens when a division by zero is performed. - * See BigDecimal.mode. - */ - rb_define_const(rb_cBigDecimal, "EXCEPTION_ZERODIVIDE", INT2FIX(VP_EXCEPTION_ZERODIVIDE)); - - /* - * 0x100: Determines what happens when a result must be rounded in order to - * fit in the appropriate number of significant digits. See - * BigDecimal.mode. - */ - rb_define_const(rb_cBigDecimal, "ROUND_MODE", INT2FIX(VP_ROUND_MODE)); - - /* 1: Indicates that values should be rounded away from zero. See - * BigDecimal.mode. - */ - rb_define_const(rb_cBigDecimal, "ROUND_UP", INT2FIX(VP_ROUND_UP)); - - /* 2: Indicates that values should be rounded towards zero. See - * BigDecimal.mode. - */ - rb_define_const(rb_cBigDecimal, "ROUND_DOWN", INT2FIX(VP_ROUND_DOWN)); - - /* 3: Indicates that digits >= 5 should be rounded up, others rounded down. - * See BigDecimal.mode. */ - rb_define_const(rb_cBigDecimal, "ROUND_HALF_UP", INT2FIX(VP_ROUND_HALF_UP)); - - /* 4: Indicates that digits >= 6 should be rounded up, others rounded down. - * See BigDecimal.mode. - */ - rb_define_const(rb_cBigDecimal, "ROUND_HALF_DOWN", INT2FIX(VP_ROUND_HALF_DOWN)); - /* 5: Round towards +Infinity. See BigDecimal.mode. */ - rb_define_const(rb_cBigDecimal, "ROUND_CEILING", INT2FIX(VP_ROUND_CEIL)); - - /* 6: Round towards -Infinity. See BigDecimal.mode. */ - rb_define_const(rb_cBigDecimal, "ROUND_FLOOR", INT2FIX(VP_ROUND_FLOOR)); - - /* 7: Round towards the even neighbor. See BigDecimal.mode. */ - rb_define_const(rb_cBigDecimal, "ROUND_HALF_EVEN", INT2FIX(VP_ROUND_HALF_EVEN)); - - /* 0: Indicates that a value is not a number. See BigDecimal.sign. */ - rb_define_const(rb_cBigDecimal, "SIGN_NaN", INT2FIX(VP_SIGN_NaN)); - - /* 1: Indicates that a value is +0. See BigDecimal.sign. */ - rb_define_const(rb_cBigDecimal, "SIGN_POSITIVE_ZERO", INT2FIX(VP_SIGN_POSITIVE_ZERO)); - - /* -1: Indicates that a value is -0. See BigDecimal.sign. */ - rb_define_const(rb_cBigDecimal, "SIGN_NEGATIVE_ZERO", INT2FIX(VP_SIGN_NEGATIVE_ZERO)); - - /* 2: Indicates that a value is positive and finite. See BigDecimal.sign. */ - rb_define_const(rb_cBigDecimal, "SIGN_POSITIVE_FINITE", INT2FIX(VP_SIGN_POSITIVE_FINITE)); - - /* -2: Indicates that a value is negative and finite. See BigDecimal.sign. */ - rb_define_const(rb_cBigDecimal, "SIGN_NEGATIVE_FINITE", INT2FIX(VP_SIGN_NEGATIVE_FINITE)); - - /* 3: Indicates that a value is positive and infinite. See BigDecimal.sign. */ - rb_define_const(rb_cBigDecimal, "SIGN_POSITIVE_INFINITE", INT2FIX(VP_SIGN_POSITIVE_INFINITE)); - - /* -3: Indicates that a value is negative and infinite. See BigDecimal.sign. */ - rb_define_const(rb_cBigDecimal, "SIGN_NEGATIVE_INFINITE", INT2FIX(VP_SIGN_NEGATIVE_INFINITE)); - - /* Positive zero value. */ - BIGDECIMAL_LITERAL(POSITIVE_ZERO, +0); - - /* Negative zero value. */ - BIGDECIMAL_LITERAL(NEGATIVE_ZERO, -0); - - /* Positive infinity[rdoc-ref:BigDecimal@Infinity] value. */ - rb_define_const(rb_cBigDecimal, "INFINITY", BIGDECIMAL_LITERAL(POSITIVE_INFINITY, +Infinity)); - - /* Negative infinity value. */ - BIGDECIMAL_LITERAL(NEGATIVE_INFINITY, -Infinity); - - /* '{Not a Number}[rdoc-ref:BigDecimal@Not+a+Number]' value. */ - rb_define_const(rb_cBigDecimal, "NAN", BIGDECIMAL_LITERAL(NAN, NaN)); - - /* instance methods */ - rb_define_method(rb_cBigDecimal, "precision", BigDecimal_precision, 0); - rb_define_method(rb_cBigDecimal, "scale", BigDecimal_scale, 0); - rb_define_method(rb_cBigDecimal, "precision_scale", BigDecimal_precision_scale, 0); - rb_define_method(rb_cBigDecimal, "n_significant_digits", BigDecimal_n_significant_digits, 0); - - rb_define_method(rb_cBigDecimal, "add", BigDecimal_add2, 2); - rb_define_method(rb_cBigDecimal, "sub", BigDecimal_sub2, 2); - rb_define_method(rb_cBigDecimal, "mult", BigDecimal_mult2, 2); - rb_define_method(rb_cBigDecimal, "div", BigDecimal_div3, -1); - rb_define_method(rb_cBigDecimal, "hash", BigDecimal_hash, 0); - rb_define_method(rb_cBigDecimal, "to_s", BigDecimal_to_s, -1); - rb_define_method(rb_cBigDecimal, "to_i", BigDecimal_to_i, 0); - rb_define_method(rb_cBigDecimal, "to_int", BigDecimal_to_i, 0); - rb_define_method(rb_cBigDecimal, "to_r", BigDecimal_to_r, 0); - rb_define_method(rb_cBigDecimal, "split", BigDecimal_split, 0); - rb_define_method(rb_cBigDecimal, "+", BigDecimal_add, 1); - rb_define_method(rb_cBigDecimal, "-", BigDecimal_sub, 1); - rb_define_method(rb_cBigDecimal, "+@", BigDecimal_uplus, 0); - rb_define_method(rb_cBigDecimal, "-@", BigDecimal_neg, 0); - rb_define_method(rb_cBigDecimal, "*", BigDecimal_mult, 1); - rb_define_method(rb_cBigDecimal, "/", BigDecimal_div, 1); - rb_define_method(rb_cBigDecimal, "quo", BigDecimal_quo, -1); - rb_define_method(rb_cBigDecimal, "%", BigDecimal_mod, 1); - rb_define_method(rb_cBigDecimal, "modulo", BigDecimal_mod, 1); - rb_define_method(rb_cBigDecimal, "remainder", BigDecimal_remainder, 1); - rb_define_method(rb_cBigDecimal, "divmod", BigDecimal_divmod, 1); - rb_define_method(rb_cBigDecimal, "clone", BigDecimal_clone, 0); - rb_define_method(rb_cBigDecimal, "dup", BigDecimal_clone, 0); - rb_define_method(rb_cBigDecimal, "to_f", BigDecimal_to_f, 0); - rb_define_method(rb_cBigDecimal, "abs", BigDecimal_abs, 0); - rb_define_method(rb_cBigDecimal, "fix", BigDecimal_fix, 0); - rb_define_method(rb_cBigDecimal, "round", BigDecimal_round, -1); - rb_define_method(rb_cBigDecimal, "frac", BigDecimal_frac, 0); - rb_define_method(rb_cBigDecimal, "floor", BigDecimal_floor, -1); - rb_define_method(rb_cBigDecimal, "ceil", BigDecimal_ceil, -1); - rb_define_method(rb_cBigDecimal, "<=>", BigDecimal_comp, 1); - rb_define_method(rb_cBigDecimal, "==", BigDecimal_eq, 1); - rb_define_method(rb_cBigDecimal, "===", BigDecimal_eq, 1); - rb_define_method(rb_cBigDecimal, "eql?", BigDecimal_eq, 1); - rb_define_method(rb_cBigDecimal, "<", BigDecimal_lt, 1); - rb_define_method(rb_cBigDecimal, "<=", BigDecimal_le, 1); - rb_define_method(rb_cBigDecimal, ">", BigDecimal_gt, 1); - rb_define_method(rb_cBigDecimal, ">=", BigDecimal_ge, 1); - rb_define_method(rb_cBigDecimal, "zero?", BigDecimal_zero, 0); - rb_define_method(rb_cBigDecimal, "nonzero?", BigDecimal_nonzero, 0); - rb_define_method(rb_cBigDecimal, "coerce", BigDecimal_coerce, 1); - rb_define_method(rb_cBigDecimal, "inspect", BigDecimal_inspect, 0); - rb_define_method(rb_cBigDecimal, "exponent", BigDecimal_exponent, 0); - rb_define_method(rb_cBigDecimal, "sign", BigDecimal_sign, 0); - rb_define_method(rb_cBigDecimal, "nan?", BigDecimal_IsNaN, 0); - rb_define_method(rb_cBigDecimal, "infinite?", BigDecimal_IsInfinite, 0); - rb_define_method(rb_cBigDecimal, "finite?", BigDecimal_IsFinite, 0); - rb_define_method(rb_cBigDecimal, "truncate", BigDecimal_truncate, -1); - rb_define_method(rb_cBigDecimal, "_decimal_shift", BigDecimal_decimal_shift, 1); - rb_define_method(rb_cBigDecimal, "_dump", BigDecimal_dump, -1); - -#ifdef BIGDECIMAL_USE_VP_TEST_METHODS - rb_define_method(rb_cBigDecimal, "vpdivd", BigDecimal_vpdivd, 2); - rb_define_method(rb_cBigDecimal, "vpdivd_newton", BigDecimal_vpdivd_newton, 2); - rb_define_method(rb_cBigDecimal, "newton_raphson_inverse", BigDecimal_newton_raphson_inverse, 1); - rb_define_method(rb_cBigDecimal, "vpmult", BigDecimal_vpmult, 1); - rb_define_method(rb_cBigDecimal, "nttmult", BigDecimal_nttmult, 1); -#endif /* BIGDECIMAL_USE_VP_TEST_METHODS */ - -#define ROUNDING_MODE(i, name, value) \ - id_##name = rb_intern_const(#name); \ - rbd_rounding_modes[i].id = id_##name; \ - rbd_rounding_modes[i].mode = value; - - ROUNDING_MODE(0, up, RBD_ROUND_UP); - ROUNDING_MODE(1, down, RBD_ROUND_DOWN); - ROUNDING_MODE(2, half_up, RBD_ROUND_HALF_UP); - ROUNDING_MODE(3, half_down, RBD_ROUND_HALF_DOWN); - ROUNDING_MODE(4, ceil, RBD_ROUND_CEIL); - ROUNDING_MODE(5, floor, RBD_ROUND_FLOOR); - ROUNDING_MODE(6, half_even, RBD_ROUND_HALF_EVEN); - - ROUNDING_MODE(7, default, RBD_ROUND_DEFAULT); - ROUNDING_MODE(8, truncate, RBD_ROUND_TRUNCATE); - ROUNDING_MODE(9, banker, RBD_ROUND_BANKER); - ROUNDING_MODE(10, ceiling, RBD_ROUND_CEILING); - -#undef ROUNDING_MODE - - id_eq = rb_intern_const("=="); - id_half = rb_intern_const("half"); - - (void)VPrint; /* suppress unused warning */ -} - -/* - * - * ============================================================================ - * - * vp_ routines begin from here. - * - * ============================================================================ - * - */ -#ifdef BIGDECIMAL_DEBUG -static int gfDebug = 1; /* Debug switch */ -#endif /* BIGDECIMAL_DEBUG */ - -static VALUE VpConstOne; /* constant 1.0 */ - -enum op_sw { - OP_SW_ADD = 1, /* + */ - OP_SW_SUB, /* - */ - OP_SW_MULT, /* * */ - OP_SW_DIV /* / */ -}; - -static int VpIsDefOP(Real *c, Real *a, Real *b, enum op_sw sw); -static DECDIG VpAddAbs(Real *a,Real *b,Real *c); -static DECDIG VpSubAbs(Real *a,Real *b,Real *c); -static size_t VpSetPTR(Real *a, Real *b, Real *c, size_t *a_pos, size_t *b_pos, size_t *c_pos, DECDIG *av, DECDIG *bv); -static void VpFormatSt(char *psz, size_t fFmt); -static int VpRdup(Real *m, size_t ind_m); - -#ifdef BIGDECIMAL_DEBUG -# ifdef HAVE_RB_EXT_RACTOR_SAFE -# error Need to make rewiting gnAlloc atomic -# endif -static int gnAlloc = 0; /* Memory allocation counter */ -#endif /* BIGDECIMAL_DEBUG */ - -/* - * EXCEPTION Handling. - */ - -#define bigdecimal_set_thread_local_exception_mode(mode) \ - rb_thread_local_aset( \ - rb_thread_current(), \ - id_BigDecimal_exception_mode, \ - INT2FIX((int)(mode)) \ - ) - -static unsigned short -VpGetException (void) -{ - VALUE const vmode = rb_thread_local_aref( - rb_thread_current(), - id_BigDecimal_exception_mode - ); - - if (NIL_P(vmode)) { - bigdecimal_set_thread_local_exception_mode(BIGDECIMAL_EXCEPTION_MODE_DEFAULT); - return BIGDECIMAL_EXCEPTION_MODE_DEFAULT; - } - - return NUM2USHORT(vmode); -} - -static void -VpSetException(unsigned short f) -{ - bigdecimal_set_thread_local_exception_mode(f); -} - -static void -VpCheckException(Real *p, bool always) -{ - if (VpIsNaN(p)) { - VpException(VP_EXCEPTION_NaN, "Computation results in 'NaN' (Not a Number)", always); - } - else if (VpIsPosInf(p)) { - VpException(VP_EXCEPTION_INFINITY, "Computation results in 'Infinity'", always); - } - else if (VpIsNegInf(p)) { - VpException(VP_EXCEPTION_INFINITY, "Computation results in '-Infinity'", always); - } -} - -static VALUE -CheckGetValue(BDVALUE v) -{ - VpCheckException(v.real, false); - return v.bigdecimal; -} - -/* - * Precision limit. - */ - -#define bigdecimal_set_thread_local_precision_limit(limit) \ - rb_thread_local_aset( \ - rb_thread_current(), \ - id_BigDecimal_precision_limit, \ - SIZET2NUM(limit) \ - ) -#define BIGDECIMAL_PRECISION_LIMIT_DEFAULT ((size_t)0) - -/* These 2 functions added at v1.1.7 */ -VP_EXPORT size_t -VpGetPrecLimit(void) -{ - VALUE const vlimit = rb_thread_local_aref( - rb_thread_current(), - id_BigDecimal_precision_limit - ); - - if (NIL_P(vlimit)) { - bigdecimal_set_thread_local_precision_limit(BIGDECIMAL_PRECISION_LIMIT_DEFAULT); - return BIGDECIMAL_PRECISION_LIMIT_DEFAULT; - } - - return NUM2SIZET(vlimit); -} - -VP_EXPORT void -VpSetPrecLimit(size_t n) -{ - bigdecimal_set_thread_local_precision_limit(n); -} - -/* - * Rounding mode. - */ - -#define bigdecimal_set_thread_local_rounding_mode(mode) \ - rb_thread_local_aset( \ - rb_thread_current(), \ - id_BigDecimal_rounding_mode, \ - INT2FIX((int)(mode)) \ - ) - -VP_EXPORT unsigned short -VpGetRoundMode(void) -{ - VALUE const vmode = rb_thread_local_aref( - rb_thread_current(), - id_BigDecimal_rounding_mode - ); - - if (NIL_P(vmode)) { - bigdecimal_set_thread_local_rounding_mode(BIGDECIMAL_ROUNDING_MODE_DEFAULT); - return BIGDECIMAL_ROUNDING_MODE_DEFAULT; - } - - return NUM2USHORT(vmode); -} - -VP_EXPORT int -VpIsRoundMode(unsigned short n) -{ - switch (n) { - case VP_ROUND_UP: - case VP_ROUND_DOWN: - case VP_ROUND_HALF_UP: - case VP_ROUND_HALF_DOWN: - case VP_ROUND_CEIL: - case VP_ROUND_FLOOR: - case VP_ROUND_HALF_EVEN: - return 1; - - default: - return 0; - } -} - -VP_EXPORT unsigned short -VpSetRoundMode(unsigned short n) -{ - if (VpIsRoundMode(n)) { - bigdecimal_set_thread_local_rounding_mode(n); - return n; - } - - return VpGetRoundMode(); -} - -/* - * 0.0 & 1.0 generator - * These gZero_..... and gOne_..... can be any name - * referenced from nowhere except Zero() and One(). - * gZero_..... and gOne_..... must have global scope - * (to let the compiler know they may be changed in outside - * (... but not actually..)). - */ -volatile const double gOne_ABCED9B4_CE73__00400511F31D = 1.0; - -static double -One(void) -{ - return gOne_ABCED9B4_CE73__00400511F31D; -} - -/* - ---------------------------------------------------------------- - Value of sign in Real structure is reserved for future use. - short sign; - ==0 : NaN - 1 : Positive zero - -1 : Negative zero - 2 : Positive number - -2 : Negative number - 3 : Positive infinite number - -3 : Negative infinite number - ---------------------------------------------------------------- -*/ - -VP_EXPORT double -VpGetDoubleNaN(void) /* Returns the value of NaN */ -{ - return nan(""); -} - -VP_EXPORT double -VpGetDoublePosInf(void) /* Returns the value of +Infinity */ -{ - return HUGE_VAL; -} - -VP_EXPORT double -VpGetDoubleNegInf(void) /* Returns the value of -Infinity */ -{ - return -HUGE_VAL; -} - -VP_EXPORT double -VpGetDoubleNegZero(void) /* Returns the value of -0 */ -{ - static double nzero = 1000.0; - if (nzero != 0.0) nzero = (One()/VpGetDoubleNegInf()); - return nzero; -} - -VP_EXPORT int -VpException(unsigned short f, const char *str,int always) -{ - unsigned short const exception_mode = VpGetException(); - - if (f == VP_EXCEPTION_OP) always = 1; - - if (always || (exception_mode & f)) { - switch(f) { - /* case VP_EXCEPTION_OVERFLOW: */ - case VP_EXCEPTION_ZERODIVIDE: - case VP_EXCEPTION_INFINITY: - case VP_EXCEPTION_NaN: - case VP_EXCEPTION_UNDERFLOW: - case VP_EXCEPTION_OP: - rb_raise(rb_eFloatDomainError, "%s", str); - break; - default: - rb_fatal("%s", str); - } - } - return 0; /* 0 Means VpException() raised no exception */ -} - -/* Throw exception or returns 0,when resulting c is Inf or NaN */ -/* sw=1:+ 2:- 3:* 4:/ */ -static int -VpIsDefOP(Real *c, Real *a, Real *b, enum op_sw sw) -{ - if (VpIsNaN(a) || VpIsNaN(b)) { - /* at least a or b is NaN */ - VpSetNaN(c); - goto NaN; - } - - if (VpIsInf(a)) { - if (VpIsInf(b)) { - switch(sw) { - case OP_SW_ADD: /* + */ - if (VpGetSign(a) == VpGetSign(b)) { - VpSetInf(c, VpGetSign(a)); - goto Inf; - } - else { - VpSetNaN(c); - goto NaN; - } - case OP_SW_SUB: /* - */ - if (VpGetSign(a) != VpGetSign(b)) { - VpSetInf(c, VpGetSign(a)); - goto Inf; - } - else { - VpSetNaN(c); - goto NaN; - } - case OP_SW_MULT: /* * */ - VpSetInf(c, VpGetSign(a)*VpGetSign(b)); - goto Inf; - case OP_SW_DIV: /* / */ - VpSetNaN(c); - goto NaN; - } - VpSetNaN(c); - goto NaN; - } - /* Inf op Finite */ - switch(sw) { - case OP_SW_ADD: /* + */ - case OP_SW_SUB: /* - */ - VpSetInf(c, VpGetSign(a)); - break; - case OP_SW_MULT: /* * */ - if (VpIsZero(b)) { - VpSetNaN(c); - goto NaN; - } - VpSetInf(c, VpGetSign(a)*VpGetSign(b)); - break; - case OP_SW_DIV: /* / */ - VpSetInf(c, VpGetSign(a)*VpGetSign(b)); - } - goto Inf; - } - - if (VpIsInf(b)) { - switch(sw) { - case OP_SW_ADD: /* + */ - VpSetInf(c, VpGetSign(b)); - break; - case OP_SW_SUB: /* - */ - VpSetInf(c, -VpGetSign(b)); - break; - case OP_SW_MULT: /* * */ - if (VpIsZero(a)) { - VpSetNaN(c); - goto NaN; - } - VpSetInf(c, VpGetSign(a)*VpGetSign(b)); - break; - case OP_SW_DIV: /* / */ - VpSetZero(c, VpGetSign(a)*VpGetSign(b)); - } - goto Inf; - } - return 1; /* Results OK */ - -Inf: - if (VpIsPosInf(c)) { - return VpException(VP_EXCEPTION_INFINITY, "Computation results to 'Infinity'", 0); - } - else { - return VpException(VP_EXCEPTION_INFINITY, "Computation results to '-Infinity'", 0); - } - -NaN: - return VpException(VP_EXCEPTION_NaN, "Computation results to 'NaN'", 0); -} - -/* - ---------------------------------------------------------------- -*/ - -/* - * returns number of chars needed to represent vp in specified format. - */ -VP_EXPORT size_t -VpNumOfChars(Real *vp,const char *pszFmt) -{ - SIGNED_VALUE ex; - size_t nc; - - if (vp == NULL) return BASE_FIG*2+6; - if (!VpIsDef(vp)) return 32; /* not sure,may be OK */ - - switch(*pszFmt) { - case 'F': - nc = BASE_FIG*(vp->Prec + 1)+2; - ex = vp->exponent; - if (ex < 0) { - nc += BASE_FIG*(size_t)(-ex); - } - else { - if ((size_t)ex > vp->Prec) { - nc += BASE_FIG*((size_t)ex - vp->Prec); - } - } - break; - case 'E': - /* fall through */ - default: - nc = BASE_FIG * vp->Prec + 25; /* "-0."(3) + digits_chars + "e-"(2) + 64bit_exponent_chars(19) + null(1) */ - } - return nc; -} - -/* - * Initializer for Vp routines and constants used. - * [Input] - * BaseVal: Base value(assigned to BASE) for Vp calculation. - * It must be the form BaseVal=10**n.(n=1,2,3,...) - * If Base <= 0L,then the BASE will be calculated so - * that BASE is as large as possible satisfying the - * relation MaxVal <= BASE*(BASE+1). Where the value - * MaxVal is the largest value which can be represented - * by one DECDIG word in the computer used. - * - * [Returns] - * BIGDECIMAL_DOUBLE_FIGURES ... OK - */ -VP_EXPORT size_t -VpInit(DECDIG BaseVal) -{ - /* Setup +/- Inf NaN -0 */ - VpGetDoubleNegZero(); - - /* Const 1.0 */ - rb_global_variable(&VpConstOne); - VpConstOne = NewZeroWrap(1, 1).bigdecimal; - VpSetOne(VpPtr(VpConstOne)); - -#ifdef BIGDECIMAL_DEBUG - gnAlloc = 0; -#endif /* BIGDECIMAL_DEBUG */ - - return BIGDECIMAL_DOUBLE_FIGURES; -} - -VP_EXPORT Real * -VpOne(void) -{ - return VpPtr(VpConstOne); -} - -/* If exponent overflows,then raise exception or returns 0 */ -static int -AddExponent(Real *a, SIGNED_VALUE n) -{ - SIGNED_VALUE e = a->exponent; - SIGNED_VALUE m = e+n; - if (e > 0 && n > 0) { - if (n > VP_EXPONENT_MAX - e) goto overflow; - } else if (e < 0 && n < 0) { - if (n < VP_EXPONENT_MIN - e) goto underflow; - } else if (m > VP_EXPONENT_MAX) { - goto overflow; - } else if (m < VP_EXPONENT_MIN) { - goto underflow; - } - a->exponent = m; - return 1; - -/* Overflow/Underflow ==> Raise exception or returns 0 */ -underflow: - VpSetZero(a, VpGetSign(a)); - return VpException(VP_EXCEPTION_UNDERFLOW, "Exponent underflow", 0); - -overflow: - VpSetInf(a, VpGetSign(a)); - return VpException(VP_EXCEPTION_OVERFLOW, "Exponent overflow", 0); -} - -NULLABLE_BDVALUE -bigdecimal_parse_special_string(const char *str) -{ - static const struct { - const char *str; - size_t len; - int sign; - } table[] = { - { SZ_INF, sizeof(SZ_INF) - 1, VP_SIGN_POSITIVE_INFINITE }, - { SZ_PINF, sizeof(SZ_PINF) - 1, VP_SIGN_POSITIVE_INFINITE }, - { SZ_NINF, sizeof(SZ_NINF) - 1, VP_SIGN_NEGATIVE_INFINITE }, - { SZ_NaN, sizeof(SZ_NaN) - 1, VP_SIGN_NaN } - }; - static const size_t table_length = sizeof(table) / sizeof(table[0]); - size_t i; - - for (i = 0; i < table_length; ++i) { - const char *p; - if (strncmp(str, table[i].str, table[i].len) != 0) { - continue; - } - - p = str + table[i].len; - while (*p && ISSPACE(*p)) ++p; - if (*p == '\0') { - VALUE obj = BigDecimal_allocate(1); - Real *vp = VpPtr(obj); - switch (table[i].sign) { - default: - UNREACHABLE; - return (NULLABLE_BDVALUE) { Qnil, NULL }; - case VP_SIGN_POSITIVE_INFINITE: - VpSetPosInf(vp); - break; - case VP_SIGN_NEGATIVE_INFINITE: - VpSetNegInf(vp); - break; - case VP_SIGN_NaN: - VpSetNaN(vp); - break; - } - return (NULLABLE_BDVALUE) { obj, vp }; - } - } - - return (NULLABLE_BDVALUE) { Qnil, NULL }; -} - -/* - * Allocates variable. - * [Input] - * szVal ... The value assigned(char). - * - * [Returns] - * NULLABLE_BDVALUE to the newly allocated variable. - * Null is returned if memory allocation failed, or any error occured. - */ -VP_EXPORT NULLABLE_BDVALUE -VpAlloc(const char *szVal, int strict_p, int exc) -{ - const char *orig_szVal = szVal; - size_t i, j, ni, ipf, nf, ipe, ne, exp_seen, nalloc; - char v, *psz; - int sign=1; - VALUE buf; - - /* Skipping leading spaces */ - while (ISSPACE(*szVal)) szVal++; - - /* Check on Inf & NaN */ - NULLABLE_BDVALUE special_bd = bigdecimal_parse_special_string(szVal); - if (special_bd.real_or_null != NULL) { - return special_bd; - } - - /* Skip leading `#`. - * It used to be a mark to indicate that an extra MaxPrec should be allocated, - * but now it has no effect. - */ - if (*szVal == '#') ++szVal; - - /* Scanning digits */ - - /* A buffer for keeping scanned digits */ - buf = rb_str_tmp_new(strlen(szVal) + 1); - psz = RSTRING_PTR(buf); - - /* cursor: i for psz, and j for szVal */ - i = j = 0; - - /* Scanning: sign part */ - v = psz[i] = szVal[j]; - if ((v == '-') || (v == '+')) { - sign = -(v == '-'); - ++i; - ++j; - } - - /* Scanning: integer part */ - ni = 0; /* number of digits in the integer part */ - while ((v = psz[i] = szVal[j]) != '\0') { - if (!strict_p && ISSPACE(v)) { - v = psz[i] = '\0'; - break; - } - if (v == '_') { - if (ni > 0) { - v = szVal[j+1]; - if (v == '\0' || ISSPACE(v) || ISDIGIT(v)) { - ++j; - continue; - } - if (!strict_p) { - v = psz[i] = '\0'; - break; - } - } - goto invalid_value; - } - if (!ISDIGIT(v)) { - break; - } - ++ni; - ++i; - ++j; - } - - /* Scanning: fractional part */ - nf = 0; /* number of digits in the fractional part */ - ne = 0; /* number of digits in the exponential part */ - ipf = 0; /* index of the beginning of the fractional part */ - ipe = 0; /* index of the beginning of the exponential part */ - exp_seen = 0; - - if (v != '\0') { - /* Scanning fractional part */ - if ((psz[i] = szVal[j]) == '.') { - ++i; - ++j; - ipf = i; - while ((v = psz[i] = szVal[j]) != '\0') { - if (!strict_p && ISSPACE(v)) { - v = psz[i] = '\0'; - break; - } - if (v == '_') { - if (nf > 0 && ISDIGIT(szVal[j+1])) { - ++j; - continue; - } - if (!strict_p) { - v = psz[i] = '\0'; - break; - } - goto invalid_value; - } - if (!ISDIGIT(v)) break; - ++i; - ++j; - ++nf; - } - } - - /* Scanning exponential part */ - if (v != '\0') { - switch ((psz[i] = szVal[j])) { - case '\0': - break; - case 'e': case 'E': - case 'd': case 'D': - exp_seen = 1; - ++i; - ++j; - ipe = i; - v = psz[i] = szVal[j]; - if ((v == '-') || (v == '+')) { - ++i; - ++j; - } - while ((v = psz[i] = szVal[j]) != '\0') { - if (!strict_p && ISSPACE(v)) { - v = psz[i] = '\0'; - break; - } - if (v == '_') { - if (ne > 0 && ISDIGIT(szVal[j+1])) { - ++j; - continue; - } - if (!strict_p) { - v = psz[i] = '\0'; - if (ne == 0) { - exp_seen = 0; - } - break; - } - goto invalid_value; - } - if (!ISDIGIT(v)) break; - ++i; - ++j; - ++ne; - } - break; - default: - break; - } - } - - if (v != '\0') { - /* Scanning trailing spaces */ - while (ISSPACE(szVal[j])) ++j; - - /* Invalid character */ - if (szVal[j] && strict_p) { - goto invalid_value; - } - } - } - - psz[i] = '\0'; - - if (strict_p && ((ni == 0 && nf == 0) || (exp_seen && ne == 0))) { - VALUE str; - invalid_value: - if (!strict_p) { - BDVALUE res = rbd_allocate_struct_zero_wrap(1, 1); - return (NULLABLE_BDVALUE) { res.bigdecimal, res.real }; - } - if (!exc) { - return (NULLABLE_BDVALUE) { Qnil, NULL }; - } - str = rb_str_new2(orig_szVal); - rb_raise(rb_eArgError, "invalid value for BigDecimal(): \"%"PRIsVALUE"\"", str); - } - - nalloc = (ni + nf + BASE_FIG - 1) / BASE_FIG + 1; /* set effective allocation */ - /* units for szVal[] */ - VALUE obj = BigDecimal_allocate(nalloc); - Real *vp = VpPtr(obj); - VpSetZero(vp, sign); - VpCtoV(vp, psz, ni, psz + ipf, nf, psz + ipe, ne); - rb_str_resize(buf, 0); - return (NULLABLE_BDVALUE) { obj, vp }; -} - -/* - * Assignment(c=a). - * [Input] - * a ... RHSV - * isw ... switch for assignment. - * c = a when isw > 0 - * c = -a when isw < 0 - * if c->MaxPrec < a->Prec,then round operation - * will be performed. - * [Output] - * c ... LHSV - */ -VP_EXPORT size_t -VpAsgn(Real *c, Real *a, int isw) -{ - size_t n; - if (VpIsNaN(a)) { - VpSetNaN(c); - return 0; - } - if (VpIsInf(a)) { - VpSetInf(c, isw * VpGetSign(a)); - return 0; - } - - /* check if the RHS is zero */ - if (!VpIsZero(a)) { - c->exponent = a->exponent; /* store exponent */ - VpSetSign(c, isw * VpGetSign(a)); /* set sign */ - n = (a->Prec < c->MaxPrec) ? (a->Prec) : (c->MaxPrec); - c->Prec = n; - memcpy(c->frac, a->frac, n * sizeof(DECDIG)); - /* Needs round ? */ - if (isw != 10 && isw != -10) { - /* Not in ActiveRound */ - if(c->Prec < a->Prec) { - VpInternalRound(c, n, (n>0) ? a->frac[n-1] : 0, a->frac[n]); - } - else { - VpLimitRound(c,0); - } - } - } - else { - /* The value of 'a' is zero. */ - VpSetZero(c, isw * VpGetSign(a)); - return 1; - } - return c->Prec * BASE_FIG; -} - -/* - * c = a + b when operation = 1 or 2 - * c = a - b when operation = -1 or -2. - * Returns number of significant digits of c - */ -VP_EXPORT size_t -VpAddSub(Real *c, Real *a, Real *b, int operation) -{ - short sw, isw, sign; - Real *a_ptr, *b_ptr; - size_t n, na, nb, i; - DECDIG mrv; - - if (!VpIsDefOP(c, a, b, (operation > 0) ? OP_SW_ADD : OP_SW_SUB)) return 0; /* No significant digits */ - - /* check if a or b is zero */ - if (VpIsZero(a)) { - /* a is zero,then assign b to c */ - if (!VpIsZero(b)) { - VpAsgn(c, b, operation); - } - else { - /* Both a and b are zero. */ - if (VpGetSign(a) < 0 && operation * VpGetSign(b) < 0) { - /* -0 -0 */ - VpSetZero(c, -1); - } - else { - VpSetZero(c, 1); - } - return 1; /* 0: 1 significant digits */ - } - return c->Prec * BASE_FIG; - } - if (VpIsZero(b)) { - /* b is zero,then assign a to c. */ - VpAsgn(c, a, 1); - return c->Prec*BASE_FIG; - } - - if (operation < 0) sw = -1; - else sw = 1; - - /* compare absolute value. As a result,|a_ptr|>=|b_ptr| */ - if (a->exponent > b->exponent) { - a_ptr = a; - b_ptr = b; - } /* |a|>|b| */ - else if (a->exponent < b->exponent) { - a_ptr = b; - b_ptr = a; - } /* |a|<|b| */ - else { - /* Exponent part of a and b is the same,then compare fraction */ - /* part */ - na = a->Prec; - nb = b->Prec; - n = Min(na, nb); - for (i=0; i < n; ++i) { - if (a->frac[i] > b->frac[i]) { - a_ptr = a; - b_ptr = b; - goto end_if; - } - else if (a->frac[i] < b->frac[i]) { - a_ptr = b; - b_ptr = a; - goto end_if; - } - } - if (na > nb) { - a_ptr = a; - b_ptr = b; - goto end_if; - } - else if (na < nb) { - a_ptr = b; - b_ptr = a; - goto end_if; - } - /* |a| == |b| */ - if (VpGetSign(a) + sw *VpGetSign(b) == 0) { - VpSetZero(c, 1); /* abs(a)=abs(b) and operation = '-' */ - return c->Prec * BASE_FIG; - } - a_ptr = a; - b_ptr = b; - } - -end_if: - isw = VpGetSign(a) + sw *VpGetSign(b); - /* - * isw = 0 ...( 1)+(-1),( 1)-( 1),(-1)+(1),(-1)-(-1) - * = 2 ...( 1)+( 1),( 1)-(-1) - * =-2 ...(-1)+(-1),(-1)-( 1) - * If isw==0, then c =(Sign a_ptr)(|a_ptr|-|b_ptr|) - * else c =(Sign ofisw)(|a_ptr|+|b_ptr|) - */ - if (isw) { /* addition */ - VpSetSign(c, 1); - mrv = VpAddAbs(a_ptr, b_ptr, c); - sign = isw / 2; - } - else { /* subtraction */ - VpSetSign(c, 1); - mrv = VpSubAbs(a_ptr, b_ptr, c); - sign = a_ptr == a ? VpGetSign(a) : VpGetSign(a_ptr) * sw; - } - if (VpIsInf(c)) { - VpSetInf(c, sign); - } - else { - VpSetSign(c, sign); - VpInternalRound(c, 0, (c->Prec > 0) ? c->frac[c->Prec-1] : 0, mrv); - } - - return c->Prec * BASE_FIG; -} - -/* - * Addition of two values with variable precision - * a and b assuming abs(a)>abs(b). - * c = abs(a) + abs(b) ; where |a|>=|b| - */ -static DECDIG -VpAddAbs(Real *a, Real *b, Real *c) -{ - size_t word_shift; - size_t ap; - size_t bp; - size_t cp; - size_t a_pos; - size_t b_pos, b_pos_with_word_shift; - size_t c_pos; - DECDIG av, bv, carry, mrv; - - word_shift = VpSetPTR(a, b, c, &ap, &bp, &cp, &av, &bv); - a_pos = ap; - b_pos = bp; - c_pos = cp; - - if (word_shift == (size_t)-1L) return 0; /* Overflow */ - if (b_pos == (size_t)-1L) goto Assign_a; - - mrv = av + bv; /* Most right val. Used for round. */ - - /* Just assign the last few digits of b to c because a has no */ - /* corresponding digits to be added. */ - if (b_pos > 0) { - while (b_pos > 0 && b_pos + word_shift > a_pos) { - c->frac[--c_pos] = b->frac[--b_pos]; - } - } - if (b_pos == 0 && word_shift > a_pos) { - while (word_shift-- > a_pos) { - c->frac[--c_pos] = 0; - } - } - - /* Just assign the last few digits of a to c because b has no */ - /* corresponding digits to be added. */ - b_pos_with_word_shift = b_pos + word_shift; - while (a_pos > b_pos_with_word_shift) { - c->frac[--c_pos] = a->frac[--a_pos]; - } - carry = 0; /* set first carry be zero */ - - /* Now perform addition until every digits of b will be */ - /* exhausted. */ - while (b_pos > 0) { - c->frac[--c_pos] = a->frac[--a_pos] + b->frac[--b_pos] + carry; - if (c->frac[c_pos] >= BASE) { - c->frac[c_pos] -= BASE; - carry = 1; - } - else { - carry = 0; - } - } - - /* Just assign the first few digits of a with considering */ - /* the carry obtained so far because b has been exhausted. */ - while (a_pos > 0) { - c->frac[--c_pos] = a->frac[--a_pos] + carry; - if (c->frac[c_pos] >= BASE) { - c->frac[c_pos] -= BASE; - carry = 1; - } - else { - carry = 0; - } - } - if (c_pos) c->frac[c_pos - 1] += carry; - goto Exit; - -Assign_a: - VpAsgn(c, a, 1); - mrv = 0; - -Exit: - - return mrv; -} - -/* - * c = abs(a) - abs(b) - */ -static DECDIG -VpSubAbs(Real *a, Real *b, Real *c) -{ - size_t word_shift; - size_t ap; - size_t bp; - size_t cp; - size_t a_pos; - size_t b_pos, b_pos_with_word_shift; - size_t c_pos; - DECDIG av, bv, borrow, mrv; - - word_shift = VpSetPTR(a, b, c, &ap, &bp, &cp, &av, &bv); - a_pos = ap; - b_pos = bp; - c_pos = cp; - if (word_shift == (size_t)-1L) return 0; /* Overflow */ - if (b_pos == (size_t)-1L) goto Assign_a; - - if (av >= bv) { - mrv = av - bv; - borrow = 0; - } - else { - mrv = 0; - borrow = 1; - } - - /* Just assign the values which are the BASE subtracted by */ - /* each of the last few digits of the b because the a has no */ - /* corresponding digits to be subtracted. */ - if (b_pos + word_shift > a_pos) { - while (b_pos > 0 && b_pos + word_shift > a_pos) { - c->frac[--c_pos] = BASE - b->frac[--b_pos] - borrow; - borrow = 1; - } - if (b_pos == 0) { - while (word_shift > a_pos) { - --word_shift; - c->frac[--c_pos] = BASE - borrow; - borrow = 1; - } - } - } - /* Just assign the last few digits of a to c because b has no */ - /* corresponding digits to subtract. */ - - b_pos_with_word_shift = b_pos + word_shift; - while (a_pos > b_pos_with_word_shift) { - c->frac[--c_pos] = a->frac[--a_pos]; - } - - /* Now perform subtraction until every digits of b will be */ - /* exhausted. */ - while (b_pos > 0) { - --c_pos; - if (a->frac[--a_pos] < b->frac[--b_pos] + borrow) { - c->frac[c_pos] = BASE + a->frac[a_pos] - b->frac[b_pos] - borrow; - borrow = 1; - } - else { - c->frac[c_pos] = a->frac[a_pos] - b->frac[b_pos] - borrow; - borrow = 0; - } - } - - /* Just assign the first few digits of a with considering */ - /* the borrow obtained so far because b has been exhausted. */ - while (a_pos > 0) { - --c_pos; - if (a->frac[--a_pos] < borrow) { - c->frac[c_pos] = BASE + a->frac[a_pos] - borrow; - borrow = 1; - } - else { - c->frac[c_pos] = a->frac[a_pos] - borrow; - borrow = 0; - } - } - if (c_pos) c->frac[c_pos - 1] -= borrow; - goto Exit; - -Assign_a: - VpAsgn(c, a, 1); - mrv = 0; - -Exit: - return mrv; -} - -/* - * Note: If(av+bv)>= HALF_BASE,then 1 will be added to the least significant - * digit of c(In case of addition). - * ------------------------- figure of output ----------------------------------- - * a = xxxxxxxxxxx - * b = xxxxxxxxxx - * c =xxxxxxxxxxxxxxx - * word_shift = | | - * right_word = | | (Total digits in RHSV) - * left_word = | | (Total digits in LHSV) - * a_pos = | - * b_pos = | - * c_pos = | - */ -static size_t -VpSetPTR(Real *a, Real *b, Real *c, size_t *a_pos, size_t *b_pos, size_t *c_pos, DECDIG *av, DECDIG *bv) -{ - size_t left_word, right_word, word_shift; - - size_t const round_limit = (VpGetPrecLimit() + BASE_FIG - 1) / BASE_FIG; - - assert(a->exponent >= b->exponent); - - c->frac[0] = 0; - *av = *bv = 0; - - word_shift = (a->exponent - b->exponent); - left_word = b->Prec + word_shift; - right_word = Max(a->Prec, left_word); - left_word = c->MaxPrec - 1; /* -1 ... prepare for round up */ - - /* - * check if 'round' is needed. - */ - if (right_word > left_word) { /* round ? */ - /*--------------------------------- - * Actual size of a = xxxxxxAxx - * Actual size of b = xxxBxxxxx - * Max. size of c = xxxxxx - * Round off = |-----| - * c_pos = | - * right_word = | - * a_pos = | - */ - *c_pos = right_word = left_word + 1; /* Set resulting precision */ - /* be equal to that of c */ - if (a->Prec >= c->MaxPrec) { - /* - * a = xxxxxxAxxx - * c = xxxxxx - * a_pos = | - */ - *a_pos = left_word; - if (*a_pos <= round_limit) { - *av = a->frac[*a_pos]; /* av is 'A' shown in above. */ - } - } - else { - /* - * a = xxxxxxx - * c = xxxxxxxxxx - * a_pos = | - */ - *a_pos = a->Prec; - } - if (b->Prec + word_shift >= c->MaxPrec) { - /* - * a = xxxxxxxxx - * b = xxxxxxxBxxx - * c = xxxxxxxxxxx - * b_pos = | - */ - if (c->MaxPrec >= word_shift + 1) { - *b_pos = c->MaxPrec - word_shift - 1; - if (*b_pos + word_shift <= round_limit) { - *bv = b->frac[*b_pos]; - } - } - else { - *b_pos = -1L; - } - } - else { - /* - * a = xxxxxxxxxxxxxxxx - * b = xxxxxx - * c = xxxxxxxxxxxxx - * b_pos = | - */ - *b_pos = b->Prec; - } - } - else { /* The MaxPrec of c - 1 > The Prec of a + b */ - /* - * a = xxxxxxx - * b = xxxxxx - * c = xxxxxxxxxxx - * c_pos = | - */ - *b_pos = b->Prec; - *a_pos = a->Prec; - *c_pos = right_word + 1; - } - c->Prec = *c_pos; - c->exponent = a->exponent; - if (!AddExponent(c, 1)) return (size_t)-1L; - return word_shift; -} - -/* - * Return number of significant digits - * c = a * b , Where a = a0a1a2 ... an - * b = b0b1b2 ... bm - * c = c0c1c2 ... cl - * a0 a1 ... an * bm - * a0 a1 ... an * bm-1 - * . . . - * . . . - * a0 a1 .... an * b0 - * +_____________________________ - * c0 c1 c2 ...... cl - */ -VP_EXPORT size_t -VpMult(Real *c, Real *a, Real *b) -{ - ssize_t a_batch_max, b_batch_max; - DECDIG_DBL batch[VPMULT_BATCH_SIZE * 2 - 1]; - - if (!VpIsDefOP(c, a, b, OP_SW_MULT)) return 0; /* No significant digit */ - - if (VpIsZero(a) || VpIsZero(b)) { - /* at least a or b is zero */ - VpSetZero(c, VpGetSign(a) * VpGetSign(b)); - return 1; /* 0: 1 significant digit */ - } - - if (VpIsOne(a)) { - VpAsgn(c, b, 10 * VpGetSign(a)); - goto Exit; - } - if (VpIsOne(b)) { - VpAsgn(c, a, 10 * VpGetSign(b)); - goto Exit; - } - if (b->Prec > a->Prec) { - /* Adjust so that digits(a)>digits(b) */ - Real *w = a; - a = b; - b = w; - } - - /* set LHSV c info */ - - c->exponent = a->exponent; /* set exponent */ - VpSetSign(c, VpGetSign(a) * VpGetSign(b)); /* set sign */ - if (!AddExponent(c, b->exponent)) return 0; - - if (b->Prec >= NTT_MULTIPLICATION_THRESHOLD) { - ntt_multiply(a->Prec, b->Prec, a->frac, b->frac, c->frac); - c->Prec = a->Prec + b->Prec; - goto Cleanup; - } - - c->Prec = a->Prec + b->Prec; /* set precision */ - memset(c->frac, 0, c->Prec * sizeof(DECDIG)); /* Initialize c */ - - // Process VPMULT_BATCH_SIZE decdigits at a time to reduce the number of carry operations. - a_batch_max = (a->Prec - 1) / VPMULT_BATCH_SIZE; - b_batch_max = (b->Prec - 1) / VPMULT_BATCH_SIZE; - for (ssize_t ibatch = a_batch_max; ibatch >= 0; ibatch--) { - int isize = ibatch == a_batch_max ? (a->Prec - 1) % VPMULT_BATCH_SIZE + 1 : VPMULT_BATCH_SIZE; - for (ssize_t jbatch = b_batch_max; jbatch >= 0; jbatch--) { - int jsize = jbatch == b_batch_max ? (b->Prec - 1) % VPMULT_BATCH_SIZE + 1 : VPMULT_BATCH_SIZE; - memset(batch, 0, (isize + jsize - 1) * sizeof(DECDIG_DBL)); - - // Perform multiplication without carry calculation. - // BASE * BASE * VPMULT_BATCH_SIZE < 2**64 should be satisfied so that - // DECDIG_DBL can hold the intermediate sum without overflow. - for (int i = 0; i < isize; i++) { - for (int j = 0; j < jsize; j++) { - batch[i + j] += (DECDIG_DBL)a->frac[ibatch * VPMULT_BATCH_SIZE + i] * b->frac[jbatch * VPMULT_BATCH_SIZE + j]; - } - } - - // Add the batch result to c with carry calculation. - DECDIG_DBL carry = 0; - for (int k = isize + jsize - 2; k >= 0; k--) { - size_t l = (ibatch + jbatch) * VPMULT_BATCH_SIZE + k + 1; - DECDIG_DBL s = c->frac[l] + batch[k] + carry; - c->frac[l] = (DECDIG)(s % BASE); - carry = (DECDIG_DBL)(s / BASE); - } - - // Adding carry may exceed BASE, but it won't cause overflow of DECDIG. - // Exceeded value will be resolved in the carry operation of next (ibatch + jbatch - 1) batch. - // WARNING: This safety strongly relies on the current nested loop execution order. - c->frac[(ibatch + jbatch) * VPMULT_BATCH_SIZE] += (DECDIG)carry; - } - } - -Cleanup: - VpNmlz(c); - -Exit: - return c->Prec*BASE_FIG; -} - -/* - * c = a / b, remainder = r - * XXXX_YYYY_ZZZZ / 0001 = XXXX_YYYY_ZZZZ - * XXXX_YYYY_ZZZZ / 1111 = 000X_000Y_000Z - * 00XX_XXYY_YYZZ / 1000 = 0000_0XXX_XYYY - * 0001_0000_0000 / 9999 = 0000_0001_0001 - */ -VP_EXPORT size_t -VpDivd(Real *c, Real *r, Real *a, Real *b) -{ - size_t word_a, word_b, word_c, word_r; - size_t i, n, ind_a, ind_b, ind_c, ind_r; - size_t nLoop; - DECDIG_DBL q, b1, b1p1, b1b2, b1b2p1, r1r2; - DECDIG borrow1, borrow2; - DECDIG_DBL qb; - - VpSetNaN(r); - if (!VpIsDefOP(c, a, b, OP_SW_DIV)) goto Exit; - if (VpIsZero(a) && VpIsZero(b)) { - VpSetNaN(c); - return VpException(VP_EXCEPTION_NaN, "Computation results to 'NaN'", 0); - } - if (VpIsZero(b)) { - VpSetInf(c, VpGetSign(a) * VpGetSign(b)); - return VpException(VP_EXCEPTION_ZERODIVIDE, "Divide by zero", 0); - } - if (VpIsZero(a)) { - /* numerator a is zero */ - VpSetZero(c, VpGetSign(a) * VpGetSign(b)); - VpSetZero(r, VpGetSign(a) * VpGetSign(b)); - goto Exit; - } - - word_a = a->Prec; - word_b = b->Prec; - word_c = c->MaxPrec; - word_r = r->MaxPrec; - - if (word_a > word_r || word_b + word_c - 2 >= word_r) goto space_error; - - if (word_c >= NEWTON_RAPHSON_DIVISION_THRESHOLD && word_b >= NEWTON_RAPHSON_DIVISION_THRESHOLD) { - VpDivdNewton(c, r, a, b); - goto Exit; - } - - for (i = 0; i < word_a; ++i) r->frac[i] = a->frac[i]; - for (i = word_a; i < word_r; ++i) r->frac[i] = 0; - for (i = 0; i < word_c; ++i) c->frac[i] = 0; - - /* initial procedure */ - b1 = b1p1 = b->frac[0]; - if (b->Prec <= 1) { - b1b2p1 = b1b2 = b1p1 * BASE; - } - else { - b1p1 = b1 + 1; - b1b2p1 = b1b2 = b1 * BASE + b->frac[1]; - if (b->Prec > 2) ++b1b2p1; - } - - /* */ - /* loop start */ - nLoop = Min(word_c, word_r); - ind_c = 0; - while (ind_c < nLoop) { - if (r->frac[ind_c] == 0) { - ++ind_c; - continue; - } - r1r2 = (DECDIG_DBL)r->frac[ind_c] * BASE + (ind_c + 1 < word_r ? r->frac[ind_c + 1] : 0); - if (r1r2 == b1b2) { - /* The first two word digits is the same */ - ind_b = 2; - ind_a = ind_c + 2; - while (ind_b < word_b) { - if (r->frac[ind_a] < b->frac[ind_b]) goto div_b1p1; - if (r->frac[ind_a] > b->frac[ind_b]) break; - ++ind_a; - ++ind_b; - } - /* The first few word digits of r and b is the same and */ - /* the first different word digit of w is greater than that */ - /* of b, so quotient is 1. */ - q = 1; - ++c->frac[ind_c]; - ind_r = b->Prec + ind_c - 1; - goto sub_mult; - } - /* The first two word digits is not the same, */ - /* then compare magnitude, and divide actually. */ - if (r1r2 >= b1b2p1) { - q = r1r2 / b1b2p1; /* q == (DECDIG)q */ - c->frac[ind_c] += (DECDIG)q; - ind_r = b->Prec + ind_c - 1; - goto sub_mult; - } - -div_b1p1: - if (ind_c + 1 >= word_c) goto out_side; - q = r1r2 / b1p1; /* q == (DECDIG)q */ - c->frac[ind_c + 1] += (DECDIG)q; - ind_r = b->Prec + ind_c; - -sub_mult: - borrow1 = borrow2 = 0; - ind_b = word_b - 1; - if (ind_r >= word_r) goto space_error; - n = ind_b; - for (i = 0; i <= n; ++i) { - /* now, perform r = r - q * b */ - qb = q * b->frac[ind_b]; - if (qb < BASE) borrow1 = 0; - else { - borrow1 = (DECDIG)(qb / BASE); - qb -= (DECDIG_DBL)borrow1 * BASE; /* get qb < BASE */ - } - if(r->frac[ind_r] < qb) { - r->frac[ind_r] += (DECDIG)(BASE - qb); - borrow2 = borrow2 + borrow1 + 1; - } - else { - r->frac[ind_r] -= (DECDIG)qb; - borrow2 += borrow1; - } - if (borrow2) { - if(r->frac[ind_r - 1] < borrow2) { - r->frac[ind_r - 1] += (BASE - borrow2); - borrow2 = 1; - } - else { - r->frac[ind_r - 1] -= borrow2; - borrow2 = 0; - } - } - --ind_r; - --ind_b; - } - - r->frac[ind_r] -= borrow2; - } - /* End of operation, now final arrangement */ -out_side: - c->Prec = word_c; - c->exponent = a->exponent; - VpSetSign(c, VpGetSign(a) * VpGetSign(b)); - if (!AddExponent(c, 1)) return 0; - if (!AddExponent(c, -(b->exponent))) return 0; - - VpNmlz(c); /* normalize c */ - r->Prec = word_r; - r->exponent = a->exponent; - VpSetSign(r, VpGetSign(a)); - VpNmlz(r); /* normalize r(remainder) */ - goto Exit; - -space_error: - rb_bug("ERROR(VpDivd): space for remainder too small."); - -Exit: - return c->Prec * BASE_FIG; -} - -/* - * Input a = 00000xxxxxxxx En(5 preceding zeros) - * Output a = xxxxxxxx En-5 - */ -static int -VpNmlz(Real *a) -{ - size_t ind_a, i; - - if (!VpIsDef(a)) goto NoVal; - if (VpIsZero(a)) goto NoVal; - - ind_a = a->Prec; - while (ind_a--) { - if (a->frac[ind_a]) { - a->Prec = ind_a + 1; - i = 0; - while (a->frac[i] == 0) ++i; /* skip the first few zeros */ - if (i) { - a->Prec -= i; - if (!AddExponent(a, -(SIGNED_VALUE)i)) return 0; - memmove(&a->frac[0], &a->frac[i], a->Prec*sizeof(DECDIG)); - } - return 1; - } - } - /* a is zero(no non-zero digit) */ - VpSetZero(a, VpGetSign(a)); - return 0; - -NoVal: - a->frac[0] = 0; - a->Prec = 1; - a->exponent = 0; - return 0; -} - -/* - * VpComp = 0 ... if a=b, - * Pos ... a>b, - * Neg ... asign - b->sign; - else e = a->sign; - - if (e > 0) return 1; - else if (e < 0) return -1; - else return 0; - } - if (!VpIsDef(b)) { - e = -b->sign; - if (e > 0) return 1; - else return -1; - } - /* Zero check */ - if (VpIsZero(a)) { - if (VpIsZero(b)) return 0; /* both zero */ - val = -VpGetSign(b); - goto Exit; - } - if (VpIsZero(b)) { - val = VpGetSign(a); - goto Exit; - } - - /* compare sign */ - if (VpGetSign(a) > VpGetSign(b)) { - val = 1; /* a>b */ - goto Exit; - } - if (VpGetSign(a) < VpGetSign(b)) { - val = -1; /* aexponent > b->exponent) { - val = VpGetSign(a); - goto Exit; - } - if (a->exponent < b->exponent) { - val = -VpGetSign(b); - goto Exit; - } - - /* a and b have same exponent, then compare their significand. */ - mx = (a->Prec < b->Prec) ? a->Prec : b->Prec; - ind = 0; - while (ind < mx) { - if (a->frac[ind] > b->frac[ind]) { - val = VpGetSign(a); - goto Exit; - } - if (a->frac[ind] < b->frac[ind]) { - val = -VpGetSign(b); - goto Exit; - } - ++ind; - } - if (a->Prec > b->Prec) { - val = VpGetSign(a); - } - else if (a->Prec < b->Prec) { - val = -VpGetSign(b); - } - -Exit: - if (val > 1) val = 1; - else if (val < -1) val = -1; - - return (int)val; -} - -/* - * cntl_chr ... ASCIIZ Character, print control characters - * Available control codes: - * % ... VP variable. To print '%', use '%%'. - * \n ... new line - * \b ... backspace - * \t ... tab - * Note: % must not appear more than once - * a ... VP variable to be printed - */ -static int -VPrint(FILE *fp, const char *cntl_chr, Real *a) -{ - size_t i, j, nc, nd, ZeroSup, sep = 10; - DECDIG m, e, nn; - - j = 0; - nd = nc = 0; /* nd : number of digits in fraction part(every 10 digits, */ - /* nd<=10). */ - /* nc : number of characters printed */ - ZeroSup = 1; /* Flag not to print the leading zeros as 0.00xxxxEnn */ - while (*(cntl_chr + j)) { - if (*(cntl_chr + j) == '%' && *(cntl_chr + j + 1) != '%') { - nc = 0; - if (VpIsNaN(a)) { - fprintf(fp, SZ_NaN); - nc += 8; - } - else if (VpIsPosInf(a)) { - fprintf(fp, SZ_INF); - nc += 8; - } - else if (VpIsNegInf(a)) { - fprintf(fp, SZ_NINF); - nc += 9; - } - else if (!VpIsZero(a)) { - if (BIGDECIMAL_NEGATIVE_P(a)) { - fprintf(fp, "-"); - ++nc; - } - nc += fprintf(fp, "0."); - switch (*(cntl_chr + j + 1)) { - default: - break; - - case '0': case 'z': - ZeroSup = 0; - ++j; - sep = cntl_chr[j] == 'z' ? BIGDECIMAL_COMPONENT_FIGURES : 10; - break; - } - for (i = 0; i < a->Prec; ++i) { - m = BASE1; - e = a->frac[i]; - while (m) { - nn = e / m; - if (!ZeroSup || nn) { - nc += fprintf(fp, "%lu", (unsigned long)nn); /* The leading zero(s) */ - /* as 0.00xx will not */ - /* be printed. */ - ++nd; - ZeroSup = 0; /* Set to print succeeding zeros */ - } - if (nd >= sep) { /* print ' ' after every 10 digits */ - nd = 0; - nc += fprintf(fp, " "); - } - e = e - nn * m; - m /= 10; - } - } - nc += fprintf(fp, "E%"PRIdSIZE, VpExponent10(a)); - nc += fprintf(fp, " (%"PRIdVALUE", %"PRIuSIZE", %"PRIuSIZE")", a->exponent, a->Prec, a->MaxPrec); - } - else { - nc += fprintf(fp, "0.0"); - } - } - else { - ++nc; - if (*(cntl_chr + j) == '\\') { - switch (*(cntl_chr + j + 1)) { - case 'n': - fprintf(fp, "\n"); - ++j; - break; - case 't': - fprintf(fp, "\t"); - ++j; - break; - case 'b': - fprintf(fp, "\n"); - ++j; - break; - default: - fprintf(fp, "%c", *(cntl_chr + j)); - break; - } - } - else { - fprintf(fp, "%c", *(cntl_chr + j)); - if (*(cntl_chr + j) == '%') ++j; - } - } - j++; - } - - return (int)nc; -} - -static void -VpFormatSt(char *psz, size_t fFmt) -{ - size_t iend, idig = 0, iexp = 0, nspaces; - char *p; - - if (fFmt == 0) return; - - iend = strlen(psz); - - if ((p = strchr(psz, '.'))) { - idig = (p - psz) + 1; - } - if ((p = strchr(psz, 'E')) || (p = strchr(psz, 'e'))) { - iexp = p - psz; - } - if (idig == 0 || idig > iexp) return; - - nspaces = (iexp - idig - 1) / fFmt; - p = psz + iend + 1; - for (size_t i = nspaces; i > 0; i--) { - char *src = psz + idig + i * fFmt; - char *dst = psz + idig + i * (fFmt + 1); - memmove(dst, src, p - src); - dst[-1] = ' '; - p = src; - } -} - -VP_EXPORT ssize_t -VpExponent10(Real *a) -{ - ssize_t ex; - size_t n; - - if (!VpHasVal(a)) return 0; - - ex = a->exponent * (ssize_t)BASE_FIG; - n = BASE1; - while ((a->frac[0] / n) == 0) { - --ex; - n /= 10; - } - return ex; -} - -VP_EXPORT void -VpSzMantissa(Real *a, char *buf, size_t buflen) -{ - size_t i, n, ZeroSup; - DECDIG_DBL m, e, nn; - - if (VpIsNaN(a)) { - snprintf(buf, buflen, SZ_NaN); - return; - } - if (VpIsPosInf(a)) { - snprintf(buf, buflen, SZ_INF); - return; - } - if (VpIsNegInf(a)) { - snprintf(buf, buflen, SZ_NINF); - return; - } - - ZeroSup = 1; /* Flag not to print the leading zeros as 0.00xxxxEnn */ - if (!VpIsZero(a)) { - if (BIGDECIMAL_NEGATIVE_P(a)) *buf++ = '-'; - n = a->Prec; - for (i = 0; i < n; ++i) { - m = BASE1; - e = a->frac[i]; - while (m) { - nn = e / m; - if (!ZeroSup || nn) { - *buf = (char)('0' + nn); - buf++; - /* as 0.00xx will be ignored. */ - ZeroSup = 0; /* Set to print succeeding zeros */ - } - e = e - nn * m; - m /= 10; - } - } - *buf = 0; - while (buf[-1] == '0') *(--buf) = 0; - } - else { - if (VpIsPosZero(a)) snprintf(buf, buflen, "0"); - else snprintf(buf, buflen, "-0"); - } -} - -VP_EXPORT int -VpToSpecialString(Real *a, char *buf, size_t buflen, int fPlus) -/* fPlus = 0: default, 1: set ' ' before digits, 2: set '+' before digits. */ -{ - if (VpIsNaN(a)) { - snprintf(buf, buflen, SZ_NaN); - return 1; - } - - if (VpIsPosInf(a)) { - if (fPlus == 1) { - *buf++ = ' '; - } - else if (fPlus == 2) { - *buf++ = '+'; - } - snprintf(buf, buflen, SZ_INF); - return 1; - } - if (VpIsNegInf(a)) { - snprintf(buf, buflen, SZ_NINF); - return 1; - } - if (VpIsZero(a)) { - if (VpIsPosZero(a)) { - if (fPlus == 1) snprintf(buf, buflen, " 0.0"); - else if (fPlus == 2) snprintf(buf, buflen, "+0.0"); - else snprintf(buf, buflen, "0.0"); - } - else snprintf(buf, buflen, "-0.0"); - return 1; - } - return 0; -} - -#define ULLTOA_BUFFER_SIZE 20 -static size_t Vp_ulltoa(unsigned long long number, char *buf) -{ - static const char digits[] = "0123456789"; - char* tmp = buf; - - do *tmp-- = digits[number % 10]; while (number /= 10); - return buf - tmp; -} - -VP_EXPORT void -VpToString(Real *a, char *buf, size_t buflen, size_t fFmt, int fPlus) -/* fPlus = 0: default, 1: set ' ' before digits, 2: set '+' before digits. */ -{ - char ulltoa_buf[ULLTOA_BUFFER_SIZE]; - char *ulltoa_buf_end = ulltoa_buf + ULLTOA_BUFFER_SIZE; - size_t i, n, ZeroSup; - DECDIG shift, m, e, nn; - char *p = buf; - size_t plen = buflen; - ssize_t ex; - - if (VpToSpecialString(a, buf, buflen, fPlus)) return; - - ZeroSup = 1; /* Flag not to print the leading zeros as 0.00xxxxEnn */ - -#define ADVANCE(n) do { \ - if (plen < n) goto overflow; \ - p += n; \ - plen -= n; \ -} while (0) - - if (BIGDECIMAL_NEGATIVE_P(a)) { - *p = '-'; - ADVANCE(1); - } - else if (fPlus == 1) { - *p = ' '; - ADVANCE(1); - } - else if (fPlus == 2) { - *p = '+'; - ADVANCE(1); - } - - *p = '0'; ADVANCE(1); - *p = '.'; ADVANCE(1); - - n = a->Prec; - for (i = 0; i < n; ++i) { - m = BASE1; - e = a->frac[i]; - while (m) { - nn = e / m; - if (!ZeroSup || nn) { - *p = (char)('0' + nn); - ADVANCE(1); - - /* as 0.00xx will be ignored. */ - ZeroSup = 0; /* Set to print succeeding zeros */ - } - e = e - nn * m; - m /= 10; - } - } - - ex = a->exponent * (ssize_t)BASE_FIG; - shift = BASE1; - while (a->frac[0] / shift == 0) { - --ex; - shift /= 10; - } - while (p - 1 > buf && p[-1] == '0') { - *(--p) = '\0'; - ++plen; - } - *p = 'e'; - ADVANCE(1); - - if (ex < 0) { - *p = '-'; - ADVANCE(1); - ex = -ex; - } - - size_t ex_n = Vp_ulltoa(ex, ulltoa_buf_end - 1); - if (ex_n > plen) goto overflow; - MEMCPY(p, ulltoa_buf_end - ex_n, char, ex_n); - ADVANCE(ex_n); - *p = '\0'; - ADVANCE(1); - - if (fFmt) VpFormatSt(buf, fFmt); - - overflow: - return; -#undef ADVANCE -} - -VP_EXPORT void -VpToFString(Real *a, char *buf, size_t buflen, size_t fFmt, int fPlus) -/* fPlus = 0: default, 1: set ' ' before digits, 2: set '+' before digits. */ -{ - size_t i, n; - DECDIG m, e; - char *p = buf; - size_t plen = buflen, delim = fFmt; - ssize_t ex; - - if (VpToSpecialString(a, buf, buflen, fPlus)) return; - -#define APPEND(c, group) do { \ - if (plen < 1) goto overflow; \ - if (group && delim == 0) { \ - *p = ' '; \ - p += 1; \ - plen -= 1; \ - } \ - if (plen < 1) goto overflow; \ - *p = c; \ - p += 1; \ - plen -= 1; \ - if (group) delim = (delim + 1) % fFmt; \ -} while (0) - - - if (BIGDECIMAL_NEGATIVE_P(a)) { - APPEND('-', false); - } - else if (fPlus == 1) { - APPEND(' ', false); - } - else if (fPlus == 2) { - APPEND('+', false); - } - - n = a->Prec; - ex = a->exponent; - if (ex <= 0) { - APPEND('0', false); - APPEND('.', false); - } - while (ex < 0) { - for (i=0; i < BASE_FIG; ++i) { - APPEND('0', fFmt > 0); - } - ++ex; - } - - for (i = 0; i < n; ++i) { - m = BASE1; - e = a->frac[i]; - if (i == 0 && ex > 0) { - for (delim = 0; e / m == 0; delim++) { - m /= 10; - } - if (fFmt > 0) { - delim = 2*fFmt - (ex * BASE_FIG - delim) % fFmt; - } - } - while (m && (e || (i < n - 1) || ex > 0)) { - APPEND((char)(e / m + '0'), fFmt > 0); - e %= m; - m /= 10; - } - if (--ex == 0) { - APPEND('.', false); - delim = fFmt; - } - } - - while (ex > 0) { - for (i=0; i < BASE_FIG; ++i) { - APPEND('0', fFmt > 0); - } - if (--ex == 0) { - APPEND('.', false); - } - } - - *p = '\0'; - if (p - 1 > buf && p[-1] == '.') { - snprintf(p, plen, "0"); - } - - overflow: - return; -#undef APPEND -} - -/* - * [Output] - * a[] ... variable to be assigned the value. - * [Input] - * int_chr[] ... integer part(may include '+/-'). - * ni ... number of characters in int_chr[],not including '+/-'. - * frac[] ... fraction part. - * nf ... number of characters in frac[]. - * exp_chr[] ... exponent part(including '+/-'). - * ne ... number of characters in exp_chr[],not including '+/-'. - */ -VP_EXPORT int -VpCtoV(Real *a, const char *int_chr, size_t ni, const char *frac, size_t nf, const char *exp_chr, size_t ne) -{ - size_t i, j, ind_a, ma, mi, me; - SIGNED_VALUE e; - int sign, signe, exponent_overflow; - - /* get exponent part */ - e = 0; - ma = a->MaxPrec; - mi = ni; - me = ne; - signe = 1; - exponent_overflow = 0; - memset(a->frac, 0, ma * sizeof(DECDIG)); - if (ne > 0) { - i = 0; - if (exp_chr[0] == '-') { - signe = -1; - ++i; - ++me; - } - else if (exp_chr[0] == '+') { - ++i; - ++me; - } - while (i < me) { - int dig = exp_chr[i] - '0'; - if (MUL_OVERFLOW_SIGNED_VALUE_P(e, 10) || - ADD_OVERFLOW_SIGNED_VALUE_P(e * 10, signe * dig)) { - exponent_overflow = 1; - break; - } - e = e * 10 + signe * dig; - ++i; - } - } - - /* get integer part */ - i = 0; - sign = 1; - if (1 /*ni >= 0*/) { - if (int_chr[0] == '-') { - sign = -1; - ++i; - ++mi; - } - else if (int_chr[0] == '+') { - ++i; - ++mi; - } - } - /* skip leading zeros in integer part */ - while (i < mi && int_chr[i] == '0') { - ++i; - --ni; - } - - /* set actual exponent size. */ - if (ADD_OVERFLOW_SIGNED_VALUE_P(e, (SIGNED_VALUE)ni)) { - exponent_overflow = 1; - } else { - e += ni; - } - - /* Adjust the exponent so that it is the multiple of BASE_FIG. */ - j = (BASE_FIG - e % BASE_FIG) % BASE_FIG; - if (ADD_OVERFLOW_SIGNED_VALUE_P(e, (SIGNED_VALUE)j)) { - exponent_overflow = 1; - } else { - e += j; - } - - if (exponent_overflow || e < EXPONENT_MIN || e > EXPONENT_MAX) { - int zero = 1; - for ( ; i < mi && zero; i++) zero = int_chr[i] == '0'; - for (i = 0; i < nf && zero; i++) zero = frac[i] == '0'; - if (!zero && e > 0) { - VpSetInf(a, sign); - VpException(VP_EXCEPTION_INFINITY, "exponent overflow",0); - } - else VpSetZero(a, sign); - return 1; - } - - ind_a = 0; - while (i < mi) { - a->frac[ind_a] = 0; - while (j < BASE_FIG && i < mi) { - a->frac[ind_a] = a->frac[ind_a] * 10 + int_chr[i] - '0'; - ++j; - ++i; - } - if (i < mi) { - ++ind_a; - if (ind_a >= ma) goto over_flow; - j = 0; - } - } - - /* get fraction part */ - - i = 0; - while (i < nf) { - while (j < BASE_FIG && i < nf) { - a->frac[ind_a] = a->frac[ind_a] * 10 + frac[i] - '0'; - ++j; - ++i; - } - if (i < nf) { - ++ind_a; - if (ind_a >= ma) goto over_flow; - j = 0; - } - } - goto Final; - -over_flow: - rb_warn("Conversion from String to BigDecimal overflow (last few digits discarded)."); - -Final: - if (ind_a >= ma) ind_a = ma - 1; - while (j < BASE_FIG) { - a->frac[ind_a] = a->frac[ind_a] * 10; - ++j; - } - a->Prec = ind_a + 1; - a->exponent = e / (SIGNED_VALUE)BASE_FIG; - VpSetSign(a, sign); - VpNmlz(a); - return 1; -} - -/* - * [Input] - * *m ... Real - * [Output] - * *d ... fraction part of m(d = 0.xxxxxxx). where # of 'x's is fig. - * *e ... exponent of m. - * BIGDECIMAL_DOUBLE_FIGURES ... Number of digits in a double variable. - * - * m -> d*10**e, 0Prec); - *d = 0.0; - div = 1.; - while (ind_m < mm) { - div /= (double)BASE; - *d = *d + (double)m->frac[ind_m++] * div; - } - *e = m->exponent * (SIGNED_VALUE)BASE_FIG; - *d *= VpGetSign(m); - -Exit: - return f; -} - -/* - * Round relatively from the decimal point. - * f: rounding mode - * nf: digit location to round from the decimal point. - */ -VP_EXPORT int -VpMidRound(Real *y, unsigned short f, ssize_t nf) -{ - /* fracf: any positive digit under rounding position? */ - /* fracf_1further: any positive digits under one further than the rounding position? */ - /* exptoadd: number of digits needed to compensate negative nf */ - int fracf, fracf_1further; - ssize_t n,i,ix,ioffset, exptoadd; - DECDIG v, shifter; - DECDIG div; - - nf += y->exponent * (ssize_t)BASE_FIG; - exptoadd=0; - if (nf < 0) { - /* rounding position too left(large). */ - if (f != VP_ROUND_CEIL && f != VP_ROUND_FLOOR) { - VpSetZero(y, VpGetSign(y)); /* truncate everything */ - return 0; - } - exptoadd = -nf; - nf = 0; - } - - ix = nf / (ssize_t)BASE_FIG; - if ((size_t)ix >= y->Prec) return 0; /* rounding position too right(small). */ - v = y->frac[ix]; - - ioffset = nf - ix*(ssize_t)BASE_FIG; - n = (ssize_t)BASE_FIG - ioffset - 1; - for (shifter = 1, i = 0; i < n; ++i) shifter *= 10; - - /* so the representation used (in y->frac) is an array of DECDIG, where - each DECDIG contains a value between 0 and BASE-1, consisting of BASE_FIG - decimal places. - - (that numbers of decimal places are typed as ssize_t is somewhat confusing) - - nf is now position (in decimal places) of the digit from the start of - the array. - - ix is the position (in DECDIGs) of the DECDIG containing the decimal digit, - from the start of the array. - - v is the value of this DECDIG - - ioffset is the number of extra decimal places along of this decimal digit - within v. - - n is the number of decimal digits remaining within v after this decimal digit - shifter is 10**n, - - v % shifter are the remaining digits within v - v % (shifter * 10) are the digit together with the remaining digits within v - v / shifter are the digit's predecessors together with the digit - div = v / shifter / 10 is just the digit's precessors - (v / shifter) - div*10 is just the digit, which is what v ends up being reassigned to. - */ - - fracf = (v % (shifter * 10) > 0); - fracf_1further = ((v % shifter) > 0); - - v /= shifter; - div = v / 10; - v = v - div*10; - /* now v is just the digit required. - now fracf is whether the digit or any of the remaining digits within v are non-zero - now fracf_1further is whether any of the remaining digits within v are non-zero - */ - - /* now check all the remaining DECDIGs for zero-ness a whole DECDIG at a time. - if we spot any non-zeroness, that means that we found a positive digit under - rounding position, and we also found a positive digit under one further than - the rounding position, so both searches (to see if any such non-zero digit exists) - can stop */ - - for (i = ix + 1; (size_t)i < y->Prec; i++) { - if (y->frac[i] % BASE) { - fracf = fracf_1further = 1; - break; - } - } - - /* now fracf = does any positive digit exist under the rounding position? - now fracf_1further = does any positive digit exist under one further than the - rounding position? - now v = the first digit under the rounding position */ - - /* drop digits after pointed digit */ - memset(y->frac + ix + 1, 0, (y->Prec - (ix + 1)) * sizeof(DECDIG)); - - switch (f) { - case VP_ROUND_DOWN: /* Truncate */ - break; - case VP_ROUND_UP: /* Roundup */ - if (fracf) ++div; - break; - case VP_ROUND_HALF_UP: - if (v>=5) ++div; - break; - case VP_ROUND_HALF_DOWN: - if (v > 5 || (v == 5 && fracf_1further)) ++div; - break; - case VP_ROUND_CEIL: - if (fracf && BIGDECIMAL_POSITIVE_P(y)) ++div; - break; - case VP_ROUND_FLOOR: - if (fracf && BIGDECIMAL_NEGATIVE_P(y)) ++div; - break; - case VP_ROUND_HALF_EVEN: /* Banker's rounding */ - if (v > 5) ++div; - else if (v == 5) { - if (fracf_1further) { - ++div; - } - else { - if (ioffset == 0) { - /* v is the first decimal digit of its DECDIG; - need to grab the previous DECDIG if present - to check for evenness of the previous decimal - digit (which is same as that of the DECDIG since - base 10 has a factor of 2) */ - if (ix && (y->frac[ix-1] % 2)) ++div; - } - else { - if (div % 2) ++div; - } - } - } - break; - } - for (i = 0; i <= n; ++i) div *= 10; - if (div >= BASE) { - if (ix) { - y->frac[ix] = 0; - VpRdup(y, ix); - } - else { - short s = VpGetSign(y); - SIGNED_VALUE e = y->exponent; - VpSetOne(y); - VpSetSign(y, s); - y->exponent = e + 1; - } - } - else { - y->frac[ix] = div; - VpNmlz(y); - } - if (exptoadd > 0 && !VpIsZero(y)) { - y->exponent += (SIGNED_VALUE)(exptoadd / BASE_FIG); - exptoadd %= (ssize_t)BASE_FIG; - for (i = 0; i < exptoadd; i++) { - y->frac[0] *= 10; - if (y->frac[0] >= BASE) { - y->frac[0] /= BASE; - y->exponent++; - } - } - } - return 1; -} - -VP_EXPORT int -VpLeftRound(Real *y, unsigned short f, ssize_t nf) -/* - * Round from the left hand side of the digits. - */ -{ - DECDIG v; - if (!VpHasVal(y)) return 0; /* Unable to round */ - v = y->frac[0]; - nf -= y->exponent * (ssize_t)BASE_FIG; - while ((v /= 10) != 0) nf--; - nf += (ssize_t)BASE_FIG-1; - return VpMidRound(y, f, nf); -} - -VP_EXPORT int -VpActiveRound(Real *y, Real *x, unsigned short f, ssize_t nf) -{ - /* First,assign whole value in truncation mode */ - if (VpAsgn(y, x, 10) <= 1) return 0; /* Zero,NaN,or Infinity */ - return VpMidRound(y, f, nf); -} - -static int -VpLimitRound(Real *c, size_t ixDigit) -{ - size_t ix = VpGetPrecLimit(); - if (!VpNmlz(c)) return -1; - if (!ix) return 0; - if (!ixDigit) ixDigit = c->Prec-1; - if ((ix + BASE_FIG - 1) / BASE_FIG > ixDigit + 1) return 0; - return VpLeftRound(c, VpGetRoundMode(), (ssize_t)ix); -} - -/* If I understand correctly, this is only ever used to round off the final decimal - digit of precision */ -static void -VpInternalRound(Real *c, size_t ixDigit, DECDIG vPrev, DECDIG v) -{ - int f = 0; - - unsigned short const rounding_mode = VpGetRoundMode(); - - if (VpLimitRound(c, ixDigit)) return; - if (!v) return; - - v /= BASE1; - switch (rounding_mode) { - case VP_ROUND_DOWN: - break; - case VP_ROUND_UP: - if (v) f = 1; - break; - case VP_ROUND_HALF_UP: - if (v >= 5) f = 1; - break; - case VP_ROUND_HALF_DOWN: - /* this is ok - because this is the last digit of precision, - the case where v == 5 and some further digits are nonzero - will never occur */ - if (v >= 6) f = 1; - break; - case VP_ROUND_CEIL: - if (v && BIGDECIMAL_POSITIVE_P(c)) f = 1; - break; - case VP_ROUND_FLOOR: - if (v && BIGDECIMAL_NEGATIVE_P(c)) f = 1; - break; - case VP_ROUND_HALF_EVEN: /* Banker's rounding */ - /* as per VP_ROUND_HALF_DOWN, because this is the last digit of precision, - there is no case to worry about where v == 5 and some further digits are nonzero */ - if (v > 5) f = 1; - else if (v == 5 && vPrev % 2) f = 1; - break; - } - if (f) { - VpRdup(c, ixDigit); - VpNmlz(c); - } -} - -/* - * Rounds up m(plus one to final digit of m). - */ -static int -VpRdup(Real *m, size_t ind_m) -{ - DECDIG carry; - - if (!ind_m) ind_m = m->Prec; - - carry = 1; - while (carry > 0 && ind_m--) { - m->frac[ind_m] += carry; - if (m->frac[ind_m] >= BASE) m->frac[ind_m] -= BASE; - else carry = 0; - } - if (carry > 0) { /* Overflow,count exponent and set fraction part be 1 */ - if (!AddExponent(m, 1)) return 0; - m->Prec = m->frac[0] = 1; - } - else { - VpNmlz(m); - } - return 1; -} - -/* - * y = x - fix(x) - */ -VP_EXPORT void -VpFrac(Real *y, Real *x) -{ - size_t my, ind_y, ind_x; - - if (!VpHasVal(x)) { - VpAsgn(y, x, 10); - goto Exit; - } - - if (x->exponent > 0 && (size_t)x->exponent >= x->Prec) { - VpSetZero(y, VpGetSign(x)); - goto Exit; - } - else if (x->exponent <= 0) { - VpAsgn(y, x, 10); - goto Exit; - } - - /* satisfy: x->exponent > 0 */ - - y->Prec = x->Prec - (size_t)x->exponent; - y->Prec = Min(y->Prec, y->MaxPrec); - y->exponent = 0; - VpSetSign(y, VpGetSign(x)); - ind_y = 0; - my = y->Prec; - ind_x = x->exponent; - while (ind_y < my) { - y->frac[ind_y] = x->frac[ind_x]; - ++ind_y; - ++ind_x; - } - VpNmlz(y); - -Exit: - return; -} - -#ifdef BIGDECIMAL_DEBUG -int -VpVarCheck(Real * v) -/* - * Checks the validity of the Real variable v. - * [Input] - * v ... Real *, variable to be checked. - * [Returns] - * 0 ... correct v. - * other ... error - */ -{ - size_t i; - - if (v->MaxPrec == 0) { - printf("ERROR(VpVarCheck): Illegal Max. Precision(=%"PRIuSIZE")\n", - v->MaxPrec); - return 1; - } - if (v->Prec == 0 || v->Prec > v->MaxPrec) { - printf("ERROR(VpVarCheck): Illegal Precision(=%"PRIuSIZE")\n", v->Prec); - printf(" Max. Prec.=%"PRIuSIZE"\n", v->MaxPrec); - return 2; - } - for (i = 0; i < v->Prec; ++i) { - if (v->frac[i] >= BASE) { - printf("ERROR(VpVarCheck): Illegal fraction\n"); - printf(" Frac[%"PRIuSIZE"]=%"PRIuDECDIG"\n", i, v->frac[i]); - printf(" Prec. =%"PRIuSIZE"\n", v->Prec); - printf(" Exp. =%"PRIdVALUE"\n", v->exponent); - printf(" BASE =%"PRIuDECDIG"\n", BASE); - return 3; - } - } - return 0; -} -#endif /* BIGDECIMAL_DEBUG */ diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/bigdecimal.h b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/bigdecimal.h deleted file mode 100644 index 46fb36b..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/bigdecimal.h +++ /dev/null @@ -1,298 +0,0 @@ -/* - * - * Ruby BigDecimal(Variable decimal precision) extension library. - * - * Copyright(C) 2002 by Shigeo Kobayashi(shigeo@tinyforest.gr.jp) - * - */ - -#ifndef RUBY_BIG_DECIMAL_H -#define RUBY_BIG_DECIMAL_H 1 - -#define RUBY_NO_OLD_COMPATIBILITY -#include "ruby/ruby.h" -#include "missing.h" - -#ifdef HAVE_FLOAT_H -# include -#endif - -#define DECDIG uint32_t -#define DECDIG_DBL uint64_t -#define DECDIG_DBL_SIGNED int64_t -#define SIZEOF_DECDIG 4 -#define PRI_DECDIG_PREFIX "" -#ifdef PRI_LL_PREFIX -# define PRI_DECDIG_DBL_PREFIX PRI_LL_PREFIX -#else -# define PRI_DECDIG_DBL_PREFIX "l" -#endif - -#define PRIdDECDIG PRI_DECDIG_PREFIX"d" -#define PRIiDECDIG PRI_DECDIG_PREFIX"i" -#define PRIoDECDIG PRI_DECDIG_PREFIX"o" -#define PRIuDECDIG PRI_DECDIG_PREFIX"u" -#define PRIxDECDIG PRI_DECDIG_PREFIX"x" -#define PRIXDECDIG PRI_DECDIG_PREFIX"X" - -#define PRIdDECDIG_DBL PRI_DECDIG_DBL_PREFIX"d" -#define PRIiDECDIG_DBL PRI_DECDIG_DBL_PREFIX"i" -#define PRIoDECDIG_DBL PRI_DECDIG_DBL_PREFIX"o" -#define PRIuDECDIG_DBL PRI_DECDIG_DBL_PREFIX"u" -#define PRIxDECDIG_DBL PRI_DECDIG_DBL_PREFIX"x" -#define PRIXDECDIG_DBL PRI_DECDIG_DBL_PREFIX"X" - -#define BIGDECIMAL_BASE ((DECDIG)1000000000U) -#define BIGDECIMAL_COMPONENT_FIGURES 9 -/* - * The number of components required for a 64-bit integer. - * - * INT64_MAX: 9_223372036_854775807 - * UINT64_MAX: 18_446744073_709551615 - */ -#define BIGDECIMAL_INT64_MAX_LENGTH 3 - -#define BIGDECIMAL_DOUBLE_FIGURES (1+DBL_DIG) - -#if defined(__cplusplus) -extern "C" { -#if 0 -} /* satisfy cc-mode */ -#endif -#endif - -extern VALUE rb_cBigDecimal; - -/* - * NaN & Infinity - */ -#define SZ_NaN "NaN" -#define SZ_INF "Infinity" -#define SZ_PINF "+Infinity" -#define SZ_NINF "-Infinity" - -/* - * #define VP_EXPORT other than static to let VP_ routines - * be called from outside of this module. - */ -#define VP_EXPORT static - -/* Exception mode */ -#define VP_EXCEPTION_ALL ((unsigned short)0x00FF) -#define VP_EXCEPTION_INFINITY ((unsigned short)0x0001) -#define VP_EXCEPTION_NaN ((unsigned short)0x0002) -#define VP_EXCEPTION_UNDERFLOW ((unsigned short)0x0004) -#define VP_EXCEPTION_OVERFLOW ((unsigned short)0x0001) /* 0x0008) */ -#define VP_EXCEPTION_ZERODIVIDE ((unsigned short)0x0010) - -/* Following 2 exceptions can't controlled by user */ -#define VP_EXCEPTION_OP ((unsigned short)0x0020) - -#define BIGDECIMAL_EXCEPTION_MODE_DEFAULT 0U - -/* This is used in BigDecimal#mode */ -#define VP_ROUND_MODE ((unsigned short)0x0100) - -/* Rounding mode */ -#define VP_ROUND_UP RBD_ROUND_UP -#define VP_ROUND_DOWN RBD_ROUND_DOWN -#define VP_ROUND_HALF_UP RBD_ROUND_HALF_UP -#define VP_ROUND_HALF_DOWN RBD_ROUND_HALF_DOWN -#define VP_ROUND_CEIL RBD_ROUND_CEIL -#define VP_ROUND_FLOOR RBD_ROUND_FLOOR -#define VP_ROUND_HALF_EVEN RBD_ROUND_HALF_EVEN - -enum rbd_rounding_mode { - RBD_ROUND_UP = 1, - RBD_ROUND_DOWN = 2, - RBD_ROUND_HALF_UP = 3, - RBD_ROUND_HALF_DOWN = 4, - RBD_ROUND_CEIL = 5, - RBD_ROUND_FLOOR = 6, - RBD_ROUND_HALF_EVEN = 7, - - RBD_ROUND_DEFAULT = RBD_ROUND_HALF_UP, - RBD_ROUND_TRUNCATE = RBD_ROUND_DOWN, - RBD_ROUND_BANKER = RBD_ROUND_HALF_EVEN, - RBD_ROUND_CEILING = RBD_ROUND_CEIL -}; - -#define BIGDECIMAL_ROUNDING_MODE_DEFAULT VP_ROUND_HALF_UP - -/* Sign flag */ -#define VP_SIGN_NaN 0 /* NaN */ -#define VP_SIGN_POSITIVE_ZERO 1 /* Positive zero */ -#define VP_SIGN_NEGATIVE_ZERO -1 /* Negative zero */ -#define VP_SIGN_POSITIVE_FINITE 2 /* Positive finite number */ -#define VP_SIGN_NEGATIVE_FINITE -2 /* Negative finite number */ -#define VP_SIGN_POSITIVE_INFINITE 3 /* Positive infinite number */ -#define VP_SIGN_NEGATIVE_INFINITE -3 /* Negative infinite number */ - -/* The size of fraction part array */ -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -#define FLEXIBLE_ARRAY_SIZE /* */ -#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) -#define FLEXIBLE_ARRAY_SIZE 0 -#else -#define FLEXIBLE_ARRAY_SIZE 1 -#endif - -/* - * VP representation - * r = 0.xxxxxxxxx *BASE**exponent - */ -typedef struct { - size_t MaxPrec; /* Maximum precision size */ - /* This is the actual size of frac[] */ - /*(frac[0] to frac[MaxPrec] are available). */ - size_t Prec; /* Current precision size. */ - /* This indicates how much the */ - /* array frac[] is actually used. */ - SIGNED_VALUE exponent; /* Exponent part. */ - short sign; /* Attributes of the value. */ - /* - * ==0 : NaN - * 1 : Positive zero - * -1 : Negative zero - * 2 : Positive number - * -2 : Negative number - * 3 : Positive infinite number - * -3 : Negative infinite number - */ - short flag; /* Not used in vp_routines,space for user. */ - DECDIG frac[FLEXIBLE_ARRAY_SIZE]; /* Array of fraction part. */ -} Real; - -typedef struct { - VALUE bigdecimal; - Real *real; -} BDVALUE; - -typedef struct { - VALUE bigdecimal_or_nil; - Real *real_or_null; -} NULLABLE_BDVALUE; - -/* - * ------------------ - * EXPORTables. - * ------------------ - */ - -#define VpBaseFig() BIGDECIMAL_COMPONENT_FIGURES - -/* Zero,Inf,NaN (isinf(),isnan() used to check) */ -VP_EXPORT double VpGetDoubleNaN(void); -VP_EXPORT double VpGetDoublePosInf(void); -VP_EXPORT double VpGetDoubleNegInf(void); -VP_EXPORT double VpGetDoubleNegZero(void); - -/* These 2 functions added at v1.1.7 */ -VP_EXPORT size_t VpGetPrecLimit(void); -VP_EXPORT void VpSetPrecLimit(size_t n); - -/* Round mode */ -VP_EXPORT int VpIsRoundMode(unsigned short n); -VP_EXPORT unsigned short VpGetRoundMode(void); -VP_EXPORT unsigned short VpSetRoundMode(unsigned short n); - -VP_EXPORT int VpException(unsigned short f,const char *str,int always); -VP_EXPORT size_t VpNumOfChars(Real *vp,const char *pszFmt); -VP_EXPORT size_t VpInit(DECDIG BaseVal); -VP_EXPORT NULLABLE_BDVALUE VpAlloc(const char *szVal, int strict_p, int exc); -VP_EXPORT size_t VpAsgn(Real *c, Real *a, int isw); -VP_EXPORT size_t VpAddSub(Real *c,Real *a,Real *b,int operation); -VP_EXPORT size_t VpMult(Real *c,Real *a,Real *b); -VP_EXPORT size_t VpDivd(Real *c,Real *r,Real *a,Real *b); -VP_EXPORT int VpNmlz(Real *a); -VP_EXPORT int VpComp(Real *a,Real *b); -VP_EXPORT ssize_t VpExponent10(Real *a); -VP_EXPORT void VpSzMantissa(Real *a, char *buf, size_t bufsize); -VP_EXPORT int VpToSpecialString(Real *a, char *buf, size_t bufsize, int fPlus); -VP_EXPORT void VpToString(Real *a, char *buf, size_t bufsize, size_t fFmt, int fPlus); -VP_EXPORT void VpToFString(Real *a, char *buf, size_t bufsize, size_t fFmt, int fPlus); -VP_EXPORT int VpCtoV(Real *a, const char *int_chr, size_t ni, const char *frac, size_t nf, const char *exp_chr, size_t ne); -VP_EXPORT int VpVtoD(double *d, SIGNED_VALUE *e, Real *m); -VP_EXPORT int VpActiveRound(Real *y, Real *x, unsigned short f, ssize_t il); -VP_EXPORT int VpMidRound(Real *y, unsigned short f, ssize_t nf); -VP_EXPORT int VpLeftRound(Real *y, unsigned short f, ssize_t nf); -VP_EXPORT void VpFrac(Real *y, Real *x); -VP_EXPORT int AddExponent(Real *a, SIGNED_VALUE n); - -/* VP constants */ -VP_EXPORT Real *VpOne(void); - -/* - * **** BigDecimal part **** - */ -VP_EXPORT VALUE BigDecimal_lt(VALUE self, VALUE r); -VP_EXPORT VALUE BigDecimal_ge(VALUE self, VALUE r); -VP_EXPORT VALUE BigDecimal_exponent(VALUE self); -VP_EXPORT VALUE BigDecimal_fix(VALUE self); -VP_EXPORT VALUE BigDecimal_frac(VALUE self); -VP_EXPORT VALUE BigDecimal_add(VALUE self, VALUE b); -VP_EXPORT VALUE BigDecimal_sub(VALUE self, VALUE b); -VP_EXPORT VALUE BigDecimal_mult(VALUE self, VALUE b); -VP_EXPORT VALUE BigDecimal_add2(VALUE self, VALUE b, VALUE n); -VP_EXPORT VALUE BigDecimal_sub2(VALUE self, VALUE b, VALUE n); -VP_EXPORT VALUE BigDecimal_mult2(VALUE self, VALUE b, VALUE n); -VP_EXPORT VALUE BigDecimal_split(VALUE self); -VP_EXPORT VALUE BigDecimal_decimal_shift(VALUE self, VALUE v); -VP_EXPORT inline BDVALUE GetBDValueMust(VALUE v); -VP_EXPORT inline BDVALUE rbd_allocate_struct_zero_wrap(int sign, size_t const digits); -#define NewZeroWrap rbd_allocate_struct_zero_wrap - -/* - * ------------------ - * MACRO definitions. - * ------------------ - */ -#define Abs(a) (((a)>= 0)?(a):(-(a))) -#define Max(a, b) (((a)>(b))?(a):(b)) -#define Min(a, b) (((a)>(b))?(b):(a)) - -/* Sign */ - -/* VpGetSign(a) returns 1,-1 if a>0,a<0 respectively */ -#define VpGetSign(a) (((a)->sign>0)?1:(-1)) -/* Change sign of a to a>0,a<0 if s = 1,-1 respectively */ -#define VpChangeSign(a,s) {if((s)>0) (a)->sign=(short)Abs((ssize_t)(a)->sign);else (a)->sign=-(short)Abs((ssize_t)(a)->sign);} -/* Sets sign of a to a>0,a<0 if s = 1,-1 respectively */ -#define VpSetSign(a,s) {if((s)>0) (a)->sign=(short)VP_SIGN_POSITIVE_FINITE;else (a)->sign=(short)VP_SIGN_NEGATIVE_FINITE;} - -/* 1 */ -#define VpSetOne(a) {(a)->Prec=(a)->exponent=(a)->frac[0]=1;(a)->sign=VP_SIGN_POSITIVE_FINITE;} - -/* ZEROs */ -#define VpIsPosZero(a) ((a)->sign==VP_SIGN_POSITIVE_ZERO) -#define VpIsNegZero(a) ((a)->sign==VP_SIGN_NEGATIVE_ZERO) -#define VpIsZero(a) (VpIsPosZero(a) || VpIsNegZero(a)) -#define VpSetPosZero(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->exponent=0,(a)->sign=VP_SIGN_POSITIVE_ZERO) -#define VpSetNegZero(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->exponent=0,(a)->sign=VP_SIGN_NEGATIVE_ZERO) -#define VpSetZero(a,s) (void)(((s)>0)?VpSetPosZero(a):VpSetNegZero(a)) - -/* NaN */ -#define VpIsNaN(a) ((a)->sign==VP_SIGN_NaN) -#define VpSetNaN(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->exponent=0,(a)->sign=VP_SIGN_NaN) - -/* Infinity */ -#define VpIsPosInf(a) ((a)->sign==VP_SIGN_POSITIVE_INFINITE) -#define VpIsNegInf(a) ((a)->sign==VP_SIGN_NEGATIVE_INFINITE) -#define VpIsInf(a) (VpIsPosInf(a) || VpIsNegInf(a)) -#define VpIsDef(a) ( !(VpIsNaN(a)||VpIsInf(a)) ) -#define VpSetPosInf(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->exponent=0,(a)->sign=VP_SIGN_POSITIVE_INFINITE) -#define VpSetNegInf(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->exponent=0,(a)->sign=VP_SIGN_NEGATIVE_INFINITE) -#define VpSetInf(a,s) (void)(((s)>0)?VpSetPosInf(a):VpSetNegInf(a)) -#define VpHasVal(a) (a->frac[0]) -#define VpIsOne(a) ((a->Prec==1)&&(a->frac[0]==1)&&(a->exponent==1)) -#ifdef BIGDECIMAL_DEBUG -int VpVarCheck(Real * v); -#endif /* BIGDECIMAL_DEBUG */ - -#if defined(__cplusplus) -#if 0 -{ /* satisfy cc-mode */ -#endif -} /* extern "C" { */ -#endif -#endif /* RUBY_BIG_DECIMAL_H */ diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/bits.h b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/bits.h deleted file mode 100644 index 66efce4..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/bits.h +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef BIGDECIMAL_BITS_H -#define BIGDECIMAL_BITS_H - -#include "feature.h" -#include "static_assert.h" - -#if defined(__x86_64__) && defined(HAVE_X86INTRIN_H) -# include /* for _lzcnt_u64, etc. */ -#elif defined(_MSC_VER) && defined(HAVE_INTRIN_H) -# include /* for the following intrinsics */ -#endif - -#if defined(_MSC_VER) && defined(__AVX2__) -# pragma intrinsic(__lzcnt) -# pragma intrinsic(__lzcnt64) -#endif - -#define numberof(array) ((int)(sizeof(array) / sizeof((array)[0]))) -#define roomof(x, y) (((x) + (y) - 1) / (y)) -#define type_roomof(x, y) roomof(sizeof(x), sizeof(y)) - -#define MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \ - (a) == 0 ? 0 : \ - (a) == -1 ? (b) < -(max) : \ - (a) > 0 ? \ - ((b) > 0 ? (max) / (a) < (b) : (min) / (a) > (b)) : \ - ((b) > 0 ? (min) / (a) < (b) : (max) / (a) > (b))) - -#define ADD_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \ - ((a) > 0) == ((b) > 0) && ((a) > 0 ? (max) - (a) < (b) : (min) - (a) > (b))) - -#ifdef HAVE_UINT128_T -# define bit_length(x) \ - (unsigned int) \ - (sizeof(x) <= sizeof(int32_t) ? 32 - nlz_int32((uint32_t)(x)) : \ - sizeof(x) <= sizeof(int64_t) ? 64 - nlz_int64((uint64_t)(x)) : \ - 128 - nlz_int128((uint128_t)(x))) -#else -# define bit_length(x) \ - (unsigned int) \ - (sizeof(x) <= sizeof(int32_t) ? 32 - nlz_int32((uint32_t)(x)) : \ - 64 - nlz_int64((uint64_t)(x))) -#endif - -static inline unsigned nlz_int32(uint32_t x); -static inline unsigned nlz_int64(uint64_t x); -#ifdef HAVE_UINT128_T -static inline unsigned nlz_int128(uint128_t x); -#endif - -static inline unsigned int -nlz_int32(uint32_t x) -{ -#if defined(_MSC_VER) && defined(__AVX2__) && defined(HAVE___LZCNT) - /* Note: It seems there is no such thing like __LZCNT__ predefined in MSVC. - * AMD CPUs have had this instruction for decades (since K10) but for - * Intel, Haswell is the oldest one. We need to use __AVX2__ for maximum - * safety. */ - return (unsigned int)__lzcnt(x); - -#elif defined(__x86_64__) && defined(__LZCNT__) && defined(HAVE__LZCNT_U32) - return (unsigned int)_lzcnt_u32(x); - -#elif defined(_MSC_VER) && defined(HAVE__BITSCANREVERSE) - unsigned long r; - return _BitScanReverse(&r, x) ? (31 - (int)r) : 32; - -#elif __has_builtin(__builtin_clz) - STATIC_ASSERT(sizeof_int, sizeof(int) * CHAR_BIT == 32); - return x ? (unsigned int)__builtin_clz(x) : 32; - -#else - uint32_t y; - unsigned n = 32; - y = x >> 16; if (y) {n -= 16; x = y;} - y = x >> 8; if (y) {n -= 8; x = y;} - y = x >> 4; if (y) {n -= 4; x = y;} - y = x >> 2; if (y) {n -= 2; x = y;} - y = x >> 1; if (y) {return n - 2;} - return (unsigned int)(n - x); -#endif -} - -static inline unsigned int -nlz_int64(uint64_t x) -{ -#if defined(_MSC_VER) && defined(__AVX2__) && defined(HAVE___LZCNT64) - return (unsigned int)__lzcnt64(x); - -#elif defined(__x86_64__) && defined(__LZCNT__) && defined(HAVE__LZCNT_U64) - return (unsigned int)_lzcnt_u64(x); - -#elif defined(_WIN64) && defined(_MSC_VER) && defined(HAVE__BITSCANREVERSE64) - unsigned long r; - return _BitScanReverse64(&r, x) ? (63u - (unsigned int)r) : 64; - -#elif __has_builtin(__builtin_clzl) && __has_builtin(__builtin_clzll) && !(defined(__sun) && defined(__sparc)) - if (x == 0) { - return 64; - } - else if (sizeof(long) * CHAR_BIT == 64) { - return (unsigned int)__builtin_clzl((unsigned long)x); - } - else if (sizeof(long long) * CHAR_BIT == 64) { - return (unsigned int)__builtin_clzll((unsigned long long)x); - } - else { - /* :FIXME: Is there a way to make this branch a compile-time error? */ - __builtin_unreachable(); - } - -#else - uint64_t y; - unsigned int n = 64; - y = x >> 32; if (y) {n -= 32; x = y;} - y = x >> 16; if (y) {n -= 16; x = y;} - y = x >> 8; if (y) {n -= 8; x = y;} - y = x >> 4; if (y) {n -= 4; x = y;} - y = x >> 2; if (y) {n -= 2; x = y;} - y = x >> 1; if (y) {return n - 2;} - return (unsigned int)(n - x); - -#endif -} - -#ifdef HAVE_UINT128_T -static inline unsigned int -nlz_int128(uint128_t x) -{ - uint64_t y = (uint64_t)(x >> 64); - - if (x == 0) { - return 128; - } - else if (y == 0) { - return (unsigned int)nlz_int64(x) + 64; - } - else { - return (unsigned int)nlz_int64(y); - } -} -#endif - -#endif /* BIGDECIMAL_BITS_H */ diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/div.h b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/div.h deleted file mode 100644 index 10281d3..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/div.h +++ /dev/null @@ -1,219 +0,0 @@ -struct vp_settings { - size_t prec_limit; - unsigned short rounding_mode; -}; - -static VALUE -restore_vp_settings(VALUE saved_ptr) -{ - struct vp_settings *saved = (struct vp_settings *)saved_ptr; - VpSetPrecLimit(saved->prec_limit); - VpSetRoundMode(saved->rounding_mode); - return Qnil; -} - -// Calculate the inverse of x using the Newton-Raphson method. -// Assumes no precision limit and ROUND_HALF_UP. See VpDivdNewton. -static VALUE -newton_raphson_inverse(VALUE x, size_t prec) { - BDVALUE bdone = NewZeroWrap(1, 1); - VpSetOne(bdone.real); - VALUE one = bdone.bigdecimal; - - // Initial approximation: 10^18 / (leading 9 digits of x), calculated in 64-bit integer. - // Truncating x to 9 digits and the quotient to an integer keep the relative error below 1.2e-8, - // so it has at least 7 correct digits. - const size_t initial_digits = 7; - const DECDIG_DBL base_sq = (DECDIG_DBL)BIGDECIMAL_BASE * BIGDECIMAL_BASE; - BDVALUE bdx = GetBDValueMust(x); - DECDIG_DBL x_lead = (DECDIG_DBL)bdx.real->frac[0] * BIGDECIMAL_BASE + (bdx.real->Prec >= 2 ? bdx.real->frac[1] : 0); - int shift = 0; - while (x_lead < base_sq / 10) { - x_lead *= 10; - shift++; - } - // Dividing base_sq - 1 instead of base_sq keeps the quotient below 10 * BASE, - // so that frac[0] of inv0 never reaches BASE. - DECDIG_DBL inv_lead = (base_sq - 1) / (x_lead / BIGDECIMAL_BASE); - for (int i = 0; i < shift; i++) inv_lead *= 10; - BDVALUE inv0 = NewZeroWrap(1, 2 * BIGDECIMAL_COMPONENT_FIGURES); - VpSetOne(inv0.real); - inv0.real->frac[0] = (DECDIG)(inv_lead / BIGDECIMAL_BASE); - inv0.real->frac[1] = (DECDIG)(inv_lead % BIGDECIMAL_BASE); - inv0.real->Prec = 2; - inv0.real->exponent = 1 - bdx.real->exponent; - VpNmlz(inv0.real); - RB_GC_GUARD(bdx.bigdecimal); - VALUE inv = inv0.bigdecimal; - - int bl = 1; - while (((size_t)1 << bl) < prec) bl++; - - // Each iteration doubles the number of correct digits, and the rounding error of - // the previous iteration is squared into the new digits. Margin digits keep the - // squared error below the last digit, otherwise it can grow over iterations. - const size_t margin = 4; - for (int i = bl; i >= 0; i--) { - size_t n = (prec >> i) + margin; - if (n > prec) n = prec; - // inv0 already has this precision. The last iteration is kept to round inv to prec digits. - if (n <= initial_digits && i > 0) continue; - // Newton-Raphson iteration: inv_next = inv + inv * (1 - x * inv) - // (1 - x * inv) is about 10^(-n/2), so calculating it in n/2 digits is enough for inv_next in n digits. - VALUE one_minus_x_inv = BigDecimal_sub2( - one, - BigDecimal_mult(BigDecimal_mult2(x, one, SIZET2NUM(n + 1)), inv), - SIZET2NUM(n / 2 + margin) - ); - inv = BigDecimal_add2( - inv, - BigDecimal_mult(inv, one_minus_x_inv), - SIZET2NUM(n) - ); - } - return inv; -} - -// Calculates divmod by multiplying approximate reciprocal of y -static void -divmod_by_inv_mul(VALUE x, VALUE y, VALUE inv, VALUE *res_div, VALUE *res_mod) { - VALUE div = BigDecimal_fix(BigDecimal_mult(x, inv)); - VALUE mod = BigDecimal_sub(x, BigDecimal_mult(div, y)); - while (RTEST(BigDecimal_lt(mod, INT2FIX(0)))) { - mod = BigDecimal_add(mod, y); - div = BigDecimal_sub(div, INT2FIX(1)); - } - while (RTEST(BigDecimal_ge(mod, y))) { - mod = BigDecimal_sub(mod, y); - div = BigDecimal_add(div, INT2FIX(1)); - } - *res_div = div; - *res_mod = mod; -} - -static void -slice_copy(DECDIG *dest, Real *src, size_t rshift, size_t length) { - ssize_t start = src->exponent - (ssize_t)rshift - (ssize_t)length; - ssize_t from = Max(start, 0); - ssize_t to = Min(start + (ssize_t)length, (ssize_t)src->Prec); - if (from >= to) return; - memcpy(dest + (from - start), src->frac + from, (size_t)(to - from) * sizeof(DECDIG)); -} - -/* Calculates divmod using Newton-Raphson method. - * x and y must be a BigDecimal representing an integer value. - * - * To calculate with low cost, we need to split x into blocks and perform divmod for each block. - * x_digits = remaining_digits(<= y_digits) + block_digits * num_blocks - * - * Example: - * xxx_xxxxx_xxxxx_xxxxx(18 digits) / yyyyy(5 digits) - * remaining_digits = 3, block_digits = 5, num_blocks = 3 - * repeating xxxxx_xxxxxx.divmod(yyyyy) calculation 3 times. - * - * In each divmod step, dividend is at most (y_digits + block_digits) digits and divisor is y_digits digits. - * Reciprocal of y needs block_digits + 1 precision. - */ -static void -divmod_newton(VALUE x, VALUE y, VALUE *div_out, VALUE *mod_out) { - size_t x_digits = NUM2SIZET(BigDecimal_exponent(x)); - size_t y_digits = NUM2SIZET(BigDecimal_exponent(y)); - if (x_digits <= y_digits) x_digits = y_digits + 1; - - size_t n = x_digits / y_digits; - size_t block_figs = (x_digits - y_digits) / n / BIGDECIMAL_COMPONENT_FIGURES + 1; - size_t block_digits = block_figs * BIGDECIMAL_COMPONENT_FIGURES; - size_t num_blocks = (x_digits - y_digits + block_digits - 1) / block_digits; - size_t y_figs = (y_digits - 1) / BIGDECIMAL_COMPONENT_FIGURES + 1; - VALUE yinv = newton_raphson_inverse(y, block_digits + 1); - - BDVALUE divident = NewZeroWrap(1, BIGDECIMAL_COMPONENT_FIGURES * (y_figs + block_figs)); - BDVALUE div_result = NewZeroWrap(1, BIGDECIMAL_COMPONENT_FIGURES * (num_blocks * block_figs + 1)); - BDVALUE bdx = GetBDValueMust(x); - - VALUE mod = BigDecimal_fix(BigDecimal_decimal_shift(x, SSIZET2NUM(-(ssize_t)(num_blocks * block_digits)))); - for (ssize_t i = (ssize_t)(num_blocks - 1); i >= 0; i--) { - memset(divident.real->frac, 0, (y_figs + block_figs) * sizeof(DECDIG)); - - BDVALUE bdmod = GetBDValueMust(mod); - slice_copy(divident.real->frac, bdmod.real, 0, y_figs); - slice_copy(divident.real->frac + y_figs, bdx.real, (size_t)i * block_figs, block_figs); - RB_GC_GUARD(bdmod.bigdecimal); - - VpSetSign(divident.real, 1); - divident.real->exponent = (ssize_t)(y_figs + block_figs); - divident.real->Prec = y_figs + block_figs; - VpNmlz(divident.real); - - VALUE div; - divmod_by_inv_mul(divident.bigdecimal, y, yinv, &div, &mod); - BDVALUE bddiv = GetBDValueMust(div); - slice_copy(div_result.real->frac + (num_blocks - (size_t)i - 1) * block_figs, bddiv.real, 0, block_figs + 1); - RB_GC_GUARD(bddiv.bigdecimal); - } - VpSetSign(div_result.real, 1); - div_result.real->exponent = (ssize_t)(num_blocks * block_figs + 1); - div_result.real->Prec = num_blocks * block_figs + 1; - VpNmlz(div_result.real); - RB_GC_GUARD(bdx.bigdecimal); - RB_GC_GUARD(divident.bigdecimal); - RB_GC_GUARD(div_result.bigdecimal); - *div_out = div_result.bigdecimal; - *mod_out = mod; -} - -struct vp_divd_newton_args { - Real *c, *r, *a, *b; -}; - -static VALUE -VpDivdNewtonInner(VALUE args_ptr) -{ - struct vp_divd_newton_args *args = (struct vp_divd_newton_args *)args_ptr; - Real *c = args->c, *r = args->r, *a = args->a, *b = args->b; - BDVALUE a2, b2, c2, r2; - VALUE div, mod, a2_frac = Qnil; - size_t div_prec = c->MaxPrec - 1; - size_t base_prec = b->Prec; - - a2 = NewZeroWrap(1, a->Prec * BIGDECIMAL_COMPONENT_FIGURES); - b2 = NewZeroWrap(1, b->Prec * BIGDECIMAL_COMPONENT_FIGURES); - VpAsgn(a2.real, a, 1); - VpAsgn(b2.real, b, 1); - VpSetSign(a2.real, 1); - VpSetSign(b2.real, 1); - a2.real->exponent = (ssize_t)(base_prec + div_prec); - b2.real->exponent = (ssize_t)base_prec; - - if ((ssize_t)a2.real->Prec > a2.real->exponent) { - a2_frac = BigDecimal_frac(a2.bigdecimal); - VpMidRound(a2.real, VP_ROUND_DOWN, 0); - } - divmod_newton(a2.bigdecimal, b2.bigdecimal, &div, &mod); - if (a2_frac != Qnil) mod = BigDecimal_add(mod, a2_frac); - - c2 = GetBDValueMust(div); - r2 = GetBDValueMust(mod); - VpAsgn(c, c2.real, VpGetSign(a) * VpGetSign(b)); - VpAsgn(r, r2.real, VpGetSign(a)); - if (!VpIsZero(c)) AddExponent(c, a->exponent - b->exponent - (ssize_t)div_prec); - if (!VpIsZero(r)) AddExponent(r, a->exponent - (ssize_t)(base_prec + div_prec)); - RB_GC_GUARD(a2.bigdecimal); - RB_GC_GUARD(b2.bigdecimal); - RB_GC_GUARD(c2.bigdecimal); - RB_GC_GUARD(r2.bigdecimal); - return Qnil; -} - -// Newton-Raphson iteration converges from below, so a rounding mode that rounds toward zero -// (ROUND_DOWN, ROUND_FLOOR) adds error in the same direction at every iteration. -// Calculate with ROUND_HALF_UP and without precision limit, and restore them even if an exception is raised. -static void -VpDivdNewton(Real *c, Real *r, Real *a, Real *b) -{ - struct vp_divd_newton_args args = {c, r, a, b}; - struct vp_settings saved = {VpGetPrecLimit(), VpGetRoundMode()}; - VpSetPrecLimit(0); - VpSetRoundMode(VP_ROUND_HALF_UP); - rb_ensure(VpDivdNewtonInner, (VALUE)&args, restore_vp_settings, (VALUE)&saved); -} diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/extconf.rb b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/extconf.rb deleted file mode 100644 index 0b4baca..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/extconf.rb +++ /dev/null @@ -1,63 +0,0 @@ -# frozen_string_literal: true -require 'mkmf' - -def have_builtin_func(name, check_expr, opt = "", &b) - checking_for checking_message(name.funcall_style, nil, opt) do - if try_compile(<= 3.3 -end - -if File.file?(File.expand_path('../lib/bigdecimal.rb', __FILE__)) - bigdecimal_rb = "$(srcdir)/lib/bigdecimal.rb" -else - bigdecimal_rb = "$(srcdir)/../../lib/bigdecimal.rb" -end - -$defs.push '-DBIGDECIMAL_USE_VP_TEST_METHODS' if ENV['BIGDECIMAL_USE_VP_TEST_METHODS'] == 'true' - -create_makefile('bigdecimal') {|mf| - mf << "BIGDECIMAL_RB = #{bigdecimal_rb}\n" -} diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/feature.h b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/feature.h deleted file mode 100644 index f628514..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/feature.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef BIGDECIMAL_HAS_FEATURE_H -#define BIGDECIMAL_HAS_FEATURE_H - -/* ======== __has_feature ======== */ - -#ifndef __has_feature -# define __has_feature(_) 0 -#endif - -/* ======== __has_extension ======== */ - -#ifndef __has_extension -# define __has_extension __has_feature -#endif - -/* ======== __has_builtin ======== */ - -#ifdef HAVE_RUBY_INTERNAL_HAS_BUILTIN_H -# include -#endif - -#ifdef RBIMPL_HAS_BUILTIN -# define BIGDECIMAL_HAS_BUILTIN(...) RBIMPL_HAS_BUILTIN(__VA_ARGS__) - -#else -# /* The following section is copied from CRuby's builtin.h */ -# -# ifdef __has_builtin -# if defined(__INTEL_COMPILER) -# /* :TODO: Intel C Compiler has __has_builtin (since 19.1 maybe?), and is -# * reportedly broken. We have to skip them. However the situation can -# * change. They might improve someday. We need to revisit here later. */ -# elif defined(__GNUC__) && ! __has_builtin(__builtin_alloca) -# /* FreeBSD's defines its own *broken* version of -# * __has_builtin. Cygwin copied that content to be a victim of the -# * broken-ness. We don't take them into account. */ -# else -# define HAVE___HAS_BUILTIN 1 -# endif -# endif -# -# if defined(HAVE___HAS_BUILTIN) -# define BIGDECIMAL_HAS_BUILTIN(_) __has_builtin(_) -# -# elif defined(__GNUC__) -# define BIGDECIMAL_HAS_BUILTIN(_) BIGDECIMAL_HAS_BUILTIN_ ## _ -# if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 6)) -# define BIGDECIMAL_HAS_BUILTIN___builtin_clz 1 -# define BIGDECIMAL_HAS_BUILTIN___builtin_clzl 1 -# else -# define BIGDECIMAL_HAS_BUILTIN___builtin_clz 0 -# define BIGDECIMAL_HAS_BUILTIN___builtin_clzl 0 -# endif -# elif defined(_MSC_VER) -# define BIGDECIMAL_HAS_BUILTIN(_) 0 -# -# else -# define BIGDECIMAL_HAS_BUILTIN(_) BIGDECIMAL_HAS_BUILTIN_ ## _ -# define BIGDECIMAL_HAS_BUILTIN___builtin_clz HAVE_BUILTIN___BUILTIN_CLZ -# define BIGDECIMAL_HAS_BUILTIN___builtin_clzl HAVE_BUILTIN___BUILTIN_CLZL -# endif -#endif /* RBIMPL_HAS_BUILTIN */ - -#ifndef __has_builtin -# define __has_builtin(...) BIGDECIMAL_HAS_BUILTIN(__VA_ARGS__) -#endif - -#endif /* BIGDECIMAL_HAS_FEATURE_H */ diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/missing.c b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/missing.c deleted file mode 100644 index 1454c28..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/missing.c +++ /dev/null @@ -1,28 +0,0 @@ -#include - -#ifdef HAVE_RUBY_ATOMIC_H -# include -#endif - -#ifdef RUBY_ATOMIC_PTR_CAS -# define ATOMIC_PTR_CAS(var, old, new) RUBY_ATOMIC_PTR_CAS(var, old, new) -#endif - -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) -/* GCC warns about unknown sanitizer, which is annoying. */ -# undef NO_SANITIZE -# define NO_SANITIZE(x, y) \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Wattributes\"") \ - __attribute__((__no_sanitize__(x))) y; \ - _Pragma("GCC diagnostic pop") \ - y -#endif - -#undef strtod -#define strtod BigDecimal_strtod -#undef dtoa -#define dtoa BigDecimal_dtoa -#undef hdtoa -#define hdtoa BigDecimal_hdtoa -#include "missing/dtoa.c" diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/missing.h b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/missing.h deleted file mode 100644 index 437d5bf..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/missing.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef MISSING_H -#define MISSING_H 1 - -#if defined(__cplusplus) -extern "C" { -#if 0 -} /* satisfy cc-mode */ -#endif -#endif - -#ifndef RB_UNUSED_VAR -# if defined(_MSC_VER) && _MSC_VER >= 1911 -# define RB_UNUSED_VAR(x) x [[maybe_unused]] - -# elif defined(__has_cpp_attribute) && __has_cpp_attribute(maybe_unused) -# define RB_UNUSED_VAR(x) x [[maybe_unused]] - -# elif defined(__has_c_attribute) && __has_c_attribute(maybe_unused) -# define RB_UNUSED_VAR(x) x [[maybe_unused]] - -# elif defined(__GNUC__) -# define RB_UNUSED_VAR(x) x __attribute__ ((unused)) - -# else -# define RB_UNUSED_VAR(x) x -# endif -#endif /* RB_UNUSED_VAR */ - -#if defined(_MSC_VER) && _MSC_VER >= 1310 -# define HAVE___ASSUME 1 - -#elif defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1300 -# define HAVE___ASSUME 1 -#endif - -#ifndef UNREACHABLE -# if __has_builtin(__builtin_unreachable) -# define UNREACHABLE __builtin_unreachable() - -# elif defined(HAVE___ASSUME) -# define UNREACHABLE __assume(0) - -# else -# define UNREACHABLE /* unreachable */ -# endif -#endif /* UNREACHABLE */ - -/* bool */ - -#ifndef __bool_true_false_are_defined -# include -#endif - -/* dtoa */ -char *BigDecimal_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve); - -/* complex */ - -#ifndef HAVE_RB_COMPLEX_REAL -static inline VALUE -rb_complex_real_fallback(VALUE cmp) -{ -#ifdef RCOMPLEX - return RCOMPLEX(cmp)->real; -#else - return rb_funcall(cmp, rb_intern("real"), 0); -#endif -} -#define rb_complex_real rb_complex_real_fallback -#endif - -#ifndef HAVE_RB_COMPLEX_IMAG -static inline VALUE -rb_complex_imag_fallback(VALUE cmp) -{ -# ifdef RCOMPLEX - return RCOMPLEX(cmp)->imag; -# else - return rb_funcall(cmp, rb_intern("imag"), 0); -# endif -} -#define rb_complex_imag rb_complex_imag_fallback -#endif - -/* st */ - -#ifndef ST2FIX -# undef RB_ST2FIX -# define RB_ST2FIX(h) LONG2FIX((long)(h)) -# define ST2FIX(h) RB_ST2FIX(h) -#endif - -/* warning */ - -#if !defined(HAVE_RB_CATEGORY_WARN) || !defined(HAVE_CONST_RB_WARN_CATEGORY_DEPRECATED) -# define rb_category_warn(category, ...) rb_warn(__VA_ARGS__) -#endif - -#if defined(__cplusplus) -#if 0 -{ /* satisfy cc-mode */ -#endif -} /* extern "C" { */ -#endif - -#endif /* MISSING_H */ diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/missing/dtoa.c b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/missing/dtoa.c deleted file mode 100644 index ba8cd46..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/missing/dtoa.c +++ /dev/null @@ -1,3509 +0,0 @@ -/**************************************************************** - * - * The author of this software is David M. Gay. - * - * Copyright (c) 1991, 2000, 2001 by Lucent Technologies. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose without fee is hereby granted, provided that this entire notice - * is included in all copies of any software which is or includes a copy - * or modification of this software and in all copies of the supporting - * documentation for such software. - * - * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY - * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY - * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. - * - ***************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -/* On a machine with IEEE extended-precision registers, it is - * necessary to specify double-precision (53-bit) rounding precision - * before invoking strtod or dtoa. If the machine uses (the equivalent - * of) Intel 80x87 arithmetic, the call - * _control87(PC_53, MCW_PC); - * does this with many compilers. Whether this or another call is - * appropriate depends on the compiler; for this to work, it may be - * necessary to #include "float.h" or another system-dependent header - * file. - */ - -/* strtod for IEEE-, VAX-, and IBM-arithmetic machines. - * - * This strtod returns a nearest machine number to the input decimal - * string (or sets errno to ERANGE). With IEEE arithmetic, ties are - * broken by the IEEE round-even rule. Otherwise ties are broken by - * biased rounding (add half and chop). - * - * Inspired loosely by William D. Clinger's paper "How to Read Floating - * Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 92-101]. - * - * Modifications: - * - * 1. We only require IEEE, IBM, or VAX double-precision - * arithmetic (not IEEE double-extended). - * 2. We get by with floating-point arithmetic in a case that - * Clinger missed -- when we're computing d * 10^n - * for a small integer d and the integer n is not too - * much larger than 22 (the maximum integer k for which - * we can represent 10^k exactly), we may be able to - * compute (d*10^k) * 10^(e-k) with just one roundoff. - * 3. Rather than a bit-at-a-time adjustment of the binary - * result in the hard case, we use floating-point - * arithmetic to determine the adjustment to within - * one bit; only in really hard cases do we need to - * compute a second residual. - * 4. Because of 3., we don't need a large table of powers of 10 - * for ten-to-e (just some small tables, e.g. of 10^k - * for 0 <= k <= 22). - */ - -/* - * #define IEEE_LITTLE_ENDIAN for IEEE-arithmetic machines where the least - * significant byte has the lowest address. - * #define IEEE_BIG_ENDIAN for IEEE-arithmetic machines where the most - * significant byte has the lowest address. - * #define Long int on machines with 32-bit ints and 64-bit longs. - * #define IBM for IBM mainframe-style floating-point arithmetic. - * #define VAX for VAX-style floating-point arithmetic (D_floating). - * #define No_leftright to omit left-right logic in fast floating-point - * computation of dtoa. - * #define Honor_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3 - * and strtod and dtoa should round accordingly. - * #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3 - * and Honor_FLT_ROUNDS is not #defined. - * #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines - * that use extended-precision instructions to compute rounded - * products and quotients) with IBM. - * #define ROUND_BIASED for IEEE-format with biased rounding. - * #define Inaccurate_Divide for IEEE-format with correctly rounded - * products but inaccurate quotients, e.g., for Intel i860. - * #define NO_LONG_LONG on machines that do not have a "long long" - * integer type (of >= 64 bits). On such machines, you can - * #define Just_16 to store 16 bits per 32-bit Long when doing - * high-precision integer arithmetic. Whether this speeds things - * up or slows things down depends on the machine and the number - * being converted. If long long is available and the name is - * something other than "long long", #define Llong to be the name, - * and if "unsigned Llong" does not work as an unsigned version of - * Llong, #define #ULLong to be the corresponding unsigned type. - * #define KR_headers for old-style C function headers. - * #define Bad_float_h if your system lacks a float.h or if it does not - * define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP, - * FLT_RADIX, FLT_ROUNDS, and DBL_MAX. - * #define MALLOC your_malloc, where your_malloc(n) acts like malloc(n) - * if memory is available and otherwise does something you deem - * appropriate. If MALLOC is undefined, malloc will be invoked - * directly -- and assumed always to succeed. - * #define INFNAN_CHECK on IEEE systems to cause strtod to check for - * Infinity and NaN (case insensitively). On some systems (e.g., - * some HP systems), it may be necessary to #define NAN_WORD0 - * appropriately -- to the most significant word of a quiet NaN. - * (On HP Series 700/800 machines, -DNAN_WORD0=0x7ff40000 works.) - * When INFNAN_CHECK is #defined and No_Hex_NaN is not #defined, - * strtod also accepts (case insensitively) strings of the form - * NaN(x), where x is a string of hexadecimal digits and spaces; - * if there is only one string of hexadecimal digits, it is taken - * for the 52 fraction bits of the resulting NaN; if there are two - * or more strings of hex digits, the first is for the high 20 bits, - * the second and subsequent for the low 32 bits, with intervening - * white space ignored; but if this results in none of the 52 - * fraction bits being on (an IEEE Infinity symbol), then NAN_WORD0 - * and NAN_WORD1 are used instead. - * #define MULTIPLE_THREADS if the system offers preemptively scheduled - * multiple threads. In this case, you must provide (or suitably - * #define) two locks, acquired by ACQUIRE_DTOA_LOCK(n) and freed - * by FREE_DTOA_LOCK(n) for n = 0 or 1. (The second lock, accessed - * in pow5mult, ensures lazy evaluation of only one copy of high - * powers of 5; omitting this lock would introduce a small - * probability of wasting memory, but would otherwise be harmless.) - * You must also invoke freedtoa(s) to free the value s returned by - * dtoa. You may do so whether or not MULTIPLE_THREADS is #defined. - * #define NO_IEEE_Scale to disable new (Feb. 1997) logic in strtod that - * avoids underflows on inputs whose result does not underflow. - * If you #define NO_IEEE_Scale on a machine that uses IEEE-format - * floating-point numbers and flushes underflows to zero rather - * than implementing gradual underflow, then you must also #define - * Sudden_Underflow. - * #define YES_ALIAS to permit aliasing certain double values with - * arrays of ULongs. This leads to slightly better code with - * some compilers and was always used prior to 19990916, but it - * is not strictly legal and can cause trouble with aggressively - * optimizing compilers (e.g., gcc 2.95.1 under -O2). - * #define USE_LOCALE to use the current locale's decimal_point value. - * #define SET_INEXACT if IEEE arithmetic is being used and extra - * computation should be done to set the inexact flag when the - * result is inexact and avoid setting inexact when the result - * is exact. In this case, dtoa.c must be compiled in - * an environment, perhaps provided by #include "dtoa.c" in a - * suitable wrapper, that defines two functions, - * int get_inexact(void); - * void clear_inexact(void); - * such that get_inexact() returns a nonzero value if the - * inexact bit is already set, and clear_inexact() sets the - * inexact bit to 0. When SET_INEXACT is #defined, strtod - * also does extra computations to set the underflow and overflow - * flags when appropriate (i.e., when the result is tiny and - * inexact or when it is a numeric value rounded to +-infinity). - * #define NO_ERRNO if strtod should not assign errno = ERANGE when - * the result overflows to +-Infinity or underflows to 0. - */ - -#ifdef WORDS_BIGENDIAN -#define IEEE_BIG_ENDIAN -#else -#define IEEE_LITTLE_ENDIAN -#endif - -#ifdef __vax__ -#define VAX -#undef IEEE_BIG_ENDIAN -#undef IEEE_LITTLE_ENDIAN -#endif - -#if defined(__arm__) && !defined(__VFP_FP__) -#define IEEE_BIG_ENDIAN -#undef IEEE_LITTLE_ENDIAN -#endif - -#undef Long -#undef ULong - -#include -#include -#include -#include - -#if (INT_MAX >> 30) && !(INT_MAX >> 31) -#define Long int -#define ULong unsigned int -#elif (LONG_MAX >> 30) && !(LONG_MAX >> 31) -#define Long long int -#define ULong unsigned long int -#else -#error No 32bit integer -#endif - -#if defined(HAVE_LONG_LONG) && (HAVE_LONG_LONG) -#define Llong LONG_LONG -#else -#define NO_LONG_LONG -#endif - -#ifdef DEBUG -#include -#define Bug(x) {fprintf(stderr, "%s\n", (x)); exit(EXIT_FAILURE);} -#endif - -#ifndef ISDIGIT -#include -#define ISDIGIT(c) isdigit(c) -#endif -#include -#include -#include - -#ifdef USE_LOCALE -#include -#endif - -#if defined(HAVE_STDCKDINT_H) || !defined(__has_include) -#elif __has_include() -# define HAVE_STDCKDINT_H 1 -#endif -#ifdef HAVE_STDCKDINT_H -# include -#endif - -#if !defined(ckd_add) -static inline int /* bool */ -ckd_add(int *result, int x, int y) -{ - if (x < 0) { - if (y < INT_MIN - x) return 1; - } - else if (x > 0) { - if (y > INT_MAX - x) return 1; - } - *result = x + y; - return 0; -} -#endif - -#ifdef MALLOC -extern void *MALLOC(size_t); -#else -#define MALLOC malloc -#endif -#ifdef FREE -extern void FREE(void*); -#else -#define FREE free -#endif -#ifndef NO_SANITIZE -#define NO_SANITIZE(x, y) y -#endif - -#undef IEEE_Arith -#undef Avoid_Underflow -#ifdef IEEE_BIG_ENDIAN -#define IEEE_Arith -#endif -#ifdef IEEE_LITTLE_ENDIAN -#define IEEE_Arith -#endif - -#ifdef Bad_float_h - -#ifdef IEEE_Arith -#define DBL_DIG 15 -#define DBL_MAX_10_EXP 308 -#define DBL_MAX_EXP 1024 -#define FLT_RADIX 2 -#endif /*IEEE_Arith*/ - -#ifdef IBM -#define DBL_DIG 16 -#define DBL_MAX_10_EXP 75 -#define DBL_MAX_EXP 63 -#define FLT_RADIX 16 -#define DBL_MAX 7.2370055773322621e+75 -#endif - -#ifdef VAX -#define DBL_DIG 16 -#define DBL_MAX_10_EXP 38 -#define DBL_MAX_EXP 127 -#define FLT_RADIX 2 -#define DBL_MAX 1.7014118346046923e+38 -#endif - -#ifndef LONG_MAX -#define LONG_MAX 2147483647 -#endif - -#else /* ifndef Bad_float_h */ -#include -#endif /* Bad_float_h */ - -#include - -#ifdef __cplusplus -extern "C" { -#if 0 -} /* satisfy cc-mode */ -#endif -#endif - -#ifndef hexdigit -static const char hexdigit[] = "0123456789abcdef0123456789ABCDEF"; -#endif - -#if defined(IEEE_LITTLE_ENDIAN) + defined(IEEE_BIG_ENDIAN) + defined(VAX) + defined(IBM) != 1 -Exactly one of IEEE_LITTLE_ENDIAN, IEEE_BIG_ENDIAN, VAX, or IBM should be defined. -#endif - -typedef union { double d; ULong L[2]; } U; - -#ifdef YES_ALIAS -typedef double double_u; -# define dval(x) (x) -# ifdef IEEE_LITTLE_ENDIAN -# define word0(x) (((ULong *)&(x))[1]) -# define word1(x) (((ULong *)&(x))[0]) -# else -# define word0(x) (((ULong *)&(x))[0]) -# define word1(x) (((ULong *)&(x))[1]) -# endif -#else -typedef U double_u; -# ifdef IEEE_LITTLE_ENDIAN -# define word0(x) ((x).L[1]) -# define word1(x) ((x).L[0]) -# else -# define word0(x) ((x).L[0]) -# define word1(x) ((x).L[1]) -# endif -# define dval(x) ((x).d) -#endif - -/* The following definition of Storeinc is appropriate for MIPS processors. - * An alternative that might be better on some machines is - * #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff) - */ -#if defined(IEEE_LITTLE_ENDIAN) + defined(VAX) + defined(__arm__) -#define Storeinc(a,b,c) (((unsigned short *)(a))[1] = (unsigned short)(b), \ -((unsigned short *)(a))[0] = (unsigned short)(c), (a)++) -#else -#define Storeinc(a,b,c) (((unsigned short *)(a))[0] = (unsigned short)(b), \ -((unsigned short *)(a))[1] = (unsigned short)(c), (a)++) -#endif - -/* #define P DBL_MANT_DIG */ -/* Ten_pmax = floor(P*log(2)/log(5)) */ -/* Bletch = (highest power of 2 < DBL_MAX_10_EXP) / 16 */ -/* Quick_max = floor((P-1)*log(FLT_RADIX)/log(10) - 1) */ -/* Int_max = floor(P*log(FLT_RADIX)/log(10) - 1) */ - -#ifdef IEEE_Arith -#define Exp_shift 20 -#define Exp_shift1 20 -#define Exp_msk1 0x100000 -#define Exp_msk11 0x100000 -#define Exp_mask 0x7ff00000 -#define P 53 -#define Bias 1023 -#define Emin (-1022) -#define Exp_1 0x3ff00000 -#define Exp_11 0x3ff00000 -#define Ebits 11 -#define Frac_mask 0xfffff -#define Frac_mask1 0xfffff -#define Ten_pmax 22 -#define Bletch 0x10 -#define Bndry_mask 0xfffff -#define Bndry_mask1 0xfffff -#define LSB 1 -#define Sign_bit 0x80000000 -#define Log2P 1 -#define Tiny0 0 -#define Tiny1 1 -#define Quick_max 14 -#define Int_max 14 -#ifndef NO_IEEE_Scale -#define Avoid_Underflow -#ifdef Flush_Denorm /* debugging option */ -#undef Sudden_Underflow -#endif -#endif - -#ifndef Flt_Rounds -#ifdef FLT_ROUNDS -#define Flt_Rounds FLT_ROUNDS -#else -#define Flt_Rounds 1 -#endif -#endif /*Flt_Rounds*/ - -#ifdef Honor_FLT_ROUNDS -#define Rounding rounding -#undef Check_FLT_ROUNDS -#define Check_FLT_ROUNDS -#else -#define Rounding Flt_Rounds -#endif - -#else /* ifndef IEEE_Arith */ -#undef Check_FLT_ROUNDS -#undef Honor_FLT_ROUNDS -#undef SET_INEXACT -#undef Sudden_Underflow -#define Sudden_Underflow -#ifdef IBM -#undef Flt_Rounds -#define Flt_Rounds 0 -#define Exp_shift 24 -#define Exp_shift1 24 -#define Exp_msk1 0x1000000 -#define Exp_msk11 0x1000000 -#define Exp_mask 0x7f000000 -#define P 14 -#define Bias 65 -#define Exp_1 0x41000000 -#define Exp_11 0x41000000 -#define Ebits 8 /* exponent has 7 bits, but 8 is the right value in b2d */ -#define Frac_mask 0xffffff -#define Frac_mask1 0xffffff -#define Bletch 4 -#define Ten_pmax 22 -#define Bndry_mask 0xefffff -#define Bndry_mask1 0xffffff -#define LSB 1 -#define Sign_bit 0x80000000 -#define Log2P 4 -#define Tiny0 0x100000 -#define Tiny1 0 -#define Quick_max 14 -#define Int_max 15 -#else /* VAX */ -#undef Flt_Rounds -#define Flt_Rounds 1 -#define Exp_shift 23 -#define Exp_shift1 7 -#define Exp_msk1 0x80 -#define Exp_msk11 0x800000 -#define Exp_mask 0x7f80 -#define P 56 -#define Bias 129 -#define Exp_1 0x40800000 -#define Exp_11 0x4080 -#define Ebits 8 -#define Frac_mask 0x7fffff -#define Frac_mask1 0xffff007f -#define Ten_pmax 24 -#define Bletch 2 -#define Bndry_mask 0xffff007f -#define Bndry_mask1 0xffff007f -#define LSB 0x10000 -#define Sign_bit 0x8000 -#define Log2P 1 -#define Tiny0 0x80 -#define Tiny1 0 -#define Quick_max 15 -#define Int_max 15 -#endif /* IBM, VAX */ -#endif /* IEEE_Arith */ - -#ifndef IEEE_Arith -#define ROUND_BIASED -#endif - -#ifdef RND_PRODQUOT -#define rounded_product(a,b) ((a) = rnd_prod((a), (b))) -#define rounded_quotient(a,b) ((a) = rnd_quot((a), (b))) -extern double rnd_prod(double, double), rnd_quot(double, double); -#else -#define rounded_product(a,b) ((a) *= (b)) -#define rounded_quotient(a,b) ((a) /= (b)) -#endif - -#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1)) -#define Big1 0xffffffff - -#ifndef Pack_32 -#define Pack_32 -#endif - -#define FFFFFFFF 0xffffffffUL - -#ifdef NO_LONG_LONG -#undef ULLong -#ifdef Just_16 -#undef Pack_32 -/* When Pack_32 is not defined, we store 16 bits per 32-bit Long. - * This makes some inner loops simpler and sometimes saves work - * during multiplications, but it often seems to make things slightly - * slower. Hence the default is now to store 32 bits per Long. - */ -#endif -#else /* long long available */ -#ifndef Llong -#define Llong long long -#endif -#ifndef ULLong -#define ULLong unsigned Llong -#endif -#endif /* NO_LONG_LONG */ - -#define MULTIPLE_THREADS 1 - -#ifndef MULTIPLE_THREADS -#define ACQUIRE_DTOA_LOCK(n) /*nothing*/ -#define FREE_DTOA_LOCK(n) /*nothing*/ -#else -#define ACQUIRE_DTOA_LOCK(n) /*unused right now*/ -#define FREE_DTOA_LOCK(n) /*unused right now*/ -#endif - -#ifndef ATOMIC_PTR_CAS -#define ATOMIC_PTR_CAS(var, old, new) ((var) = (new), (void *)(old)) -#endif -#ifndef LIKELY -#define LIKELY(x) (x) -#endif -#ifndef UNLIKELY -#define UNLIKELY(x) (x) -#endif -#ifndef ASSUME -#define ASSUME(x) (void)(x) -#endif - -#define Kmax 15 - -struct Bigint { - struct Bigint *next; - int k, maxwds, sign, wds; - ULong x[1]; -}; - -typedef struct Bigint Bigint; - -static Bigint * -Balloc(int k) -{ - int x; - Bigint *rv; - - x = 1 << k; - rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(ULong)); - if (!rv) return NULL; - rv->k = k; - rv->maxwds = x; - rv->sign = rv->wds = 0; - return rv; -} - -static void -Bclear(Bigint **vp) -{ - Bigint *v = *vp; - *vp = NULL; - if (v) FREE(v); -} -#define Bfree(v) Bclear(&(v)) - -#define Bcopy(x,y) memcpy((char *)&(x)->sign, (char *)&(y)->sign, \ -(y)->wds*sizeof(Long) + 2*sizeof(int)) - -static Bigint * -multadd(Bigint *b, int m, int a) /* multiply by m and add a */ -{ - int i, wds; - ULong *x; -#ifdef ULLong - ULLong carry, y; -#else - ULong carry, y; -#ifdef Pack_32 - ULong xi, z; -#endif -#endif - Bigint *b1; - - wds = b->wds; - x = b->x; - i = 0; - carry = a; - do { -#ifdef ULLong - y = *x * (ULLong)m + carry; - carry = y >> 32; - *x++ = (ULong)(y & FFFFFFFF); -#else -#ifdef Pack_32 - xi = *x; - y = (xi & 0xffff) * m + carry; - z = (xi >> 16) * m + (y >> 16); - carry = z >> 16; - *x++ = (z << 16) + (y & 0xffff); -#else - y = *x * m + carry; - carry = y >> 16; - *x++ = y & 0xffff; -#endif -#endif - } while (++i < wds); - if (carry) { - if (wds >= b->maxwds) { - b1 = Balloc(b->k+1); - if (!b1) { - Bfree(b); - return NULL; - } - Bcopy(b1, b); - Bfree(b); - b = b1; - } - b->x[wds++] = (ULong)carry; - b->wds = wds; - } - return b; -} - -static Bigint * -s2b(const char *s, int nd0, int nd, ULong y9) -{ - Bigint *b; - int i, k; - Long x, y; - - x = (nd + 8) / 9; - for (k = 0, y = 1; x > y; y <<= 1, k++) ; -#ifdef Pack_32 - b = Balloc(k); - if (!b) return NULL; - b->x[0] = y9; - b->wds = 1; -#else - b = Balloc(k+1); - if (!b) return NULL; - b->x[0] = y9 & 0xffff; - b->wds = (b->x[1] = y9 >> 16) ? 2 : 1; -#endif - - i = 9; - if (9 < nd0) { - s += 9; - do { - b = multadd(b, 10, *s++ - '0'); - if (!b) return NULL; - } while (++i < nd0); - s++; - } - else - s += 10; - for (; i < nd; i++) { - b = multadd(b, 10, *s++ - '0'); - if (!b) return NULL; - } - return b; -} - -static int -hi0bits(register ULong x) -{ - register int k = 0; - - if (!(x & 0xffff0000)) { - k = 16; - x <<= 16; - } - if (!(x & 0xff000000)) { - k += 8; - x <<= 8; - } - if (!(x & 0xf0000000)) { - k += 4; - x <<= 4; - } - if (!(x & 0xc0000000)) { - k += 2; - x <<= 2; - } - if (!(x & 0x80000000)) { - k++; - if (!(x & 0x40000000)) - return 32; - } - return k; -} - -static int -lo0bits(ULong *y) -{ - register int k; - register ULong x = *y; - - if (x & 7) { - if (x & 1) - return 0; - if (x & 2) { - *y = x >> 1; - return 1; - } - *y = x >> 2; - return 2; - } - k = 0; - if (!(x & 0xffff)) { - k = 16; - x >>= 16; - } - if (!(x & 0xff)) { - k += 8; - x >>= 8; - } - if (!(x & 0xf)) { - k += 4; - x >>= 4; - } - if (!(x & 0x3)) { - k += 2; - x >>= 2; - } - if (!(x & 1)) { - k++; - x >>= 1; - if (!x) - return 32; - } - *y = x; - return k; -} - -static Bigint * -i2b(int i) -{ - Bigint *b; - - b = Balloc(1); - if (!b) return NULL; - b->x[0] = i; - b->wds = 1; - return b; -} - -#define Bzero_p(b) (!(b)->x[0] && (b)->wds <= 1) - -static Bigint * -mult(Bigint *a, Bigint *b) -{ - Bigint *c; - int k, wa, wb, wc; - ULong *x, *xa, *xae, *xb, *xbe, *xc, *xc0; - ULong y; -#ifdef ULLong - ULLong carry, z; -#else - ULong carry, z; -#ifdef Pack_32 - ULong z2; -#endif -#endif - - if (Bzero_p(a) || Bzero_p(b)) { - c = Balloc(0); - if (!c) return NULL; - c->wds = 1; - c->x[0] = 0; - return c; - } - - if (a->wds < b->wds) { - c = a; - a = b; - b = c; - } - k = a->k; - wa = a->wds; - wb = b->wds; - wc = wa + wb; - if (wc > a->maxwds) - k++; - c = Balloc(k); - if (!c) return NULL; - for (x = c->x, xa = x + wc; x < xa; x++) - *x = 0; - xa = a->x; - xae = xa + wa; - xb = b->x; - xbe = xb + wb; - xc0 = c->x; -#ifdef ULLong - for (; xb < xbe; xc0++) { - if ((y = *xb++) != 0) { - x = xa; - xc = xc0; - carry = 0; - do { - z = *x++ * (ULLong)y + *xc + carry; - carry = z >> 32; - *xc++ = (ULong)(z & FFFFFFFF); - } while (x < xae); - *xc = (ULong)carry; - } - } -#else -#ifdef Pack_32 - for (; xb < xbe; xb++, xc0++) { - if ((y = *xb & 0xffff) != 0) { - x = xa; - xc = xc0; - carry = 0; - do { - z = (*x & 0xffff) * y + (*xc & 0xffff) + carry; - carry = z >> 16; - z2 = (*x++ >> 16) * y + (*xc >> 16) + carry; - carry = z2 >> 16; - Storeinc(xc, z2, z); - } while (x < xae); - *xc = (ULong)carry; - } - if ((y = *xb >> 16) != 0) { - x = xa; - xc = xc0; - carry = 0; - z2 = *xc; - do { - z = (*x & 0xffff) * y + (*xc >> 16) + carry; - carry = z >> 16; - Storeinc(xc, z, z2); - z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry; - carry = z2 >> 16; - } while (x < xae); - *xc = z2; - } - } -#else - for (; xb < xbe; xc0++) { - if (y = *xb++) { - x = xa; - xc = xc0; - carry = 0; - do { - z = *x++ * y + *xc + carry; - carry = z >> 16; - *xc++ = z & 0xffff; - } while (x < xae); - *xc = (ULong)carry; - } - } -#endif -#endif - for (xc0 = c->x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) ; - c->wds = wc; - return c; -} - -static Bigint *p5s; - -static Bigint * -pow5mult(Bigint *b, int k) -{ - Bigint *b1, *p5, *p51; - int i; - static const int p05[3] = { 5, 25, 125 }; - - if ((i = k & 3) != 0) { - b = multadd(b, p05[i-1], 0); - if (!b) return NULL; - } - -#define b_cache(var, addr, new_expr) \ - if ((var = addr) != 0) {} else { \ - Bigint *tmp = 0; \ - ACQUIRE_DTOA_LOCK(1); \ - if (!(var = addr) && (var = (new_expr)) != 0) { \ - var->next = 0; \ - tmp = ATOMIC_PTR_CAS(addr, NULL, var); \ - } \ - FREE_DTOA_LOCK(1); \ - if (UNLIKELY(tmp)) { \ - Bfree(var); \ - var = tmp; \ - } \ - else if (!var) { \ - Bfree(b); \ - return NULL; \ - } \ - } - - if (!(k >>= 2)) - return b; - /* first time */ - b_cache(p5, p5s, i2b(625)); - for (;;) { - if (k & 1) { - b1 = mult(b, p5); - Bfree(b); - b = b1; - if (!b) return NULL; - } - if (!(k >>= 1)) - break; - b_cache(p51, p5->next, mult(p5, p5)); - p5 = p51; - } - return b; -} - -static Bigint * -lshift(Bigint *b, int k) -{ - int i, k1, n, n1; - Bigint *b1; - ULong *x, *x1, *xe, z; - - if (!k || Bzero_p(b)) return b; - -#ifdef Pack_32 - n = k >> 5; -#else - n = k >> 4; -#endif - k1 = b->k; - n1 = n + b->wds + 1; - for (i = b->maxwds; n1 > i; i <<= 1) - k1++; - b1 = Balloc(k1); - if (!b1) { - Bfree(b); - return NULL; - } - x1 = b1->x; - for (i = 0; i < n; i++) - *x1++ = 0; - x = b->x; - xe = x + b->wds; -#ifdef Pack_32 - if (k &= 0x1f) { - k1 = 32 - k; - z = 0; - do { - *x1++ = *x << k | z; - z = *x++ >> k1; - } while (x < xe); - if ((*x1 = z) != 0) - ++n1; - } -#else - if (k &= 0xf) { - k1 = 16 - k; - z = 0; - do { - *x1++ = *x << k & 0xffff | z; - z = *x++ >> k1; - } while (x < xe); - if (*x1 = z) - ++n1; - } -#endif - else - do { - *x1++ = *x++; - } while (x < xe); - b1->wds = n1 - 1; - Bfree(b); - return b1; -} - -static int -cmp(Bigint *a, Bigint *b) -{ - ULong *xa, *xa0, *xb, *xb0; - int i, j; - - i = a->wds; - j = b->wds; -#ifdef DEBUG - if (i > 1 && !a->x[i-1]) - Bug("cmp called with a->x[a->wds-1] == 0"); - if (j > 1 && !b->x[j-1]) - Bug("cmp called with b->x[b->wds-1] == 0"); -#endif - if (i -= j) - return i; - xa0 = a->x; - xa = xa0 + j; - xb0 = b->x; - xb = xb0 + j; - for (;;) { - if (*--xa != *--xb) - return *xa < *xb ? -1 : 1; - if (xa <= xa0) - break; - } - return 0; -} - -NO_SANITIZE("unsigned-integer-overflow", static Bigint * diff(Bigint *a, Bigint *b)); -static Bigint * -diff(Bigint *a, Bigint *b) -{ - Bigint *c; - int i, wa, wb; - ULong *xa, *xae, *xb, *xbe, *xc; -#ifdef ULLong - ULLong borrow, y; -#else - ULong borrow, y; -#ifdef Pack_32 - ULong z; -#endif -#endif - - i = cmp(a,b); - if (!i) { - c = Balloc(0); - if (!c) return NULL; - c->wds = 1; - c->x[0] = 0; - return c; - } - if (i < 0) { - c = a; - a = b; - b = c; - i = 1; - } - else - i = 0; - c = Balloc(a->k); - if (!c) return NULL; - c->sign = i; - wa = a->wds; - xa = a->x; - xae = xa + wa; - wb = b->wds; - xb = b->x; - xbe = xb + wb; - xc = c->x; - borrow = 0; -#ifdef ULLong - do { - y = (ULLong)*xa++ - *xb++ - borrow; - borrow = y >> 32 & (ULong)1; - *xc++ = (ULong)(y & FFFFFFFF); - } while (xb < xbe); - while (xa < xae) { - y = *xa++ - borrow; - borrow = y >> 32 & (ULong)1; - *xc++ = (ULong)(y & FFFFFFFF); - } -#else -#ifdef Pack_32 - do { - y = (*xa & 0xffff) - (*xb & 0xffff) - borrow; - borrow = (y & 0x10000) >> 16; - z = (*xa++ >> 16) - (*xb++ >> 16) - borrow; - borrow = (z & 0x10000) >> 16; - Storeinc(xc, z, y); - } while (xb < xbe); - while (xa < xae) { - y = (*xa & 0xffff) - borrow; - borrow = (y & 0x10000) >> 16; - z = (*xa++ >> 16) - borrow; - borrow = (z & 0x10000) >> 16; - Storeinc(xc, z, y); - } -#else - do { - y = *xa++ - *xb++ - borrow; - borrow = (y & 0x10000) >> 16; - *xc++ = y & 0xffff; - } while (xb < xbe); - while (xa < xae) { - y = *xa++ - borrow; - borrow = (y & 0x10000) >> 16; - *xc++ = y & 0xffff; - } -#endif -#endif - while (!*--xc) - wa--; - c->wds = wa; - return c; -} - -static double -ulp(double x_) -{ - register Long L; - double_u x, a; - dval(x) = x_; - - L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1; -#ifndef Avoid_Underflow -#ifndef Sudden_Underflow - if (L > 0) { -#endif -#endif -#ifdef IBM - L |= Exp_msk1 >> 4; -#endif - word0(a) = L; - word1(a) = 0; -#ifndef Avoid_Underflow -#ifndef Sudden_Underflow - } - else { - L = -L >> Exp_shift; - if (L < Exp_shift) { - word0(a) = 0x80000 >> L; - word1(a) = 0; - } - else { - word0(a) = 0; - L -= Exp_shift; - word1(a) = L >= 31 ? 1 : 1 << 31 - L; - } - } -#endif -#endif - return dval(a); -} - -static double -b2d(Bigint *a, int *e) -{ - ULong *xa, *xa0, w, y, z; - int k; - double_u d; -#ifdef VAX - ULong d0, d1; -#else -#define d0 word0(d) -#define d1 word1(d) -#endif - - xa0 = a->x; - xa = xa0 + a->wds; - y = *--xa; -#ifdef DEBUG - if (!y) Bug("zero y in b2d"); -#endif - k = hi0bits(y); - *e = 32 - k; -#ifdef Pack_32 - if (k < Ebits) { - d0 = Exp_1 | y >> (Ebits - k); - w = xa > xa0 ? *--xa : 0; - d1 = y << ((32-Ebits) + k) | w >> (Ebits - k); - goto ret_d; - } - z = xa > xa0 ? *--xa : 0; - if (k -= Ebits) { - d0 = Exp_1 | y << k | z >> (32 - k); - y = xa > xa0 ? *--xa : 0; - d1 = z << k | y >> (32 - k); - } - else { - d0 = Exp_1 | y; - d1 = z; - } -#else - if (k < Ebits + 16) { - z = xa > xa0 ? *--xa : 0; - d0 = Exp_1 | y << k - Ebits | z >> Ebits + 16 - k; - w = xa > xa0 ? *--xa : 0; - y = xa > xa0 ? *--xa : 0; - d1 = z << k + 16 - Ebits | w << k - Ebits | y >> 16 + Ebits - k; - goto ret_d; - } - z = xa > xa0 ? *--xa : 0; - w = xa > xa0 ? *--xa : 0; - k -= Ebits + 16; - d0 = Exp_1 | y << k + 16 | z << k | w >> 16 - k; - y = xa > xa0 ? *--xa : 0; - d1 = w << k + 16 | y << k; -#endif -ret_d: -#ifdef VAX - word0(d) = d0 >> 16 | d0 << 16; - word1(d) = d1 >> 16 | d1 << 16; -#else -#undef d0 -#undef d1 -#endif - return dval(d); -} - -static Bigint * -d2b(double d_, int *e, int *bits) -{ - double_u d; - Bigint *b; - int de, k; - ULong *x, y, z; -#ifndef Sudden_Underflow - int i; -#endif -#ifdef VAX - ULong d0, d1; -#endif - dval(d) = d_; -#ifdef VAX - d0 = word0(d) >> 16 | word0(d) << 16; - d1 = word1(d) >> 16 | word1(d) << 16; -#else -#define d0 word0(d) -#define d1 word1(d) -#endif - -#ifdef Pack_32 - b = Balloc(1); -#else - b = Balloc(2); -#endif - if (!b) return NULL; - x = b->x; - - z = d0 & Frac_mask; - d0 &= 0x7fffffff; /* clear sign bit, which we ignore */ -#ifdef Sudden_Underflow - de = (int)(d0 >> Exp_shift); -#ifndef IBM - z |= Exp_msk11; -#endif -#else - if ((de = (int)(d0 >> Exp_shift)) != 0) - z |= Exp_msk1; -#endif -#ifdef Pack_32 - if ((y = d1) != 0) { - if ((k = lo0bits(&y)) != 0) { - x[0] = y | z << (32 - k); - z >>= k; - } - else - x[0] = y; -#ifndef Sudden_Underflow - i = -#endif - b->wds = (x[1] = z) ? 2 : 1; - } - else { -#ifdef DEBUG - if (!z) - Bug("Zero passed to d2b"); -#endif - k = lo0bits(&z); - x[0] = z; -#ifndef Sudden_Underflow - i = -#endif - b->wds = 1; - k += 32; - } -#else - if (y = d1) { - if (k = lo0bits(&y)) - if (k >= 16) { - x[0] = y | z << 32 - k & 0xffff; - x[1] = z >> k - 16 & 0xffff; - x[2] = z >> k; - i = 2; - } - else { - x[0] = y & 0xffff; - x[1] = y >> 16 | z << 16 - k & 0xffff; - x[2] = z >> k & 0xffff; - x[3] = z >> k+16; - i = 3; - } - else { - x[0] = y & 0xffff; - x[1] = y >> 16; - x[2] = z & 0xffff; - x[3] = z >> 16; - i = 3; - } - } - else { -#ifdef DEBUG - if (!z) - Bug("Zero passed to d2b"); -#endif - k = lo0bits(&z); - if (k >= 16) { - x[0] = z; - i = 0; - } - else { - x[0] = z & 0xffff; - x[1] = z >> 16; - i = 1; - } - k += 32; - } - while (!x[i]) - --i; - b->wds = i + 1; -#endif -#ifndef Sudden_Underflow - if (de) { -#endif -#ifdef IBM - *e = (de - Bias - (P-1) << 2) + k; - *bits = 4*P + 8 - k - hi0bits(word0(d) & Frac_mask); -#else - *e = de - Bias - (P-1) + k; - *bits = P - k; -#endif -#ifndef Sudden_Underflow - } - else { - *e = de - Bias - (P-1) + 1 + k; -#ifdef Pack_32 - *bits = 32*i - hi0bits(x[i-1]); -#else - *bits = (i+2)*16 - hi0bits(x[i]); -#endif - } -#endif - return b; -} -#undef d0 -#undef d1 - -static double -ratio(Bigint *a, Bigint *b) -{ - double_u da, db; - int k, ka, kb; - - dval(da) = b2d(a, &ka); - dval(db) = b2d(b, &kb); -#ifdef Pack_32 - k = ka - kb + 32*(a->wds - b->wds); -#else - k = ka - kb + 16*(a->wds - b->wds); -#endif -#ifdef IBM - if (k > 0) { - word0(da) += (k >> 2)*Exp_msk1; - if (k &= 3) - dval(da) *= 1 << k; - } - else { - k = -k; - word0(db) += (k >> 2)*Exp_msk1; - if (k &= 3) - dval(db) *= 1 << k; - } -#else - if (k > 0) - word0(da) += k*Exp_msk1; - else { - k = -k; - word0(db) += k*Exp_msk1; - } -#endif - return dval(da) / dval(db); -} - -static const double -tens[] = { - 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, - 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, - 1e20, 1e21, 1e22 -#ifdef VAX - , 1e23, 1e24 -#endif -}; - -static const double -#ifdef IEEE_Arith -bigtens[] = { 1e16, 1e32, 1e64, 1e128, 1e256 }; -static const double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128, -#ifdef Avoid_Underflow - 9007199254740992.*9007199254740992.e-256 - /* = 2^106 * 1e-53 */ -#else - 1e-256 -#endif -}; -/* The factor of 2^53 in tinytens[4] helps us avoid setting the underflow */ -/* flag unnecessarily. It leads to a song and dance at the end of strtod. */ -#define Scale_Bit 0x10 -#define n_bigtens 5 -#else -#ifdef IBM -bigtens[] = { 1e16, 1e32, 1e64 }; -static const double tinytens[] = { 1e-16, 1e-32, 1e-64 }; -#define n_bigtens 3 -#else -bigtens[] = { 1e16, 1e32 }; -static const double tinytens[] = { 1e-16, 1e-32 }; -#define n_bigtens 2 -#endif -#endif - -#ifndef IEEE_Arith -#undef INFNAN_CHECK -#endif - -#ifdef INFNAN_CHECK - -#ifndef NAN_WORD0 -#define NAN_WORD0 0x7ff80000 -#endif - -#ifndef NAN_WORD1 -#define NAN_WORD1 0 -#endif - -static int -match(const char **sp, char *t) -{ - int c, d; - const char *s = *sp; - - while (d = *t++) { - if ((c = *++s) >= 'A' && c <= 'Z') - c += 'a' - 'A'; - if (c != d) - return 0; - } - *sp = s + 1; - return 1; -} - -#ifndef No_Hex_NaN -static void -hexnan(double *rvp, const char **sp) -{ - ULong c, x[2]; - const char *s; - int havedig, udx0, xshift; - - x[0] = x[1] = 0; - havedig = xshift = 0; - udx0 = 1; - s = *sp; - while (c = *(const unsigned char*)++s) { - if (c >= '0' && c <= '9') - c -= '0'; - else if (c >= 'a' && c <= 'f') - c += 10 - 'a'; - else if (c >= 'A' && c <= 'F') - c += 10 - 'A'; - else if (c <= ' ') { - if (udx0 && havedig) { - udx0 = 0; - xshift = 1; - } - continue; - } - else if (/*(*/ c == ')' && havedig) { - *sp = s + 1; - break; - } - else - return; /* invalid form: don't change *sp */ - havedig = 1; - if (xshift) { - xshift = 0; - x[0] = x[1]; - x[1] = 0; - } - if (udx0) - x[0] = (x[0] << 4) | (x[1] >> 28); - x[1] = (x[1] << 4) | c; - } - if ((x[0] &= 0xfffff) || x[1]) { - word0(*rvp) = Exp_mask | x[0]; - word1(*rvp) = x[1]; - } -} -#endif /*No_Hex_NaN*/ -#endif /* INFNAN_CHECK */ - -NO_SANITIZE("unsigned-integer-overflow", double strtod(const char *s00, char **se)); -double -strtod(const char *s00, char **se) -{ -#ifdef Avoid_Underflow - int scale; -#endif - int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign, - e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; - const char *s, *s0, *s1; - double aadj, adj; - double_u aadj1, rv, rv0; - Long L; - ULong y, z; - Bigint *bb, *bb1, *bd, *bd0, *bs, *delta; -#ifdef SET_INEXACT - int inexact, oldinexact; -#endif -#ifdef Honor_FLT_ROUNDS - int rounding; -#endif -#ifdef USE_LOCALE - const char *s2; -#endif - - errno = 0; - sign = nz0 = nz = 0; - dval(rv) = 0.; - for (s = s00;;s++) - switch (*s) { - case '-': - sign = 1; - /* no break */ - case '+': - if (*++s) - goto break2; - /* no break */ - case 0: - goto ret0; - case '\t': - case '\n': - case '\v': - case '\f': - case '\r': - case ' ': - continue; - default: - goto break2; - } -break2: - if (*s == '0') { - if (s[1] == 'x' || s[1] == 'X') { - s0 = ++s; - adj = 0; - aadj = 1.0; - nd0 = -4; - - if (!*++s || (!(s1 = strchr(hexdigit, *s)) && *s != '.')) goto ret0; - if (*s == '0') { - while (*++s == '0'); - if (!*s) goto ret; - s1 = strchr(hexdigit, *s); - } - if (s1 != NULL) { - do { - adj += aadj * ((s1 - hexdigit) & 15); - nd0 += 4; - aadj /= 16; - } while (*++s && (s1 = strchr(hexdigit, *s))); - } - - if ((*s == '.') && *++s && (s1 = strchr(hexdigit, *s))) { - if (nd0 < 0) { - while (*s == '0') { - s++; - nd0 -= 4; - } - } - for (; *s && (s1 = strchr(hexdigit, *s)); ++s) { - adj += aadj * ((s1 - hexdigit) & 15); - if ((aadj /= 16) == 0.0) { - while (*++s && strchr(hexdigit, *s)); - break; - } - } - } - - if (*s == 'P' || *s == 'p') { - dsign = 0x2C - *++s; /* +: 2B, -: 2D */ - if (abs(dsign) == 1) s++; - else dsign = 1; - - nd = 0; - c = *s; - if (c < '0' || '9' < c) goto ret0; - do { - nd *= 10; - nd += c; - nd -= '0'; - c = *++s; - /* Float("0x0."+("0"*267)+"1fp2095") */ - if (nd + dsign * nd0 > 2095) { - while ('0' <= c && c <= '9') c = *++s; - break; - } - } while ('0' <= c && c <= '9'); - nd0 += nd * dsign; - } - dval(rv) = ldexp(adj, nd0); - goto ret; - } - nz0 = 1; - while (*++s == '0') ; - if (!*s) - goto ret; - } - s0 = s; - y = z = 0; - for (nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++) - if (nd < 9) - y = 10*y + c - '0'; - else if (nd < DBL_DIG + 2) - z = 10*z + c - '0'; - nd0 = nd; -#ifdef USE_LOCALE - s1 = localeconv()->decimal_point; - if (c == *s1) { - c = '.'; - if (*++s1) { - s2 = s; - for (;;) { - if (*++s2 != *s1) { - c = 0; - break; - } - if (!*++s1) { - s = s2; - break; - } - } - } - } -#endif - if (c == '.') { - c = *++s; - if (!ISDIGIT(c)) - goto dig_done; - if (!nd) { - for (; c == '0'; c = *++s) - nz++; - if (c > '0' && c <= '9') { - s0 = s; - nf += nz; - nz = 0; - goto have_dig; - } - goto dig_done; - } - for (; c >= '0' && c <= '9'; c = *++s) { -have_dig: - nz++; - if (nd > DBL_DIG * 4) { - continue; - } - if (c -= '0') { - nf += nz; - for (i = 1; i < nz; i++) - if (nd++ < 9) - y *= 10; - else if (nd <= DBL_DIG + 2) - z *= 10; - if (nd++ < 9) - y = 10*y + c; - else if (nd <= DBL_DIG + 2) - z = 10*z + c; - nz = 0; - } - } - } -dig_done: - e = 0; - if (c == 'e' || c == 'E') { - if (!nd && !nz && !nz0) { - goto ret0; - } - s00 = s; - esign = 0; - switch (c = *++s) { - case '-': - esign = 1; - case '+': - c = *++s; - } - if (c >= '0' && c <= '9') { - while (c == '0') - c = *++s; - if (c > '0' && c <= '9') { - L = c - '0'; - s1 = s; - while ((c = *++s) >= '0' && c <= '9') - L = 10*L + c - '0'; - if (s - s1 > 8 || L > 19999) - /* Avoid confusion from exponents - * so large that e might overflow. - */ - e = 19999; /* safe for 16 bit ints */ - else - e = (int)L; - if (esign) - e = -e; - } - else - e = 0; - } - else - s = s00; - } - if (!nd) { - if (!nz && !nz0) { -#ifdef INFNAN_CHECK - /* Check for Nan and Infinity */ - switch (c) { - case 'i': - case 'I': - if (match(&s,"nf")) { - --s; - if (!match(&s,"inity")) - ++s; - word0(rv) = 0x7ff00000; - word1(rv) = 0; - goto ret; - } - break; - case 'n': - case 'N': - if (match(&s, "an")) { - word0(rv) = NAN_WORD0; - word1(rv) = NAN_WORD1; -#ifndef No_Hex_NaN - if (*s == '(') /*)*/ - hexnan(&rv, &s); -#endif - goto ret; - } - } -#endif /* INFNAN_CHECK */ -ret0: - s = s00; - sign = 0; - } - goto ret; - } - e1 = e -= nf; - - /* Now we have nd0 digits, starting at s0, followed by a - * decimal point, followed by nd-nd0 digits. The number we're - * after is the integer represented by those digits times - * 10**e */ - - if (!nd0) - nd0 = nd; - k = nd < DBL_DIG + 2 ? nd : DBL_DIG + 2; - dval(rv) = y; - if (k > 9) { -#ifdef SET_INEXACT - if (k > DBL_DIG) - oldinexact = get_inexact(); -#endif - dval(rv) = tens[k - 9] * dval(rv) + z; - } - bd0 = bb = bd = bs = delta = 0; - if (nd <= DBL_DIG -#ifndef RND_PRODQUOT -#ifndef Honor_FLT_ROUNDS - && Flt_Rounds == 1 -#endif -#endif - ) { - if (!e) - goto ret; - if (e > 0) { - if (e <= Ten_pmax) { -#ifdef VAX - goto vax_ovfl_check; -#else -#ifdef Honor_FLT_ROUNDS - /* round correctly FLT_ROUNDS = 2 or 3 */ - if (sign) { - dval(rv) = -dval(rv); - sign = 0; - } -#endif - /* rv = */ rounded_product(dval(rv), tens[e]); - goto ret; -#endif - } - i = DBL_DIG - nd; - if (e <= Ten_pmax + i) { - /* A fancier test would sometimes let us do - * this for larger i values. - */ -#ifdef Honor_FLT_ROUNDS - /* round correctly FLT_ROUNDS = 2 or 3 */ - if (sign) { - dval(rv) = -dval(rv); - sign = 0; - } -#endif - e -= i; - dval(rv) *= tens[i]; -#ifdef VAX - /* VAX exponent range is so narrow we must - * worry about overflow here... - */ -vax_ovfl_check: - word0(rv) -= P*Exp_msk1; - /* rv = */ rounded_product(dval(rv), tens[e]); - if ((word0(rv) & Exp_mask) - > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) - goto ovfl; - word0(rv) += P*Exp_msk1; -#else - /* rv = */ rounded_product(dval(rv), tens[e]); -#endif - goto ret; - } - } -#ifndef Inaccurate_Divide - else if (e >= -Ten_pmax) { -#ifdef Honor_FLT_ROUNDS - /* round correctly FLT_ROUNDS = 2 or 3 */ - if (sign) { - dval(rv) = -dval(rv); - sign = 0; - } -#endif - /* rv = */ rounded_quotient(dval(rv), tens[-e]); - goto ret; - } -#endif - } - e1 += nd - k; - -#ifdef IEEE_Arith -#ifdef SET_INEXACT - inexact = 1; - if (k <= DBL_DIG) - oldinexact = get_inexact(); -#endif -#ifdef Avoid_Underflow - scale = 0; -#endif -#ifdef Honor_FLT_ROUNDS - if ((rounding = Flt_Rounds) >= 2) { - if (sign) - rounding = rounding == 2 ? 0 : 2; - else - if (rounding != 2) - rounding = 0; - } -#endif -#endif /*IEEE_Arith*/ - - /* Get starting approximation = rv * 10**e1 */ - - if (e1 > 0) { - if ((i = e1 & 15) != 0) - dval(rv) *= tens[i]; - if (e1 &= ~15) { - if (e1 > DBL_MAX_10_EXP) { -ovfl: -#ifndef NO_ERRNO - errno = ERANGE; -#endif - /* Can't trust HUGE_VAL */ -#ifdef IEEE_Arith -#ifdef Honor_FLT_ROUNDS - switch (rounding) { - case 0: /* toward 0 */ - case 3: /* toward -infinity */ - word0(rv) = Big0; - word1(rv) = Big1; - break; - default: - word0(rv) = Exp_mask; - word1(rv) = 0; - } -#else /*Honor_FLT_ROUNDS*/ - word0(rv) = Exp_mask; - word1(rv) = 0; -#endif /*Honor_FLT_ROUNDS*/ -#ifdef SET_INEXACT - /* set overflow bit */ - dval(rv0) = 1e300; - dval(rv0) *= dval(rv0); -#endif -#else /*IEEE_Arith*/ - word0(rv) = Big0; - word1(rv) = Big1; -#endif /*IEEE_Arith*/ - if (bd0) - goto retfree; - goto ret; - } - e1 >>= 4; - for (j = 0; e1 > 1; j++, e1 >>= 1) - if (e1 & 1) - dval(rv) *= bigtens[j]; - /* The last multiplication could overflow. */ - word0(rv) -= P*Exp_msk1; - dval(rv) *= bigtens[j]; - if ((z = word0(rv) & Exp_mask) - > Exp_msk1*(DBL_MAX_EXP+Bias-P)) - goto ovfl; - if (z > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) { - /* set to largest number */ - /* (Can't trust DBL_MAX) */ - word0(rv) = Big0; - word1(rv) = Big1; - } - else - word0(rv) += P*Exp_msk1; - } - } - else if (e1 < 0) { - e1 = -e1; - if ((i = e1 & 15) != 0) - dval(rv) /= tens[i]; - if (e1 >>= 4) { - if (e1 >= 1 << n_bigtens) - goto undfl; -#ifdef Avoid_Underflow - if (e1 & Scale_Bit) - scale = 2*P; - for (j = 0; e1 > 0; j++, e1 >>= 1) - if (e1 & 1) - dval(rv) *= tinytens[j]; - if (scale && (j = 2*P + 1 - ((word0(rv) & Exp_mask) - >> Exp_shift)) > 0) { - /* scaled rv is denormal; zap j low bits */ - if (j >= 32) { - word1(rv) = 0; - if (j >= 53) - word0(rv) = (P+2)*Exp_msk1; - else - word0(rv) &= 0xffffffff << (j-32); - } - else - word1(rv) &= 0xffffffff << j; - } -#else - for (j = 0; e1 > 1; j++, e1 >>= 1) - if (e1 & 1) - dval(rv) *= tinytens[j]; - /* The last multiplication could underflow. */ - dval(rv0) = dval(rv); - dval(rv) *= tinytens[j]; - if (!dval(rv)) { - dval(rv) = 2.*dval(rv0); - dval(rv) *= tinytens[j]; -#endif - if (!dval(rv)) { -undfl: - dval(rv) = 0.; -#ifndef NO_ERRNO - errno = ERANGE; -#endif - if (bd0) - goto retfree; - goto ret; - } -#ifndef Avoid_Underflow - word0(rv) = Tiny0; - word1(rv) = Tiny1; - /* The refinement below will clean - * this approximation up. - */ - } -#endif - } - } - - /* Now the hard part -- adjusting rv to the correct value.*/ - - /* Put digits into bd: true value = bd * 10^e */ - - bd0 = s2b(s0, nd0, nd, y); - if (!bd0) goto ret; - - for (;;) { - bd = Balloc(bd0->k); - if (!bd) goto retfree; - Bcopy(bd, bd0); - bb = d2b(dval(rv), &bbe, &bbbits); /* rv = bb * 2^bbe */ - if (!bb) goto retfree; - bs = i2b(1); - if (!bs) goto retfree; - - if (e >= 0) { - bb2 = bb5 = 0; - bd2 = bd5 = e; - } - else { - bb2 = bb5 = -e; - bd2 = bd5 = 0; - } - if (bbe >= 0) - bb2 += bbe; - else - bd2 -= bbe; - bs2 = bb2; -#ifdef Honor_FLT_ROUNDS - if (rounding != 1) - bs2++; -#endif -#ifdef Avoid_Underflow - j = bbe - scale; - i = j + bbbits - 1; /* logb(rv) */ - if (i < Emin) /* denormal */ - j += P - Emin; - else - j = P + 1 - bbbits; -#else /*Avoid_Underflow*/ -#ifdef Sudden_Underflow -#ifdef IBM - j = 1 + 4*P - 3 - bbbits + ((bbe + bbbits - 1) & 3); -#else - j = P + 1 - bbbits; -#endif -#else /*Sudden_Underflow*/ - j = bbe; - i = j + bbbits - 1; /* logb(rv) */ - if (i < Emin) /* denormal */ - j += P - Emin; - else - j = P + 1 - bbbits; -#endif /*Sudden_Underflow*/ -#endif /*Avoid_Underflow*/ - bb2 += j; - bd2 += j; -#ifdef Avoid_Underflow - bd2 += scale; -#endif - i = bb2 < bd2 ? bb2 : bd2; - if (i > bs2) - i = bs2; - if (i > 0) { - bb2 -= i; - bd2 -= i; - bs2 -= i; - } - if (bb5 > 0) { - bs = pow5mult(bs, bb5); - if (!bs) goto retfree; - bb1 = mult(bs, bb); - Bfree(bb); - bb = bb1; - if (!bb) goto retfree; - } - if (bb2 > 0) { - bb = lshift(bb, bb2); - if (!bb) goto retfree; - } - if (bd5 > 0) { - bd = pow5mult(bd, bd5); - if (!bd) goto retfree; - } - if (bd2 > 0) { - bd = lshift(bd, bd2); - if (!bd) goto retfree; - } - if (bs2 > 0) { - bs = lshift(bs, bs2); - if (!bs) goto retfree; - } - delta = diff(bb, bd); - if (!delta) goto retfree; - dsign = delta->sign; - delta->sign = 0; - i = cmp(delta, bs); -#ifdef Honor_FLT_ROUNDS - if (rounding != 1) { - if (i < 0) { - /* Error is less than an ulp */ - if (!delta->x[0] && delta->wds <= 1) { - /* exact */ -#ifdef SET_INEXACT - inexact = 0; -#endif - break; - } - if (rounding) { - if (dsign) { - adj = 1.; - goto apply_adj; - } - } - else if (!dsign) { - adj = -1.; - if (!word1(rv) - && !(word0(rv) & Frac_mask)) { - y = word0(rv) & Exp_mask; -#ifdef Avoid_Underflow - if (!scale || y > 2*P*Exp_msk1) -#else - if (y) -#endif - { - delta = lshift(delta,Log2P); - if (!delta) goto nomem; - if (cmp(delta, bs) <= 0) - adj = -0.5; - } - } -apply_adj: -#ifdef Avoid_Underflow - if (scale && (y = word0(rv) & Exp_mask) - <= 2*P*Exp_msk1) - word0(adj) += (2*P+1)*Exp_msk1 - y; -#else -#ifdef Sudden_Underflow - if ((word0(rv) & Exp_mask) <= - P*Exp_msk1) { - word0(rv) += P*Exp_msk1; - dval(rv) += adj*ulp(dval(rv)); - word0(rv) -= P*Exp_msk1; - } - else -#endif /*Sudden_Underflow*/ -#endif /*Avoid_Underflow*/ - dval(rv) += adj*ulp(dval(rv)); - } - break; - } - adj = ratio(delta, bs); - if (adj < 1.) - adj = 1.; - if (adj <= 0x7ffffffe) { - /* adj = rounding ? ceil(adj) : floor(adj); */ - y = adj; - if (y != adj) { - if (!((rounding>>1) ^ dsign)) - y++; - adj = y; - } - } -#ifdef Avoid_Underflow - if (scale && (y = word0(rv) & Exp_mask) <= 2*P*Exp_msk1) - word0(adj) += (2*P+1)*Exp_msk1 - y; -#else -#ifdef Sudden_Underflow - if ((word0(rv) & Exp_mask) <= P*Exp_msk1) { - word0(rv) += P*Exp_msk1; - adj *= ulp(dval(rv)); - if (dsign) - dval(rv) += adj; - else - dval(rv) -= adj; - word0(rv) -= P*Exp_msk1; - goto cont; - } -#endif /*Sudden_Underflow*/ -#endif /*Avoid_Underflow*/ - adj *= ulp(dval(rv)); - if (dsign) - dval(rv) += adj; - else - dval(rv) -= adj; - goto cont; - } -#endif /*Honor_FLT_ROUNDS*/ - - if (i < 0) { - /* Error is less than half an ulp -- check for - * special case of mantissa a power of two. - */ - if (dsign || word1(rv) || word0(rv) & Bndry_mask -#ifdef IEEE_Arith -#ifdef Avoid_Underflow - || (word0(rv) & Exp_mask) <= (2*P+1)*Exp_msk1 -#else - || (word0(rv) & Exp_mask) <= Exp_msk1 -#endif -#endif - ) { -#ifdef SET_INEXACT - if (!delta->x[0] && delta->wds <= 1) - inexact = 0; -#endif - break; - } - if (!delta->x[0] && delta->wds <= 1) { - /* exact result */ -#ifdef SET_INEXACT - inexact = 0; -#endif - break; - } - delta = lshift(delta,Log2P); - if (!delta) goto retfree; - if (cmp(delta, bs) > 0) - goto drop_down; - break; - } - if (i == 0) { - /* exactly half-way between */ - if (dsign) { - if ((word0(rv) & Bndry_mask1) == Bndry_mask1 - && word1(rv) == ( -#ifdef Avoid_Underflow - (scale && (y = word0(rv) & Exp_mask) <= 2*P*Exp_msk1) - ? (0xffffffff & (0xffffffff << (2*P+1-(y>>Exp_shift)))) : -#endif - 0xffffffff)) { - /*boundary case -- increment exponent*/ - word0(rv) = (word0(rv) & Exp_mask) - + Exp_msk1 -#ifdef IBM - | Exp_msk1 >> 4 -#endif - ; - word1(rv) = 0; -#ifdef Avoid_Underflow - dsign = 0; -#endif - break; - } - } - else if (!(word0(rv) & Bndry_mask) && !word1(rv)) { -drop_down: - /* boundary case -- decrement exponent */ -#ifdef Sudden_Underflow /*{{*/ - L = word0(rv) & Exp_mask; -#ifdef IBM - if (L < Exp_msk1) -#else -#ifdef Avoid_Underflow - if (L <= (scale ? (2*P+1)*Exp_msk1 : Exp_msk1)) -#else - if (L <= Exp_msk1) -#endif /*Avoid_Underflow*/ -#endif /*IBM*/ - goto undfl; - L -= Exp_msk1; -#else /*Sudden_Underflow}{*/ -#ifdef Avoid_Underflow - if (scale) { - L = word0(rv) & Exp_mask; - if (L <= (2*P+1)*Exp_msk1) { - if (L > (P+2)*Exp_msk1) - /* round even ==> */ - /* accept rv */ - break; - /* rv = smallest denormal */ - goto undfl; - } - } -#endif /*Avoid_Underflow*/ - L = (word0(rv) & Exp_mask) - Exp_msk1; -#endif /*Sudden_Underflow}}*/ - word0(rv) = L | Bndry_mask1; - word1(rv) = 0xffffffff; -#ifdef IBM - goto cont; -#else - break; -#endif - } -#ifndef ROUND_BIASED - if (!(word1(rv) & LSB)) - break; -#endif - if (dsign) - dval(rv) += ulp(dval(rv)); -#ifndef ROUND_BIASED - else { - dval(rv) -= ulp(dval(rv)); -#ifndef Sudden_Underflow - if (!dval(rv)) - goto undfl; -#endif - } -#ifdef Avoid_Underflow - dsign = 1 - dsign; -#endif -#endif - break; - } - if ((aadj = ratio(delta, bs)) <= 2.) { - if (dsign) - aadj = dval(aadj1) = 1.; - else if (word1(rv) || word0(rv) & Bndry_mask) { -#ifndef Sudden_Underflow - if (word1(rv) == Tiny1 && !word0(rv)) - goto undfl; -#endif - aadj = 1.; - dval(aadj1) = -1.; - } - else { - /* special case -- power of FLT_RADIX to be */ - /* rounded down... */ - - if (aadj < 2./FLT_RADIX) - aadj = 1./FLT_RADIX; - else - aadj *= 0.5; - dval(aadj1) = -aadj; - } - } - else { - aadj *= 0.5; - dval(aadj1) = dsign ? aadj : -aadj; -#ifdef Check_FLT_ROUNDS - switch (Rounding) { - case 2: /* towards +infinity */ - dval(aadj1) -= 0.5; - break; - case 0: /* towards 0 */ - case 3: /* towards -infinity */ - dval(aadj1) += 0.5; - } -#else - if (Flt_Rounds == 0) - dval(aadj1) += 0.5; -#endif /*Check_FLT_ROUNDS*/ - } - y = word0(rv) & Exp_mask; - - /* Check for overflow */ - - if (y == Exp_msk1*(DBL_MAX_EXP+Bias-1)) { - dval(rv0) = dval(rv); - word0(rv) -= P*Exp_msk1; - adj = dval(aadj1) * ulp(dval(rv)); - dval(rv) += adj; - if ((word0(rv) & Exp_mask) >= - Exp_msk1*(DBL_MAX_EXP+Bias-P)) { - if (word0(rv0) == Big0 && word1(rv0) == Big1) - goto ovfl; - word0(rv) = Big0; - word1(rv) = Big1; - goto cont; - } - else - word0(rv) += P*Exp_msk1; - } - else { -#ifdef Avoid_Underflow - if (scale && y <= 2*P*Exp_msk1) { - if (aadj <= 0x7fffffff) { - if ((z = (int)aadj) <= 0) - z = 1; - aadj = z; - dval(aadj1) = dsign ? aadj : -aadj; - } - word0(aadj1) += (2*P+1)*Exp_msk1 - y; - } - adj = dval(aadj1) * ulp(dval(rv)); - dval(rv) += adj; -#else -#ifdef Sudden_Underflow - if ((word0(rv) & Exp_mask) <= P*Exp_msk1) { - dval(rv0) = dval(rv); - word0(rv) += P*Exp_msk1; - adj = dval(aadj1) * ulp(dval(rv)); - dval(rv) += adj; -#ifdef IBM - if ((word0(rv) & Exp_mask) < P*Exp_msk1) -#else - if ((word0(rv) & Exp_mask) <= P*Exp_msk1) -#endif - { - if (word0(rv0) == Tiny0 && word1(rv0) == Tiny1) - goto undfl; - word0(rv) = Tiny0; - word1(rv) = Tiny1; - goto cont; - } - else - word0(rv) -= P*Exp_msk1; - } - else { - adj = dval(aadj1) * ulp(dval(rv)); - dval(rv) += adj; - } -#else /*Sudden_Underflow*/ - /* Compute adj so that the IEEE rounding rules will - * correctly round rv + adj in some half-way cases. - * If rv * ulp(rv) is denormalized (i.e., - * y <= (P-1)*Exp_msk1), we must adjust aadj to avoid - * trouble from bits lost to denormalization; - * example: 1.2e-307 . - */ - if (y <= (P-1)*Exp_msk1 && aadj > 1.) { - dval(aadj1) = (double)(int)(aadj + 0.5); - if (!dsign) - dval(aadj1) = -dval(aadj1); - } - adj = dval(aadj1) * ulp(dval(rv)); - dval(rv) += adj; -#endif /*Sudden_Underflow*/ -#endif /*Avoid_Underflow*/ - } - z = word0(rv) & Exp_mask; -#ifndef SET_INEXACT -#ifdef Avoid_Underflow - if (!scale) -#endif - if (y == z) { - /* Can we stop now? */ - L = (Long)aadj; - aadj -= L; - /* The tolerances below are conservative. */ - if (dsign || word1(rv) || word0(rv) & Bndry_mask) { - if (aadj < .4999999 || aadj > .5000001) - break; - } - else if (aadj < .4999999/FLT_RADIX) - break; - } -#endif -cont: - Bfree(bb); - Bfree(bd); - Bfree(bs); - Bfree(delta); - } -#ifdef SET_INEXACT - if (inexact) { - if (!oldinexact) { - word0(rv0) = Exp_1 + (70 << Exp_shift); - word1(rv0) = 0; - dval(rv0) += 1.; - } - } - else if (!oldinexact) - clear_inexact(); -#endif -#ifdef Avoid_Underflow - if (scale) { - word0(rv0) = Exp_1 - 2*P*Exp_msk1; - word1(rv0) = 0; - dval(rv) *= dval(rv0); -#ifndef NO_ERRNO - /* try to avoid the bug of testing an 8087 register value */ - if (word0(rv) == 0 && word1(rv) == 0) - errno = ERANGE; -#endif - } -#endif /* Avoid_Underflow */ -#ifdef SET_INEXACT - if (inexact && !(word0(rv) & Exp_mask)) { - /* set underflow bit */ - dval(rv0) = 1e-300; - dval(rv0) *= dval(rv0); - } -#endif -retfree: - Bfree(bb); - Bfree(bd); - Bfree(bs); - Bfree(bd0); - Bfree(delta); -ret: - if (se) - *se = (char *)s; - return sign ? -dval(rv) : dval(rv); -} - -NO_SANITIZE("unsigned-integer-overflow", static int quorem(Bigint *b, Bigint *S)); -static int -quorem(Bigint *b, Bigint *S) -{ - int n; - ULong *bx, *bxe, q, *sx, *sxe; -#ifdef ULLong - ULLong borrow, carry, y, ys; -#else - ULong borrow, carry, y, ys; -#ifdef Pack_32 - ULong si, z, zs; -#endif -#endif - - n = S->wds; -#ifdef DEBUG - /*debug*/ if (b->wds > n) - /*debug*/ Bug("oversize b in quorem"); -#endif - if (b->wds < n) - return 0; - sx = S->x; - sxe = sx + --n; - bx = b->x; - bxe = bx + n; - q = *bxe / (*sxe + 1); /* ensure q <= true quotient */ -#ifdef DEBUG - /*debug*/ if (q > 9) - /*debug*/ Bug("oversized quotient in quorem"); -#endif - if (q) { - borrow = 0; - carry = 0; - do { -#ifdef ULLong - ys = *sx++ * (ULLong)q + carry; - carry = ys >> 32; - y = *bx - (ys & FFFFFFFF) - borrow; - borrow = y >> 32 & (ULong)1; - *bx++ = (ULong)(y & FFFFFFFF); -#else -#ifdef Pack_32 - si = *sx++; - ys = (si & 0xffff) * q + carry; - zs = (si >> 16) * q + (ys >> 16); - carry = zs >> 16; - y = (*bx & 0xffff) - (ys & 0xffff) - borrow; - borrow = (y & 0x10000) >> 16; - z = (*bx >> 16) - (zs & 0xffff) - borrow; - borrow = (z & 0x10000) >> 16; - Storeinc(bx, z, y); -#else - ys = *sx++ * q + carry; - carry = ys >> 16; - y = *bx - (ys & 0xffff) - borrow; - borrow = (y & 0x10000) >> 16; - *bx++ = y & 0xffff; -#endif -#endif - } while (sx <= sxe); - if (!*bxe) { - bx = b->x; - while (--bxe > bx && !*bxe) - --n; - b->wds = n; - } - } - if (cmp(b, S) >= 0) { - q++; - borrow = 0; - carry = 0; - bx = b->x; - sx = S->x; - do { -#ifdef ULLong - ys = *sx++ + carry; - carry = ys >> 32; - y = *bx - (ys & FFFFFFFF) - borrow; - borrow = y >> 32 & (ULong)1; - *bx++ = (ULong)(y & FFFFFFFF); -#else -#ifdef Pack_32 - si = *sx++; - ys = (si & 0xffff) + carry; - zs = (si >> 16) + (ys >> 16); - carry = zs >> 16; - y = (*bx & 0xffff) - (ys & 0xffff) - borrow; - borrow = (y & 0x10000) >> 16; - z = (*bx >> 16) - (zs & 0xffff) - borrow; - borrow = (z & 0x10000) >> 16; - Storeinc(bx, z, y); -#else - ys = *sx++ + carry; - carry = ys >> 16; - y = *bx - (ys & 0xffff) - borrow; - borrow = (y & 0x10000) >> 16; - *bx++ = y & 0xffff; -#endif -#endif - } while (sx <= sxe); - bx = b->x; - bxe = bx + n; - if (!*bxe) { - while (--bxe > bx && !*bxe) - --n; - b->wds = n; - } - } - return q; -} - -#ifndef MULTIPLE_THREADS -static char *dtoa_result; -#endif - -#ifndef MULTIPLE_THREADS -static char * -rv_alloc(int i) -{ - return dtoa_result = MALLOC(i); -} -#else -#define rv_alloc(i) MALLOC(i) -#endif - -static char * -nrv_alloc(const char *s, char **rve, size_t n) -{ - char *rv, *t; - - t = rv = rv_alloc(n); - if (!rv) return NULL; - while ((*t = *s++) != 0) t++; - if (rve) - *rve = t; - return rv; -} - -#define rv_strdup(s, rve) nrv_alloc((s), (rve), strlen(s)+1) - -#ifndef MULTIPLE_THREADS -/* freedtoa(s) must be used to free values s returned by dtoa - * when MULTIPLE_THREADS is #defined. It should be used in all cases, - * but for consistency with earlier versions of dtoa, it is optional - * when MULTIPLE_THREADS is not defined. - */ - -static void -freedtoa(char *s) -{ - FREE(s); -} -#endif - -static const char INFSTR[] = "Infinity"; -static const char NANSTR[] = "NaN"; -static const char ZEROSTR[] = "0"; - -/* dtoa for IEEE arithmetic (dmg): convert double to ASCII string. - * - * Inspired by "How to Print Floating-Point Numbers Accurately" by - * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 112-126]. - * - * Modifications: - * 1. Rather than iterating, we use a simple numeric overestimate - * to determine k = floor(log10(d)). We scale relevant - * quantities using O(log2(k)) rather than O(k) multiplications. - * 2. For some modes > 2 (corresponding to ecvt and fcvt), we don't - * try to generate digits strictly left to right. Instead, we - * compute with fewer bits and propagate the carry if necessary - * when rounding the final digit up. This is often faster. - * 3. Under the assumption that input will be rounded nearest, - * mode 0 renders 1e23 as 1e23 rather than 9.999999999999999e22. - * That is, we allow equality in stopping tests when the - * round-nearest rule will give the same floating-point value - * as would satisfaction of the stopping test with strict - * inequality. - * 4. We remove common factors of powers of 2 from relevant - * quantities. - * 5. When converting floating-point integers less than 1e16, - * we use floating-point arithmetic rather than resorting - * to multiple-precision integers. - * 6. When asked to produce fewer than 15 digits, we first try - * to get by with floating-point arithmetic; we resort to - * multiple-precision integer arithmetic only if we cannot - * guarantee that the floating-point calculation has given - * the correctly rounded result. For k requested digits and - * "uniformly" distributed input, the probability is - * something like 10^(k-15) that we must resort to the Long - * calculation. - */ - -char * -dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve) -{ - /* Arguments ndigits, decpt, sign are similar to those - of ecvt and fcvt; trailing zeros are suppressed from - the returned string. If not null, *rve is set to point - to the end of the return value. If d is +-Infinity or NaN, - then *decpt is set to 9999. - - mode: - 0 ==> shortest string that yields d when read in - and rounded to nearest. - 1 ==> like 0, but with Steele & White stopping rule; - e.g. with IEEE P754 arithmetic , mode 0 gives - 1e23 whereas mode 1 gives 9.999999999999999e22. - 2 ==> max(1,ndigits) significant digits. This gives a - return value similar to that of ecvt, except - that trailing zeros are suppressed. - 3 ==> through ndigits past the decimal point. This - gives a return value similar to that from fcvt, - except that trailing zeros are suppressed, and - ndigits can be negative. - 4,5 ==> similar to 2 and 3, respectively, but (in - round-nearest mode) with the tests of mode 0 to - possibly return a shorter string that rounds to d. - With IEEE arithmetic and compilation with - -DHonor_FLT_ROUNDS, modes 4 and 5 behave the same - as modes 2 and 3 when FLT_ROUNDS != 1. - 6-9 ==> Debugging modes similar to mode - 4: don't try - fast floating-point estimate (if applicable). - - Values of mode other than 0-9 are treated as mode 0. - - Sufficient space is allocated to the return value - to hold the suppressed trailing zeros. - */ - - int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1, - j, j1, k, k0, k_check, leftright, m2, m5, s2, s5, - spec_case, try_quick, half = 0; - Long L; -#ifndef Sudden_Underflow - int denorm; - ULong x; -#endif - Bigint *b, *b1, *delta, *mlo = 0, *mhi = 0, *S; - double ds; - double_u d, d2, eps; - char *s, *s0; -#ifdef Honor_FLT_ROUNDS - int rounding; -#endif -#ifdef SET_INEXACT - int inexact, oldinexact; -#endif - - dval(d) = d_; - -#ifndef MULTIPLE_THREADS - if (dtoa_result) { - freedtoa(dtoa_result); - dtoa_result = 0; - } -#endif - - if (word0(d) & Sign_bit) { - /* set sign for everything, including 0's and NaNs */ - *sign = 1; - word0(d) &= ~Sign_bit; /* clear sign bit */ - } - else - *sign = 0; - -#if defined(IEEE_Arith) + defined(VAX) -#ifdef IEEE_Arith - if ((word0(d) & Exp_mask) == Exp_mask) -#else - if (word0(d) == 0x8000) -#endif - { - /* Infinity or NaN */ - *decpt = 9999; -#ifdef IEEE_Arith - if (!word1(d) && !(word0(d) & 0xfffff)) - return rv_strdup(INFSTR, rve); -#endif - return rv_strdup(NANSTR, rve); - } -#endif -#ifdef IBM - dval(d) += 0; /* normalize */ -#endif - if (!dval(d)) { - *decpt = 1; - return rv_strdup(ZEROSTR, rve); - } - -#ifdef SET_INEXACT - try_quick = oldinexact = get_inexact(); - inexact = 1; -#endif -#ifdef Honor_FLT_ROUNDS - if ((rounding = Flt_Rounds) >= 2) { - if (*sign) - rounding = rounding == 2 ? 0 : 2; - else - if (rounding != 2) - rounding = 0; - } -#endif - - b = d2b(dval(d), &be, &bbits); - if (!b) return NULL; -#ifdef Sudden_Underflow - i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)); -#else - if ((i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1))) != 0) { -#endif - dval(d2) = dval(d); - word0(d2) &= Frac_mask1; - word0(d2) |= Exp_11; -#ifdef IBM - if (j = 11 - hi0bits(word0(d2) & Frac_mask)) - dval(d2) /= 1 << j; -#endif - - /* log(x) ~=~ log(1.5) + (x-1.5)/1.5 - * log10(x) = log(x) / log(10) - * ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10)) - * log10(d) = (i-Bias)*log(2)/log(10) + log10(d2) - * - * This suggests computing an approximation k to log10(d) by - * - * k = (i - Bias)*0.301029995663981 - * + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 ); - * - * We want k to be too large rather than too small. - * The error in the first-order Taylor series approximation - * is in our favor, so we just round up the constant enough - * to compensate for any error in the multiplication of - * (i - Bias) by 0.301029995663981; since |i - Bias| <= 1077, - * and 1077 * 0.30103 * 2^-52 ~=~ 7.2e-14, - * adding 1e-13 to the constant term more than suffices. - * Hence we adjust the constant term to 0.1760912590558. - * (We could get a more accurate k by invoking log10, - * but this is probably not worthwhile.) - */ - - i -= Bias; -#ifdef IBM - i <<= 2; - i += j; -#endif -#ifndef Sudden_Underflow - denorm = 0; - } - else { - /* d is denormalized */ - - i = bbits + be + (Bias + (P-1) - 1); - x = i > 32 ? word0(d) << (64 - i) | word1(d) >> (i - 32) - : word1(d) << (32 - i); - dval(d2) = x; - word0(d2) -= 31*Exp_msk1; /* adjust exponent */ - i -= (Bias + (P-1) - 1) + 1; - denorm = 1; - } -#endif - ds = (dval(d2)-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981; - k = (int)ds; - if (ds < 0. && ds != k) - k--; /* want k = floor(ds) */ - k_check = 1; - if (k >= 0 && k <= Ten_pmax) { - if (dval(d) < tens[k]) - k--; - k_check = 0; - } - j = bbits - i - 1; - if (j >= 0) { - b2 = 0; - s2 = j; - } - else { - b2 = -j; - s2 = 0; - } - if (k >= 0) { - b5 = 0; - s5 = k; - s2 += k; - } - else { - b2 -= k; - b5 = -k; - s5 = 0; - } - if (mode < 0 || mode > 9) - mode = 0; - -#ifndef SET_INEXACT -#ifdef Check_FLT_ROUNDS - try_quick = Rounding == 1; -#else - try_quick = 1; -#endif -#endif /*SET_INEXACT*/ - - if (mode > 5) { - mode -= 4; - try_quick = 0; - } - leftright = 1; - ilim = ilim1 = -1; - switch (mode) { - case 0: - case 1: - i = 18; - ndigits = 0; - break; - case 2: - leftright = 0; - /* no break */ - case 4: - if (ndigits <= 0) - ndigits = 1; - ilim = ilim1 = i = ndigits; - break; - case 3: - leftright = 0; - /* no break */ - case 5: - if (ckd_add(&i, ndigits, k + 1)) { /* k + 1 should be safe */ - Bfree(b); - return NULL; - } - ilim = i; - ilim1 = i - 1; - if (i <= 0) - i = 1; - } - s = s0 = rv_alloc(i+1); - if (!s) { - Bfree(b); - return NULL; - } - -#ifdef Honor_FLT_ROUNDS - if (mode > 1 && rounding != 1) - leftright = 0; -#endif - - if (ilim >= 0 && ilim <= Quick_max && try_quick) { - - /* Try to get by with floating-point arithmetic. */ - - i = 0; - dval(d2) = dval(d); - k0 = k; - ilim0 = ilim; - ieps = 2; /* conservative */ - if (k > 0) { - ds = tens[k&0xf]; - j = k >> 4; - if (j & Bletch) { - /* prevent overflows */ - j &= Bletch - 1; - dval(d) /= bigtens[n_bigtens-1]; - ieps++; - } - for (; j; j >>= 1, i++) - if (j & 1) { - ieps++; - ds *= bigtens[i]; - } - dval(d) /= ds; - } - else if ((j1 = -k) != 0) { - dval(d) *= tens[j1 & 0xf]; - for (j = j1 >> 4; j; j >>= 1, i++) - if (j & 1) { - ieps++; - dval(d) *= bigtens[i]; - } - } - if (k_check && dval(d) < 1. && ilim > 0) { - if (ilim1 <= 0) - goto fast_failed; - ilim = ilim1; - k--; - dval(d) *= 10.; - ieps++; - } - dval(eps) = ieps*dval(d) + 7.; - word0(eps) -= (P-1)*Exp_msk1; - if (ilim == 0) { - S = mhi = 0; - dval(d) -= 5.; - if (dval(d) > dval(eps)) - goto one_digit; - if (dval(d) < -dval(eps)) - goto no_digits; - goto fast_failed; - } -#ifndef No_leftright - if (leftright) { - /* Use Steele & White method of only - * generating digits needed. - */ - dval(eps) = 0.5/tens[ilim-1] - dval(eps); - for (i = 0;;) { - L = (int)dval(d); - dval(d) -= L; - *s++ = '0' + (int)L; - if (dval(d) < dval(eps)) - goto ret1; - if (1. - dval(d) < dval(eps)) - goto bump_up; - if (++i >= ilim) - break; - dval(eps) *= 10.; - dval(d) *= 10.; - } - } - else { -#endif - /* Generate ilim digits, then fix them up. */ - dval(eps) *= tens[ilim-1]; - for (i = 1;; i++, dval(d) *= 10.) { - L = (Long)(dval(d)); - if (!(dval(d) -= L)) - ilim = i; - *s++ = '0' + (int)L; - if (i == ilim) { - if (dval(d) > 0.5 + dval(eps)) - goto bump_up; - else if (dval(d) < 0.5 - dval(eps)) { - while (*--s == '0') ; - s++; - goto ret1; - } - half = 1; - if ((*(s-1) - '0') & 1) { - goto bump_up; - } - break; - } - } -#ifndef No_leftright - } -#endif -fast_failed: - s = s0; - dval(d) = dval(d2); - k = k0; - ilim = ilim0; - } - - /* Do we have a "small" integer? */ - - if (be >= 0 && k <= Int_max) { - /* Yes. */ - ds = tens[k]; - if (ndigits < 0 && ilim <= 0) { - S = mhi = 0; - if (ilim < 0 || dval(d) <= 5*ds) - goto no_digits; - goto one_digit; - } - for (i = 1;; i++, dval(d) *= 10.) { - L = (Long)(dval(d) / ds); - dval(d) -= L*ds; -#ifdef Check_FLT_ROUNDS - /* If FLT_ROUNDS == 2, L will usually be high by 1 */ - if (dval(d) < 0) { - L--; - dval(d) += ds; - } -#endif - *s++ = '0' + (int)L; - if (!dval(d)) { -#ifdef SET_INEXACT - inexact = 0; -#endif - break; - } - if (i == ilim) { -#ifdef Honor_FLT_ROUNDS - if (mode > 1) - switch (rounding) { - case 0: goto ret1; - case 2: goto bump_up; - } -#endif - dval(d) += dval(d); - if (dval(d) > ds || (dval(d) == ds && (L & 1))) { -bump_up: - while (*--s == '9') - if (s == s0) { - k++; - *s = '0'; - break; - } - ++*s++; - } - break; - } - } - goto ret1; - } - - m2 = b2; - m5 = b5; - if (leftright) { - i = -#ifndef Sudden_Underflow - denorm ? be + (Bias + (P-1) - 1 + 1) : -#endif -#ifdef IBM - 1 + 4*P - 3 - bbits + ((bbits + be - 1) & 3); -#else - 1 + P - bbits; -#endif - b2 += i; - s2 += i; - mhi = i2b(1); - if (!mhi) goto nomem; - } - if (m2 > 0 && s2 > 0) { - i = m2 < s2 ? m2 : s2; - b2 -= i; - m2 -= i; - s2 -= i; - } - if (b5 > 0) { - if (leftright) { - if (m5 > 0) { - mhi = pow5mult(mhi, m5); - if (!mhi) goto nomem; - b1 = mult(mhi, b); - Bfree(b); - b = b1; - if (!b) goto nomem; - } - if ((j = b5 - m5) != 0) { - b = pow5mult(b, j); - if (!b) goto nomem; - } - } - else { - b = pow5mult(b, b5); - if (!b) goto nomem; - } - } - S = i2b(1); - if (!S) goto nomem; - if (s5 > 0) { - S = pow5mult(S, s5); - if (!S) goto nomem; - } - - /* Check for special case that d is a normalized power of 2. */ - - spec_case = 0; - if ((mode < 2 || leftright) -#ifdef Honor_FLT_ROUNDS - && rounding == 1 -#endif - ) { - if (!word1(d) && !(word0(d) & Bndry_mask) -#ifndef Sudden_Underflow - && word0(d) & (Exp_mask & ~Exp_msk1) -#endif - ) { - /* The special case */ - b2 += Log2P; - s2 += Log2P; - spec_case = 1; - } - } - - /* Arrange for convenient computation of quotients: - * shift left if necessary so divisor has 4 leading 0 bits. - * - * Perhaps we should just compute leading 28 bits of S once - * and for all and pass them and a shift to quorem, so it - * can do shifts and ors to compute the numerator for q. - */ -#ifdef Pack_32 - if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f) != 0) - i = 32 - i; -#else - if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0xf) != 0) - i = 16 - i; -#endif - if (i > 4) { - i -= 4; - b2 += i; - m2 += i; - s2 += i; - } - else if (i < 4) { - i += 28; - b2 += i; - m2 += i; - s2 += i; - } - if (b2 > 0) { - b = lshift(b, b2); - if (!b) goto nomem; - } - if (s2 > 0) { - S = lshift(S, s2); - if (!S) goto nomem; - } - if (k_check) { - if (cmp(b,S) < 0) { - k--; - b = multadd(b, 10, 0); /* we botched the k estimate */ - if (!b) goto nomem; - if (leftright) { - mhi = multadd(mhi, 10, 0); - if (!mhi) goto nomem; - } - ilim = ilim1; - } - } - if (ilim <= 0 && (mode == 3 || mode == 5)) { - if (ilim < 0 || cmp(b,S = multadd(S,5,0)) <= 0) { - /* no digits, fcvt style */ -no_digits: - k = -1 - ndigits; - goto ret; - } -one_digit: - *s++ = '1'; - k++; - goto ret; - } - if (leftright) { - if (m2 > 0) { - mhi = lshift(mhi, m2); - if (!mhi) goto nomem; - } - - /* Compute mlo -- check for special case - * that d is a normalized power of 2. - */ - - mlo = mhi; - if (spec_case) { - mhi = Balloc(mhi->k); - if (!mhi) goto nomem; - Bcopy(mhi, mlo); - mhi = lshift(mhi, Log2P); - if (!mhi) goto nomem; - } - - for (i = 1;;i++) { - dig = quorem(b,S) + '0'; - /* Do we yet have the shortest decimal string - * that will round to d? - */ - j = cmp(b, mlo); - delta = diff(S, mhi); - if (!delta) goto nomem; - j1 = delta->sign ? 1 : cmp(b, delta); - Bfree(delta); -#ifndef ROUND_BIASED - if (j1 == 0 && mode != 1 && !(word1(d) & 1) -#ifdef Honor_FLT_ROUNDS - && rounding >= 1 -#endif - ) { - if (dig == '9') - goto round_9_up; - if (j > 0) - dig++; -#ifdef SET_INEXACT - else if (!b->x[0] && b->wds <= 1) - inexact = 0; -#endif - *s++ = dig; - goto ret; - } -#endif - if (j < 0 || (j == 0 && mode != 1 -#ifndef ROUND_BIASED - && !(word1(d) & 1) -#endif - )) { - if (!b->x[0] && b->wds <= 1) { -#ifdef SET_INEXACT - inexact = 0; -#endif - goto accept_dig; - } -#ifdef Honor_FLT_ROUNDS - if (mode > 1) - switch (rounding) { - case 0: goto accept_dig; - case 2: goto keep_dig; - } -#endif /*Honor_FLT_ROUNDS*/ - if (j1 > 0) { - b = lshift(b, 1); - if (!b) goto nomem; - j1 = cmp(b, S); - if ((j1 > 0 || (j1 == 0 && (dig & 1))) && dig++ == '9') - goto round_9_up; - } -accept_dig: - *s++ = dig; - goto ret; - } - if (j1 > 0) { -#ifdef Honor_FLT_ROUNDS - if (!rounding) - goto accept_dig; -#endif - if (dig == '9') { /* possible if i == 1 */ -round_9_up: - *s++ = '9'; - goto roundoff; - } - *s++ = dig + 1; - goto ret; - } -#ifdef Honor_FLT_ROUNDS -keep_dig: -#endif - *s++ = dig; - if (i == ilim) - break; - b = multadd(b, 10, 0); - if (!b) goto nomem; - if (mlo == mhi) { - mlo = mhi = multadd(mhi, 10, 0); - if (!mlo) goto nomem; - } - else { - mlo = multadd(mlo, 10, 0); - if (!mlo) goto nomem; - mhi = multadd(mhi, 10, 0); - if (!mhi) goto nomem; - } - } - } - else - for (i = 1;; i++) { - *s++ = dig = quorem(b,S) + '0'; - if (!b->x[0] && b->wds <= 1) { -#ifdef SET_INEXACT - inexact = 0; -#endif - goto ret; - } - if (i >= ilim) - break; - b = multadd(b, 10, 0); - if (!b) goto nomem; - } - - /* Round off last digit */ - -#ifdef Honor_FLT_ROUNDS - switch (rounding) { - case 0: goto trimzeros; - case 2: goto roundoff; - } -#endif - b = lshift(b, 1); - if (!b) goto nomem; - j = cmp(b, S); - if (j > 0 || (j == 0 && (dig & 1))) { - roundoff: - while (*--s == '9') - if (s == s0) { - k++; - *s++ = '1'; - goto ret; - } - if (!half || (*s - '0') & 1) - ++*s; - } - else { - while (*--s == '0') ; - } - s++; -ret: - Bfree(S); - if (mhi) { - if (mlo && mlo != mhi) - Bfree(mlo); - Bfree(mhi); - } -ret1: -#ifdef SET_INEXACT - if (inexact) { - if (!oldinexact) { - word0(d) = Exp_1 + (70 << Exp_shift); - word1(d) = 0; - dval(d) += 1.; - } - } - else if (!oldinexact) - clear_inexact(); -#endif - Bfree(b); - *s = 0; - *decpt = k + 1; - if (rve) - *rve = s; - return s0; - nomem: - if (S) Bfree(S); - if (mhi) { - if (mlo && mlo != mhi) - Bfree(mlo); - Bfree(mhi); - } - if (b) Bfree(b); - FREE(s0); - return NULL; -} - -/*- - * Copyright (c) 2004-2008 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#define DBL_MANH_SIZE 20 -#define DBL_MANL_SIZE 32 -#define DBL_ADJ (DBL_MAX_EXP - 2) -#define SIGFIGS ((DBL_MANT_DIG + 3) / 4 + 1) -#define dexp_get(u) ((int)(word0(u) >> Exp_shift) & ~Exp_msk1) -#define dexp_set(u,v) (word0(u) = (((int)(word0(u)) & ~Exp_mask) | ((v) << Exp_shift))) -#define dmanh_get(u) ((uint32_t)(word0(u) & Frac_mask)) -#define dmanl_get(u) ((uint32_t)word1(u)) - - -/* - * This procedure converts a double-precision number in IEEE format - * into a string of hexadecimal digits and an exponent of 2. Its - * behavior is bug-for-bug compatible with dtoa() in mode 2, with the - * following exceptions: - * - * - An ndigits < 0 causes it to use as many digits as necessary to - * represent the number exactly. - * - The additional xdigs argument should point to either the string - * "0123456789ABCDEF" or the string "0123456789abcdef", depending on - * which case is desired. - * - This routine does not repeat dtoa's mistake of setting decpt - * to 9999 in the case of an infinity or NaN. INT_MAX is used - * for this purpose instead. - * - * Note that the C99 standard does not specify what the leading digit - * should be for non-zero numbers. For instance, 0x1.3p3 is the same - * as 0x2.6p2 is the same as 0x4.cp3. This implementation always makes - * the leading digit a 1. This ensures that the exponent printed is the - * actual base-2 exponent, i.e., ilogb(d). - * - * Inputs: d, xdigs, ndigits - * Outputs: decpt, sign, rve - */ -char * -hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign, char **rve) -{ - U u; - char *s, *s0; - int bufsize; - uint32_t manh, manl; - - u.d = d; - if (word0(u) & Sign_bit) { - /* set sign for everything, including 0's and NaNs */ - *sign = 1; - word0(u) &= ~Sign_bit; /* clear sign bit */ - } - else - *sign = 0; - - if (isinf(d)) { /* FP_INFINITE */ - *decpt = INT_MAX; - return rv_strdup(INFSTR, rve); - } - else if (isnan(d)) { /* FP_NAN */ - *decpt = INT_MAX; - return rv_strdup(NANSTR, rve); - } - else if (d == 0.0) { /* FP_ZERO */ - *decpt = 1; - return rv_strdup(ZEROSTR, rve); - } - else if (dexp_get(u)) { /* FP_NORMAL */ - *decpt = dexp_get(u) - DBL_ADJ; - } - else { /* FP_SUBNORMAL */ - u.d *= 5.363123171977039e+154 /* 0x1p514 */; - *decpt = dexp_get(u) - (514 + DBL_ADJ); - } - - if (ndigits == 0) /* dtoa() compatibility */ - ndigits = 1; - - /* - * If ndigits < 0, we are expected to auto-size, so we allocate - * enough space for all the digits. - */ - bufsize = (ndigits > 0) ? ndigits : SIGFIGS; - s0 = rv_alloc(bufsize+1); - if (!s0) return NULL; - - /* Round to the desired number of digits. */ - if (SIGFIGS > ndigits && ndigits > 0) { - float redux = 1.0f; - int offset = 4 * ndigits + DBL_MAX_EXP - 4 - DBL_MANT_DIG; - dexp_set(u, offset); - u.d += redux; - u.d -= redux; - *decpt += dexp_get(u) - offset; - } - - manh = dmanh_get(u); - manl = dmanl_get(u); - *s0 = '1'; - for (s = s0 + 1; s < s0 + bufsize; s++) { - *s = xdigs[(manh >> (DBL_MANH_SIZE - 4)) & 0xf]; - manh = (manh << 4) | (manl >> (DBL_MANL_SIZE - 4)); - manl <<= 4; - } - - /* If ndigits < 0, we are expected to auto-size the precision. */ - if (ndigits < 0) { - for (ndigits = SIGFIGS; s0[ndigits - 1] == '0'; ndigits--) - ; - } - - s = s0 + ndigits; - *s = '\0'; - if (rve != NULL) - *rve = s; - return (s0); -} - -#ifdef __cplusplus -#if 0 -{ /* satisfy cc-mode */ -#endif -} -#endif diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/ntt.h b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/ntt.h deleted file mode 100644 index bbd8376..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/ntt.h +++ /dev/null @@ -1,191 +0,0 @@ -// NTT (Number Theoretic Transform) implementation for BigDecimal multiplication - -#define NTT_PRIMITIVE_ROOT 17 -#define NTT_PRIME_BASE1 24 -#define NTT_PRIME_BASE2 26 -#define NTT_PRIME_BASE3 29 -#define NTT_PRIME_SHIFT 27 -#define NTT_PRIME1 (((uint32_t)NTT_PRIME_BASE1 << NTT_PRIME_SHIFT) | 1) -#define NTT_PRIME2 (((uint32_t)NTT_PRIME_BASE2 << NTT_PRIME_SHIFT) | 1) -#define NTT_PRIME3 (((uint32_t)NTT_PRIME_BASE3 << NTT_PRIME_SHIFT) | 1) -#define MAX_NTT32_BITS 27 -#define NTT_DECDIG_BASE 1000000000 - -// Calculates base**ex % mod -static uint32_t -mod_pow(uint32_t base, uint32_t ex, uint32_t mod) { - uint32_t res = 1; - uint32_t bit = 1; - while (true) { - if (ex & bit) { - ex ^= bit; - res = ((uint64_t)res * base) % mod; - } - if (!ex) break; - base = ((uint64_t)base * base) % mod; - bit <<= 1; - } - return res; -} - -// Recursively performs butterfly operations of NTT -static void -ntt_recursive(int size_bits, uint32_t *input, uint32_t *output, uint32_t *tmp, int depth, uint32_t r, uint32_t prime) { - if (depth > 0) { - ntt_recursive(size_bits, input, tmp, output, depth - 1, ((uint64_t)r * r) % prime, prime); - } else { - tmp = input; - } - uint32_t size_half = (uint32_t)1 << (size_bits - 1); - uint32_t stride = (uint32_t)1 << (size_bits - depth - 1); - uint32_t n = size_half / stride; - uint32_t rn = 1, rm = prime - 1; - for (uint32_t i = 0; i < n; i++) { - uint32_t *aptr = tmp + i * 2 * stride; - uint32_t *bptr = aptr + stride; - uint32_t *out1 = output + stride * i; - uint32_t *out2 = out1 + size_half; - for (uint32_t k = 0; k < stride; k++) { - uint32_t a = aptr[k], b = bptr[k]; - out1[k] = (a + (uint64_t)rn * b) % prime; - out2[k] = (a + (uint64_t)rm * b) % prime; - } - rn = ((uint64_t)rn * r) % prime; - rm = ((uint64_t)rm * r) % prime; - } -} - -/* Perform NTT on input array. - * base, shift: Represent the prime number as (base << shift | 1) - * r_base: Primitive root of unity modulo prime - * size_bits: log2 of the size of the input array. Should be less or equal to shift - * input: input array of size (1 << size_bits) - */ -static void -ntt(int size_bits, uint32_t *input, uint32_t *output, uint32_t *tmp, int r_base, int base, int shift, int dir) { - uint32_t size = (uint32_t)1 << size_bits; - uint32_t prime = ((uint32_t)base << shift) | 1; - - // rmax**(1 << shift) % prime == 1 - // r**size % prime == 1 - uint32_t rmax = mod_pow((uint32_t)r_base, (uint32_t)base, prime); - uint32_t r = mod_pow(rmax, (uint32_t)1 << (shift - size_bits), prime); - - if (dir < 0) r = mod_pow(r, prime - 2, prime); - ntt_recursive(size_bits, input, output, tmp, size_bits - 1, r, prime); - if (dir < 0) { - uint32_t n_inv = mod_pow((uint32_t)size, prime - 2, prime); - for (uint32_t i = 0; i < size; i++) { - output[i] = ((uint64_t)output[i] * n_inv) % prime; - } - } -} - -/* Calculate c that satisfies: c % PRIME1 == mod1 && c % PRIME2 == mod2 && c % PRIME3 == mod3 - * c = (mod1 * 35002755423056150739595925972 + mod2 * 14584479687667766215746868453 + mod3 * 37919651490985126265126719818) % (PRIME1 * PRIME2 * PRIME3) - * Assume c <= 999999999**2*(1<<27) - */ -static inline void -mod_restore_prime_24_26_29_shift_27(uint32_t mod1, uint32_t mod2, uint32_t mod3, uint32_t *digits) { - // Use mixed radix notation to eliminate modulo by PRIME1 * PRIME2 * PRIME3 - // [DIG0, DIG1, DIG2] = DIG0 + DIG1 * PRIME1 + DIG2 * PRIME1 * PRIME2 - // DIG0: 0...PRIME1, DIG1: 0...PRIME2, DIG2: 0...PRIME3 - // 35002755423056150739595925972 = [1, 3489660916, 3113851359] - // 14584479687667766215746868453 = [0, 13, 1297437912] - // 37919651490985126265126719818 = [0, 0, 3373338954] - uint64_t c0 = mod1; - uint64_t c1 = (uint64_t)mod2 * 13 + (uint64_t)mod1 * 3489660916; - uint64_t c2 = (uint64_t)mod3 * 3373338954 % NTT_PRIME3 + (uint64_t)mod2 * 1297437912 % NTT_PRIME3 + (uint64_t)mod1 * 3113851359 % NTT_PRIME3; - c2 += c1 / NTT_PRIME2; - c1 %= NTT_PRIME2; - c2 %= NTT_PRIME3; - // Base conversion. c fits in 3 digits. - c1 += c2 % NTT_DECDIG_BASE * NTT_PRIME2; - c0 += c1 % NTT_DECDIG_BASE * NTT_PRIME1; - c1 /= NTT_DECDIG_BASE; - digits[0] = c0 % NTT_DECDIG_BASE; - c0 /= NTT_DECDIG_BASE; - c1 += c2 / NTT_DECDIG_BASE % NTT_DECDIG_BASE * NTT_PRIME2; - c0 += c1 % NTT_DECDIG_BASE * NTT_PRIME1; - c1 /= NTT_DECDIG_BASE; - digits[1] = c0 % NTT_DECDIG_BASE; - digits[2] = (uint32_t)(c0 / NTT_DECDIG_BASE + c1 % NTT_DECDIG_BASE * NTT_PRIME1); -} - -/* - * NTT multiplication - * Uses three NTTs with mod (24 << 27 | 1), (26 << 27 | 1), and (29 << 27 | 1) - */ -static void -ntt_multiply(size_t a_size, size_t b_size, uint32_t *a, uint32_t *b, uint32_t *c) { - if (a_size < b_size) { - ntt_multiply(b_size, a_size, b, a, c); - return; - } - - int ntt_size_bits = (int)bit_length(b_size - 1) + 1; - if (ntt_size_bits > MAX_NTT32_BITS) { - rb_raise(rb_eArgError, "Multiply size too large"); - } - - // To calculate large_a * small_b faster, split into several batches. - uint32_t ntt_size = (uint32_t)1 << ntt_size_bits; - uint32_t batch_size = ntt_size - (uint32_t)b_size; - uint32_t batch_count = (uint32_t)((a_size + batch_size - 1) / batch_size); - - uint32_t *mem = ruby_xcalloc(ntt_size * 9, sizeof(uint32_t)); - uint32_t *ntt1 = mem; - uint32_t *ntt2 = mem + ntt_size; - uint32_t *ntt3 = mem + ntt_size * 2; - uint32_t *tmp1 = mem + ntt_size * 3; - uint32_t *tmp2 = mem + ntt_size * 4; - uint32_t *tmp3 = mem + ntt_size * 5; - uint32_t *conv1 = mem + ntt_size * 6; - uint32_t *conv2 = mem + ntt_size * 7; - uint32_t *conv3 = mem + ntt_size * 8; - - // Calculate NTT for b in three primes. Result is reused for each batch of a. - memcpy(tmp1, b, b_size * sizeof(uint32_t)); - memset(tmp1 + b_size, 0, (ntt_size - b_size) * sizeof(uint32_t)); - ntt(ntt_size_bits, tmp1, ntt1, tmp2, NTT_PRIMITIVE_ROOT, NTT_PRIME_BASE1, NTT_PRIME_SHIFT, +1); - ntt(ntt_size_bits, tmp1, ntt2, tmp2, NTT_PRIMITIVE_ROOT, NTT_PRIME_BASE2, NTT_PRIME_SHIFT, +1); - ntt(ntt_size_bits, tmp1, ntt3, tmp2, NTT_PRIMITIVE_ROOT, NTT_PRIME_BASE3, NTT_PRIME_SHIFT, +1); - - memset(c, 0, (a_size + b_size) * sizeof(uint32_t)); - for (uint32_t idx = 0; idx < batch_count; idx++) { - uint32_t len = idx == batch_count - 1 ? (uint32_t)a_size - idx * batch_size : batch_size; - memcpy(tmp1, a + idx * batch_size, len * sizeof(uint32_t)); - memset(tmp1 + len, 0, (ntt_size - len) * sizeof(uint32_t)); - // Calculate convolution for this batch in three primes - ntt(ntt_size_bits, tmp1, tmp2, tmp3, NTT_PRIMITIVE_ROOT, NTT_PRIME_BASE1, NTT_PRIME_SHIFT, +1); - for (uint32_t i = 0; i < ntt_size; i++) tmp2[i] = ((uint64_t)tmp2[i] * ntt1[i]) % NTT_PRIME1; - ntt(ntt_size_bits, tmp2, conv1, tmp3, NTT_PRIMITIVE_ROOT, NTT_PRIME_BASE1, NTT_PRIME_SHIFT, -1); - ntt(ntt_size_bits, tmp1, tmp2, tmp3, NTT_PRIMITIVE_ROOT, NTT_PRIME_BASE2, NTT_PRIME_SHIFT, +1); - for (uint32_t i = 0; i < ntt_size; i++) tmp2[i] = ((uint64_t)tmp2[i] * ntt2[i]) % NTT_PRIME2; - ntt(ntt_size_bits, tmp2, conv2, tmp3, NTT_PRIMITIVE_ROOT, NTT_PRIME_BASE2, NTT_PRIME_SHIFT, -1); - ntt(ntt_size_bits, tmp1, tmp2, tmp3, NTT_PRIMITIVE_ROOT, NTT_PRIME_BASE3, NTT_PRIME_SHIFT, +1); - for (uint32_t i = 0; i < ntt_size; i++) tmp2[i] = ((uint64_t)tmp2[i] * ntt3[i]) % NTT_PRIME3; - ntt(ntt_size_bits, tmp2, conv3, tmp3, NTT_PRIMITIVE_ROOT, NTT_PRIME_BASE3, NTT_PRIME_SHIFT, -1); - - // Restore the original convolution value from three convolutions calculated in three primes. - // Each convolution value is maximum 999999999**2*(1<<27)/2 - for (uint32_t i = 0; i < ntt_size; i++) { - uint32_t dig[3]; - mod_restore_prime_24_26_29_shift_27(conv1[i], conv2[i], conv3[i], dig); - // Maximum values of dig[0], dig[1], and dig[2] are 999999999, 999999999 and 67108863 respectively - // Maximum overlapped sum (considering overlaps between 2 batches) is less than 4134217722 - // so this sum doesn't overflow uint32_t. - for (int j = 0; j < 3; j++) { - // Index check: if dig[j] is non-zero, assign index is within valid range. - if (dig[j]) c[idx * batch_size + i + 1 - (uint32_t)j] += dig[j]; - } - } - } - uint32_t carry = 0; - for (int32_t i = (int32_t)(a_size + b_size - 1); i >= 0; i--) { - uint32_t v = c[i] + carry; - c[i] = v % NTT_DECDIG_BASE; - carry = v / NTT_DECDIG_BASE; - } - ruby_xfree(mem); -} diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/static_assert.h b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/static_assert.h deleted file mode 100644 index 9295729..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/ext/bigdecimal/static_assert.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef BIGDECIMAL_STATIC_ASSERT_H -#define BIGDECIMAL_STATIC_ASSERT_H - -#include "feature.h" - -#ifdef HAVE_RUBY_INTERNAL_STATIC_ASSERT_H -# include -#endif - -#ifdef RBIMPL_STATIC_ASSERT -# define STATIC_ASSERT RBIMPL_STATIC_ASSERT -#endif - -#ifndef STATIC_ASSERT -# /* The following section is copied from CRuby's static_assert.h */ - -# if defined(__cplusplus) && defined(__cpp_static_assert) -# /* https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations */ -# define BIGDECIMAL_STATIC_ASSERT0 static_assert - -# elif defined(__cplusplus) && defined(_MSC_VER) && _MSC_VER >= 1600 -# define BIGDECIMAL_STATIC_ASSERT0 static_assert - -# elif defined(__INTEL_CXX11_MODE__) -# define BIGDECIMAL_STATIC_ASSERT0 static_assert - -# elif defined(__cplusplus) && __cplusplus >= 201103L -# define BIGDECIMAL_STATIC_ASSERT0 static_assert - -# elif defined(__cplusplus) && __has_extension(cxx_static_assert) -# define BIGDECIMAL_STATIC_ASSERT0 __extension__ static_assert - -# elif defined(__STDC_VERSION__) && __has_extension(c_static_assert) -# define BIGDECIMAL_STATIC_ASSERT0 __extension__ _Static_assert - -# elif defined(__STDC_VERSION__) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) -# define BIGDECIMAL_STATIC_ASSERT0 __extension__ _Static_assert -#endif - -# if defined(__DOXYGEN__) -# define STATIC_ASSERT static_assert - -# elif defined(BIGDECIMAL_STATIC_ASSERT0) -# define STATIC_ASSERT(name, expr) \ - BIGDECIMAL_STATIC_ASSERT0(expr, #name ": " #expr) - -# else -# define STATIC_ASSERT(name, expr) \ - typedef int static_assert_ ## name ## _check[1 - 2 * !(expr)] -# endif -#endif /* STATIC_ASSERT */ - - -#endif /* BIGDECIMAL_STATIC_ASSERT_H */ diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal.rb b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal.rb deleted file mode 100644 index 5b492ec..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal.rb +++ /dev/null @@ -1,404 +0,0 @@ -if RUBY_ENGINE == 'jruby' - JRuby::Util.load_ext("org.jruby.ext.bigdecimal.BigDecimalLibrary") - - class BigDecimal - def _decimal_shift(i) # :nodoc: - to_java.move_point_right(i).to_d - end - end -else - require 'bigdecimal.so' -end - -class BigDecimal - module Internal # :nodoc: - # Default extra precision for intermediate calculations - # This value is currently the same as BigDecimal.double_fig, but defined separately for future changes. - EXTRA_PREC = 16 - - # Coerce x to BigDecimal with the specified precision. - # TODO: some methods (example: BigMath.exp) require more precision than specified to coerce. - def self.coerce_to_bigdecimal(x, prec, method_name) # :nodoc: - case x - when BigDecimal - return x - when Integer, Float - return BigDecimal(x, 0) - when Rational - return BigDecimal(x, [prec, 2 * BigDecimal.double_fig].max) - end - raise ArgumentError, "#{x.inspect} can't be coerced into BigDecimal" - end - - def self.coerce_validate_prec(prec, method_name, accept_zero: false) # :nodoc: - unless Integer === prec - original = prec - # Emulate Integer.try_convert for ruby < 3.1 - if prec.respond_to?(:to_int) - prec = prec.to_int - else - raise TypeError, "no implicit conversion of #{original.class} into Integer" - end - raise TypeError, "can't convert #{original.class} to Integer" unless Integer === prec - end - - if accept_zero - raise ArgumentError, "Negative precision for #{method_name}" if prec < 0 - else - raise ArgumentError, "Zero or negative precision for #{method_name}" if prec <= 0 - end - prec - end - - def self.infinity_computation_result # :nodoc: - if BigDecimal.mode(BigDecimal::EXCEPTION_ALL).anybits?(BigDecimal::EXCEPTION_INFINITY) - raise FloatDomainError, "Computation results in 'Infinity'" - end - BigDecimal::INFINITY - end - - def self.underflow_computation_result # :nodoc: - if BigDecimal.mode(BigDecimal::EXCEPTION_ALL).anybits?(BigDecimal::EXCEPTION_UNDERFLOW) - raise FloatDomainError, 'Exponent underflow' - end - BigDecimal(0) - end - - def self.nan_computation_result # :nodoc: - if BigDecimal.mode(BigDecimal::EXCEPTION_ALL).anybits?(BigDecimal::EXCEPTION_NaN) - raise FloatDomainError, "Computation results to 'NaN'" - end - BigDecimal::NAN - end - - # Iteration for Newton's method with increasing precision - def self.newton_loop(prec, initial_precision: BigDecimal.double_fig / 2, safe_margin: 2) # :nodoc: - precs = [] - while prec > initial_precision - precs << prec - prec = (precs.last + 1) / 2 + safe_margin - end - precs.reverse_each do |p| - yield p - end - end - - # Calculates Math.log(x.to_f) considering large or small exponent - def self.float_log(x) # :nodoc: - Math.log(x._decimal_shift(-x.exponent).to_f) + x.exponent * Math.log(10) - end - - # Calculating Taylor series sum using binary splitting method - # Calculates f(x) = (x/d0)*(1+(x/d1)*(1+(x/d2)*(1+(x/d3)*(1+...)))) - # x.n_significant_digits or ds.size must be small to be performant. - def self.taylor_sum_binary_splitting(x, ds, prec) # :nodoc: - fs = ds.map {|d| [0, BigDecimal(d)] } - # fs = [[a0, a1], [b0, b1], [c0, c1], ...] - # f(x) = a0/a1+(x/a1)*(1+b0/b1+(x/b1)*(1+c0/c1+(x/c1)*(1+d0/d1+(x/d1)*(1+...)))) - while fs.size > 1 - # Merge two adjacent fractions - # from: (1 + a0/a1 + x/a1 * (1 + b0/b1 + x/b1 * rest)) - # to: (1 + (a0*b1+x*(b0+b1))/(a1*b1) + (x*x)/(a1*b1) * rest) - xn = xn ? xn.mult(xn, prec) : x - fs = fs.each_slice(2).map do |(a, b)| - b ||= [0, BigDecimal(1)._decimal_shift([xn.exponent, 0].max + 2)] - [ - (a[0] * b[1]).add(xn * (b[0] + b[1]), prec), - a[1].mult(b[1], prec) - ] - end - end - BigDecimal(fs[0][0]).div(fs[0][1], prec) - end - end - - # call-seq: - # self ** other -> bigdecimal - # - # Returns the \BigDecimal value of +self+ raised to power +other+: - # - # b = BigDecimal('3.14') - # b ** 2 # => 0.98596e1 - # b ** 2.0 # => 0.98596e1 - # b ** Rational(2, 1) # => 0.98596e1 - # - # Related: BigDecimal#power. - # - def **(y) - case y - when BigDecimal, Integer, Float, Rational - power(y) - when nil - raise TypeError, 'wrong argument type NilClass' - else - x, y = y.coerce(self) - x**y - end - end - - # call-seq: - # power(n) - # power(n, prec) - # - # Returns the value raised to the power of n. - # - # Also available as the operator **. - # - def power(y, prec = 0) - prec = Internal.coerce_validate_prec(prec, :power, accept_zero: true) - x = self - y = Internal.coerce_to_bigdecimal(y, prec.nonzero? || n_significant_digits, :power) - - return Internal.nan_computation_result if x.nan? || y.nan? - return BigDecimal(1) if y.zero? - - if y.infinite? - if x < 0 - return BigDecimal(0) if x < -1 && y.negative? - return BigDecimal(0) if x > -1 && y.positive? - raise Math::DomainError, 'Result undefined for negative base raised to infinite power' - elsif x < 1 - return y.positive? ? BigDecimal(0) : BigDecimal::Internal.infinity_computation_result - elsif x == 1 - return BigDecimal(1) - else - return y.positive? ? BigDecimal::Internal.infinity_computation_result : BigDecimal(0) - end - end - - if x.infinite? && y < 0 - # Computation result will be +0 or -0. Avoid overflow. - neg = x < 0 && y.frac.zero? && y % 2 == 1 - return neg ? -BigDecimal(0) : BigDecimal(0) - end - - if x.zero? - return BigDecimal(1) if y.zero? - return BigDecimal(0) if y > 0 - if y.frac.zero? && y % 2 == 1 && x.sign == -1 - return -BigDecimal::Internal.infinity_computation_result - else - return BigDecimal::Internal.infinity_computation_result - end - elsif x < 0 - if y.frac.zero? - if y % 2 == 0 - return (-x).power(y, prec) - else - return -(-x).power(y, prec) - end - else - raise Math::DomainError, 'Computation results in complex number' - end - elsif x == 1 - return BigDecimal(1) - end - - limit = BigDecimal.limit - frac_part = y.frac - - if frac_part.zero? && prec.zero? && limit.zero? - # Infinite precision calculation for `x ** int` and `x.power(int)` - int_part = y.fix.to_i - int_part = -int_part if (neg = int_part < 0) - ans = BigDecimal(1) - n = 1 - xn = x - while true - ans *= xn if int_part.allbits?(n) - n <<= 1 - break if n > int_part - xn *= xn - # Detect overflow/underflow before consuming infinite memory - if (xn.exponent.abs - 1) * int_part / n >= 0x7FFFFFFFFFFFFFFF - return ((xn.exponent > 0) ^ neg ? BigDecimal::Internal.infinity_computation_result : BigDecimal(0)) * (int_part.even? || x > 0 ? 1 : -1) - end - end - return neg ? BigDecimal(1) / ans : ans - end - - result_prec = prec.nonzero? || [x.n_significant_digits, y.n_significant_digits, BigDecimal.double_fig].max + BigDecimal.double_fig - result_prec = [result_prec, limit].min if prec.zero? && limit.nonzero? - - prec2 = result_prec + BigDecimal::Internal::EXTRA_PREC - - if y < 0 - inv = x.power(-y, prec2) - return BigDecimal(0) if inv.infinite? - return BigDecimal::Internal.infinity_computation_result if inv.zero? - return BigDecimal(1).div(inv, result_prec) - end - - if frac_part.zero? && y.exponent < Math.log(result_prec) * 5 + 20 - # Use exponentiation by squaring if y is an integer and not too large - pow_prec = prec2 + y.exponent - n = 1 - xn = x - ans = BigDecimal(1) - int_part = y.fix.to_i - while true - ans = ans.mult(xn, pow_prec) if int_part.allbits?(n) - n <<= 1 - break if n > int_part - xn = xn.mult(xn, pow_prec) - end - ans.mult(1, result_prec) - else - if x > 1 && x.finite? - # To calculate exp(z, prec), z needs prec+max(z.exponent, 0) precision if z > 0. - # Estimate (y*log(x)).exponent - logx_exponent = x < 2 ? (x - 1).exponent : Math.log10(x.exponent).round - ylogx_exponent = y.exponent + logx_exponent - prec2 += [ylogx_exponent, 0].max - end - BigMath.exp(BigMath.log(x, prec2).mult(y, prec2), result_prec) - end - end - - # Returns the square root of the value. - # - # Result has at least prec significant digits. - # - def sqrt(prec) - prec = Internal.coerce_validate_prec(prec, :sqrt, accept_zero: true) - return Internal.infinity_computation_result if infinite? == 1 - - raise FloatDomainError, 'sqrt of negative value' if self < 0 - raise FloatDomainError, "sqrt of 'NaN'(Not a Number)" if nan? - return self if zero? - - if prec == 0 - limit = BigDecimal.limit - prec = n_significant_digits + BigDecimal.double_fig - prec = [limit, prec].min if limit.nonzero? - end - - ex = exponent / 2 - x = _decimal_shift(-2 * ex) - y = BigDecimal(Math.sqrt(x.to_f), 0) - Internal.newton_loop(prec + BigDecimal::Internal::EXTRA_PREC) do |p| - y = y.add(x.div(y, p), p).div(2, p) - end - y._decimal_shift(ex).mult(1, prec) - end -end - -# Core BigMath methods for BigDecimal (log, exp) are defined here. -# Other methods (sin, cos, atan) are defined in 'bigdecimal/math.rb'. -module BigMath - module_function - - # call-seq: - # BigMath.log(decimal, numeric) -> BigDecimal - # - # Computes the natural logarithm of +decimal+ to the specified number of - # digits of precision, +numeric+. - # - # If +decimal+ is zero or negative, raises Math::DomainError. - # - # If +decimal+ is positive infinity, returns Infinity. - # - # If +decimal+ is NaN, returns NaN. - # - def log(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :log) - raise Math::DomainError, 'Complex argument for BigMath.log' if Complex === x - - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :log) - return BigDecimal::Internal.nan_computation_result if x.nan? - raise Math::DomainError, 'Negative argument for log' if x < 0 - return -BigDecimal::Internal.infinity_computation_result if x.zero? - return BigDecimal::Internal.infinity_computation_result if x.infinite? - return BigDecimal(0) if x == 1 - - prec2 = prec + BigDecimal::Internal::EXTRA_PREC - - # Reduce x to near 1 - if x > 1.01 || x < 0.99 - # log(x) = log(x/exp(logx_approx)) + logx_approx - logx_approx = BigDecimal(BigDecimal::Internal.float_log(x), 0) - x = x.div(exp(logx_approx, prec2), prec2) - else - logx_approx = BigDecimal(0) - end - - # Solve exp(y) - x = 0 with Newton's method - # Repeat: y -= (exp(y) - x) / exp(y) - y = BigDecimal(BigDecimal::Internal.float_log(x), 0) - exp_additional_prec = [-(x - 1).exponent, 0].max - BigDecimal::Internal.newton_loop(prec2) do |p| - expy = exp(y, p + exp_additional_prec) - y = y.sub(expy.sub(x, p).div(expy, p), p) - end - y.add(logx_approx, prec) - end - - private_class_method def _exp_binary_splitting(x, prec) # :nodoc: - return BigDecimal(1) if x.zero? - # Find k that satisfies x**k / k! < 10**(-prec) - log10 = Math.log(10) - logx = BigDecimal::Internal.float_log(x.abs) - step = (1..).bsearch { |k| Math.lgamma(k + 1)[0] - k * logx > prec * log10 } - # exp(x)-1 = x*(1+x/2*(1+x/3*(1+x/4*(1+x/5*(1+...))))) - 1 + BigDecimal::Internal.taylor_sum_binary_splitting(x, [*1..step], prec) - end - - # call-seq: - # BigMath.exp(decimal, numeric) -> BigDecimal - # - # Computes the value of e (the base of natural logarithms) raised to the - # power of +decimal+, to the specified number of digits of precision. - # - # If +decimal+ is infinity, returns Infinity. - # - # If +decimal+ is NaN, returns NaN. - # - def exp(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :exp) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :exp) - return BigDecimal::Internal.nan_computation_result if x.nan? - if x.infinite? || x.exponent >= 21 # exp(10**20) and exp(-10**20) overflows/underflows 64-bit exponent - if x.positive? - return BigDecimal::Internal.infinity_computation_result - elsif x.infinite? - # exp(-Infinity) is +0 by definition, this is not an underflow. - return BigDecimal(0) - else - return BigDecimal::Internal.underflow_computation_result - end - end - - return BigDecimal(1) if x.zero? - - # exp(x * 10**cnt) = exp(x)**(10**cnt) - cnt = x < -1 || x > 1 ? x.exponent : 0 - prec2 = prec + BigDecimal::Internal::EXTRA_PREC + cnt - x = x._decimal_shift(-cnt) - - # Decimal form of bit-burst algorithm - # Calculate exp(x.xxxxxxxxxxxxxxxx) as - # exp(x.xx) * exp(0.00xx) * exp(0.0000xxxx) * exp(0.00000000xxxxxxxx) - x = x.mult(1, prec2) - n = 2 - y = BigDecimal(1) - BigDecimal.save_limit do - BigDecimal.limit(0) - while x != 0 do - partial_x = x.truncate(n) - x -= partial_x - y = y.mult(_exp_binary_splitting(partial_x, prec2), prec2) - n *= 2 - end - end - - # calculate exp(x * 10**cnt) from exp(x) - # exp(x * 10**k) = exp(x * 10**(k - 1)) ** 10 - cnt.times do - y2 = y.mult(y, prec2) - y5 = y2.mult(y2, prec2).mult(y, prec2) - y = y5.mult(y5, prec2) - end - - y.mult(1, prec) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal.so b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal.so deleted file mode 100755 index df5f4ae..0000000 Binary files a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal.so and /dev/null differ diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/jacobian.rb b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/jacobian.rb deleted file mode 100644 index 9a5e5be..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/jacobian.rb +++ /dev/null @@ -1,92 +0,0 @@ -# frozen_string_literal: false - -require 'bigdecimal' - -warn "'bigdecimal/jacobian' is deprecated and will be removed in a future release." - -# require 'bigdecimal/jacobian' -# -# Provides methods to compute the Jacobian matrix of a set of equations at a -# point x. In the methods below: -# -# f is an Object which is used to compute the Jacobian matrix of the equations. -# It must provide the following methods: -# -# f.values(x):: returns the values of all functions at x -# -# f.zero:: returns 0.0 -# f.one:: returns 1.0 -# f.two:: returns 2.0 -# f.ten:: returns 10.0 -# -# f.eps:: returns the convergence criterion (epsilon value) used to determine whether two values are considered equal. If |a-b| < epsilon, the two values are considered equal. -# -# x is the point at which to compute the Jacobian. -# -# fx is f.values(x). -# -module Jacobian - module_function - - # Determines the equality of two numbers by comparing to zero, or using the epsilon value - def isEqual(a,b,zero=0.0,e=1.0e-8) - aa = a.abs - bb = b.abs - if aa == zero && bb == zero then - true - else - if ((a-b)/(aa+bb)).abs < e then - true - else - false - end - end - end - - - # Computes the derivative of +f[i]+ at +x[i]+. - # +fx+ is the value of +f+ at +x+. - def dfdxi(f,fx,x,i) - nRetry = 0 - n = x.size - xSave = x[i] - ok = 0 - ratio = f.ten*f.ten*f.ten - dx = x[i].abs/ratio - dx = fx[i].abs/ratio if isEqual(dx,f.zero,f.zero,f.eps) - dx = f.one/f.ten if isEqual(dx,f.zero,f.zero,f.eps) - until ok>0 do - deriv = [] - nRetry += 1 - if nRetry > 100 - raise "Singular Jacobian matrix. No change at x[" + i.to_s + "]" - end - dx = dx*f.two - x[i] += dx - fxNew = f.values(x) - for j in 0...n do - if !isEqual(fxNew[j],fx[j],f.zero,f.eps) then - ok += 1 - deriv <<= (fxNew[j]-fx[j])/dx - else - deriv <<= f.zero - end - end - x[i] = xSave - end - deriv - end - - # Computes the Jacobian of +f+ at +x+. +fx+ is the value of +f+ at +x+. - def jacobian(f,fx,x) - n = x.size - dfdx = Array.new(n*n) - for i in 0...n do - df = dfdxi(f,fx,x,i) - for j in 0...n do - dfdx[j*n+i] = df[j] - end - end - dfdx - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/ludcmp.rb b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/ludcmp.rb deleted file mode 100644 index d112fc1..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/ludcmp.rb +++ /dev/null @@ -1,91 +0,0 @@ -# frozen_string_literal: false -require 'bigdecimal' - -warn "'bigdecimal/ludcmp' is deprecated and will be removed in a future release." - -# -# Solves a*x = b for x, using LU decomposition. -# -module LUSolve - module_function - - # Performs LU decomposition of the n by n matrix a. - def ludecomp(a,n,zero=0,one=1) - prec = BigDecimal.limit(nil) - ps = [] - scales = [] - for i in 0...n do # pick up largest(abs. val.) element in each row. - ps <<= i - nrmrow = zero - ixn = i*n - for j in 0...n do - biggst = a[ixn+j].abs - nrmrow = biggst if biggst>nrmrow - end - if nrmrow>zero then - scales <<= one.div(nrmrow,prec) - else - raise "Singular matrix" - end - end - n1 = n - 1 - for k in 0...n1 do # Gaussian elimination with partial pivoting. - biggst = zero; - for i in k...n do - size = a[ps[i]*n+k].abs*scales[ps[i]] - if size>biggst then - biggst = size - pividx = i - end - end - raise "Singular matrix" if biggst<=zero - if pividx!=k then - j = ps[k] - ps[k] = ps[pividx] - ps[pividx] = j - end - pivot = a[ps[k]*n+k] - for i in (k+1)...n do - psin = ps[i]*n - a[psin+k] = mult = a[psin+k].div(pivot,prec) - if mult!=zero then - pskn = ps[k]*n - for j in (k+1)...n do - a[psin+j] -= mult.mult(a[pskn+j],prec) - end - end - end - end - raise "Singular matrix" if a[ps[n1]*n+n1] == zero - ps - end - - # Solves a*x = b for x, using LU decomposition. - # - # a is a matrix, b is a constant vector, x is the solution vector. - # - # ps is the pivot, a vector which indicates the permutation of rows performed - # during LU decomposition. - def lusolve(a,b,ps,zero=0.0) - prec = BigDecimal.limit(nil) - n = ps.size - x = [] - for i in 0...n do - dot = zero - psin = ps[i]*n - for j in 0...i do - dot = a[psin+j].mult(x[j],prec) + dot - end - x <<= b[ps[i]] - dot - end - (n-1).downto(0) do |i| - dot = zero - psin = ps[i]*n - for j in (i+1)...n do - dot = a[psin+j].mult(x[j],prec) + dot - end - x[i] = (x[i]-dot).div(a[psin+i],prec) - end - x - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/math.rb b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/math.rb deleted file mode 100644 index af7fb2c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/math.rb +++ /dev/null @@ -1,716 +0,0 @@ -# frozen_string_literal: true -require 'bigdecimal' - -# -#-- -# Contents: -# sqrt(x, prec) -# cbrt(x, prec) -# hypot(x, y, prec) -# sin (x, prec) -# cos (x, prec) -# tan (x, prec) -# asin(x, prec) -# acos(x, prec) -# atan(x, prec) -# atan2(y, x, prec) -# sinh (x, prec) -# cosh (x, prec) -# tanh (x, prec) -# asinh(x, prec) -# acosh(x, prec) -# atanh(x, prec) -# log2 (x, prec) -# log10(x, prec) -# log1p(x, prec) -# expm1(x, prec) -# erf (x, prec) -# erfc(x, prec) -# gamma(x, prec) -# lgamma(x, prec) -# frexp(x) -# ldexp(x, exponent) -# PI (prec) -# E (prec) == exp(1.0,prec) -# -# where: -# x, y ... BigDecimal number to be computed. -# prec ... Number of digits to be obtained. -#++ -# -# Provides mathematical functions. -# -# Example: -# -# require "bigdecimal/math" -# -# include BigMath -# -# a = BigDecimal((PI(49)/2).to_s) -# puts sin(a,100) # => 0.9999999999...9999999986e0 -# -module BigMath - module_function - - # call-seq: - # sqrt(decimal, numeric) -> BigDecimal - # - # Computes the square root of +decimal+ to the specified number of digits of - # precision, +numeric+. - # - # BigMath.sqrt(BigDecimal('2'), 32).to_s - # #=> "0.14142135623730950488016887242097e1" - # - def sqrt(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :sqrt) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :sqrt) - x.sqrt(prec) - end - - - # Returns [sign, reduced_x] where reduced_x is in -pi/2..pi/2 - # and satisfies sin(x) = sign * sin(reduced_x) - # If add_half_pi is true, adds pi/2 to x before reduction. - # Precision of pi is adjusted to ensure reduced_x has the required precision. - private_class_method def _sin_periodic_reduction(x, prec, add_half_pi: false) # :nodoc: - return [1, x] if -Math::PI/2 <= x && x <= Math::PI/2 && !add_half_pi - - mod_prec = prec + BigDecimal::Internal::EXTRA_PREC - pi_extra_prec = [x.exponent, 0].max + BigDecimal::Internal::EXTRA_PREC - while true - pi = PI(mod_prec + pi_extra_prec) - half_pi = pi / 2 - div, mod = (add_half_pi ? x + pi : x + half_pi).divmod(pi) - mod -= half_pi - if mod.zero? || mod_prec + mod.exponent <= 0 - # mod is too small to estimate required pi precision - mod_prec = mod_prec * 3 / 2 + BigDecimal::Internal::EXTRA_PREC - elsif mod_prec + mod.exponent < prec - # Estimate required precision of pi - mod_prec = prec - mod.exponent + BigDecimal::Internal::EXTRA_PREC - else - return [div % 2 == 0 ? 1 : -1, mod.mult(1, prec)] - end - end - end - - private_class_method def _sin_binary_splitting(x, prec) # :nodoc: - return x if x.zero? - x2 = x.mult(x, prec) - # Find k that satisfies x2**k / (2k+1)! < 10**(-prec) - log10 = Math.log(10) - logx = BigDecimal::Internal.float_log(x.abs) - step = (1..).bsearch { |k| Math.lgamma(2 * k + 1)[0] - 2 * k * logx > prec * log10 } - # Construct denominator sequence for binary splitting - # sin(x) = x*(1-x2/(2*3)*(1-x2/(4*5)*(1-x2/(6*7)*(1-x2/(8*9)*(1-...))))) - ds = (1..step).map {|i| -(2 * i) * (2 * i + 1) } - x.mult(1 + BigDecimal::Internal.taylor_sum_binary_splitting(x2, ds, prec), prec) - end - - private_class_method def _sin_around_zero(x, prec) # :nodoc: - # Divide x into several parts - # sin(x.xxxxxxxx...) = sin(x.xx + 0.00xx + 0.0000xxxx + ...) - # Calculate sin of each part and restore sin(0.xxxxxxxx...) using addition theorem. - sin = BigDecimal(0) - cos = BigDecimal(1) - n = 2 - while x != 0 do - partial_x = x.truncate(n) - x -= partial_x - s = _sin_binary_splitting(partial_x, prec) - c = (1 - s * s).sqrt(prec) - sin, cos = (sin * c).add(cos * s, prec), (cos * c).sub(sin * s, prec) - n *= 2 - end - sin.clamp(BigDecimal(-1), BigDecimal(1)) - end - - # call-seq: - # cbrt(decimal, numeric) -> BigDecimal - # - # Computes the cube root of +decimal+ to the specified number of digits of - # precision, +numeric+. - # - # BigMath.cbrt(BigDecimal('2'), 32).to_s - # #=> "0.12599210498948731647672106072782e1" - # - def cbrt(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :cbrt) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :cbrt) - return BigDecimal::Internal.nan_computation_result if x.nan? - return BigDecimal::Internal.infinity_computation_result * x.infinite? if x.infinite? - return BigDecimal(0) if x.zero? - - x = -x if neg = x < 0 - ex = x.exponent / 3 - x = x._decimal_shift(-3 * ex) - y = BigDecimal(Math.cbrt(x.to_f), 0) - BigDecimal::Internal.newton_loop(prec + BigDecimal::Internal::EXTRA_PREC) do |p| - y = (2 * y + x.div(y, p).div(y, p)).div(3, p) - end - y._decimal_shift(ex).mult(neg ? -1 : 1, prec) - end - - # call-seq: - # hypot(x, y, numeric) -> BigDecimal - # - # Returns sqrt(x**2 + y**2) to the specified number of digits of - # precision, +numeric+. - # - # BigMath.hypot(BigDecimal('1'), BigDecimal('2'), 32).to_s - # #=> "0.22360679774997896964091736687313e1" - # - def hypot(x, y, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :hypot) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :hypot) - y = BigDecimal::Internal.coerce_to_bigdecimal(y, prec, :hypot) - return BigDecimal::Internal.nan_computation_result if x.nan? || y.nan? - return BigDecimal::Internal.infinity_computation_result if x.infinite? || y.infinite? - prec2 = prec + BigDecimal::Internal::EXTRA_PREC - sqrt(x.mult(x, prec2) + y.mult(y, prec2), prec) - end - - # call-seq: - # sin(decimal, numeric) -> BigDecimal - # - # Computes the sine of +decimal+ to the specified number of digits of - # precision, +numeric+. - # - # If +decimal+ is Infinity or NaN, returns NaN. - # - # BigMath.sin(BigMath.PI(5)/4, 32).to_s - # #=> "0.70710807985947359435812921837984e0" - # - def sin(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :sin) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :sin) - return BigDecimal::Internal.nan_computation_result if x.infinite? || x.nan? - n = prec + BigDecimal::Internal::EXTRA_PREC - sign, x = _sin_periodic_reduction(x, n) - _sin_around_zero(x, n).mult(sign, prec) - end - - # call-seq: - # cos(decimal, numeric) -> BigDecimal - # - # Computes the cosine of +decimal+ to the specified number of digits of - # precision, +numeric+. - # - # If +decimal+ is Infinity or NaN, returns NaN. - # - # BigMath.cos(BigMath.PI(16), 32).to_s - # #=> "-0.99999999999999999999999999999997e0" - # - def cos(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :cos) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :cos) - return BigDecimal::Internal.nan_computation_result if x.infinite? || x.nan? - n = prec + BigDecimal::Internal::EXTRA_PREC - sign, x = _sin_periodic_reduction(x, n, add_half_pi: true) - _sin_around_zero(x, n).mult(sign, prec) - end - - # call-seq: - # tan(decimal, numeric) -> BigDecimal - # - # Computes the tangent of +decimal+ to the specified number of digits of - # precision, +numeric+. - # - # If +decimal+ is Infinity or NaN, returns NaN. - # - # BigMath.tan(BigDecimal("0.0"), 4).to_s - # #=> "0.0" - # - # BigMath.tan(BigMath.PI(24) / 4, 32).to_s - # #=> "0.99999999999999999999999830836025e0" - # - def tan(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :tan) - prec2 = prec + BigDecimal::Internal::EXTRA_PREC - sin(x, prec2).div(cos(x, prec2), prec) - end - - # call-seq: - # asin(decimal, numeric) -> BigDecimal - # - # Computes the arcsine of +decimal+ to the specified number of digits of - # precision, +numeric+. - # - # If +decimal+ is NaN, returns NaN. - # - # BigMath.asin(BigDecimal('0.5'), 32).to_s - # #=> "0.52359877559829887307710723054658e0" - # - def asin(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :asin) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :asin) - raise Math::DomainError, "Out of domain argument for asin" if x < -1 || x > 1 - return BigDecimal::Internal.nan_computation_result if x.nan? - - prec2 = prec + BigDecimal::Internal::EXTRA_PREC - cos = (1 - x**2).sqrt(prec2) - if cos.zero? - PI(prec2).div(x > 0 ? 2 : -2, prec) - else - atan(x.div(cos, prec2), prec) - end - end - - # call-seq: - # acos(decimal, numeric) -> BigDecimal - # - # Computes the arccosine of +decimal+ to the specified number of digits of - # precision, +numeric+. - # - # If +decimal+ is NaN, returns NaN. - # - # BigMath.acos(BigDecimal('0.5'), 32).to_s - # #=> "0.10471975511965977461542144610932e1" - # - def acos(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :acos) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :acos) - raise Math::DomainError, "Out of domain argument for acos" if x < -1 || x > 1 - return BigDecimal::Internal.nan_computation_result if x.nan? - - prec2 = prec + BigDecimal::Internal::EXTRA_PREC - return (PI(prec2) / 2).sub(asin(x, prec2), prec) if x < 0 - return PI(prec2).div(2, prec) if x.zero? - - sin = (1 - x**2).sqrt(prec2) - atan(sin.div(x, prec2), prec) - end - - # call-seq: - # atan(decimal, numeric) -> BigDecimal - # - # Computes the arctangent of +decimal+ to the specified number of digits of - # precision, +numeric+. - # - # If +decimal+ is NaN, returns NaN. - # - # BigMath.atan(BigDecimal('-1'), 32).to_s - # #=> "-0.78539816339744830961566084581988e0" - # - def atan(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :atan) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :atan) - return BigDecimal::Internal.nan_computation_result if x.nan? - n = prec + BigDecimal::Internal::EXTRA_PREC - return PI(n).div(2 * x.infinite?, prec) if x.infinite? - - x = -x if neg = x < 0 - x = BigDecimal(1).div(x, n) if inv = x < -1 || x > 1 - - # Solve tan(y) - x = 0 with Newton's method - # Repeat: y -= (tan(y) - x) * cos(y)**2 - y = BigDecimal(Math.atan(x.to_f), 0) - BigDecimal::Internal.newton_loop(n) do |p| - s = sin(y, p) - c = (1 - s * s).sqrt(p) - y = y.sub(c * (s.sub(c * x.mult(1, p), p)), p) - end - y = PI(n) / 2 - y if inv - y.mult(neg ? -1 : 1, prec) - end - - # call-seq: - # atan2(decimal, decimal, numeric) -> BigDecimal - # - # Computes the arctangent of y and x to the specified number of digits of - # precision, +numeric+. - # - # BigMath.atan2(BigDecimal('-1'), BigDecimal('1'), 32).to_s - # #=> "-0.78539816339744830961566084581988e0" - # - def atan2(y, x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :atan2) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :atan2) - y = BigDecimal::Internal.coerce_to_bigdecimal(y, prec, :atan2) - return BigDecimal::Internal.nan_computation_result if x.nan? || y.nan? - - if x.infinite? || y.infinite? - one = BigDecimal(1) - zero = BigDecimal(0) - x = x.infinite? ? (x > 0 ? one : -one) : zero - y = y.infinite? ? (y > 0 ? one : -one) : y.sign * zero - end - - return x.sign >= 0 ? BigDecimal(0) : y.sign * PI(prec) if y.zero? - - y = -y if neg = y < 0 - xlarge = y.abs < x.abs - prec2 = prec + BigDecimal::Internal::EXTRA_PREC - if x > 0 - v = xlarge ? atan(y.div(x, prec2), prec) : PI(prec2) / 2 - atan(x.div(y, prec2), prec2) - else - v = xlarge ? PI(prec2) - atan(-y.div(x, prec2), prec2) : PI(prec2) / 2 + atan(x.div(-y, prec2), prec2) - end - v.mult(neg ? -1 : 1, prec) - end - - # call-seq: - # sinh(decimal, numeric) -> BigDecimal - # - # Computes the hyperbolic sine of +decimal+ to the specified number of digits of - # precision, +numeric+. - # - # If +decimal+ is NaN, returns NaN. - # - # BigMath.sinh(BigDecimal('1'), 32).to_s - # #=> "0.11752011936438014568823818505956e1" - # - def sinh(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :sinh) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :sinh) - return BigDecimal::Internal.nan_computation_result if x.nan? - return BigDecimal::Internal.infinity_computation_result * x.infinite? if x.infinite? - - prec2 = prec + BigDecimal::Internal::EXTRA_PREC - prec2 -= x.exponent if x.exponent < 0 - e = exp(x, prec2) - (e - BigDecimal(1).div(e, prec2)).div(2, prec) - end - - # call-seq: - # cosh(decimal, numeric) -> BigDecimal - # - # Computes the hyperbolic cosine of +decimal+ to the specified number of digits of - # precision, +numeric+. - # - # If +decimal+ is NaN, returns NaN. - # - # BigMath.cosh(BigDecimal('1'), 32).to_s - # #=> "0.15430806348152437784779056207571e1" - # - def cosh(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :cosh) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :cosh) - return BigDecimal::Internal.nan_computation_result if x.nan? - return BigDecimal::Internal.infinity_computation_result if x.infinite? - - prec2 = prec + BigDecimal::Internal::EXTRA_PREC - e = exp(x, prec2) - (e + BigDecimal(1).div(e, prec2)).div(2, prec) - end - - # call-seq: - # tanh(decimal, numeric) -> BigDecimal - # - # Computes the hyperbolic tangent of +decimal+ to the specified number of digits of - # precision, +numeric+. - # - # If +decimal+ is NaN, returns NaN. - # - # BigMath.tanh(BigDecimal('1'), 32).to_s - # #=> "0.76159415595576488811945828260479e0" - # - def tanh(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :tanh) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :tanh) - return BigDecimal::Internal.nan_computation_result if x.nan? - return BigDecimal(x.infinite?) if x.infinite? - - prec2 = prec + BigDecimal::Internal::EXTRA_PREC + [-x.exponent, 0].max - e = exp(x, prec2) - einv = BigDecimal(1).div(e, prec2) - (e - einv).div(e + einv, prec) - end - - # call-seq: - # asinh(decimal, numeric) -> BigDecimal - # - # Computes the inverse hyperbolic sine of +decimal+ to the specified number of digits of - # precision, +numeric+. - # - # If +decimal+ is NaN, returns NaN. - # - # BigMath.asinh(BigDecimal('1'), 32).to_s - # #=> "0.88137358701954302523260932497979e0" - # - def asinh(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :asinh) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :asinh) - return BigDecimal::Internal.nan_computation_result if x.nan? - return BigDecimal::Internal.infinity_computation_result * x.infinite? if x.infinite? - return -asinh(-x, prec) if x < 0 - - sqrt_prec = prec + [-x.exponent, 0].max + BigDecimal::Internal::EXTRA_PREC - log(x + sqrt(x**2 + 1, sqrt_prec), prec) - end - - # call-seq: - # acosh(decimal, numeric) -> BigDecimal - # - # Computes the inverse hyperbolic cosine of +decimal+ to the specified number of digits of - # precision, +numeric+. - # - # If +decimal+ is NaN, returns NaN. - # - # BigMath.acosh(BigDecimal('2'), 32).to_s - # #=> "0.1316957896924816708625046347308e1" - # - def acosh(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :acosh) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :acosh) - raise Math::DomainError, "Out of domain argument for acosh" if x < 1 - return BigDecimal::Internal.infinity_computation_result if x.infinite? - return BigDecimal::Internal.nan_computation_result if x.nan? - - log(x + sqrt(x**2 - 1, prec + BigDecimal::Internal::EXTRA_PREC), prec) - end - - # call-seq: - # atanh(decimal, numeric) -> BigDecimal - # - # Computes the inverse hyperbolic tangent of +decimal+ to the specified number of digits of - # precision, +numeric+. - # - # If +decimal+ is NaN, returns NaN. - # - # BigMath.atanh(BigDecimal('0.5'), 32).to_s - # #=> "0.54930614433405484569762261846126e0" - # - def atanh(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :atanh) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :atanh) - raise Math::DomainError, "Out of domain argument for atanh" if x < -1 || x > 1 - return BigDecimal::Internal.nan_computation_result if x.nan? - return BigDecimal::Internal.infinity_computation_result if x == 1 - return -BigDecimal::Internal.infinity_computation_result if x == -1 - - prec2 = prec + BigDecimal::Internal::EXTRA_PREC - (log(x + 1, prec2) - log(1 - x, prec2)).div(2, prec) - end - - # call-seq: - # BigMath.log2(decimal, numeric) -> BigDecimal - # - # Computes the base 2 logarithm of +decimal+ to the specified number of - # digits of precision, +numeric+. - # - # If +decimal+ is zero or negative, raises Math::DomainError. - # - # If +decimal+ is positive infinity, returns Infinity. - # - # If +decimal+ is NaN, returns NaN. - # - # BigMath.log2(BigDecimal('3'), 32).to_s - # #=> "0.15849625007211561814537389439478e1" - # - def log2(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :log2) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :log2) - return BigDecimal::Internal.nan_computation_result if x.nan? - return BigDecimal::Internal.infinity_computation_result if x.infinite? == 1 - - prec2 = prec + BigDecimal::Internal::EXTRA_PREC * 3 / 2 - v = log(x, prec2).div(log(BigDecimal(2), prec2), prec2) - # Perform half-up rounding to calculate log2(2**n)==n correctly in every rounding mode - v = v.round(prec + BigDecimal::Internal::EXTRA_PREC - (v.exponent < 0 ? v.exponent : 0), BigDecimal::ROUND_HALF_UP) - v.mult(1, prec) - end - - # call-seq: - # BigMath.log10(decimal, numeric) -> BigDecimal - # - # Computes the base 10 logarithm of +decimal+ to the specified number of - # digits of precision, +numeric+. - # - # If +decimal+ is zero or negative, raises Math::DomainError. - # - # If +decimal+ is positive infinity, returns Infinity. - # - # If +decimal+ is NaN, returns NaN. - # - # BigMath.log10(BigDecimal('3'), 32).to_s - # #=> "0.47712125471966243729502790325512e0" - # - def log10(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :log10) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :log10) - return BigDecimal::Internal.nan_computation_result if x.nan? - return BigDecimal::Internal.infinity_computation_result if x.infinite? == 1 - - prec2 = prec + BigDecimal::Internal::EXTRA_PREC * 3 / 2 - v = log(x, prec2).div(log(BigDecimal(10), prec2), prec2) - # Perform half-up rounding to calculate log10(10**n)==n correctly in every rounding mode - v = v.round(prec + BigDecimal::Internal::EXTRA_PREC - (v.exponent < 0 ? v.exponent : 0), BigDecimal::ROUND_HALF_UP) - v.mult(1, prec) - end - - # call-seq: - # BigMath.log1p(decimal, numeric) -> BigDecimal - # - # Computes log(1 + decimal) to the specified number of digits of precision, +numeric+. - # - # BigMath.log1p(BigDecimal('0.1'), 32).to_s - # #=> "0.95310179804324860043952123280765e-1" - # - def log1p(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :log1p) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :log1p) - raise Math::DomainError, 'Out of domain argument for log1p' if x < -1 - - return log(x + 1, prec) - end - - # call-seq: - # BigMath.expm1(decimal, numeric) -> BigDecimal - # - # Computes exp(decimal) - 1 to the specified number of digits of precision, +numeric+. - # - # BigMath.expm1(BigDecimal('0.1'), 32).to_s - # #=> "0.10517091807564762481170782649025e0" - # - def expm1(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :expm1) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :expm1) - return BigDecimal(-1) if x.infinite? == -1 - - exp_prec = prec - if x < -1 - # log10(exp(x)) = x * log10(e) - lg_e = 0.4342944819032518 - exp_prec = prec + (lg_e * x).ceil + BigDecimal::Internal::EXTRA_PREC - elsif x < 1 - exp_prec = prec - x.exponent + BigDecimal::Internal::EXTRA_PREC - else - exp_prec = prec - end - - return BigDecimal(-1) if exp_prec <= 0 - - exp(x, exp_prec).sub(1, prec) - end - - # call-seq: - # erf(decimal, numeric) -> BigDecimal - # - # Computes the error function of +decimal+ to the specified number of digits of - # precision, +numeric+. - # - # If +decimal+ is NaN, returns NaN. - # - # BigMath.erf(BigDecimal('1'), 32).to_s - # #=> "0.84270079294971486934122063508261e0" - # - def erf(x, prec) - require 'bigdecimal/math/erf' - Erf.erf(x, prec) - end - - # call-seq: - # erfc(decimal, numeric) -> BigDecimal - # - # Computes the complementary error function of +decimal+ to the specified number of digits of - # precision, +numeric+. - # - # If +decimal+ is NaN, returns NaN. - # - # BigMath.erfc(BigDecimal('10'), 32).to_s - # #=> "0.20884875837625447570007862949578e-44" - # - def erfc(x, prec) - require 'bigdecimal/math/erf' - Erf.erfc(x, prec) - end - - # call-seq: - # BigMath.gamma(decimal, numeric) -> BigDecimal - # - # Computes the gamma function of +decimal+ to the specified number of - # digits of precision, +numeric+. - # - # BigMath.gamma(BigDecimal('0.5'), 32).to_s - # #=> "0.17724538509055160272981674833411e1" - # - def gamma(x, prec) - require 'bigdecimal/math/gamma' - Gamma.gamma(x, prec) - end - - # call-seq: - # BigMath.lgamma(decimal, numeric) -> [BigDecimal, Integer] - # - # Computes the natural logarithm of the absolute value of the gamma function - # of +decimal+ to the specified number of digits of precision, +numeric+ and its sign. - # - # BigMath.lgamma(BigDecimal('0.5'), 32) - # #=> [0.57236494292470008707171367567653e0, 1] - # - def lgamma(x, prec) - require 'bigdecimal/math/gamma' - Gamma.lgamma(x, prec) - end - - # call-seq: - # frexp(x) -> [BigDecimal, Integer] - # - # Decomposes +x+ into a normalized fraction and an integral power of ten. - # - # BigMath.frexp(BigDecimal(123.456)) - # #=> [0.123456e0, 3] - # - def frexp(x) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, 0, :frexp) - return [x, 0] unless x.finite? - - exponent = x.exponent - [x._decimal_shift(-exponent), exponent] - end - - # call-seq: - # ldexp(fraction, exponent) -> BigDecimal - # - # Inverse of +frexp+. - # Returns the value of fraction * 10**exponent. - # - # BigMath.ldexp(BigDecimal("0.123456e0"), 3) - # #=> 0.123456e3 - # - def ldexp(x, exponent) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, 0, :ldexp) - x.finite? ? x._decimal_shift(exponent) : x - end - - # call-seq: - # PI(numeric) -> BigDecimal - # - # Computes the value of pi to the specified number of digits of precision, - # +numeric+. - # - # BigMath.PI(32).to_s - # #=> "0.31415926535897932384626433832795e1" - # - def PI(prec) - # Gauss–Legendre algorithm - prec = BigDecimal::Internal.coerce_validate_prec(prec, :PI) - n = prec + BigDecimal::Internal::EXTRA_PREC - a = BigDecimal(1) - b = BigDecimal(0.5, 0).sqrt(n) - s = BigDecimal(0.25, 0) - t = 1 - while a != b && (a - b).exponent > 1 - n - c = (a - b).div(2, n) - a, b = (a + b).div(2, n), (a * b).sqrt(n) - s = s.sub(c * c * t, n) - t *= 2 - end - (a * b).div(s, prec) - end - - # call-seq: - # E(numeric) -> BigDecimal - # - # Computes e (the base of natural logarithms) to the specified number of - # digits of precision, +numeric+. - # - # BigMath.E(32).to_s - # #=> "0.27182818284590452353602874713527e1" - # - def E(prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :E) - exp(1, prec) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/math/erf.rb b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/math/erf.rb deleted file mode 100644 index 77b40e3..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/math/erf.rb +++ /dev/null @@ -1,291 +0,0 @@ -# frozen_string_literal: true - -module BigMath - # Bit-burst implementation of BigMath.erf and BigMath.erfc. - # - # Both functions share the same incremental update: given erf(x0+...+xk) (or erfc), - # extend to erf(x0+...+xk+x_{k+1}) by adding (or, for erfc, subtracting) the Taylor - # expansion of the difference function - # g(t) := (erf(t + a) - erf(a)) * exp(a**2) * sqrt(pi) / 2 with a = x0+...+xk - # which satisfies the homogeneous ODE g''(t) + 2*(t+a)*g'(t) = 0. - # Each step uses binary splitting on the 3-term recurrence of g's Taylor coefficients; - # split widths x1, x2, ... double in digits, giving quasi-linear total cost. - # - # Only the bit-burst seed differs between the two: - # erf : seed = erf(x0) via Taylor expansion at 0 - # erfc : seed = erfc(x0) via asymptotic expansion (requires x0 large enough; - # returns nil if asymptotic cannot reach the requested precision, in which - # case erfc(x) is recovered from 1 - erf(x) with extra digits to absorb - # cancellation) - # - # Edge cases (after symmetry erf(-x) = -erf(x)): - # x == 0 : erf = 0 - # x > 5e9 : erf = 1, erfc underflows - # x < 0.5 (erfc only) : compute via 1 - erf to avoid unnecessary work - module Erf # :nodoc: - - # Calculates erf with given precision. - def self.erf(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :erf) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :erf) - return BigDecimal::Internal.nan_computation_result if x.nan? - return BigDecimal(x.infinite?) if x.infinite? - return BigDecimal(0) if x == 0 - return -erf(-x, prec) if x < 0 - return BigDecimal(1) if x > 5000000000 # erf(5000000000) > 1 - 1e-10000000000000000000 - if x > 8 - xf = x.to_f - log10_erfc = -xf ** 2 / Math.log(10) - Math.log10(xf * Math::PI ** 0.5) - erfc_prec = [prec + log10_erfc.ceil, 1].max - erfc = erfc_bit_burst(x, erfc_prec + BigDecimal::Internal::EXTRA_PREC) - return BigDecimal(1).sub(erfc, prec) if erfc - end - - erf_bit_burst(x, prec + BigDecimal::Internal::EXTRA_PREC).mult(1, prec) - end - - # Calculates erfc with given precision. - def self.erfc(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :erfc) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :erfc) - return BigDecimal::Internal.nan_computation_result if x.nan? - return BigDecimal(1 - x.infinite?) if x.infinite? - return BigDecimal(1).sub(erf(x, prec + BigDecimal::Internal::EXTRA_PREC), prec) if x < 0.5 - return BigDecimal::Internal.underflow_computation_result if x > 5000000000 # erfc(5000000000) < 1e-10000000000000000000 (underflow) - - if x > 8 - y = erfc_bit_burst(x, prec + BigDecimal::Internal::EXTRA_PREC) - return y.mult(1, prec) if y - end - - # erfc(x) = 1 - erf(x) < exp(-x**2)/x/sqrt(pi) - # Precision of erf(x) needs about log10(exp(-x**2)/x/sqrt(pi)) extra digits - log10 = 2.302585092994046 - xf = x.to_f - high_prec = prec + BigDecimal::Internal::EXTRA_PREC + ((xf**2 + Math.log(xf) + Math.log(Math::PI)/2) / log10).ceil - BigDecimal(1).sub(erf_bit_burst(x, high_prec), prec) - end - - # Matrix multiplication. m1 and m2 are size*size length array that represents size*size matrix - def self.matrix_mult(m1, m2, size, prec) - (size * size).times.map do |i| - size.times.map do |k| - m1[i / size * size + k].mult(m2[size * k + i % size], prec) - end.reduce {|a, b| a.add(b, prec) } - end - end - - # Returns (erf(x + a) - erf(a)) * exp(a**2) * sqrt(pi) / 2 calculated with binary splitting method. - def self.erf_binary_splitting_diff(x, a, prec) - # Let f(x) = (erf(x + a) - erf(a)) * exp(a**2) * sqrt(pi) / 2 - # f(x) satisfies the following differential equation: - # 2*(x+a)*f'(x) + f''(x) = 0 - # We can derive the following recurrence for the Taylor coefficients of f: - # f(x) = x * (c0 + c1*x + c2*x**2 + c3*x**3 + ...) - # c(0) = 1 - # c(1) = -a - # c(i) = -2 * (a * c(i - 1) + c(i - 2) * (i - 1) / i) / (i + 1) - - # Estimate required number of terms by calculating c(i) with low precision - low_prec = 10 - a_low = a.mult(1, low_prec) - x_low = x.mult(1, low_prec) - coefs = [BigDecimal(1), -a_low] - xn = BigDecimal(1) - threshold = BigDecimal(1)._decimal_shift(-prec) - steps = (2..).find do |n| - prevprev, prev = coefs - xn = xn.mult(x_low, low_prec) - coefs = prev, (a_low * prev + (prevprev * (n - 1)).div(n, low_prec)).mult(-2, low_prec).div(n + 1, low_prec) - coefs[0].mult(xn, low_prec).abs < threshold && coefs[1].mult(xn * x_low, low_prec).abs < threshold - end - - # Let M(i) be a 2x2 matrix that generates the next coefficients vector (c(i-1), c(i)) - # from the previous two coefficients (c(i-2), c(i-1)). - # M(i) = | 0, 1 | - # | -2*(i-1)/i/(i+1), -2*a/(i+1) | - # - # Then, we can calculate (c(steps-1), c(steps)) as M(steps)*M(steps-1)*...*M(2)*Vector(c0, c1). - # - # Calculate a matrix that represents the sum of the Taylor series: - # SumMatrix = ((((...+I)x*M4+I)*x*M3+I)*M2*x+I) - # Actual sum can be calculated as: - # SumMatrix * Vector(c0, c1) = Vector(c0+c1*x+c2*x**2+c3*x**3+..., _) - # In this binary splitting method, adjacent two operations are combined into one repeatedly. - # ((...) * x * A + B) / C is the form of each operation. A and B are 2x2 matrices, C is a scalar. - - zero = BigDecimal(0) - operations = (2..steps + 2).map do |i| - d = BigDecimal(i * (i + 1)) - [[zero, d, BigDecimal(-2 * (i - 1)), a * (-2 * i)], [d, zero, zero, d], d] - end - - while operations.size > 1 - xpow = xpow ? xpow.mult(xpow, prec) : x.mult(1, prec) - operations = operations.each_slice(2).map do |op1, op2| - # Combine two operations into one: - # (((Remaining * x * A2 + B2) / C2) * x * A1 + B1) / C1 - # ((Remaining * (x*x) * (A2*A1) + (x*B2*A1+B1*C2)) / (C1*C2) - # Therefore, combined operation can be represented as: - # Anext = A2 * A1 - # Bnext = x * B2 * A1 + B1 * C2 - # Cnext = C1 * C2 - # xnext = x * x - a1, b1, c1 = op1 - a2, b2, c2 = op2 || [[zero] * 4, [zero] * 4, BigDecimal(1)] - [ - matrix_mult(a2, a1, 2, prec), - array_weighted_sum(matrix_mult(b2, a1, 2, prec), xpow, b1, c2, prec), - c1.mult(c2, prec), - ] - end - end - _, sum_matrix, denominator = operations.first - sum = (sum_matrix[0] - a * sum_matrix[1]).div(denominator, prec) - x.mult(sum, prec) - end - - # Calculates erfc(x) using bit-burst algorithm. - # Returns nil if the asymptotic expansion does not reach the requested precision. - def self.erfc_bit_burst(x, prec) - # By bounding the relative error via |d(erfc)/erfc| <= 2*x*|dx| (erfc(x) decays as exp(-x**2)/x), - # truncate x to the minimum digits sufficient for prec-digit accuracy of the result. - x = x.mult(1, prec + Math.log10(2 * x.to_f**2).ceil) - erf_erfc_bit_burst(x, prec, start_digits: 40, mode: :erfc) - end - - # Calculates erf(x) using bit-burst algorithm. - def self.erf_bit_burst(x, prec) - # By bounding the error via erf'(x) = (2/sqrt(pi)) * exp(-x**2), - # truncate x to the minimum digits sufficient for prec-digit accuracy of the result. - x = x.mult(1, [(prec - x.floor**2 / Math.log(10) + Math.log10(x.ceil)).ceil, 10].max) - erf_erfc_bit_burst(x, prec, start_digits: 8, mode: :erf) - end - - # Calculates erf or erfc using bit-burst algorithm. - # Returns nil if erfc mode cannot reach the requested precision. - def self.erf_erfc_bit_burst(x, prec, start_digits:, mode:) - digits = [-x.exponent * 2, start_digits].max - partial = x.truncate(digits) - case mode - when :erf - f = erf_exp2_binary_splitting(partial, prec) - when :erfc - f = erfc_exp2_asymptotic_binary_splitting(partial, prec) - return unless f - end - - exp_scale = BigMath.exp(-partial * partial, prec) - f = f.mult(exp_scale, prec) - - calculated_x = partial - x -= partial - - until x.zero? - digits *= 2 - partial = x.truncate(digits) - next if partial.zero? - - diff_prec = [prec - f.exponent + exp_scale.exponent + partial.exponent, 1].max - diff = erf_binary_splitting_diff(partial, calculated_x, diff_prec) - case mode - when :erf - f = f.add(diff.mult(exp_scale, prec), prec) - when :erfc - f = f.sub(diff.mult(exp_scale, prec), prec) - end - - calculated_x += partial - x -= partial - exp_scale = exp_scale.mult(BigMath.exp(partial * (partial - 2 * calculated_x), diff_prec), diff_prec) unless x.zero? - end - f.mult(BigDecimal(2).div(BigMath::PI(prec).sqrt(prec), prec), prec) - end - - # Matrix/Vector weighted sum - def self.array_weighted_sum(m1, w1, m2, w2, prec) - m1.zip(m2).map {|v1, v2| (v1 * w1).add(v2 * w2, prec) } - end - - # Calculates Taylor expansion of erf(x)*exp(x**2)*sqrt(pi)/2 with binary splitting method. - def self.erf_exp2_binary_splitting(x, prec) - # Let f(x) = erf(x)*exp(x**2)*sqrt(pi)/2 - # = c0 + c1*x + c2*x**2 + c3*x**3 + c4*x**4 + ... - # f(x) is designed to make all coefficients positive so that we don't need to consider cancellation error. - # - # f(x) satisfies the following differential equation: - # f'(x) = 1 + 2 * x * f(x) - # f'(x) = c1 + 2*c2*x + 3*c3*x**2 + 4*c4*x**3 + 5*c5*x**4 + ... - # = 1+2*x*(c0 + c1*x + c2*x**2 + c3*x**3 + c4*x**4 + ...) - # therefore, - # c0 = 0 - # c1 = 1 - # c2 = 2 * (c0 + c1) / 2 - # c3 = 2 * (c1 + c2) / 3 - # c4 = 2 * (c2 + c3) / 4 - - # Find the smallest n where the n-th Taylor term |c_n * x^n| falls below the precision - # threshold, using a Stirling-based upper bound on |c_n|. - log10f = Math.log(10) - cexponent = Math.log10(Math.sqrt(2)) + BigDecimal::Internal.float_log(x.abs) / log10f - - x_to_f = x < 1e-300 ? 1e-300 : x.to_f # x.to_f may underflow when x is very small (e.g. 1e-400) - steps = (2..).bsearch do |n| - x_to_f ** 2 < n && n * cexponent + Math.lgamma(n / 2)[0] / log10f + n * Math.log10(2) - Math.lgamma(n - 1)[0] / log10f < -prec + x_to_f**2 / log10f - end - - denominators = (steps / 2).times.map {|i| 2 * i + 3 } - x.mult(1 + BigDecimal::Internal.taylor_sum_binary_splitting(2 * x * x, denominators, prec), prec) - end - - # Calculates asymptotic expansion of erfc(x)*exp(x**2)*sqrt(pi)/2 with binary splitting method - def self.erfc_exp2_asymptotic_binary_splitting(x, prec) - # Let f(x) = erfc(x)*sqrt(pi)*exp(x**2)/2 - # f(x) satisfies the following differential equation: - # 2*x*f(x) = f'(x) + 1 - # From the above equation, we can derive the following asymptotic expansion: - # f(x) = (0..kmax).sum { (-1)**k * (2*k)! / 4**k / k! / x**(2*k) } / x / 2 - - # This asymptotic expansion does not converge. - # But if there is a k that satisfies (2*k)! / 4**k / k! / x**(2*k) < 10**(-prec), - # It is enough to calculate erfc within the given precision. - # Using Stirling's approximation, we can simplify this condition to: - # log(2)/2 + k*log(k) - k - 2*k*log(x) < -prec*log(10) - # and the left side is minimized when k = x**2. - xf = x.to_f - kmax = (1..(xf ** 2).floor).bsearch do |k| - Math.log(2) / 2 + k * Math.log(k) - k - 2 * k * Math.log(xf) < -prec * Math.log(10) - end - return unless kmax - - # Convert asymptotic expansion to nested form: - # 1 + a/x + a*b/x/x + a*b*c/x/x/x + a*b*c/x/x/x*rest - # = 1 + (a/x) * (1 + (b/x) * (1 + (c/x) * (1 + rest))) - # - # And calculate it with binary splitting: - # (a1/d + b1/d * (a2/d + b2/d * (rest))) - # = ((a1*d+b1*a2)/(d*d) + b1*b2/(d*denominator) * (rest))) - denominator = x.mult(x, prec).mult(2, prec) - fractions = (1..kmax).map do |k| - [denominator, BigDecimal(1 - 2 * k)] - end - while fractions.size > 1 - fractions = fractions.each_slice(2).map do |fraction1, fraction2| - a1, b1 = fraction1 - a2, b2 = fraction2 || [BigDecimal(0), denominator] - [ - a1.mult(denominator, prec).add(b1.mult(a2, prec), prec), - b1.mult(b2, prec), - ] - end - denominator = denominator.mult(denominator, prec) - end - # Plug rest = 1 into the merged form: the innermost "(1 + rest)" of the nested expansion - # evaluates to 1 at truncation (rest = 0). - sum = fractions[0][0].add(fractions[0][1], prec).div(denominator, prec) - sum.div(x, prec) / 2 - end - end - - private_constant :Erf -end diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/math/gamma.rb b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/math/gamma.rb deleted file mode 100644 index 1832547..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/math/gamma.rb +++ /dev/null @@ -1,513 +0,0 @@ -# frozen_string_literal: true -require 'bigdecimal/math' - -module BigMath - - # Calculates gamma/lgamma - # Algorithm overview: - # - # Lagrange interpolation of f(x) = b**x / x! at integer nodes x_i = b-l, ..., b+l. - # BSM(Binary Splitting Method) version for small digit numbers, O(PREC*log(PREC)^3) - # BSGS(Baby-Step Giant-Step) version for full digit numbers, O(PREC^2*log(log(PREC))) - # Both orders of magnitude faster than Spouge's approximation which is O(PREC^2*log(PREC)) - # (Complexities assume quasi-linear multiplication, counting large-by-small products - # as (n/m) * M(m) = n * log(m) bit ops. BigDecimal multiplies the small coefficients - # by schoolbook instead: an extra log factor asymptotically, but faster at any feasible PREC.) - # Requires fast factorial of an integer near x (see Factorial Doubling below). - # - # Factorial Doubling for fast calculation of large factorials: - # Using Legendre duplication formula, we can calculate factorial(2n) from factorial(n) and factorial(n + 0.5). - # Calculating factorial(n + 0.5) is done by the BSM version of Lagrange interpolation in quasi-linear time. - # This will drastically reduce the cost of calculating large factorials. - # O(PREC*log(PREC)^3*log(factorial_argument)) - # - # Stirling's approximation with Bernoulli numbers - # Only used when x is extremely large. - - module Gamma # :nodoc: - - # Calculates gamma function with given precision. - def self.gamma(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :gamma) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :gamma) - prec2 = prec + BigDecimal::Internal::EXTRA_PREC - - if x < 0.5 - raise Math::DomainError, 'Numerical argument is out of domain - gamma' if x.frac.zero? - - # Euler's reflection formula: gamma(z) * gamma(1-z) = pi/sin(pi*z) - pi = BigMath::PI(prec2) - sin = sinpix(x, pi, prec2) - pi.div(gamma(1 - x, prec2).mult(sin, prec2), prec) - else - # Digits of x beyond the working precision cannot affect the result. - # Rounding must happen before the integer test: an x indistinguishable from - # an integer must take the exact integer path, because gamma_lagrange - # requires a non-integer x (an integer x makes a node distance exactly zero). - x = x.mult(1, prec2 + x.exponent + 10) - if x.frac.zero? - integer_factorial(x.to_i - 1, prec2).mult(1, prec) - else - base, large_factorial_arg, small_factorial_arg, exp2 = gamma_lagrange(x, prec2) - ans = base.mult(integer_factorial(small_factorial_arg, prec2), prec2) - ans = ans.mult(BigDecimal(2).power(exp2, prec2), prec2) unless exp2.zero? - ans.mult(integer_factorial(large_factorial_arg, prec2), prec) - end - end - end - - # Calculates log gamma and its sign with given precision. - def self.lgamma(x, prec) - prec = BigDecimal::Internal.coerce_validate_prec(prec, :lgamma) - x = BigDecimal::Internal.coerce_to_bigdecimal(x, prec, :lgamma) - prec2 = prec + BigDecimal::Internal::EXTRA_PREC - if x < 0.5 - return [BigDecimal::INFINITY, 1] if x.frac.zero? - - loop do - # Euler's reflection formula: gamma(z) * gamma(1-z) = pi/sin(pi*z) - pi = BigMath::PI(prec2) - sin = sinpix(x, pi, prec2) - log_gamma = BigMath.log(pi, prec2).sub(lgamma(1 - x, prec2).first + BigMath.log(sin.abs, prec2), prec) - return [log_gamma, sin > 0 ? 1 : -1] if log_gamma != 0 && prec2 + log_gamma.exponent > prec + BigDecimal::Internal::EXTRA_PREC - - # Retry with higher precision if loss of significance is too large - prec2 = prec2 * 3 / 2 - end - else - # if x is close to 1 or 2, increase precision to reduce loss of significance - diff1_exponent = x < 3 ? (x - 1).exponent : 0 - diff2_exponent = x < 3 ? (x - 2).exponent : 0 - extremely_near_one = diff1_exponent < -prec2 - extremely_near_two = diff2_exponent < -prec2 - - if extremely_near_one || extremely_near_two - # If x is extremely close to base = 1 or 2, linear interpolation is accurate enough. - # Taylor expansion at x = base is: (x - base) * digamma(base) + (x - base) ** 2 * trigamma(base) / 2 + ... - # And we can ignore (x - base) ** 2 and higher order terms. - base = extremely_near_one ? 1 : 2 - d = BigDecimal(1)._decimal_shift(1 - prec2) - log_gamma_d, sign = lgamma(base + d, prec2) - return [log_gamma_d.mult(x - base, prec2).div(d, prec), sign] - end - - prec2 += [-diff1_exponent, -diff2_exponent, 0].max - - # Same rounding as in Gamma.gamma. Must come after the near 1 and 2 handling - # above, which needs the exact distance from x to 1 or 2. - x = x.mult(1, prec2 + x.exponent + 10) - - # When x is extremely large, the cost of Bernoulli number generation for Stirling's - # asymptotic expansion is smaller than the cost of multiple steps of doubling method. - # The condition is based on heuristic cost estimation and empirical tuning. - if x > prec2 && x.exponent > Integer.sqrt(prec2) / 6 - [lgamma_stirling(x, prec2).mult(1, prec), 1] - elsif x.frac.zero? - [integer_factorial_log(x.to_i - 1, prec2).mult(1, prec), 1] - else - base, large_factorial_arg, small_factorial_arg, exp2 = gamma_lagrange(x, prec2) - lgamma = BigMath.log(base, prec2) - lgamma = lgamma.add(BigMath.log(2, prec2) * exp2, prec2) unless exp2.zero? - lgamma = lgamma.add(integer_factorial_log(small_factorial_arg, prec2), prec2) - lgamma = lgamma.add(integer_factorial_log(large_factorial_arg, prec2), prec) - [lgamma, 1] - end - end - end - - # Calculates prod { x - k } for k in ks and the coefficients of the expanded polynomial. - # xn is an array of precalculated powers of x: [1, x, x**2, x**3, ...] - def self.x_minus_k_prod_coef(ks, xn, prec) - coef = [1] - ks.each do |k| - coef_next = [0] * (coef.size + 1) - coef.each_with_index do |c, i| - coef_next[i] -= k * c - coef_next[i + 1] += c - end - coef = coef_next - end - - prod = coef.each_with_index.map do |c, i| - xn[i].mult(c, prec) - end.reduce do |sum, value| - sum.add(value, prec) - end - [prod, coef] - end - - # Bit length to keep in bit-dropping integer products and fraction merges. - # Only about prec * log2(10) bits are needed. 10 / 3 slightly exceeds log2(10), - # and 64 extra bits absorb the ~1 bit lost per truncation over the tree depth. - def self.drop_cap_bits(prec) - (prec * 10 + 192) / 3 - end - - # Calculate numbers.reduce(:*) of integers by Binary Splitting Method. - # Returns [mantissa, exp2] representing mantissa * 2**exp2. - # With cap, lower bits of intermediate products are dropped to keep each - # multiplication cost bounded by the target precision. Without cap, the product is exact. - def self.int_bsm_prod(numbers, cap = nil) - numbers = numbers.to_a - exp2 = 0 - while numbers.size > 1 - numbers = numbers.each_slice(2).map do |a, b| - next a unless b - v = a * b - if cap && (s = v.bit_length - cap) > 0 - exp2 += s - v >>= s - end - v - end - end - [numbers.first || 1, exp2] - end - - # Calculate factorial for integer n - def self.integer_factorial(n, prec) - power_part, exp2, exp_sqrtpi = integer_factorial_parameter(n, prec) - ans = BigDecimal(2).power(exp2, prec) - power_part.each_with_index do |base, index| - ans = ans.mult(base.power(1 << index, prec), prec) - end - if exp_sqrtpi != 0 - pi = BigMath::PI(doubling_level_prec(prec, power_part.size - 1)) - # exp_sqrtpi is 2**k - 1 (odd): the doubling recursion squares the child's - # sqrt(pi) exponent and adds one, so only the last level's sqrt survives - pipow = pi.power(exp_sqrtpi / 2, prec).mult(pi.sqrt(prec), prec) - ans = ans.div(pipow, prec) - end - ans - end - - # Precision for values that integer_factorial raises to the power 2**index. - # The power multiplies their relative error by 2**index, so they need - # index * log10(2) more digits than the result. - def self.doubling_level_prec(prec, index) - prec + (index * Math.log10(2)).ceil + 1 - end - - # Calculate log factorial for integer n - def self.integer_factorial_log(n, prec) - power_part, exp2, exp_sqrtpi = integer_factorial_parameter(n, prec) - ans = exp2.zero? ? BigDecimal(0) : BigMath.log(2, prec) * exp2 - power_part.each_with_index do |base, index| - ans = ans.add(BigMath.log(base, prec) * (1 << index), prec) - end - if exp_sqrtpi != 0 - pi = BigMath::PI(prec) - ans = ans.sub(BigMath.log(pi, prec) * (BigDecimal(exp_sqrtpi) / 2), prec) - end - ans - end - - # Calculates parameters for integer factorial calculation. - # Returns [base_power_part, exp2, exp_sqrtpi] that can produce factorial(n) as: - # factorial(n) = prod { base_power_part[i]**(1 << i) } * 2**exp2 / sqrt(pi)**exp_sqrtpi - # These parameters are used to avoid overflow when calculating log factorial and lgamma for large n. - def self.integer_factorial_parameter(n, prec) - base_power_part, factorial_power_part, exp2, exp_sqrtpi = integer_factorial_recursive(n, prec) - fact_x = 1 - fact_y = BigDecimal(1) - # factorial_power_part is non-decreasing (deeper recursion levels have smaller b, - # and gamma_lagrange_l grows as b shrinks), so fact_y can be extended incrementally. - # fact_y is carried over to every later index, so it needs the precision - # of the deepest level from the start. - level_prec = doubling_level_prec(prec, factorial_power_part.size - 1) - factorial_power_part.each_with_index do |factorial_arg, index| - # Exact product (no bit drop): these ranges total only O(prec * log(prec)) digits, - # and a dropped 2**s here would be raised to 2**index, exceeding the representable - # exponent range while base_power_part[index] underflows by the same amount. - mantissa, = int_bsm_prod(fact_x + 1..factorial_arg) - fact_y = fact_y.mult(mantissa, level_prec) - fact_x = factorial_arg - base_power_part[index] = base_power_part[index].mult(fact_y, level_prec) - end - [base_power_part, exp2, exp_sqrtpi] - end - - # Returns [base_power_part, factorial_power_part, exp2, exp_sqrtpi] that can produce factorial(n) as: - # factorial(n) = prod { base_power_part[i]**(1 << i) } * prod { factorial(factorial_power_part[i])**(1 << i) } * 2**exp2 / sqrt(pi)**(exp_sqrtpi) - # If n is large, this method recursively calculates factorial for smaller n by Legendre duplication formula. - # index is the recursion depth, which is also the position in the returned arrays. - def self.integer_factorial_recursive(n, prec, index = 0) - level_prec = doubling_level_prec(prec, index) - if n < 4 * prec - mantissa, exp2 = int_bsm_prod(1..n, drop_cap_bits(level_prec)) - return [[BigDecimal(mantissa)], [], exp2, 0] - end - - # Use Legendre duplication formula to reduce factorial(n) to half-size factorials: - # factorial(n) = factorial(n/2.0) * factorial((n-1)/2.0) * 2**n / sqrt(pi) - # gamma_lagrange((n + 1) / 2 + 0.5, prec) computes the half-integer factorial - # (whichever of the two factors above is a half-integer). - half_arg = BigDecimal((n + 1) / 2) + BigDecimal('0.5') - base, large_factorial_arg, small_factorial_arg, lagrange_exp2 = gamma_lagrange(half_arg, level_prec) - - range_mantissa, = int_bsm_prod(large_factorial_arg + 1..n / 2) # exact: total size is O(prec) digits - base = base.mult(range_mantissa, level_prec) - base_power_part, factorial_power_part, exp2, exp_sqrtpi = integer_factorial_recursive(large_factorial_arg, prec, index + 1) - [ - [base] + base_power_part, - [small_factorial_arg] + factorial_power_part, - exp2 * 2 + n + lagrange_exp2, - exp_sqrtpi * 2 + 1 - ] - end - - # Estimate the required number of interpolation points `l` to achieve `prec` digits. - # - # Assuming the nodes stay strictly positive, the function b^x/x! approximates a - # Gaussian curve e^(-y^2 / 2b) around its peak (x=b). - # The Taylor coefficient of degree 2l is roughly c_2l = 1 / (l! * (2b)^l). - # Multiplying this by the distance product of 2l+1 nodes (approx (l/e)^(2l)), - # the overall truncation error E is bounded by: E ~ (l / 2eb)^l. - # - # Setting E <= 10^-prec gives the implicit equation: - # l * log10(2 * e * b / l) = prec => l = prec / log10(2 * e * b / l) - def self.gamma_lagrange_l(b, prec) - # Initial guess of l. When b >= 2 * prec - 1 (guaranteed by the shift in gamma_lagrange), - # this is safely larger than the actual l. - l = prec - - # Solves the implicit equation via fixed-point iteration. - # Due to the slow growth of the logarithm, 2 iterations are practically sufficient. - 2.times { l = prec / Math.log10(2 * Math::E * b / l) } - l.ceil + 10 # Adds safety margin - end - - # Calculate approximate gamma by Lagrange interpolation of f(x) = b**x / x! - # Nodes are placed at x_i = b-l, b-l+1, ..., b+l. - # b: x.round, l: number of nodes on one side (total nodes = 2*l+1) - # - # Mathematically, we use the barycentric interpolation form: - # f(x) \approx \omega(x) \sum_{i} \frac{w_i f(x_i)}{x - x_i} - # Therefore, \Gamma(x+1) = x! = b**x / f(x) - # - # Time complexity: - # - O(PREC*log(PREC)^3) for small-digit x (Binary Splitting) - # - O(PREC^2*log(log(PREC))) for full-digit x (Baby-step Giant-step). - # Measured time grows like PREC^2. - # - # Returns [base, large_factorial_arg, small_factorial_arg, exp2] that can produce gamma(x) as: - # gamma(x) = base * 2**exp2 * factorial(large_factorial_arg) * factorial(small_factorial_arg) - def self.gamma_lagrange(x, prec) - # Shift x to establish a safe center (b) for the barycentric interpolation. - # - # We must keep all interpolation nodes strictly positive (b - l > 0). Approaching - # x = 0 breaks the Gaussian approximation used to estimate `l` and provides no - # useful information for the interpolation. - # - # While b =~ 1.36 * prec is the strict theoretical minimum to stay positive, we - # heuristically use b = 2 * prec. This moves the nodes safely away from x = 0, - # stabilizes the curve, and empirically yields the optimal total computation cost. - # (See `gamma_lagrange_l` for the mathematical derivation of the approximation). - shift = x < 2 * prec ? 2 * prec - x.floor : 0 - x += shift - - x = BigDecimal(x) - 1 - b = x.round - l = gamma_lagrange_l(b, prec) - exp2 = 0 - - # --- Reference: Naive interpolation logic --- - # The two branches below optimize this calculation for the full-digit and small-digit x cases. - # sum = BigDecimal(0) - # prod = [*(b - l..b + l), *(0...shift)].map {|i| x - i }.reduce { _1.mult(_2, prec) } - # c = BigDecimal(1) # represents w_i * f(x_i) (normalized) - # (b - l..b + l).each do |i| - # if i != b - l - # c = c.mult(-b * (b + l - i + 1), prec).div((i - b + l) * i, prec) - # end - # sum = sum.add(c.div(x - i, prec), prec) - # end - # -------------------------------------------- - - # Choose between BSM and BSGS based on total bit cost: - # BSM: (l * n_sig / prec) full-digit multiplications, each costing prec * log(prec) - # bit ops, total l * n_sig * log(prec). - # BSGS: l * prec bit ops with batch_size = log2(prec) (see below). - # Cross-over: n_sig * log(prec) > prec. - if x.n_significant_digits * prec.bit_length > prec - # Reduce full-precision multiplications/divisions using a Batched Evaluation - # inspired by the Baby-Step Giant-Step (BSGS) method. - - # Normal BSGS uses batch_size = sqrt(l), but here the integer coefficients of the - # expanded prod { x - k } over a batch grow like (b + l)**batch_size, so a smaller - # batch keeps both the coefficient size and the per-batch evaluation cost low. - # batch_size = log2(prec) brings the total BSGS bit cost down to O(l * prec * log(log(prec))). - batch_size = prec.bit_length - - # When expanding prod { x - k }, the coefficient of x**n might be huge. - # Increase internal calculation precision to avoid catastrophic cancellation. - # When x is within 10**-q of a node, batch_prod cancels by q more digits; - # without the extra digits the computed batch_prod can even collapse to - # exactly zero, and the division below would raise or produce NaN. - nearest_node_distance = x - x.round(0, BigDecimal::ROUND_HALF_UP) - near_node_digits = [1 - nearest_node_distance.exponent, 0].max - internal_xn_prec = prec + (Math.log10(b + l) * batch_size).ceil + near_node_digits - xn = [BigDecimal(1)] - xn << xn.last.mult(x, internal_xn_prec) while xn.size <= batch_size - - c = BigDecimal(1) - sum = BigDecimal(0) - prod = BigDecimal(1) - - # sum, c and prod are updated once per batch, so their rounding errors - # accumulate in proportion to the number of batches. - batch_count = (2 * l + 1 + shift) / batch_size + 1 - accumulate_prec = prec + Math.log10(batch_count).ceil + 1 - - ((b - l)..(b + l)).to_a.each_slice(batch_size) do |batch_ks| - # Calculate prod{ x - k } in this batch - batch_prod, prod_coef = x_minus_k_prod_coef(batch_ks, xn, internal_xn_prec) - - # Calculate coefficients of batch_prod / (x - k) using Synthetic Division (Ruffini's rule) - batch_coef = [0] * batch_ks.size - c_scale = 1r - batch_ks.each do |k| - c_scale = c_scale * (-b * (b + l - k + 1)) / ((k - b + l) * k) if k != b - l - rem = 0 - (batch_ks.size - 1).downto(0) do |i| - quo = prod_coef[i + 1] + rem - rem = quo * k - batch_coef[i] += c_scale * quo - end - end - - batch_sum = BigDecimal(0) - batch_coef.each_with_index do |coef, i| - batch_sum = batch_sum.add(xn[i].mult(coef.numerator, internal_xn_prec).div(coef.denominator, internal_xn_prec), internal_xn_prec) - end - # batch_prod loses relative accuracy when x is extremely close to a node in this - # batch. This is harmless: the same computed value is divided into sum here and - # multiplied into prod below, so the error cancels in the final prod * sum. - sum = sum.add(batch_sum.mult(c, accumulate_prec).div(batch_prod, accumulate_prec), accumulate_prec) - c = c.mult(c_scale.numerator, accumulate_prec).div(c_scale.denominator, accumulate_prec) - prod = prod.mult(batch_prod, accumulate_prec) - end - - # Perform shift.times {|i| prod = prod.mult(x - i, prec) } with batch processing - shift.times.to_a.each_slice(batch_size) do |batch_ks| - shift_prod, _prod_coef = x_minus_k_prod_coef(batch_ks, xn, internal_xn_prec) - prod = prod.mult(shift_prod, accumulate_prec) - end - else - # Binary Splitting Method (BSM) for short-digit inputs. - # Scaling x by 10**frac_digits makes every node term x - i an exact integer, - # so the whole tree runs on Integer arithmetic. The scale cancels inside the - # fraction merges; only prod and sum need explicit rescaling. - frac_digits = [x.n_significant_digits - x.exponent, 0].max - s10 = 10**frac_digits - xs = x._decimal_shift(frac_digits).to_i - cap = drop_cap_bits(prec) - - prod_factors = (b - l..b + l).map {|i| xs - i * s10 } + shift.times.map {|i| xs - i * s10 } - mantissa, dropped_exp2 = int_bsm_prod(prod_factors, cap) - prod = BigDecimal(mantissa)._decimal_shift(-frac_digits * prod_factors.size) - # prod is missing the dropped 2**dropped_exp2 factor and gamma is proportional - # to 1 / prod. Returning the compensation as exp2 lets the factorial doubling - # fold it into its own 2**exp2 channel instead of paying a power here. - exp2 = -dropped_exp2 - - # State represents a partial evaluation of the series as: [sum_num, mult_num, den] - # Conceptually, each state translates to the following mathematical expression: - # (sum_num / den) + (mult_num / den) * (rest_of_the_series) - # - # The initial state [denominator, numerator, denominator] simply represents: - # (denominator / denominator) + (numerator / denominator) * rest - # = 1 + (numerator / denominator) * rest - # - fractions = (b - l + 1..b + l).map do |i| - denominator = (xs - i * s10) * ((i - b + l) * i) - numerator = (xs - (i - 1) * s10) * (-b * (b + l - i + 1)) - [denominator, numerator, denominator] - end - - while fractions.size > 1 - fractions = fractions.each_slice(2).map do |a, c| - c ||= [1, 0, 1] - # Merge operation for BSM: - # a[0]/a[2] + a[1]/a[2] * (c[0]/c[2] + c[1]/c[2] * rest) - # = (a[0]*c[2] + a[1]*c[0]) / (a[2]*c[2]) + (a[1]*c[1]) / (a[2]*c[2]) * rest - v0 = a[0] * c[2] + a[1] * c[0] - v1 = a[1] * c[1] - v2 = a[2] * c[2] - # Drop lower bits to avoid the integers growing too large; see drop_cap_bits. - # All three components share the shift, so the represented ratios are unchanged. - s = v2.bit_length - cap - if s > 0 - v0 >>= s - v1 >>= s - v2 >>= s - end - [v0, v1, v2] - end - end - fraction = fractions.first - sum = BigDecimal((fraction[0] + fraction[1]) * s10).div(fraction[2] * (xs - (b - l) * s10), prec) - end - - # Reconstruct Gamma(x_original) by reversing the scaling and applying shift formula - e = x - (b - l) - if e.frac == 0.5 - # The factorial doubling path always has x = integer + 0.5. For this exponent shape, - # integer power and sqrt are much cheaper than the exp/log based fractional power. - power_part = BigDecimal(b).power(e.to_i, prec).mult(BigDecimal(b).sqrt(prec), prec) - else - power_part = BigDecimal(b).power(e, prec) - end - base = power_part.div(prod.mult(sum, prec), prec) - large_factorial_arg = b - l - small_factorial_arg = 2 * l - [base, large_factorial_arg, small_factorial_arg, exp2] - end - - # Calculates bernoulli number. - # bns: calculated bernoulli numbers for memoization - def self.bernoulli(n, bns, prec) - return bns[0] ||= BigDecimal(1) if n == 0 - return bns[1] ||= BigDecimal(-0.5) if n == 1 - return bns[n] ||= BigDecimal(0) if n.odd? - bns[n] ||= ( - comb = 1 - sum = BigDecimal(0) - n.times do |i| - sum = sum.add(comb * bernoulli(i, bns, prec), prec) - comb = comb * (n - i + 1) / (i + 1) - end - sum.div(-n - 1, prec) - ) - end - - # Calculate log gamma using Stirling's asymptotic expansion. - # While the condition of this asymptotic expansion is x > prec * log(10) / 2 / pi, - # we'll use this method only when x is extremely large to reduce the cost of Bernoulli number generation. - def self.lgamma_stirling(x, prec) - x = BigDecimal(x) - y = (x * (BigMath.log(x, prec) - 1)).add(BigMath.log(2 * BigMath::PI(prec).div(x, prec), prec) / 2, prec) - bns = [] - xn = x - x2 = x.mult(x, prec) - (1..).each do |k| - xn = xn.mult(x2, prec) if k != 1 - d = bernoulli(2 * k, bns, prec).div(xn, prec).div(2 * k * (2 * k - 1), prec) - y = y.add(d, prec) - break if d.exponent < y.exponent - prec - end - y - end - - # Returns sin(pi * x), for gamma reflection formula calculation - def self.sinpix(x, pi, prec) - x = x % 2 - sign = x > 1 ? -1 : 1 - x %= 1 - x = 1 - x if x > 0.5 # to avoid sin(pi*x) loss of precision for x close to 1 - sign * BigMath.sin(x.mult(pi, prec), prec) - end - end - - private_constant :Gamma -end diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/newton.rb b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/newton.rb deleted file mode 100644 index bb70d47..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/newton.rb +++ /dev/null @@ -1,82 +0,0 @@ -# frozen_string_literal: false -require "bigdecimal/ludcmp" -require "bigdecimal/jacobian" - -warn "'bigdecimal/newton' is deprecated and will be removed in a future release." - -# -# newton.rb -# -# Solves the nonlinear algebraic equation system f = 0 by Newton's method. -# This program is not dependent on BigDecimal. -# -# To call: -# n = nlsolve(f,x) -# where n is the number of iterations required, -# x is the initial value vector -# f is an Object which is used to compute the values of the equations to be solved. -# It must provide the following methods: -# -# f.values(x):: returns the values of all functions at x -# -# f.zero:: returns 0.0 -# f.one:: returns 1.0 -# f.two:: returns 2.0 -# f.ten:: returns 10.0 -# -# f.eps:: returns the convergence criterion (epsilon value) used to determine whether two values are considered equal. If |a-b| < epsilon, the two values are considered equal. -# -# On exit, x is the solution vector. -# -module Newton - include LUSolve - include Jacobian - module_function - - def norm(fv,zero=0.0) # :nodoc: - s = zero - n = fv.size - for i in 0...n do - s += fv[i]*fv[i] - end - s - end - - # See also Newton - def nlsolve(f,x) - nRetry = 0 - n = x.size - - f0 = f.values(x) - zero = f.zero - one = f.one - two = f.two - p5 = one/two - d = norm(f0,zero) - minfact = f.ten*f.ten*f.ten - minfact = one/minfact - e = f.eps - while d >= e do - nRetry += 1 - # Not yet converged. => Compute Jacobian matrix - dfdx = jacobian(f,f0,x) - # Solve dfdx*dx = -f0 to estimate dx - dx = lusolve(dfdx,f0,ludecomp(dfdx,n,zero,one),zero) - fact = two - xs = x.dup - begin - fact *= p5 - if fact < minfact then - raise "Failed to reduce function values." - end - for i in 0...n do - x[i] = xs[i] - dx[i]*fact - end - f0 = f.values(x) - dn = norm(f0,zero) - end while(dn>=d) - d = dn - end - nRetry - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/util.rb b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/util.rb deleted file mode 100644 index 7f2232d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/lib/bigdecimal/util.rb +++ /dev/null @@ -1,186 +0,0 @@ -# frozen_string_literal: true -# -#-- -# bigdecimal/util extends various native classes to provide the #to_d method, -# and provides BigDecimal#to_d and BigDecimal#to_digits. -#++ - -require 'bigdecimal' - -class Integer < Numeric - # call-seq: - # int.to_d -> bigdecimal - # - # Returns the value of +int+ as a BigDecimal. - # - # require 'bigdecimal' - # require 'bigdecimal/util' - # - # 42.to_d # => 0.42e2 - # - # See also Kernel.BigDecimal. - # - def to_d - BigDecimal(self) - end -end - - -class Float < Numeric - # call-seq: - # float.to_d -> bigdecimal - # float.to_d(precision) -> bigdecimal - # - # Returns the value of +float+ as a BigDecimal. - # The +precision+ parameter is used to determine the number of - # significant digits for the result. When +precision+ is set to +0+, - # the number of digits to represent the float being converted is determined - # automatically. - # The default +precision+ is +0+. - # - # require 'bigdecimal' - # require 'bigdecimal/util' - # - # 0.5.to_d # => 0.5e0 - # 1.234.to_d # => 0.1234e1 - # 1.234.to_d(2) # => 0.12e1 - # - # See also Kernel.BigDecimal. - # - def to_d(precision=0) - BigDecimal(self, precision) - end -end - - -class String - # call-seq: - # str.to_d -> bigdecimal - # - # Returns the result of interpreting leading characters in +str+ - # as a BigDecimal. - # - # require 'bigdecimal' - # require 'bigdecimal/util' - # - # "0.5".to_d # => 0.5e0 - # "123.45e1".to_d # => 0.12345e4 - # "45.67 degrees".to_d # => 0.4567e2 - # - # See also Kernel.BigDecimal. - # - def to_d - BigDecimal.interpret_loosely(self) - end -end - - -class BigDecimal < Numeric - # call-seq: - # a.to_digits -> string - # - # Converts a BigDecimal to a String of the form "nnnnnn.mmm". - # This method is deprecated; use BigDecimal#to_s("F") instead. - # - # require 'bigdecimal/util' - # - # d = BigDecimal("3.14") - # d.to_digits # => "3.14" - # - def to_digits - if self.nan? || self.infinite? || self.zero? - self.to_s - else - i = self.to_i.to_s - _,f,_,z = self.frac.split - i + "." + ("0"*(-z)) + f - end - end - - # call-seq: - # a.to_d -> bigdecimal - # - # Returns self. - # - # require 'bigdecimal/util' - # - # d = BigDecimal("3.14") - # d.to_d # => 0.314e1 - # - def to_d - self - end -end - - -class Rational < Numeric - # call-seq: - # rat.to_d(precision) -> bigdecimal - # - # Returns the value as a BigDecimal. - # - # The +precision+ parameter is used to determine the number of - # significant digits for the result. When +precision+ is set to +0+, - # the number of digits to represent the float being converted is determined - # automatically. - # The default +precision+ is +0+. - # - # require 'bigdecimal' - # require 'bigdecimal/util' - # - # Rational(22, 7).to_d(3) # => 0.314e1 - # - # See also Kernel.BigDecimal. - # - def to_d(precision=0) - BigDecimal(self, precision) - end -end - - -class Complex < Numeric - # call-seq: - # cmp.to_d -> bigdecimal - # cmp.to_d(precision) -> bigdecimal - # - # Returns the value as a BigDecimal. - # If the imaginary part is not +0+, an error is raised - # - # The +precision+ parameter is used to determine the number of - # significant digits for the result. When +precision+ is set to +0+, - # the number of digits to represent the float being converted is determined - # automatically. - # The default +precision+ is +0+. - # - # require 'bigdecimal' - # require 'bigdecimal/util' - # - # Complex(0.1234567, 0).to_d(4) # => 0.1235e0 - # Complex(Rational(22, 7), 0).to_d(3) # => 0.314e1 - # Complex(1, 1).to_d # raises ArgumentError - # - # See also Kernel.BigDecimal. - # - def to_d(precision=0) - BigDecimal(self) unless self.imag.zero? # to raise error - - BigDecimal(self.real, precision) - end -end - - -class NilClass - # call-seq: - # nil.to_d -> bigdecimal - # - # Returns nil represented as a BigDecimal. - # - # require 'bigdecimal' - # require 'bigdecimal/util' - # - # nil.to_d # => 0.0 - # - def to_d - BigDecimal(0) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/sample/linear.rb b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/sample/linear.rb deleted file mode 100644 index 0cfac03..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/sample/linear.rb +++ /dev/null @@ -1,110 +0,0 @@ -# -# linear.rb -# -# Solves linear equation system(A*x = b) by LU decomposition method. -# where A is a coefficient matrix,x is an answer vector,b is a constant vector. -# -# USAGE: -# ruby linear.rb [input file solved] -# - -# :stopdoc: -require "bigdecimal" - -# Requires gem matrix -require "matrix" - -class PrecisionSpecifiedValue - # NOTE: - # Change following PREC if needed. - - attr_reader :value - def initialize(value, prec) - @value = BigDecimal(value) - @prec = prec - end - - def unwrap(value) - PrecisionSpecifiedValue === value ? value.value : value - end - - def coerce(other) - [self.class.new(unwrap(other), @prec), self] - end - - def abs - self.class.new(@value.abs, @prec) - end - - def >(other) - @value > unwrap(other) - end - - def <(other) - @value < unwrap(other) - end - - def -(other) - self.class.new(@value.sub(unwrap(other), @prec), @prec) - end - - def +(other) - self.class.new(@value.add(unwrap(other), @prec), @prec) - end - - def *(other) - self.class.new(@value.mult(unwrap(other), @prec), @prec) - end - - def quo(other) - self.class.new(@value.div(unwrap(other), @prec), @prec) - end -end - -return if __FILE__ != $0 - -def rd_order(na) - printf("Number of equations ?") if(na <= 0) - ARGF.gets().to_i -end - -na = ARGV.size - -while (n=rd_order(na))>0 - a = [] - b = [] - if na <= 0 - # Read data from console. - printf("\nEnter coefficient matrix element A[i,j]\n") - for i in 0...n do - a << n.times.map do |j| - printf("A[%d,%d]? ",i,j); s = ARGF.gets - BigDecimal(s) - end - printf("Contatant vector element b[%d] ? ",i) - b << BigDecimal(ARGF.gets) - end - else - # Read data from specified file. - printf("Coefficient matrix and constant vector.\n") - for i in 0...n do - s = ARGF.gets - printf("%d) %s",i,s) - s = s.split - a << n.times.map {|j| BigDecimal(s[j]) } - b << BigDecimal(s[n]) - end - end - - prec = 100 - matrix = Matrix[*a.map {|row| row.map {|v| PrecisionSpecifiedValue.new(v, prec) } }] - vector = b.map {|v| PrecisionSpecifiedValue.new(v, prec) } - x = matrix.lup.solve(vector).map(&:value) - - printf("Answer(x[i] & (A*x-b)[i]) follows\n") - for i in 0...n do - printf("x[%d]=%s ",i,x[i].to_s) - diff = a[i].zip(x).sum {|aij, xj| aij*xj }.sub(b[i], 10) - printf(" & %s\n", diff.to_s) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/sample/nlsolve.rb b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/sample/nlsolve.rb deleted file mode 100644 index 7953653..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/sample/nlsolve.rb +++ /dev/null @@ -1,57 +0,0 @@ -# -# nlsolve.rb -# An example for solving nonlinear algebraic equation system. -# - -require "bigdecimal" -require_relative "linear" - -# Requires gem matrix -require "matrix" - -# :stopdoc: - -def func((x, y)) # defines functions solved - [ - x**2 + y**2 - 2, - (x - 1)**2 + (y + 1)**2 - 3 - ] -end - -def jacobian(x, f, delta, prec) - dim = x.size - dim.times.map do |i| - xplus = Array.new(dim) {|j| x[i] + (j == i ? delta : 0) } - xminus = Array.new(dim) {|j| x[i] - (j == i ? delta : 0) } - yplus = f.call(xplus) - yminus = f.call(xminus) - yplus.zip(yminus).map {|p, m| (p - m).div(2 * delta, prec) } - end.transpose -end - -def nlsolve(initial_x, prec:, max_iteration: 100, &f) - initial_x = initial_x.map {|v| BigDecimal(v) } - x = initial_x - delta = BigDecimal(0.01) - calc_prec = prec + 10 - max_iteration.times do |iteration| - # Newton step - jacobian = jacobian(x, f, delta, calc_prec) - matrix = Matrix[*jacobian.map {|row| row.map {|v| PrecisionSpecifiedValue.new(v, calc_prec) } }] - y = f.call(x) - vector = y.map {|v| PrecisionSpecifiedValue.new(v, calc_prec) } - dx = matrix.lup.solve(vector).map(&:value) - x_prev = x - x = x.zip(dx).map {|xi, di| xi.sub(di, prec) } - movement = x_prev.zip(x).map {|xn, xi| (xn - xi).abs }.max - delta = [movement, delta].min.mult(1, 10) - break if movement.zero? || movement.exponent < -prec - end - x -end - -initial_value = [1, 1] -ans = nlsolve(initial_value, prec: 100) {|x| func(x) } -diff = func(ans).map {|v| v.mult(1, 10) } -p(ans:) -p(diff:) diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/sample/pi.rb b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/sample/pi.rb deleted file mode 100644 index 4b17ed0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/sample/pi.rb +++ /dev/null @@ -1,16 +0,0 @@ -# -# pi.rb -# -# Calculates 3.1415.... (the number of times that a circle's diameter -# will fit around the circle) -# - -require "bigdecimal" -require "bigdecimal/math.rb" - -if ARGV.size == 1 - print "PI("+ARGV[0]+"):\n" - p BigMath.PI(ARGV[0].to_i) -else - print "TRY: ruby pi.rb 1000 \n" -end diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/sig/big_decimal.rbs b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/sig/big_decimal.rbs deleted file mode 100644 index dd2a3c3..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/sig/big_decimal.rbs +++ /dev/null @@ -1,1504 +0,0 @@ -class BigDecimal < Numeric - # BigDecimal::ROUND_MODE - type round_mode = 256 - type round_mode_integer = 1 | 2 | 3 | 4 | 5 | 6 | 7 - type round_mode_symbol = :up | :down | :half_up | :half_down | :half_even | :ceiling | :floor | :truncate | :banker | :default - - # - # Internal method used to provide marshalling support. See the Marshal module. - # - def self._load: (String) -> BigDecimal - - # - # Returns the number of digits a Float object is allowed to have; the result is - # system-dependent: - # - # BigDecimal.double_fig # => 16 - # - def self.double_fig: () -> Integer - - # - # - def self.interpret_loosely: (string) -> BigDecimal - - # - # Limit the number of significant digits in newly created BigDecimal numbers to - # the specified value. Rounding is performed as necessary, as specified by - # BigDecimal.mode. - # - # A limit of 0, the default, means no upper limit. - # - # The limit specified by this method takes less priority over any limit - # specified to instance methods such as ceil, floor, truncate, or round. - # - def self.limit: (?Integer? digits) -> Integer - - # - # Returns an integer representing the mode settings for exception handling and - # rounding. - # - # These modes control exception handling: - # - # * BigDecimal::EXCEPTION_NaN. - # * BigDecimal::EXCEPTION_INFINITY. - # * BigDecimal::EXCEPTION_UNDERFLOW. - # * BigDecimal::EXCEPTION_OVERFLOW. - # * BigDecimal::EXCEPTION_ZERODIVIDE. - # * BigDecimal::EXCEPTION_ALL. - # - # Values for `setting` for exception handling: - # - # * `true`: sets the given `mode` to `true`. - # * `false`: sets the given `mode` to `false`. - # * `nil`: does not modify the mode settings. - # - # You can use method BigDecimal.save_exception_mode to temporarily change, and - # then automatically restore, exception modes. - # - # For clarity, some examples below begin by setting all exception modes to - # `false`. - # - # This mode controls the way rounding is to be performed: - # - # * BigDecimal::ROUND_MODE - # - # You can use method BigDecimal.save_rounding_mode to temporarily change, and - # then automatically restore, the rounding mode. - # - # **NaNs** - # - # Mode BigDecimal::EXCEPTION_NaN controls behavior when a BigDecimal NaN is - # created. - # - # Settings: - # - # * `false` (default): Returns `BigDecimal('NaN')`. - # * `true`: Raises FloatDomainError. - # - # Examples: - # - # BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0 - # BigDecimal('NaN') # => NaN - # BigDecimal.mode(BigDecimal::EXCEPTION_NaN, true) # => 2 - # BigDecimal('NaN') # Raises FloatDomainError - # - # **Infinities** - # - # Mode BigDecimal::EXCEPTION_INFINITY controls behavior when a BigDecimal - # Infinity or -Infinity is created. Settings: - # - # * `false` (default): Returns `BigDecimal('Infinity')` or - # `BigDecimal('-Infinity')`. - # * `true`: Raises FloatDomainError. - # - # Examples: - # - # BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0 - # BigDecimal('Infinity') # => Infinity - # BigDecimal('-Infinity') # => -Infinity - # BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, true) # => 1 - # BigDecimal('Infinity') # Raises FloatDomainError - # BigDecimal('-Infinity') # Raises FloatDomainError - # - # **Underflow** - # - # Mode BigDecimal::EXCEPTION_UNDERFLOW controls behavior when a BigDecimal - # underflow occurs. Settings: - # - # * `false` (default): Returns `BigDecimal('0')` or `BigDecimal('-Infinity')`. - # * `true`: Raises FloatDomainError. - # - # Examples: - # - # BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0 - # def flow_under - # x = BigDecimal('0.1') - # 100.times { x *= x } - # end - # flow_under # => 100 - # BigDecimal.mode(BigDecimal::EXCEPTION_UNDERFLOW, true) # => 4 - # flow_under # Raises FloatDomainError - # - # **Overflow** - # - # Mode BigDecimal::EXCEPTION_OVERFLOW controls behavior when a BigDecimal - # overflow occurs. Settings: - # - # * `false` (default): Returns `BigDecimal('Infinity')` or - # `BigDecimal('-Infinity')`. - # * `true`: Raises FloatDomainError. - # - # Examples: - # - # BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0 - # def flow_over - # x = BigDecimal('10') - # 100.times { x *= x } - # end - # flow_over # => 100 - # BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, true) # => 1 - # flow_over # Raises FloatDomainError - # - # **Zero Division** - # - # Mode BigDecimal::EXCEPTION_ZERODIVIDE controls behavior when a zero-division - # occurs. Settings: - # - # * `false` (default): Returns `BigDecimal('Infinity')` or - # `BigDecimal('-Infinity')`. - # * `true`: Raises FloatDomainError. - # - # Examples: - # - # BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0 - # one = BigDecimal('1') - # zero = BigDecimal('0') - # one / zero # => Infinity - # BigDecimal.mode(BigDecimal::EXCEPTION_ZERODIVIDE, true) # => 16 - # one / zero # Raises FloatDomainError - # - # **All Exceptions** - # - # Mode BigDecimal::EXCEPTION_ALL controls all of the above: - # - # BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0 - # BigDecimal.mode(BigDecimal::EXCEPTION_ALL, true) # => 23 - # - # **Rounding** - # - # Mode BigDecimal::ROUND_MODE controls the way rounding is to be performed; its - # `setting` values are: - # - # * `ROUND_UP`: Round away from zero. Aliased as `:up`. - # * `ROUND_DOWN`: Round toward zero. Aliased as `:down` and `:truncate`. - # * `ROUND_HALF_UP`: Round toward the nearest neighbor; if the neighbors are - # equidistant, round away from zero. Aliased as `:half_up` and `:default`. - # * `ROUND_HALF_DOWN`: Round toward the nearest neighbor; if the neighbors are - # equidistant, round toward zero. Aliased as `:half_down`. - # * `ROUND_HALF_EVEN` (Banker's rounding): Round toward the nearest neighbor; - # if the neighbors are equidistant, round toward the even neighbor. Aliased - # as `:half_even` and `:banker`. - # * `ROUND_CEILING`: Round toward positive infinity. Aliased as `:ceiling` and - # `:ceil`. - # * `ROUND_FLOOR`: Round toward negative infinity. Aliased as `:floor:`. - # - def self.mode: (round_mode, ?(round_mode_integer | round_mode_symbol)) -> Integer - | (Integer exception_mode, ?bool? setting) -> Integer - - # - # Execute the provided block, but preserve the exception mode - # - # BigDecimal.save_exception_mode do - # BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) - # BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) - # - # BigDecimal(BigDecimal('Infinity')) - # BigDecimal(BigDecimal('-Infinity')) - # BigDecimal(BigDecimal('NaN')) - # end - # - # For use with the BigDecimal::EXCEPTION_* - # - # See BigDecimal.mode - # - def self.save_exception_mode: () { (?nil) -> void } -> void - - # - # Execute the provided block, but preserve the precision limit - # - # BigDecimal.limit(100) - # puts BigDecimal.limit - # BigDecimal.save_limit do - # BigDecimal.limit(200) - # puts BigDecimal.limit - # end - # puts BigDecimal.limit - # - def self.save_limit: () { (?nil) -> void } -> void - - # - # Execute the provided block, but preserve the rounding mode - # - # BigDecimal.save_rounding_mode do - # BigDecimal.mode(BigDecimal::ROUND_MODE, :up) - # puts BigDecimal.mode(BigDecimal::ROUND_MODE) - # end - # - # For use with the BigDecimal::ROUND_* - # - # See BigDecimal.mode - # - def self.save_rounding_mode: () { (?nil) -> void } -> void - - # - # Returns the modulus from dividing by b. - # - # See BigDecimal#divmod. - # - def %: (real | BigDecimal) -> BigDecimal - - # - # - def *: (real | BigDecimal) -> BigDecimal - | (Complex) -> Complex - - # - # Returns the BigDecimal value of `self` raised to power `other`: - # - # b = BigDecimal('3.14') - # b ** 2 # => 0.98596e1 - # b ** 2.0 # => 0.98596e1 - # b ** Rational(2, 1) # => 0.98596e1 - # - # Related: BigDecimal#power. - # - def **: (real | BigDecimal) -> BigDecimal - | (Complex) -> Complex - - # - # Returns the BigDecimal sum of `self` and `value`: - # - # b = BigDecimal('111111.111') # => 0.111111111e6 - # b + 2 # => 0.111113111e6 - # b + 2.0 # => 0.111113111e6 - # b + Rational(2, 1) # => 0.111113111e6 - # b + Complex(2, 0) # => (0.111113111e6+0i) - # - # See the [Note About - # Precision](BigDecimal.html#class-BigDecimal-label-A+Note+About+Precision). - # - def +: (real | BigDecimal) -> BigDecimal - | (Complex) -> Complex - - # - # Returns `self`: - # - # +BigDecimal(5) # => 0.5e1 - # +BigDecimal(-5) # => -0.5e1 - # - def +@: () -> BigDecimal - - # - # Returns the BigDecimal difference of `self` and `value`: - # - # b = BigDecimal('333333.333') # => 0.333333333e6 - # b - 2 # => 0.333331333e6 - # b - 2.0 # => 0.333331333e6 - # b - Rational(2, 1) # => 0.333331333e6 - # b - Complex(2, 0) # => (0.333331333e6+0i) - # - # See the [Note About - # Precision](BigDecimal.html#class-BigDecimal-label-A+Note+About+Precision). - # - def -: (real | BigDecimal) -> BigDecimal - | (Complex) -> Complex - - # - # Returns the BigDecimal negation of self: - # - # b0 = BigDecimal('1.5') - # b1 = -b0 # => -0.15e1 - # b2 = -b1 # => 0.15e1 - # - def -@: () -> BigDecimal - - # - # Divide by the specified value. - # - # The result precision will be the precision of the larger operand, but its - # minimum is 2*Float::DIG. - # - # See BigDecimal#div. See BigDecimal#quo. - # - def /: (real | BigDecimal) -> BigDecimal - | (Complex) -> Complex - - # - # Returns `true` if `self` is less than `other`, `false` otherwise: - # - # b = BigDecimal('1.5') # => 0.15e1 - # b < 2 # => true - # b < 2.0 # => true - # b < Rational(2, 1) # => true - # b < 1.5 # => false - # - # Raises an exception if the comparison cannot be made. - # - def <: (real | BigDecimal) -> bool - - # - # Returns `true` if `self` is less or equal to than `other`, `false` otherwise: - # - # b = BigDecimal('1.5') # => 0.15e1 - # b <= 2 # => true - # b <= 2.0 # => true - # b <= Rational(2, 1) # => true - # b <= 1.5 # => true - # b < 1 # => false - # - # Raises an exception if the comparison cannot be made. - # - def <=: (real | BigDecimal) -> bool - - # - # The comparison operator. a <=> b is 0 if a == b, 1 if a > b, -1 if a < b. - # - def <=>: (untyped) -> Integer? - - # - # Tests for value equality; returns true if the values are equal. - # - # The == and === operators and the eql? method have the same implementation for - # BigDecimal. - # - # Values may be coerced to perform the comparison: - # - # BigDecimal('1.0') == 1.0 #=> true - # - def ==: (untyped) -> bool - - # - # Tests for value equality; returns true if the values are equal. - # - # The == and === operators and the eql? method have the same implementation for - # BigDecimal. - # - # Values may be coerced to perform the comparison: - # - # BigDecimal('1.0') == 1.0 #=> true - # - def ===: (untyped) -> bool - - # - # Returns `true` if `self` is greater than `other`, `false` otherwise: - # - # b = BigDecimal('1.5') - # b > 1 # => true - # b > 1.0 # => true - # b > Rational(1, 1) # => true - # b > 2 # => false - # - # Raises an exception if the comparison cannot be made. - # - def >: (real | BigDecimal) -> bool - - # - # Returns `true` if `self` is greater than or equal to `other`, `false` - # otherwise: - # - # b = BigDecimal('1.5') - # b >= 1 # => true - # b >= 1.0 # => true - # b >= Rational(1, 1) # => true - # b >= 1.5 # => true - # b > 2 # => false - # - # Raises an exception if the comparison cannot be made. - # - def >=: (real | BigDecimal) -> bool - - # - # Returns a string representing the marshalling of `self`. See module Marshal. - # - # inf = BigDecimal('Infinity') # => Infinity - # dumped = inf._dump # => "9:Infinity" - # BigDecimal._load(dumped) # => Infinity - # - def _dump: (?untyped) -> String - - # - # Returns the BigDecimal absolute value of `self`: - # - # BigDecimal('5').abs # => 0.5e1 - # BigDecimal('-3').abs # => 0.3e1 - # - def abs: () -> BigDecimal - - # - # Returns the BigDecimal sum of `self` and `value` with a precision of `ndigits` - # decimal digits. - # - # When `ndigits` is less than the number of significant digits in the sum, the - # sum is rounded to that number of digits, according to the current rounding - # mode; see BigDecimal.mode. - # - # Examples: - # - # # Set the rounding mode. - # BigDecimal.mode(BigDecimal::ROUND_MODE, :half_up) - # b = BigDecimal('111111.111') - # b.add(1, 0) # => 0.111112111e6 - # b.add(1, 3) # => 0.111e6 - # b.add(1, 6) # => 0.111112e6 - # b.add(1, 15) # => 0.111112111e6 - # b.add(1.0, 15) # => 0.111112111e6 - # b.add(Rational(1, 1), 15) # => 0.111112111e6 - # - def add: (real | BigDecimal value, Integer digits) -> BigDecimal - - # - # Return the smallest integer greater than or equal to the value, as a - # BigDecimal. - # - # BigDecimal('3.14159').ceil #=> 4 - # BigDecimal('-9.1').ceil #=> -9 - # - # If n is specified and positive, the fractional part of the result has no more - # than that many digits. - # - # If n is specified and negative, at least that many digits to the left of the - # decimal point will be 0 in the result. - # - # BigDecimal('3.14159').ceil(3) #=> 3.142 - # BigDecimal('13345.234').ceil(-2) #=> 13400.0 - # - def ceil: () -> Integer - | (int n) -> BigDecimal - - # - # - def clone: () -> self - - # - # The coerce method provides support for Ruby type coercion. It is not enabled - # by default. - # - # This means that binary operations like + * / or - can often be performed on a - # BigDecimal and an object of another type, if the other object can be coerced - # into a BigDecimal value. - # - # e.g. - # a = BigDecimal("1.0") - # b = a / 2.0 #=> 0.5 - # - # Note that coercing a String to a BigDecimal is not supported by default; it - # requires a special compile-time option when building Ruby. - # - def coerce: (Numeric) -> [ BigDecimal, BigDecimal ] - - # - # Divide by the specified value. - # - # digits - # : If specified and less than the number of significant digits of the result, - # the result is rounded to that number of digits, according to - # BigDecimal.mode. - # - # If digits is 0, the result is the same as for the / operator or #quo. - # - # If digits is not specified, the result is an integer, by analogy with - # Float#div; see also BigDecimal#divmod. - # - # - # See BigDecimal#/. See BigDecimal#quo. - # - # Examples: - # - # a = BigDecimal("4") - # b = BigDecimal("3") - # - # a.div(b, 3) # => 0.133e1 - # - # a.div(b, 0) # => 0.1333333333333333333e1 - # a / b # => 0.1333333333333333333e1 - # a.quo(b) # => 0.1333333333333333333e1 - # - # a.div(b) # => 1 - # - def div: (real | BigDecimal value) -> Integer - | (real | BigDecimal value, int digits) -> BigDecimal - - # - # Divides by the specified value, and returns the quotient and modulus as - # BigDecimal numbers. The quotient is rounded towards negative infinity. - # - # For example: - # - # require 'bigdecimal' - # - # a = BigDecimal("42") - # b = BigDecimal("9") - # - # q, m = a.divmod(b) - # - # c = q * b + m - # - # a == c #=> true - # - # The quotient q is (a/b).floor, and the modulus is the amount that must be - # added to q * b to get a. - # - def divmod: (real | BigDecimal) -> [ Integer, BigDecimal ] - - # - # - def dup: () -> self - - # - # Tests for value equality; returns true if the values are equal. - # - # The == and === operators and the eql? method have the same implementation for - # BigDecimal. - # - # Values may be coerced to perform the comparison: - # - # BigDecimal('1.0') == 1.0 #=> true - # - def eql?: (untyped) -> bool - - # - # Returns the exponent of the BigDecimal number, as an Integer. - # - # If the number can be represented as 0.xxxxxx*10**n where xxxxxx is a string of - # digits with no leading zeros, then n is the exponent. - # - def exponent: () -> Integer - - # - # Returns True if the value is finite (not NaN or infinite). - # - def finite?: () -> bool - - # - # Return the integer part of the number, as a BigDecimal. - # - def fix: () -> BigDecimal - - # - # Return the largest integer less than or equal to the value, as a BigDecimal. - # - # BigDecimal('3.14159').floor #=> 3 - # BigDecimal('-9.1').floor #=> -10 - # - # If n is specified and positive, the fractional part of the result has no more - # than that many digits. - # - # If n is specified and negative, at least that many digits to the left of the - # decimal point will be 0 in the result. - # - # BigDecimal('3.14159').floor(3) #=> 3.141 - # BigDecimal('13345.234').floor(-2) #=> 13300.0 - # - def floor: () -> Integer - | (int n) -> BigDecimal - - # - # Return the fractional part of the number, as a BigDecimal. - # - def frac: () -> BigDecimal - - # - # Returns the integer hash value for `self`. - # - # Two instances of BigDecimal have the same hash value if and only if they have - # equal: - # - # * Sign. - # * Fractional part. - # * Exponent. - # - def hash: () -> Integer - - # - # Returns nil, -1, or +1 depending on whether the value is finite, -Infinity, or - # +Infinity. - # - def infinite?: () -> Integer? - - # - # Returns a string representation of self. - # - # BigDecimal("1234.5678").inspect - # #=> "0.12345678e4" - # - def inspect: () -> String - - # - # Returns the modulus from dividing by b. - # - # See BigDecimal#divmod. - # - def modulo: (real | BigDecimal b) -> BigDecimal - - # - # Returns the BigDecimal product of `self` and `value` with a precision of - # `ndigits` decimal digits. - # - # When `ndigits` is less than the number of significant digits in the sum, the - # sum is rounded to that number of digits, according to the current rounding - # mode; see BigDecimal.mode. - # - # Examples: - # - # # Set the rounding mode. - # BigDecimal.mode(BigDecimal::ROUND_MODE, :half_up) - # b = BigDecimal('555555.555') - # b.mult(3, 0) # => 0.1666666665e7 - # b.mult(3, 3) # => 0.167e7 - # b.mult(3, 6) # => 0.166667e7 - # b.mult(3, 15) # => 0.1666666665e7 - # b.mult(3.0, 0) # => 0.1666666665e7 - # b.mult(Rational(3, 1), 0) # => 0.1666666665e7 - # b.mult(Complex(3, 0), 0) # => (0.1666666665e7+0.0i) - # - def mult: (real | BigDecimal value, int digits) -> BigDecimal - - # - # Returns True if the value is Not a Number. - # - def nan?: () -> bool - - # - # Returns self if the value is non-zero, nil otherwise. - # - def nonzero?: () -> self? - - # - # Returns the value raised to the power of n. - # - # Also available as the operator **. - # - def power: (real | BigDecimal n, ?int prec) -> BigDecimal - - # - # Divide by the specified value. - # - # digits - # : If specified and less than the number of significant digits of the result, - # the result is rounded to the given number of digits, according to the - # rounding mode indicated by BigDecimal.mode. - # - # If digits is 0 or omitted, the result is the same as for the / operator. - # - # - # See BigDecimal#/. See BigDecimal#div. - # - def quo: (real | BigDecimal) -> BigDecimal - | (Complex) -> Complex - - # - # Returns the remainder from dividing by the value. - # - # x.remainder(y) means x-y*(x/y).truncate - # - def remainder: (real | BigDecimal) -> BigDecimal - - # - # Round to the nearest integer (by default), returning the result as a - # BigDecimal if n is specified, or as an Integer if it isn't. - # - # BigDecimal('3.14159').round #=> 3 - # BigDecimal('8.7').round #=> 9 - # BigDecimal('-9.9').round #=> -10 - # - # BigDecimal('3.14159').round(2).class.name #=> "BigDecimal" - # BigDecimal('3.14159').round.class.name #=> "Integer" - # - # If n is specified and positive, the fractional part of the result has no more - # than that many digits. - # - # If n is specified and negative, at least that many digits to the left of the - # decimal point will be 0 in the result, and return value will be an Integer. - # - # BigDecimal('3.14159').round(3) #=> 3.142 - # BigDecimal('13345.234').round(-2) #=> 13300 - # - # The value of the optional mode argument can be used to determine how rounding - # is performed; see BigDecimal.mode. - # - def round: () -> Integer - | (int n) -> (Integer | BigDecimal) - | (int n, round_mode_integer | round_mode_symbol) -> BigDecimal - | (?int n, half: :up | :down | :even) -> BigDecimal - - # - # Returns the sign of the value. - # - # Returns a positive value if > 0, a negative value if < 0. It behaves the same - # with zeros - it returns a positive value for a positive zero (BigDecimal('0')) - # and a negative value for a negative zero (BigDecimal('-0')). - # - # The specific value returned indicates the type and sign of the BigDecimal, as - # follows: - # - # BigDecimal::SIGN_NaN - # : value is Not a Number - # - # BigDecimal::SIGN_POSITIVE_ZERO - # : value is +0 - # - # BigDecimal::SIGN_NEGATIVE_ZERO - # : value is -0 - # - # BigDecimal::SIGN_POSITIVE_INFINITE - # : value is +Infinity - # - # BigDecimal::SIGN_NEGATIVE_INFINITE - # : value is -Infinity - # - # BigDecimal::SIGN_POSITIVE_FINITE - # : value is positive - # - # BigDecimal::SIGN_NEGATIVE_FINITE - # : value is negative - # - def sign: () -> Integer - - # - # Splits a BigDecimal number into four parts, returned as an array of values. - # - # The first value represents the sign of the BigDecimal, and is -1 or 1, or 0 if - # the BigDecimal is Not a Number. - # - # The second value is a string representing the significant digits of the - # BigDecimal, with no leading zeros. - # - # The third value is the base used for arithmetic (currently always 10) as an - # Integer. - # - # The fourth value is an Integer exponent. - # - # If the BigDecimal can be represented as 0.xxxxxx*10**n, then xxxxxx is the - # string of significant digits with no leading zeros, and n is the exponent. - # - # From these values, you can translate a BigDecimal to a float as follows: - # - # sign, significant_digits, base, exponent = a.split - # f = sign * "0.#{significant_digits}".to_f * (base ** exponent) - # - # (Note that the to_f method is provided as a more convenient way to translate a - # BigDecimal to a Float.) - # - def split: () -> [ Integer, String, Integer, Integer ] - - # - # Returns the square root of the value. - # - # Result has at least prec significant digits. - # - def sqrt: (int n) -> BigDecimal - - # - # Subtract the specified value. - # - # e.g. - # c = a.sub(b,n) - # - # digits - # : If specified and less than the number of significant digits of the result, - # the result is rounded to that number of digits, according to - # BigDecimal.mode. - # - def sub: (real | BigDecimal value, int digits) -> BigDecimal - - # - # Returns a new Float object having approximately the same value as the - # BigDecimal number. Normal accuracy limits and built-in errors of binary Float - # arithmetic apply. - # - def to_f: () -> Float - - # - # Returns the value as an Integer. - # - # If the BigDecimal is infinity or NaN, raises FloatDomainError. - # - def to_i: () -> Integer - - # - # Returns the value as an Integer. - # - # If the BigDecimal is infinity or NaN, raises FloatDomainError. - # - def to_int: () -> Integer - - # - # Converts a BigDecimal to a Rational. - # - def to_r: () -> Rational - - # - # Converts the value to a string. - # - # The default format looks like 0.xxxxEnn. - # - # The optional parameter s consists of either an integer; or an optional '+' or - # ' ', followed by an optional number, followed by an optional 'E' or 'F'. - # - # If there is a '+' at the start of s, positive values are returned with a - # leading '+'. - # - # A space at the start of s returns positive values with a leading space. - # - # If s contains a number, a space is inserted after each group of that many - # digits, starting from '.' and counting outwards. - # - # If s ends with an 'E', engineering notation (0.xxxxEnn) is used. - # - # If s ends with an 'F', conventional floating point notation is used. - # - # Examples: - # - # BigDecimal('-1234567890123.45678901234567890').to_s('5F') - # #=> '-123 45678 90123.45678 90123 45678 9' - # - # BigDecimal('1234567890123.45678901234567890').to_s('+8F') - # #=> '+12345 67890123.45678901 23456789' - # - # BigDecimal('1234567890123.45678901234567890').to_s(' F') - # #=> ' 1234567890123.4567890123456789' - # - def to_s: (?String | int s) -> String - - # - # Truncate to the nearest integer (by default), returning the result as a - # BigDecimal. - # - # BigDecimal('3.14159').truncate #=> 3 - # BigDecimal('8.7').truncate #=> 8 - # BigDecimal('-9.9').truncate #=> -9 - # - # If n is specified and positive, the fractional part of the result has no more - # than that many digits. - # - # If n is specified and negative, at least that many digits to the left of the - # decimal point will be 0 in the result. - # - # BigDecimal('3.14159').truncate(3) #=> 3.141 - # BigDecimal('13345.234').truncate(-2) #=> 13300.0 - # - def truncate: () -> Integer - | (int n) -> BigDecimal - - # - # Returns True if the value is zero. - # - def zero?: () -> bool - - private - - def initialize_copy: (self) -> self - - # - # Base value used in internal calculations. On a 32 bit system, BASE is 10000, - # indicating that calculation is done in groups of 4 digits. (If it were larger, - # BASE**2 wouldn't fit in 32 bits, so you couldn't guarantee that two groups - # could always be multiplied together without overflow.) - # - BASE: Integer - - # - # Determines whether overflow, underflow or zero divide result in an exception - # being thrown. See BigDecimal.mode. - # - EXCEPTION_ALL: Integer - - # - # Determines what happens when the result of a computation is infinity. See - # BigDecimal.mode. - # - EXCEPTION_INFINITY: Integer - - # - # Determines what happens when the result of a computation is not a number - # (NaN). See BigDecimal.mode. - # - EXCEPTION_NaN: Integer - - # - # Determines what happens when the result of a computation is an overflow (a - # result too large to be represented). See BigDecimal.mode. - # - EXCEPTION_OVERFLOW: Integer - - # - # Determines what happens when the result of a computation is an underflow (a - # result too small to be represented). See BigDecimal.mode. - # - EXCEPTION_UNDERFLOW: Integer - - # - # Determines what happens when a division by zero is performed. See - # BigDecimal.mode. - # - EXCEPTION_ZERODIVIDE: Integer - - # - # Special value constants - # - INFINITY: BigDecimal - - NAN: BigDecimal - - # - # Round towards +Infinity. See BigDecimal.mode. - # - ROUND_CEILING: Integer - - # - # Indicates that values should be rounded towards zero. See BigDecimal.mode. - # - ROUND_DOWN: Integer - - # - # Round towards -Infinity. See BigDecimal.mode. - # - ROUND_FLOOR: Integer - - # - # Indicates that digits >= 6 should be rounded up, others rounded down. See - # BigDecimal.mode. - # - ROUND_HALF_DOWN: Integer - - # - # Round towards the even neighbor. See BigDecimal.mode. - # - ROUND_HALF_EVEN: Integer - - # - # Indicates that digits >= 5 should be rounded up, others rounded down. See - # BigDecimal.mode. - # - ROUND_HALF_UP: Integer - - # - # Determines what happens when a result must be rounded in order to fit in the - # appropriate number of significant digits. See BigDecimal.mode. - # - ROUND_MODE: round_mode - - # - # Indicates that values should be rounded away from zero. See BigDecimal.mode. - # - ROUND_UP: Integer - - # - # Indicates that a value is negative and finite. See BigDecimal.sign. - # - SIGN_NEGATIVE_FINITE: Integer - - # - # Indicates that a value is negative and infinite. See BigDecimal.sign. - # - SIGN_NEGATIVE_INFINITE: Integer - - # - # Indicates that a value is -0. See BigDecimal.sign. - # - SIGN_NEGATIVE_ZERO: Integer - - # - # Indicates that a value is not a number. See BigDecimal.sign. - # - SIGN_NaN: Integer - - # - # Indicates that a value is positive and finite. See BigDecimal.sign. - # - SIGN_POSITIVE_FINITE: Integer - - # - # Indicates that a value is positive and infinite. See BigDecimal.sign. - # - SIGN_POSITIVE_INFINITE: Integer - - # - # Indicates that a value is +0. See BigDecimal.sign. - # - SIGN_POSITIVE_ZERO: Integer - - # - # The version of bigdecimal library - # - VERSION: String -end - -%a{annotate:rdoc:skip} -module Kernel - private - - # - # Returns the BigDecimal converted from `value` with a precision of `ndigits` - # decimal digits. - # - # When `ndigits` is less than the number of significant digits in the value, the - # result is rounded to that number of digits, according to the current rounding - # mode; see BigDecimal.mode. - # - # When `ndigits` is 0, the number of digits to correctly represent a float - # number is determined automatically. - # - # Returns `value` converted to a BigDecimal, depending on the type of `value`: - # - # * Integer, Float, Rational, Complex, or BigDecimal: converted directly: - # - # # Integer, Complex, or BigDecimal value does not require ndigits; ignored if given. - # BigDecimal(2) # => 0.2e1 - # BigDecimal(Complex(2, 0)) # => 0.2e1 - # BigDecimal(BigDecimal(2)) # => 0.2e1 - # # Float or Rational value requires ndigits. - # BigDecimal(2.0, 0) # => 0.2e1 - # BigDecimal(Rational(2, 1), 0) # => 0.2e1 - # - # * String: converted by parsing if it contains an integer or floating-point - # literal; leading and trailing whitespace is ignored: - # - # # String does not require ndigits; ignored if given. - # BigDecimal('2') # => 0.2e1 - # BigDecimal('2.0') # => 0.2e1 - # BigDecimal('0.2e1') # => 0.2e1 - # BigDecimal(' 2.0 ') # => 0.2e1 - # - # * Other type that responds to method `:to_str`: first converted to a string, - # then converted to a BigDecimal, as above. - # - # * Other type: - # - # * Raises an exception if keyword argument `exception` is `true`. - # * Returns `nil` if keyword argument `exception` is `false`. - # - # Raises an exception if `value` evaluates to a Float and `digits` is larger - # than Float::DIG + 1. - # - def self?.BigDecimal: (real | string | BigDecimal initial, ?int digits, ?exception: true) -> BigDecimal - | (real | string | BigDecimal initial, ?int digits, exception: bool) -> BigDecimal? - | (untyped initial, ?untyped digits, ?exception: bool) -> BigDecimal? -end - -%a{annotate:rdoc:skip} -class Integer - # - # Performs division; for integer `numeric`, truncates the result to an integer: - # - # 4 / 3 # => 1 - # 4 / -3 # => -2 - # -4 / 3 # => -2 - # -4 / -3 # => 1 - # - # For other +numeric+, returns non-integer result: - # - # 4 / 3.0 # => 1.3333333333333333 - # 4 / Rational(3, 1) # => (4/3) - # 4 / Complex(3, 0) # => ((4/3)+0i) - # - def /: (BigDecimal) -> BigDecimal - | ... - - # - # Performs multiplication: - # - # 4 * 2 # => 8 - # 4 * -2 # => -8 - # -4 * 2 # => -8 - # 4 * 2.0 # => 8.0 - # 4 * Rational(1, 3) # => (4/3) - # 4 * Complex(2, 0) # => (8+0i) - # - def *: (BigDecimal) -> BigDecimal - | ... - - # - # Performs addition: - # - # 2 + 2 # => 4 - # -2 + 2 # => 0 - # -2 + -2 # => -4 - # 2 + 2.0 # => 4.0 - # 2 + Rational(2, 1) # => (4/1) - # 2 + Complex(2, 0) # => (4+0i) - # - def +: (BigDecimal) -> BigDecimal - | ... - - # - # Performs subtraction: - # - # 4 - 2 # => 2 - # -4 - 2 # => -6 - # -4 - -2 # => -2 - # 4 - 2.0 # => 2.0 - # 4 - Rational(2, 1) # => (2/1) - # 4 - Complex(2, 0) # => (2+0i) - # - def -: (BigDecimal) -> BigDecimal - | ... -end - -%a{annotate:rdoc:skip} -class Float - # - # Returns a new Float which is the result of dividing `self` by `other`: - # - # f = 3.14 - # f / 2 # => 1.57 - # f / 2.0 # => 1.57 - # f / Rational(2, 1) # => 1.57 - # f / Complex(2, 0) # => (1.57+0.0i) - # - def /: (BigDecimal) -> BigDecimal - | ... - - # - # Returns a new Float which is the product of `self` and `other`: - # - # f = 3.14 - # f * 2 # => 6.28 - # f * 2.0 # => 6.28 - # f * Rational(1, 2) # => 1.57 - # f * Complex(2, 0) # => (6.28+0.0i) - # - def *: (BigDecimal) -> BigDecimal - | ... - - # - # Returns a new Float which is the sum of `self` and `other`: - # - # f = 3.14 - # f + 1 # => 4.140000000000001 - # f + 1.0 # => 4.140000000000001 - # f + Rational(1, 1) # => 4.140000000000001 - # f + Complex(1, 0) # => (4.140000000000001+0i) - # - def +: (BigDecimal) -> BigDecimal - | ... - - # - # Returns a new Float which is the difference of `self` and `other`: - # - # f = 3.14 - # f - 1 # => 2.14 - # f - 1.0 # => 2.14 - # f - Rational(1, 1) # => 2.14 - # f - Complex(1, 0) # => (2.14+0i) - # - def -: (BigDecimal) -> BigDecimal - | ... -end - -%a{annotate:rdoc:skip} -class Rational - # - # Performs division. - # - # Rational(2, 3) / Rational(2, 3) #=> (1/1) - # Rational(900) / Rational(1) #=> (900/1) - # Rational(-2, 9) / Rational(-9, 2) #=> (4/81) - # Rational(9, 8) / 4 #=> (9/32) - # Rational(20, 9) / 9.8 #=> 0.22675736961451246 - # - def /: (BigDecimal) -> BigDecimal - | ... - - # - # Performs multiplication. - # - # Rational(2, 3) * Rational(2, 3) #=> (4/9) - # Rational(900) * Rational(1) #=> (900/1) - # Rational(-2, 9) * Rational(-9, 2) #=> (1/1) - # Rational(9, 8) * 4 #=> (9/2) - # Rational(20, 9) * 9.8 #=> 21.77777777777778 - # - def *: (BigDecimal) -> BigDecimal - | ... - - # - # Performs addition. - # - # Rational(2, 3) + Rational(2, 3) #=> (4/3) - # Rational(900) + Rational(1) #=> (901/1) - # Rational(-2, 9) + Rational(-9, 2) #=> (-85/18) - # Rational(9, 8) + 4 #=> (41/8) - # Rational(20, 9) + 9.8 #=> 12.022222222222222 - # - def +: (BigDecimal) -> BigDecimal - | ... - - # - # Performs subtraction. - # - # Rational(2, 3) - Rational(2, 3) #=> (0/1) - # Rational(900) - Rational(1) #=> (899/1) - # Rational(-2, 9) - Rational(-9, 2) #=> (77/18) - # Rational(9, 8) - 4 #=> (-23/8) - # Rational(20, 9) - 9.8 #=> -7.577777777777778 - # - def -: (BigDecimal) -> BigDecimal - | ... -end - -%a{annotate:rdoc:skip} -class Complex - # - # Returns the quotient of `self` and `numeric`: - # - # Complex.rect(2, 3) / Complex.rect(2, 3) # => (1+0i) - # Complex.rect(900) / Complex.rect(1) # => (900+0i) - # Complex.rect(-2, 9) / Complex.rect(-9, 2) # => ((36/85)-(77/85)*i) - # Complex.rect(9, 8) / 4 # => ((9/4)+2i) - # Complex.rect(20, 9) / 9.8 # => (2.0408163265306123+0.9183673469387754i) - # - def /: (BigDecimal) -> Complex - | ... - - # - # Returns the product of `self` and `numeric`: - # - # Complex.rect(2, 3) * Complex.rect(2, 3) # => (-5+12i) - # Complex.rect(900) * Complex.rect(1) # => (900+0i) - # Complex.rect(-2, 9) * Complex.rect(-9, 2) # => (0-85i) - # Complex.rect(9, 8) * 4 # => (36+32i) - # Complex.rect(20, 9) * 9.8 # => (196.0+88.2i) - # - def *: (BigDecimal) -> Complex - | ... - - # - # Returns the sum of `self` and `numeric`: - # - # Complex.rect(2, 3) + Complex.rect(2, 3) # => (4+6i) - # Complex.rect(900) + Complex.rect(1) # => (901+0i) - # Complex.rect(-2, 9) + Complex.rect(-9, 2) # => (-11+11i) - # Complex.rect(9, 8) + 4 # => (13+8i) - # Complex.rect(20, 9) + 9.8 # => (29.8+9i) - # - def +: (BigDecimal) -> Complex - | ... - - # - # Returns the difference of `self` and `numeric`: - # - # Complex.rect(2, 3) - Complex.rect(2, 3) # => (0+0i) - # Complex.rect(900) - Complex.rect(1) # => (899+0i) - # Complex.rect(-2, 9) - Complex.rect(-9, 2) # => (7+7i) - # Complex.rect(9, 8) - 4 # => (5+8i) - # Complex.rect(20, 9) - 9.8 # => (10.2+9i) - # - def -: (BigDecimal) -> Complex - | ... -end diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/sig/big_decimal_util.rbs b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/sig/big_decimal_util.rbs deleted file mode 100644 index 4c5bfce..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/sig/big_decimal_util.rbs +++ /dev/null @@ -1,158 +0,0 @@ -%a{annotate:rdoc:skip} -class Integer - # - # Returns the value of `int` as a BigDecimal. - # - # require 'bigdecimal' - # require 'bigdecimal/util' - # - # 42.to_d # => 0.42e2 - # - # See also Kernel.BigDecimal. - # - def to_d: () -> BigDecimal -end - -%a{annotate:rdoc:skip} -class Float - # - # Returns the value of `float` as a BigDecimal. The `precision` parameter is - # used to determine the number of significant digits for the result. When - # `precision` is set to `0`, the number of digits to represent the float being - # converted is determined automatically. The default `precision` is `0`. - # - # require 'bigdecimal' - # require 'bigdecimal/util' - # - # 0.5.to_d # => 0.5e0 - # 1.234.to_d # => 0.1234e1 - # 1.234.to_d(2) # => 0.12e1 - # - # See also Kernel.BigDecimal. - # - def to_d: (?Integer precision) -> BigDecimal -end - -%a{annotate:rdoc:skip} -class String - # - # Returns the result of interpreting leading characters in `str` as a - # BigDecimal. - # - # require 'bigdecimal' - # require 'bigdecimal/util' - # - # "0.5".to_d # => 0.5e0 - # "123.45e1".to_d # => 0.12345e4 - # "45.67 degrees".to_d # => 0.4567e2 - # - # See also Kernel.BigDecimal. - # - def to_d: () -> BigDecimal -end - -%a{annotate:rdoc:skip} -class BigDecimal - # - # Converts a BigDecimal to a String of the form "nnnnnn.mmm". This method is - # deprecated; use BigDecimal#to_s("F") instead. - # - # require 'bigdecimal/util' - # - # d = BigDecimal("3.14") - # d.to_digits # => "3.14" - # - def to_digits: () -> String - - # - # Returns self. - # - # require 'bigdecimal/util' - # - # d = BigDecimal("3.14") - # d.to_d # => 0.314e1 - # - def to_d: () -> BigDecimal -end - -%a{annotate:rdoc:skip} -class Rational - # - # Returns the value as a BigDecimal. - # - # The `precision` parameter is used to determine the number of significant - # digits for the result. When `precision` is set to `0`, the number of digits to - # represent the float being converted is determined automatically. The default - # `precision` is `0`. - # - # require 'bigdecimal' - # require 'bigdecimal/util' - # - # Rational(22, 7).to_d(3) # => 0.314e1 - # - # See also Kernel.BigDecimal. - # - def to_d: (Integer precision) -> BigDecimal -end - -%a{annotate:rdoc:skip} -class Complex - # - # Returns the value as a BigDecimal. If the imaginary part is not `0`, an error - # is raised - # - # The `precision` parameter is used to determine the number of significant - # digits for the result. When `precision` is set to `0`, the number of digits to - # represent the float being converted is determined automatically. The default - # `precision` is `0`. - # - # require 'bigdecimal' - # require 'bigdecimal/util' - # - # Complex(0.1234567, 0).to_d(4) # => 0.1235e0 - # Complex(Rational(22, 7), 0).to_d(3) # => 0.314e1 - # Complex(1, 1).to_d # raises ArgumentError - # - # See also Kernel.BigDecimal. - # - def to_d: (*untyped args) -> BigDecimal -end - -%a{annotate:rdoc:skip} -class NilClass - # - # Returns nil represented as a BigDecimal. - # - # require 'bigdecimal' - # require 'bigdecimal/util' - # - # nil.to_d # => 0.0 - # - def to_d: () -> BigDecimal -end diff --git a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/sig/big_math.rbs b/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/sig/big_math.rbs deleted file mode 100644 index 6d9fc48..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/bigdecimal-4.1.3/sig/big_math.rbs +++ /dev/null @@ -1,423 +0,0 @@ -# -# Core BigMath methods for BigDecimal (log, exp) are defined here. Other methods -# (sin, cos, atan) are defined in 'bigdecimal/math.rb'. -# -# -# Provides mathematical functions. -# -# Example: -# -# require "bigdecimal/math" -# -# include BigMath -# -# a = BigDecimal((PI(49)/2).to_s) -# puts sin(a,100) # => 0.9999999999...9999999986e0 -# -module BigMath - # - # Computes e (the base of natural logarithms) to the specified number of digits - # of precision, `numeric`. - # - # BigMath.E(32).to_s - # #=> "0.27182818284590452353602874713527e1" - # - def self?.E: (int prec) -> BigDecimal - - # - # Computes the value of pi to the specified number of digits of precision, - # `numeric`. - # - # BigMath.PI(32).to_s - # #=> "0.31415926535897932384626433832795e1" - # - def self?.PI: (int prec) -> BigDecimal - - # - # Computes the arccosine of `decimal` to the specified number of digits of - # precision, `numeric`. - # - # If `decimal` is NaN, returns NaN. - # - # BigMath.acos(BigDecimal('0.5'), 32).to_s - # #=> "0.10471975511965977461542144610932e1" - # - def self?.acos: (real | BigDecimal, int prec) -> BigDecimal - - # - # Computes the inverse hyperbolic cosine of `decimal` to the specified number of - # digits of precision, `numeric`. - # - # If `decimal` is NaN, returns NaN. - # - # BigMath.acosh(BigDecimal('2'), 32).to_s - # #=> "0.1316957896924816708625046347308e1" - # - def self?.acosh: (real | BigDecimal, int prec) -> BigDecimal - - # - # Computes the arcsine of `decimal` to the specified number of digits of - # precision, `numeric`. - # - # If `decimal` is NaN, returns NaN. - # - # BigMath.asin(BigDecimal('0.5'), 32).to_s - # #=> "0.52359877559829887307710723054658e0" - # - def self?.asin: (real | BigDecimal, int prec) -> BigDecimal - - # - # Computes the inverse hyperbolic sine of `decimal` to the specified number of - # digits of precision, `numeric`. - # - # If `decimal` is NaN, returns NaN. - # - # BigMath.asinh(BigDecimal('1'), 32).to_s - # #=> "0.88137358701954302523260932497979e0" - # - def self?.asinh: (real | BigDecimal, int prec) -> BigDecimal - - # - # Computes the arctangent of `decimal` to the specified number of digits of - # precision, `numeric`. - # - # If `decimal` is NaN, returns NaN. - # - # BigMath.atan(BigDecimal('-1'), 32).to_s - # #=> "-0.78539816339744830961566084581988e0" - # - def self?.atan: (real | BigDecimal x, int prec) -> BigDecimal - - # - # Computes the arctangent of y and x to the specified number of digits of - # precision, `numeric`. - # - # BigMath.atan2(BigDecimal('-1'), BigDecimal('1'), 32).to_s - # #=> "-0.78539816339744830961566084581988e0" - # - def self?.atan2: (real | BigDecimal, real | BigDecimal, int prec) -> BigDecimal - - # - # Computes the inverse hyperbolic tangent of `decimal` to the specified number - # of digits of precision, `numeric`. - # - # If `decimal` is NaN, returns NaN. - # - # BigMath.atanh(BigDecimal('0.5'), 32).to_s - # #=> "0.54930614433405484569762261846126e0" - # - def self?.atanh: (real | BigDecimal, int prec) -> BigDecimal - - # - # Computes the cube root of `decimal` to the specified number of digits of - # precision, `numeric`. - # - # BigMath.cbrt(BigDecimal('2'), 32).to_s - # #=> "0.12599210498948731647672106072782e1" - # - def self?.cbrt: (real | BigDecimal, int prec) -> BigDecimal - - # - # Computes the cosine of `decimal` to the specified number of digits of - # precision, `numeric`. - # - # If `decimal` is Infinity or NaN, returns NaN. - # - # BigMath.cos(BigMath.PI(16), 32).to_s - # #=> "-0.99999999999999999999999999999997e0" - # - def self?.cos: (real | BigDecimal x, int prec) -> BigDecimal - - # - # Computes the hyperbolic cosine of `decimal` to the specified number of digits - # of precision, `numeric`. - # - # If `decimal` is NaN, returns NaN. - # - # BigMath.cosh(BigDecimal('1'), 32).to_s - # #=> "0.15430806348152437784779056207571e1" - # - def self?.cosh: (real | BigDecimal, int prec) -> BigDecimal - - # - # Computes the error function of `decimal` to the specified number of digits of - # precision, `numeric`. - # - # If `decimal` is NaN, returns NaN. - # - # BigMath.erf(BigDecimal('1'), 32).to_s - # #=> "0.84270079294971486934122063508261e0" - # - def self?.erf: (real | BigDecimal, int prec) -> BigDecimal - - # - # Computes the complementary error function of `decimal` to the specified number - # of digits of precision, `numeric`. - # - # If `decimal` is NaN, returns NaN. - # - # BigMath.erfc(BigDecimal('10'), 32).to_s - # #=> "0.20884875837625447570007862949578e-44" - # - def self?.erfc: (real | BigDecimal, int prec) -> BigDecimal - - # - # Computes the value of e (the base of natural logarithms) raised to the power - # of `decimal`, to the specified number of digits of precision. - # - # If `decimal` is infinity, returns Infinity. - # - # If `decimal` is NaN, returns NaN. - # - def self?.exp: (real | BigDecimal, int prec) -> BigDecimal - - # - # Computes exp(decimal) - 1 to the specified number of digits of precision, - # `numeric`. - # - # BigMath.expm1(BigDecimal('0.1'), 32).to_s - # #=> "0.10517091807564762481170782649025e0" - # - def self?.expm1: (real | BigDecimal, int prec) -> BigDecimal - - # - # Decomposes `x` into a normalized fraction and an integral power of ten. - # - # BigMath.frexp(BigDecimal(123.456)) - # #=> [0.123456e0, 3] - # - def self?.frexp: (real | BigDecimal x) -> [ BigDecimal, Integer ] - - # - # Computes the gamma function of `decimal` to the specified number of digits of - # precision, `numeric`. - # - # BigMath.gamma(BigDecimal('0.5'), 32).to_s - # #=> "0.17724538509055160272981674833411e1" - # - def self?.gamma: (real | BigDecimal, int prec) -> BigDecimal - - # - # Returns sqrt(x**2 + y**2) to the specified number of digits of precision, - # `numeric`. - # - # BigMath.hypot(BigDecimal('1'), BigDecimal('2'), 32).to_s - # #=> "0.22360679774997896964091736687313e1" - # - def self?.hypot: (real | BigDecimal, real | BigDecimal, int prec) -> BigDecimal - - # - # Inverse of `frexp`. Returns the value of fraction * 10**exponent. - # - # BigMath.ldexp(BigDecimal("0.123456e0"), 3) - # #=> 0.123456e3 - # - def self?.ldexp: (real | BigDecimal fraction, Integer exponent) -> BigDecimal - - # - # Computes the natural logarithm of the absolute value of the gamma function of - # `decimal` to the specified number of digits of precision, `numeric` and its - # sign. - # - # BigMath.lgamma(BigDecimal('0.5'), 32) - # #=> [0.57236494292470008707171367567653e0, 1] - # - def self?.lgamma: (real | BigDecimal, int prec) -> [ BigDecimal, Integer ] - - # - # Computes the natural logarithm of `decimal` to the specified number of digits - # of precision, `numeric`. - # - # If `decimal` is zero or negative, raises Math::DomainError. - # - # If `decimal` is positive infinity, returns Infinity. - # - # If `decimal` is NaN, returns NaN. - # - def self?.log: (real | BigDecimal, int prec) -> BigDecimal - - # - # Computes the base 10 logarithm of `decimal` to the specified number of digits - # of precision, `numeric`. - # - # If `decimal` is zero or negative, raises Math::DomainError. - # - # If `decimal` is positive infinity, returns Infinity. - # - # If `decimal` is NaN, returns NaN. - # - # BigMath.log10(BigDecimal('3'), 32).to_s - # #=> "0.47712125471966243729502790325512e0" - # - def self?.log10: (real | BigDecimal, int prec) -> BigDecimal - - # - # Computes log(1 + decimal) to the specified number of digits of precision, - # `numeric`. - # - # BigMath.log1p(BigDecimal('0.1'), 32).to_s - # #=> "0.95310179804324860043952123280765e-1" - # - def self?.log1p: (real | BigDecimal, int prec) -> BigDecimal - - # - # Computes the base 2 logarithm of `decimal` to the specified number of digits - # of precision, `numeric`. - # - # If `decimal` is zero or negative, raises Math::DomainError. - # - # If `decimal` is positive infinity, returns Infinity. - # - # If `decimal` is NaN, returns NaN. - # - # BigMath.log2(BigDecimal('3'), 32).to_s - # #=> "0.15849625007211561814537389439478e1" - # - def self?.log2: (real | BigDecimal, int prec) -> BigDecimal - - # - # Computes the sine of `decimal` to the specified number of digits of precision, - # `numeric`. - # - # If `decimal` is Infinity or NaN, returns NaN. - # - # BigMath.sin(BigMath.PI(5)/4, 32).to_s - # #=> "0.70710807985947359435812921837984e0" - # - def self?.sin: (real | BigDecimal x, int prec) -> BigDecimal - - # - # Computes the hyperbolic sine of `decimal` to the specified number of digits of - # precision, `numeric`. - # - # If `decimal` is NaN, returns NaN. - # - # BigMath.sinh(BigDecimal('1'), 32).to_s - # #=> "0.11752011936438014568823818505956e1" - # - def self?.sinh: (real | BigDecimal, int prec) -> BigDecimal - - # - # Computes the square root of `decimal` to the specified number of digits of - # precision, `numeric`. - # - # BigMath.sqrt(BigDecimal('2'), 32).to_s - # #=> "0.14142135623730950488016887242097e1" - # - def self?.sqrt: (real | BigDecimal x, int prec) -> BigDecimal - - # - # Computes the tangent of `decimal` to the specified number of digits of - # precision, `numeric`. - # - # If `decimal` is Infinity or NaN, returns NaN. - # - # BigMath.tan(BigDecimal("0.0"), 4).to_s - # #=> "0.0" - # - # BigMath.tan(BigMath.PI(24) / 4, 32).to_s - # #=> "0.99999999999999999999999830836025e0" - # - def self?.tan: (real | BigDecimal x, int prec) -> BigDecimal - - # - # Computes the hyperbolic tangent of `decimal` to the specified number of digits - # of precision, `numeric`. - # - # If `decimal` is NaN, returns NaN. - # - # BigMath.tanh(BigDecimal('1'), 32).to_s - # #=> "0.76159415595576488811945828260479e0" - # - def self?.tanh: (real | BigDecimal, int prec) -> BigDecimal -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.github/workflows/ci.yml b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.github/workflows/ci.yml deleted file mode 100644 index 54e1f05..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.github/workflows/ci.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: ci - -on: - pull_request: - - push: - branches: - - master - - '*-stable' - -jobs: - ci: - name: Ruby ${{ matrix.ruby.name }} - - runs-on: ubuntu-20.04 - - strategy: - fail-fast: false - - matrix: - ruby: - - { name: "2.3", value: 2.3.8 } - - { name: "2.4", value: 2.4.10 } - - { name: "2.5", value: 2.5.9 } - - { name: "2.6", value: 2.6.9 } - - { name: "2.7", value: 2.7.5 } - - { name: "3.0", value: 3.0.3 } - - { name: "3.1", value: 3.1.0 } - - steps: - - uses: actions/checkout@v2 - - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby.value }} - bundler-cache: true - - - name: Run Test - run: bundle exec rake spec - - - name: Test & publish code coverage - uses: paambaati/codeclimate-action@v3.0.0 - env: - CC_TEST_REPORTER_ID: 46c8b29dd6711f35704e7c5a541486cbbf2cff8b2df8ce755bfc09917d3c1cbb diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.gitignore b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.gitignore deleted file mode 100644 index 001d28f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -*.gem -*.rbc -.bundle -.config -.yardoc -InstalledFiles -_yardoc -coverage -doc/ -lib/bundler/man -pkg -rdoc -spec/reports -test/tmp -test/version_tmp -tmp -.idea diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.kick b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.kick deleted file mode 100644 index 0686cce..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.kick +++ /dev/null @@ -1,30 +0,0 @@ -recipe :ruby - -Kicker::Recipes::Ruby.runner_bin = 'bundle exec bacon --quiet' - -process do |files| - specs = files.take_and_map do |file| - if file =~ %r{lib/[^/]*/(.+?)\.rb$} - s = Dir.glob("spec/**/#{File.basename(file, '.rb')}_spec.rb") - s.uniq unless s.empty? - end - end - Kicker::Recipes::Ruby.run_tests(specs) -end - -# Have written this so many times, probably should make a recipe out of it. -process do |files| - files.each do |file| - case file - when 'Gemfile' - files.delete(file) - execute 'bundle install' - end - end -end - -recipe :ignore -ignore(/.*\/?tags/) -ignore(/.*\/?\.git/) -ignore(/^tmp/) - diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.rubocop.yml b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.rubocop.yml deleted file mode 100644 index 3ef9f69..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.rubocop.yml +++ /dev/null @@ -1,6 +0,0 @@ -require: - - rubocop-performance - -inherit_from: - - .rubocop_todo.yml - - .rubocop_cocoapods.yml diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.rubocop_cocoapods.yml b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.rubocop_cocoapods.yml deleted file mode 100644 index 4702a3e..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.rubocop_cocoapods.yml +++ /dev/null @@ -1,151 +0,0 @@ -AllCops: - Include: - - ./Rakefile - - ./Gemfile - - ./*.gemspec - Exclude: - - ./spec/fixtures/**/* - - ./vendor/bundle/**/* - -# At the moment not ready to be used -# https://github.com/bbatsov/rubocop/issues/947 -Style/Documentation: - Enabled: false - -#- CocoaPods -----------------------------------------------------------------# - -# We adopted raise instead of fail. -Style/SignalException: - EnforcedStyle: only_raise - -# They are idiomatic -Lint/AssignmentInCondition: - Enabled: false - -# Allow backticks -Style/AsciiComments: - Enabled: false - -# Indentation clarifies logic branches in implementations -Style/IfUnlessModifier: - Enabled: false - -# No enforced convention here. -Style/SingleLineBlockParams: - Enabled: false - -# We only add the comment when needed. -Style/Encoding: - Enabled: false - -# Having these make it easier to *not* forget to add one when adding a new -# value and you can simply copy the previous line. -Style/TrailingCommaInArguments: - EnforcedStyleForMultiline: comma - -Style/TrailingCommaInArrayLiteral: - EnforcedStyleForMultiline: comma - -Style/TrailingCommaInHashLiteral: - EnforcedStyleForMultiline: comma - -Layout/MultilineOperationIndentation: - EnforcedStyle: indented - -# Clashes with CLAide Command#validate! -Style/GuardClause: - Enabled: false - -# Not always desirable: lib/claide/command/plugins_helper.rb:12:15 -Style/Next: - Enabled: false - -# Arbitrary max lengths for classes simply do not work and enabling this will -# lead to a never ending stream of annoyance and changes. -Metrics/ClassLength: - Enabled: false - -# Arbitrary max lengths for modules simply do not work and enabling this will -# lead to a never ending stream of annoyance and changes. -Metrics/ModuleLength: - Enabled: false - -# Arbitrary max lengths for methods simply do not work and enabling this will -# lead to a never ending stream of annoyance and changes. -Metrics/MethodLength: - Enabled: false - -# No enforced convention here. -Metrics/BlockNesting: - Enabled: false - -# It will be obvious which code is complex, Rubocop should only lint simple -# rules for us. -Metrics/AbcSize: - Enabled: false - -# It will be obvious which code is complex, Rubocop should only lint simple -# rules for us. -Metrics/CyclomaticComplexity: - Enabled: false - -# It will be obvious which code is complex, Rubocop should only lint simple -# rules for us. -Metrics/PerceivedComplexity: - Enabled: false - -#- CocoaPods support for Ruby 1.8.7 ------------------------------------------# - -Style/HashSyntax: - EnforcedStyle: hash_rockets - -Style/Lambda: - Enabled: false - -Layout/DotPosition: - EnforcedStyle: trailing - -Style/EachWithObject: - Enabled: false - -Style/SpecialGlobalVars: - Enabled: false - -#- CocoaPods specs -----------------------------------------------------------# - -# Allow for `should.match /regexp/`. -Lint/AmbiguousRegexpLiteral: - Exclude: - - spec/**/* - -Performance/RedundantMatch: - Exclude: - - spec/**/* - -# Allow `object.should == object` syntax. -Lint/Void: - Exclude: - - spec/**/* - -Style/ClassAndModuleChildren: - Exclude: - - spec/**/* - -Lint/UselessComparison: - Exclude: - - spec/**/* - -Lint/RaiseException: - Enabled: false - -Lint/StructNewOverride: - Enabled: false - -Style/HashEachMethods: - Enabled: false - -Style/HashTransformKeys: - Enabled: false - -Style/HashTransformValues: - Enabled: false diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.rubocop_todo.yml b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.rubocop_todo.yml deleted file mode 100644 index 926b32c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.rubocop_todo.yml +++ /dev/null @@ -1,70 +0,0 @@ -# This configuration was generated by -# `rubocop --auto-gen-config` -# on 2016-03-09 18:40:14 -0600 using RuboCop version 0.38.0. -# The point is for the user to remove these configuration records -# one by one as the offenses are removed from the code base. -# Note that changes in the inspected code, or installation of new -# versions of RuboCop, may require this file to be generated again. - -# Offense count: 3 -Lint/IneffectiveAccessModifier: - Exclude: - - 'lib/claide/command.rb' - -# Offense count: 1 -# Cop supports --auto-correct. -Lint/RedundantCopDisableDirective: - Exclude: - - 'spec/command/banner_spec.rb' - -# Offense count: 1 -Performance/FixedSize: - Exclude: - - 'lib/claide/command/banner.rb' - -# Offense count: 1 -# Cop supports --auto-correct. -Performance/StringReplacement: - Exclude: - - 'lib/claide/command/banner.rb' - -# Offense count: 8 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles. -# SupportedStyles: prefer_alias, prefer_alias_method -Style/Alias: - Exclude: - - 'lib/claide/argument.rb' - - 'lib/claide/command.rb' - -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: SingleLineConditionsOnly. -Style/ConditionalAssignment: - Exclude: - - 'lib/claide/command/banner.rb' - -# Offense count: 1 -Style/IfInsideElse: - Exclude: - - 'lib/claide/command.rb' - -# Offense count: 9 -# Cop supports --auto-correct. -Style/MutableConstant: - Exclude: - - 'lib/claide/ansi.rb' - - 'lib/claide/argument.rb' - - 'lib/claide/command.rb' - -# Offense count: 1 -# Cop supports --auto-correct. -Style/ParallelAssignment: - Exclude: - - 'lib/claide/command/argument_suggester.rb' - -# Offense count: 1 -# Cop supports --auto-correct. -Style/RedundantInterpolation: - Exclude: - - 'lib/claide/command/argument_suggester.rb' diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.yardopts b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.yardopts deleted file mode 100644 index a647564..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/.yardopts +++ /dev/null @@ -1 +0,0 @@ ---markup markdown --protected --charset=utf-8 lib diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/CHANGELOG.md b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/CHANGELOG.md deleted file mode 100644 index 2fd0d62..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/CHANGELOG.md +++ /dev/null @@ -1,265 +0,0 @@ -# CLAide Changelog - -## 1.1.0 (2022-01-12) - -##### Enhancements - -* None. - -##### Bug Fixes - -* None. - - -## 1.0.3 (2019-08-02) - -##### Enhancements - -* None. - -##### Bug Fixes - -* Correctly handle `--help` flags when using `argv.remainder!` after initialization - [Eric Amorde](https://github.com/amorde), - [tripleCC](https://github.com/tripleCC) - [#87](https://github.com/CocoaPods/CLAide/pull/87) - - -## 1.0.2 (2017-06-06) - -##### Enhancements - -* None. - -##### Bug Fixes - -* Avoid a method redefinition warning when requiring `claide`. - [Samuel Giddins](https://github.com/segiddins) - - -## 1.0.1 (2016-10-10) - -##### Bug Fixes - -* Adds a fix for older versions of Rubygems when CLAide crashes. - [Samuel Giddins](https://github.com/segiddins) - [#73](https://github.com/CocoaPods/CLAide/issues/73) - - -## 1.0.0 (2016-05-10) - -##### Enhancements - -* None. - -##### Bug Fixes - -* None. - - -## 1.0.0.rc.1 (2016-04-30) - -##### Enhancements - -* None. - -##### Bug Fixes - -* Fix circular require of `claide/ansi` in `claide/ansi/string_escaper`. - [bootstraponline](https://github.com/bootstraponline) - [#66](https://github.com/CocoaPods/CLAide/issues/66) - - -## 1.0.0.beta.3 (2016-03-15) - -##### Enhancements - -* Added `Command.option` to easily add a single option to a command class. - [Samuel Giddins](https://github.com/segiddins) - [#64](https://github.com/CocoaPods/CLAide/issues/64) - -##### Bug Fixes - -* None. - - -## 1.0.0.beta.2 (2016-03-08) - -##### Bug Fixes - -* Attempt to get the terminal width without shelling out to `tput`. - [Samuel Giddins](https://github.com/segiddins) - - -## 1.0.0.beta.1 (2015-12-30) - -##### Bug Fixes - -* The plugin manager will now properly activate plugin gems, ensuring all of - their files are requirable. - [Samuel Giddins](https://github.com/segiddins) - - -## 0.9.1 (2015-07-05) - -##### Bug Fixes - -* Fix a regression when contradictory flags were given in `ARGV` -- the last - flag given will once again be the value returned, and all entries for that key - are removed. - [Samuel Giddins](https://github.com/segiddins) - - -## 0.9.0 (2015-07-02) - -##### Enhancements - -* Properly parse everything in `ARGV` after `--` as an argument. - [Samuel Giddins](https://github.com/segiddins) - [#48](https://github.com/CocoaPods/CLAide/issues/48) - -* Allow parsing an option that occurs multiple times. - [Samuel Giddins](https://github.com/segiddins) - - -## 0.8.2 (2015-06-27) - -##### Enhancements - -* Add `ARGV#remainder!`, which returns all the remaining arguments, deleting - them from the receiver. - [Samuel Giddins](https://github.com/segiddins) - - -## 0.8.1 (2015-02-25) - -###### Bug Fixes - -* Silence errors while loading plugins. - [Clément Beffa](https://github.com/cl3m) - [#44](https://github.com/CocoaPods/CLAide/issues/44) - - -## 0.8.0 (2014-12-25) - -###### Breaking - -* Removes the `ShellCompletionHelper` along with completion script for ZSH. This is out of the scope of CLAide. - [Eloy Durán](https://github.com/alloy) - [#43](https://github.com/CocoaPods/CLAide/issues/43) - -* Various refactoring replacing “Helper” API’s which specialised classes such as ArgumentSuggester, TextWrapper and PluginManager. - [Eloy Durán](https://github.com/alloy) - -###### Enhancements - -* Added convenience method to invoke commands more easily. - [Olivier Halligon](https://github.com/AliSoftware) - [#33](https://github.com/CocoaPods/CLAide/issues/40) - -* Changes to the PluginManager to handle multiple plugin prefixes, which by default adds the `clad` plugin prefix. - [Eloy Durán](https://github.com/alloy) - -## 0.7.0 (2014-09-11) - -###### Breaking - -* Plugins are now expected to include the `cocoapods-plugin.rb` file in - `./lib`. - [Fabio Pelosin](https://github.com/fabiopelosin) - [#28](https://github.com/CocoaPods/CLAide/pull/28) - -###### Enhancements - -* Improved messages for exceptions generated by plugins. - [Fabio Pelosin](https://github.com/fabiopelosin) - [#28](https://github.com/CocoaPods/CLAide/pull/28) - -* Use the Argument class to describe arguments. - [Olivier Halligon](https://github.com/AliSoftware) - [#33](https://github.com/CocoaPods/CLAide/issues/33) - -* Support for argument alternatives and repeatable arguments (ellipsis). - [Olivier Halligon](https://github.com/AliSoftware) - [#33](https://github.com/CocoaPods/CLAide/issues/33) - -* No stack trace if --help and --vebose are combined. - [Marius Rackwitz](https://github.com/mrackwitz) - [#36](https://github.com/CocoaPods/CLAide/issues/36) - - -## 0.6.1 (2014-05-20) - -###### Bug Fixes - -* Respect the ANSI flag for the help banner. - [Fabio Pelosin](https://github.com/fabiopelosin) - [#34](https://github.com/CocoaPods/CLAide/issues/34) - -* Underline the colon of the titles of the help banner. - [Fabio Pelosin](https://github.com/fabiopelosin) - -## 0.6.0 (2014-05-19) - -###### Enhancements - -* Use an array to describe arguments. - [Fabio Pelosin][fabiopelosin] - [#26](https://github.com/CocoaPods/CLAide/issues/26) - -* Improved layout and contents of help banner - [Fabio Pelosin](https://github.com/fabiopelosin) - [#25](https://github.com/CocoaPods/CLAide/pull/25) - -* Colorize option, arguments, and example commands in the help banner. - [Fabio Pelosin](https://github.com/fabiopelosin) - [#12](https://github.com/CocoaPods/CLAide/issues/12) - -* Add support for ANSI escape sequences. - [Fabio Pelosin](https://github.com/fabiopelosin) - [#17](https://github.com/CocoaPods/CLAide/issues/17) - [#20](https://github.com/CocoaPods/CLAide/pull/20) - [#24](https://github.com/CocoaPods/CLAide/pull/24) - -* Add support for completion script - [Fabio Pelosin](https://github.com/fabiopelosin) - [#19](https://github.com/CocoaPods/CLAide/pull/19) - -* Add support for version logic via the introduction of the `version` class - attribute to the `CLAide::Commmand` class. If a value for the attribute is - specified the `--version` flag is added. The `--version --verbose` flags - include the version of the plugins in the output. - [Fabio Pelosin](https://github.com/fabiopelosin) - [#13](https://github.com/CocoaPods/CLAide/issues/13) - [#14](https://github.com/CocoaPods/CLAide/issues/14) - -## 0.5.0 (2014-03-26) - -###### Enhancements - -* Add a `ignore_in_command_lookup` option to commands, which makes it possible - to have anonymous command classes that are or only meant to provide common - functionality, but are otherwise completely ignored during parsing, command - lookup, and help banner printing. - [Eloy Durán](https://github.com/alloy) - -* Deprecate the `color` option in favor of `ansi`. This is more abstract and - can be used for commands that only prettify output by using, for instance, - the bold ANSI code. This applies to the `CLAide` APIs as well. - [Eloy Durán](https://github.com/alloy) - -* Add more hooks that allow the user to customize how to prettify output. - [Eloy Durán](https://github.com/alloy) - -* Word wrap option descriptions to terminal width. - [Eloy Durán](https://github.com/alloy) - [#6](https://github.com/CocoaPods/CLAide/issues/6) - - -## 0.4.0 (2013-11-14) - -###### Enhancements - -* Added support for plugins. - [Les Hill](https://github.com/leshill) - [#1](https://github.com/CocoaPods/CLAide/pull/1) diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/Gemfile b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/Gemfile deleted file mode 100644 index c33e9bc..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/Gemfile +++ /dev/null @@ -1,22 +0,0 @@ -source 'https://rubygems.org' - -gemspec - -gem 'rake' - -group :development do - gem 'kicker' - gem 'colored' # for examples -end - -group :spec do - gem 'bacon' - gem 'json', '< 3' - gem 'mocha-on-bacon' - gem 'prettybacon' - - gem 'parallel', '<= 1.19.2' - gem 'rubocop', '<= 0.81.0' - gem 'rubocop-performance', '<= 1.5.2', :require => nil - gem 'simplecov' -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/LICENSE b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/LICENSE deleted file mode 100644 index 7c1df53..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) 2011 - 2012 Eloy Durán -Copyright (c) 2012 Fabio Pelosin - -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/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/README.md b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/README.md deleted file mode 100644 index f4ed63d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/README.md +++ /dev/null @@ -1,115 +0,0 @@ -# Hi, I’m Claide, your command-line tool aide. - -[![Build Status](https://img.shields.io/github/workflow/status/CocoaPods/claide/ci)](https://github.com/CocoaPods/claide/actions) -[![Gem Version](https://img.shields.io/gem/v/claide)](https://rubygems.org/gems/claide) - -I was born out of a need for a _simple_ option and command parser, while still -providing an API that allows you to quickly create a full featured command-line -interface. - -## Install - -``` -$ [sudo] gem install claide -``` - - -## Usage - -For full documentation, on the API of CLAide, visit [rubydoc.info][docs]. - - -### Argument handling - -At its core, a library, such as myself, needs to parse the parameters specified -by the user. - -Working with parameters is done through the `CLAide::ARGV` class. It takes an -array of parameters and parses them as either flags, options, or arguments. - -| Parameter | Description | -| :---: | :---: | -| `--milk`, `--no-milk` | A boolean ‘flag’, which may be negated. | -| `--sweetener=honey` | An ‘option’ consists of a key, a ‘=’, and a value. | -| `tea` | An ‘argument’ is just a value. | - - -Accessing flags, options, and arguments, with the following methods, will also -remove the parameter from the remaining unprocessed parameters. - -```ruby -argv = CLAide::ARGV.new(['tea', '--no-milk', '--sweetener=honey']) -argv.shift_argument # => 'tea' -argv.shift_argument # => nil -argv.flag?('milk') # => false -argv.flag?('milk') # => nil -argv.option('sweetener') # => 'honey' -argv.option('sweetener') # => nil -``` - - -In case the requested flag or option is not present, `nil` is returned. You can -specify a default value to be used as the optional second method parameter: - -```ruby -argv = CLAide::ARGV.new(['tea']) -argv.flag?('milk', true) # => true -argv.option('sweetener', 'sugar') # => 'sugar' -``` - - -Unlike flags and options, accessing all of the arguments can be done in either -a preserving or mutating way: - -```ruby -argv = CLAide::ARGV.new(['tea', 'coffee']) -argv.arguments # => ['tea', 'coffee'] -argv.arguments! # => ['tea', 'coffee'] -argv.arguments # => [] -``` - - -### Command handling - -Commands are actions that a tool can perform. Every command is represented by -its own command class. - -Commands may be nested, in which case they inherit from the ‘super command’ -class. Some of these nested commands may not actually perform any work -themselves, but are rather used as ‘super commands’ _only_, in which case they -are ‘abtract commands’. - -Running commands is typically done through the `CLAide::Command.run(argv)` -method, which performs the following three steps: - -1. Parses the given parameters, finds the command class matching the parameters, - and instantiates it with the remaining parameters. It’s each nested command - class’ responsibility to remove the parameters it handles from the remaining - parameters, _before_ calling the `super` implementation. - -2. Asks the command instance to validate its parameters, but only _after_ - calling the `super` implementation. The `super` implementation will show a - help banner in case the `--help` flag is specified, not all parameters were - removed from the parameter list, or the command is an abstract command. - -3. Calls the `run` method on the command instance, where it may do its work. - -4. Catches _any_ uncaught exception and shows it to user in a meaningful way. - * A `Help` exception triggers a help banner to be shown for the command. - * A exception that includes the `InformativeError` module will show _only_ - the message, unless disabled with the `--verbose` flag; and in red, - depending on the color configuration. - * Any other type of exception will be passed to `Command.report_error(error)` - for custom error reporting (such as the one in [CocoaPods][report-error]). - -In case you want to call commands from _inside_ other commands, you should use -the `CLAide::Command.parse(argv)` method to retrieve an instance of the command -and call `run` on it. Unless you are using user-supplied parameters, there -should not be a need to validate the parameters. - -See the [example][example] for a illustration of how to define commands. - - -[docs]: http://www.rubydoc.info/github/CocoaPods/CLAide/index -[example]: https://github.com/CocoaPods/CLAide/blob/master/examples/make.rb -[report-error]: https://github.com/CocoaPods/CocoaPods/blob/054fe5c861d932219ec40a91c0439a7cfc3a420c/lib/cocoapods/command.rb#L36 diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/Rakefile b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/Rakefile deleted file mode 100644 index dc22070..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/Rakefile +++ /dev/null @@ -1,57 +0,0 @@ -# encoding: utf-8 - -#-- Bootstrap --------------------------------------------------------------# - -desc 'Initializes your working copy to run the specs' -task :bootstrap do - if system('which bundle') - title 'Installing gems' - sh 'bundle install' - else - $stderr.puts "\033[0;31m" \ - "[!] Please install the bundler gem manually:\n" \ - ' $ [sudo] gem install bundler' \ - "\e[0m" - exit 1 - end -end - -begin - require 'bundler/gem_tasks' - task :default => :spec - - #-- Specs ------------------------------------------------------------------# - - desc 'Run specs' - task :spec do - title 'Running Unit Tests' - files = FileList['spec/**/*_spec.rb'].shuffle.join(' ') - sh "bundle exec bacon #{files}" - - Rake::Task['rubocop'].invoke - end - - #-- Rubocop ----------------------------------------------------------------# - - desc 'Check code against RuboCop rules' - task :rubocop do - sh 'bundle exec rubocop' - end - -rescue LoadError - $stderr.puts "\033[0;31m" \ - '[!] Some Rake tasks haven been disabled because the environment' \ - ' couldn’t be loaded. Be sure to run `rake bootstrap` first.' \ - "\e[0m" -end - -#-- Helpers ------------------------------------------------------------------# - -def title(title) - cyan_title = "\033[0;36m#{title}\033[0m" - puts - puts '-' * 80 - puts cyan_title - puts '-' * 80 - puts -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/claide.gemspec b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/claide.gemspec deleted file mode 100644 index 1f298d3..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/claide.gemspec +++ /dev/null @@ -1,23 +0,0 @@ -# -*- encoding: utf-8 -*- -$:.unshift File.expand_path('../lib', __FILE__) -require File.expand_path('../lib/claide/gem_version', __FILE__) - -Gem::Specification.new do |s| - s.name = "claide" - s.version = CLAide::VERSION - s.license = "MIT" - s.email = ["eloy.de.enige@gmail.com", "fabiopelosin@gmail.com"] - s.homepage = "https://github.com/CocoaPods/CLAide" - s.authors = ["Eloy Duran", "Fabio Pelosin"] - - s.summary = "A small command-line interface framework." - - s.files = `git ls-files -z`.split("\0").reject { |f| f =~ /\A(spec|examples)/i } - - ## Make sure you can build the gem on older versions of RubyGems too: - s.rubygems_version = "1.6.2" - s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= - s.specification_version = 3 if s.respond_to? :specification_version - - s.required_ruby_version = ">= 2.3.0" -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide.rb b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide.rb deleted file mode 100644 index 25d2c75..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide.rb +++ /dev/null @@ -1,13 +0,0 @@ -# encoding: utf-8 - -# The mods of interest are {CLAide::ARGV}, {CLAide::Command}, and -# {CLAide::InformativeError} -# -module CLAide - require 'claide/ansi' - require 'claide/argument' - require 'claide/argv' - require 'claide/command' - require 'claide/help' - require 'claide/informative_error' -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/ansi.rb b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/ansi.rb deleted file mode 100644 index 0839ed6..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/ansi.rb +++ /dev/null @@ -1,126 +0,0 @@ -# encoding: utf-8 - -require 'claide/ansi/cursor' -require 'claide/ansi/graphics' - -module CLAide - # Provides support for ANSI Escape sequences - # - # For more information see: - # - # - http://ascii-table.com/ansi-escape-sequences.php - # - http://en.wikipedia.org/wiki/ANSI_escape_code - # - # This functionality has been inspired and derived from the following gems: - # - # - colored - # - colorize - # - class ANSI - extend Cursor - extend Graphics - - class << self - # @return [Bool] Wether the string mixin should be disabled to return the - # original string. This method is intended to offer a central location - # where to disable ANSI logic without needed to implement conditionals - # across the code base of clients. - # - # @example - # - # "example".ansi.yellow #=> "\e[33mexample\e[39m" - # ANSI.disabled = true - # "example".ansi.yellow #=> "example" - # - attr_accessor :disabled - end - - # @return [Hash{Symbol => Fixnum}] The text attributes codes by their - # English name. - # - TEXT_ATTRIBUTES = { - :bold => 1, - :underline => 4, - :blink => 5, - :reverse => 7, - :hidden => 8, - } - - # @return [Hash{Symbol => Fixnum}] The codes to disable a text attribute by - # their name. - # - TEXT_DISABLE_ATTRIBUTES = { - :bold => 21, - :underline => 24, - :blink => 25, - :reverse => 27, - :hidden => 28, - } - - # Return [String] The escape sequence to reset the graphics. - # - RESET_SEQUENCE = "\e[0m" - - # @return [Hash{Symbol => Fixnum}] The colors codes by their English name. - # - COLORS = { - :black => 0, - :red => 1, - :green => 2, - :yellow => 3, - :blue => 4, - :magenta => 5, - :cyan => 6, - :white => 7, - } - - # Return [String] The escape sequence for the default foreground color. - # - DEFAULT_FOREGROUND_COLOR = "\e[39m" - - # Return [String] The escape sequence for the default background color. - # - DEFAULT_BACKGROUND_COLOR = "\e[49m" - - # @return [Fixnum] The code of a key given the map. - # - # @param [Symbol] key - # The key for which the code is needed. - # - # @param [Hash{Symbol => Fixnum}] map - # A hash which associates each code to each key. - # - # @raise If the key is not provided. - # @raise If the key is not present in the map. - # - def self.code_for_key(key, map) - unless key - raise ArgumentError, 'A key must be provided' - end - code = map[key] - unless code - raise ArgumentError, "Unsupported key: `#{key}`" - end - code - end - end -end - -#-- String mixin -------------------------------------------------------------# - -require 'claide/ansi/string_escaper' - -class String - # @return [StringEscaper] An object which provides convenience methods to - # wrap the receiver in ANSI sequences. - # - # @example - # - # "example".ansi.yellow #=> "\e[33mexample\e[39m" - # "example".ansi.on_red #=> "\e[41mexample\e[49m" - # "example".ansi.bold #=> "\e[1mexample\e[21m" - # - def ansi - CLAide::ANSI::StringEscaper.new(self) - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/ansi/cursor.rb b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/ansi/cursor.rb deleted file mode 100644 index acfd5b6..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/ansi/cursor.rb +++ /dev/null @@ -1,69 +0,0 @@ -# encoding: utf-8 - -module CLAide - class ANSI - # Provides support for generating escape sequences relative to the position - # of the cursor and to erase parts of text. - # - module Cursor - # @return [String] The escape sequence to set the cursor at the - # given line. - # - # @param [Fixnum] line - # The line where to place the cursor. - # - # @param [Fixnum] column - # The column where to place the cursor. - # - def self.set_cursor_position(line = 0, column = 0) - "\e[#{line};#{column}H" - end - - # @return [String] The escape sequence to set the cursor at the - # given line. - # - # @param [Fixnum] lines - # The amount of lines the cursor should be moved to. - # Negative values indicate up direction and positive ones - # down direction. - # - # @param [Fixnum] columns - # The amount of columns the cursor should be moved to. - # Negative values indicate left direction and positive ones - # right direction. - # - def self.move_cursor(lines, columns = 0) - lines_code = lines < 0 ? 'A' : 'B' - columns_code = columns > 0 ? 'C' : 'D' - "\e[#{lines.abs}#{lines_code};#{columns.abs}#{columns_code}" - end - - # @return [String] The escape sequence to save the cursor position. - # - def self.save_cursor_position - "\e[s" - end - - # @return [String] The escape sequence to restore the cursor to the - # previously saved position. This sequence also clears all the - # output after the position. - # - def self.restore_cursor_position - "\e[u" - end - - # @return [String] The escape sequence to erase the display. - # - def self.erase_display - "\e[2J" - end - - # @return [String] The escape sequence to erase a line form the - # cursor position to then end. - # - def self.erase_line - "\e[K" - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/ansi/graphics.rb b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/ansi/graphics.rb deleted file mode 100644 index e5c2d15..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/ansi/graphics.rb +++ /dev/null @@ -1,72 +0,0 @@ -# encoding: utf-8 - -module CLAide - class ANSI - # Provides support for generating escape sequences relative to the graphic - # mode. - # - module Graphics - # @return [String] The escape sequence for a text attribute. - # - # @param [Symbol] key - # The name of the text attribute. - # - def self.text_attribute(key) - code = ANSI.code_for_key(key, TEXT_ATTRIBUTES) - graphics_mode(code) - end - - # @return [String] The escape sequence for a foreground color. - # - # @param [Symbol] key - # The name of the color. - # - def self.foreground_color(key) - code = ANSI.code_for_key(key, COLORS) + 30 - graphics_mode(code) - end - - # @return [String] The escape sequence for a background color. - # - # @param [Symbol] key - # The name of the color. - # - def self.background_color(key) - code = ANSI.code_for_key(key, COLORS) + 40 - graphics_mode(code) - end - - # @return [String] The escape sequence for a foreground color using the - # xterm-256 format. - # - # @param [Fixnum] color - # The value of the color. - # - def self.foreground_color_256(color) - code = [38, 5, color] - graphics_mode(code) - end - - # @return [String] The escape sequence for a background color using the - # xterm-256 format. - # - # @param [Fixnum] color - # The value of the color. - # - def self.background_color_256(color) - code = [48, 5, color] - graphics_mode(code) - end - - # @return [String] The escape sequence for a single or a list of codes. - # - # @param [Fixnum, Array] codes - # The code(s). - # - def self.graphics_mode(codes) - codes = Array(codes) - "\e[#{codes.join(';')}m" - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/ansi/string_escaper.rb b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/ansi/string_escaper.rb deleted file mode 100644 index b6f461c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/ansi/string_escaper.rb +++ /dev/null @@ -1,79 +0,0 @@ -module CLAide - class ANSI - # Provides support to wrap strings in ANSI sequences according to the - # `ANSI.disabled` setting. - # - class StringEscaper < String - # @param [String] string The string to wrap. - # - def initialize(string) - super - end - - # @return [StringEscaper] Wraps a string in the given ANSI sequences, - # taking care of handling existing sequences for the same - # family of attributes (i.e. attributes terminated by the - # same sequence). - # - def wrap_in_ansi_sequence(open, close) - if ANSI.disabled - self - else - gsub!(close, open) - insert(0, open).insert(-1, close) - end - end - - # @return [StringEscaper] - # - # @param [Array] keys - # One or more keys corresponding to ANSI codes to apply to the - # string. - # - def apply(*keys) - keys.flatten.each do |key| - send(key) - end - self - end - - ANSI::COLORS.each_key do |key| - # Defines a method returns a copy of the receiver wrapped in an ANSI - # sequence for each foreground color (e.g. #blue). - # - # The methods handle nesting of ANSI sequences. - # - define_method key do - open = Graphics.foreground_color(key) - close = ANSI::DEFAULT_FOREGROUND_COLOR - wrap_in_ansi_sequence(open, close) - end - - # Defines a method returns a copy of the receiver wrapped in an ANSI - # sequence for each background color (e.g. #on_blue). - # - # The methods handle nesting of ANSI sequences. - # - define_method "on_#{key}" do - open = Graphics.background_color(key) - close = ANSI::DEFAULT_BACKGROUND_COLOR - wrap_in_ansi_sequence(open, close) - end - end - - ANSI::TEXT_ATTRIBUTES.each_key do |key| - # Defines a method returns a copy of the receiver wrapped in an ANSI - # sequence for each text attribute (e.g. #bold). - # - # The methods handle nesting of ANSI sequences. - # - define_method key do - open = Graphics.text_attribute(key) - close_code = TEXT_DISABLE_ATTRIBUTES[key] - close = Graphics.graphics_mode(close_code) - wrap_in_ansi_sequence(open, close) - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/argument.rb b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/argument.rb deleted file mode 100644 index 4d54f29..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/argument.rb +++ /dev/null @@ -1,62 +0,0 @@ -# encoding: utf-8 - -module CLAide - # This class is used to represent individual arguments to present to - # the command help banner - # - class Argument - # The string used for ellipsis / repeatable arguments in the banner - # - ELLIPSIS = '...' - - # @return [Array] - # List of alternate names for the parameters - attr_reader :names - - # @return [Boolean] - # Indicates if the argument is required (not optional) - # - attr_accessor :required - alias_method :required?, :required - - # @return [Boolean] - # Indicates if the argument is repeatable (= can appear multiple - # times in the command, which is indicated by '...' in the banner) - # - attr_accessor :repeatable - alias_method :repeatable?, :repeatable - - # @param [String,Array] names - # List of the names of each parameter alternatives. - # For convenience, if there is only one alternative for that - # parameter, we can use a String instead of a 1-item Array - # - # @param [Boolean] required - # true if the parameter is required, false if it is optional - # - # @param [Boolean] repeatable - # If true, the argument can appear multiple times in the command. - # In that case, an ellipsis will be appended after the argument - # in the help banner. - # - # @example - # - # # A required parameter that can be either a NAME or URL - # Argument.new(%(NAME URL), true) - # - def initialize(names, required, repeatable = false) - @names = Array(names) - @required = required - @repeatable = repeatable - end - - # @return [Boolean] true on equality - # - # @param [Argument] other the Argument compared against - # - def ==(other) - other.is_a?(Argument) && - names == other.names && required == other.required - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/argv.rb b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/argv.rb deleted file mode 100644 index ecadfaf..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/argv.rb +++ /dev/null @@ -1,329 +0,0 @@ -# encoding: utf-8 - -module CLAide - # This class is responsible for parsing the parameters specified by the user, - # accessing individual parameters, and keep state by removing handled - # parameters. - # - class ARGV - # @return [ARGV] Coerces an object to the ARGV class if needed. - # - # @param [Object] argv - # The object which should be converted to the ARGV class. - # - def self.coerce(argv) - if argv.is_a?(ARGV) - argv - else - ARGV.new(argv) - end - end - - # @param [Array<#to_s>] argv - # A list of parameters. - # - def initialize(argv) - @entries = Parser.parse(argv) - end - - # @return [Boolean] Whether or not there are any remaining unhandled - # parameters. - # - def empty? - @entries.empty? - end - - # @return [Array] A list of the remaining unhandled parameters, in - # the same format a user specifies it in. - # - # @example - # - # argv = CLAide::ARGV.new(['tea', '--no-milk', '--sweetener=honey']) - # argv.shift_argument # => 'tea' - # argv.remainder # => ['--no-milk', '--sweetener=honey'] - # - def remainder - @entries.map do |type, (key, value)| - case type - when :arg - key - when :flag - "--#{'no-' if value == false}#{key}" - when :option - "--#{key}=#{value}" - end - end - end - - # @return [Array] A list of the remaining unhandled parameters, in - # the same format the user specified them. - # - # @example - # - # argv = CLAide::ARGV.new(['tea', '--no-milk', '--sweetener=honey']) - # argv.shift_argument # => 'tea' - # argv.remainder! # => ['--no-milk', '--sweetener=honey'] - # argv.remainder # => [] - # - def remainder! - remainder.tap { @entries.clear } - end - - # @return [Hash] A hash that consists of the remaining flags and options - # and their values. - # - # @example - # - # argv = CLAide::ARGV.new(['tea', '--no-milk', '--sweetener=honey']) - # argv.options # => { 'milk' => false, 'sweetener' => 'honey' } - # - def options - options = {} - @entries.each do |type, (key, value)| - options[key] = value unless type == :arg - end - options - end - - # @return [Array] A list of the remaining arguments. - # - # @example - # - # argv = CLAide::ARGV.new(['tea', 'white', '--no-milk', 'biscuit']) - # argv.shift_argument # => 'tea' - # argv.arguments # => ['white', 'biscuit'] - # - def arguments - @entries.map { |type, value| value if type == :arg }.compact - end - - # @return [Array] A list of the remaining arguments. - # - # @note This version also removes the arguments from the remaining - # parameters. - # - # @example - # - # argv = CLAide::ARGV.new(['tea', 'white', '--no-milk', 'biscuit']) - # argv.arguments # => ['tea', 'white', 'biscuit'] - # argv.arguments! # => ['tea', 'white', 'biscuit'] - # argv.arguments # => [] - # - def arguments! - arguments = [] - while arg = shift_argument - arguments << arg - end - arguments - end - - # @return [String] The first argument in the remaining parameters. - # - # @note This will remove the argument from the remaining parameters. - # - # @example - # - # argv = CLAide::ARGV.new(['tea', 'white']) - # argv.shift_argument # => 'tea' - # argv.arguments # => ['white'] - # - def shift_argument - if index = @entries.find_index { |type, _| type == :arg } - entry = @entries[index] - @entries.delete_at(index) - entry.last - end - end - - # @return [Boolean, nil] Returns `true` if the flag by the specified `name` - # is among the remaining parameters and is not negated. - # - # @param [String] name - # The name of the flag to look for among the remaining parameters. - # - # @param [Boolean] default - # The value that is returned in case the flag is not among the - # remaining parameters. - # - # @note This will remove the flag from the remaining parameters. - # - # @example - # - # argv = CLAide::ARGV.new(['tea', '--no-milk', '--sweetener=honey']) - # argv.flag?('milk') # => false - # argv.flag?('milk') # => nil - # argv.flag?('milk', true) # => true - # argv.remainder # => ['tea', '--sweetener=honey'] - # - def flag?(name, default = nil) - delete_entry(:flag, name, default, true) - end - - # @return [String, nil] Returns the value of the option by the specified - # `name` is among the remaining parameters. - # - # @param [String] name - # The name of the option to look for among the remaining - # parameters. - # - # @param [String] default - # The value that is returned in case the option is not among the - # remaining parameters. - # - # @note This will remove the option from the remaining parameters. - # - # @example - # - # argv = CLAide::ARGV.new(['tea', '--no-milk', '--sweetener=honey']) - # argv.option('sweetener') # => 'honey' - # argv.option('sweetener') # => nil - # argv.option('sweetener', 'sugar') # => 'sugar' - # argv.remainder # => ['tea', '--no-milk'] - # - def option(name, default = nil) - delete_entry(:option, name, default) - end - - # @return [Array] Returns an array of all the values of the option - # with the specified `name` among the remaining - # parameters. - # - # @param [String] name - # The name of the option to look for among the remaining - # parameters. - # - # @note This will remove the option from the remaining parameters. - # - # @example - # - # argv = CLAide::ARGV.new(['--ignore=foo', '--ignore=bar']) - # argv.all_options('include') # => [] - # argv.all_options('ignore') # => ['bar', 'foo'] - # argv.remainder # => [] - # - def all_options(name) - options = [] - while entry = option(name) - options << entry - end - options - end - - private - - # @return [Array>] A list of tuples for each - # non consumed parameter, where the first entry is the `type` and - # the second entry the actual parsed parameter. - # - attr_reader :entries - - # @return [Bool, String, Nil] Removes an entry from the entries list and - # returns its value or the default value if the entry was not - # present. - # - # @param [Symbol] requested_type - # The type of the entry. - # - # @param [String] requested_key - # The key of the entry. - # - # @param [Bool, String, Nil] default - # The value which should be returned if the entry is not present. - # - # @param [Bool] delete_all - # Whether all values matching `requested_type` and `requested_key` - # should be deleted. - # - def delete_entry(requested_type, requested_key, default, delete_all = false) - pred = proc do |type, (key, _value)| - requested_key == key && requested_type == type - end - entry = entries.reverse_each.find(&pred) - delete_all ? entries.delete_if(&pred) : entries.delete(entry) - - entry.nil? ? default : entry.last.last - end - - module Parser - # @return [Array>] A list of tuples for each - # parameter, where the first entry is the `type` and the second - # entry the actual parsed parameter. - # - # @example - # - # list = parse(['tea', '--no-milk', '--sweetener=honey']) - # list # => [[:arg, "tea"], - # [:flag, ["milk", false]], - # [:option, ["sweetener", "honey"]]] - # - def self.parse(argv) - entries = [] - copy = argv.map(&:to_s) - double_dash = false - while argument = copy.shift - next if !double_dash && double_dash = (argument == '--') - type = double_dash ? :arg : argument_type(argument) - parsed_argument = parse_argument(type, argument) - entries << [type, parsed_argument] - end - entries - end - - # @return [Symbol] Returns the type of an argument. The types can be - # either: `:arg`, `:flag`, `:option`. - # - # @param [String] argument - # The argument to check. - # - def self.argument_type(argument) - if argument.start_with?('--') - if argument.include?('=') - :option - else - :flag - end - else - :arg - end - end - - # @return [String, Array] Returns the argument itself for - # normal arguments (like commands) and a tuple with the key and - # the value for options and flags. - # - # @param [Symbol] type - # The type of the argument. - # - # @param [String] argument - # The argument to check. - # - def self.parse_argument(type, argument) - case type - when :arg - return argument - when :flag - return parse_flag(argument) - when :option - return argument[2..-1].split('=', 2) - end - end - - # @return [String, Array] Returns the parameter - # describing a flag arguments. - # - # @param [String] argument - # The flag argument to check. - # - def self.parse_flag(argument) - if argument.start_with?('--no-') - key = argument[5..-1] - value = false - else - key = argument[2..-1] - value = true - end - [key, value] - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/command.rb b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/command.rb deleted file mode 100644 index 6414b5c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/command.rb +++ /dev/null @@ -1,669 +0,0 @@ -# encoding: utf-8 - -require 'claide/command/banner' -require 'claide/command/plugin_manager' -require 'claide/command/argument_suggester' - -module CLAide - # This class is used to build a command-line interface - # - # Each command is represented by a subclass of this class, which may be - # nested to create more granular commands. - # - # Following is an overview of the types of commands and what they should do. - # - # ### Any command type - # - # * Inherit from the command class under which the command should be nested. - # * Set {Command.summary} to a brief description of the command. - # * Override {Command.options} to return the options it handles and their - # descriptions and prepending them to the results of calling `super`. - # * Override {Command#initialize} if it handles any parameters. - # * Override {Command#validate!} to check if the required parameters the - # command handles are valid, or call {Command#help!} in case they’re not. - # - # ### Abstract command - # - # The following is needed for an abstract command: - # - # * Set {Command.abstract_command} to `true`. - # * Subclass the command. - # - # When the optional {Command.description} is specified, it will be shown at - # the top of the command’s help banner. - # - # ### Normal command - # - # The following is needed for a normal command: - # - # * Set {Command.arguments} to the description of the arguments this command - # handles. - # * Override {Command#run} to perform the actual work. - # - # When the optional {Command.description} is specified, it will be shown - # underneath the usage section of the command’s help banner. Otherwise this - # defaults to {Command.summary}. - # - class Command - class << self - # @return [Boolean] Indicates whether or not this command can actually - # perform work of itself, or that it only contains subcommands. - # - attr_accessor :abstract_command - alias_method :abstract_command?, :abstract_command - - # @return [Boolean] Indicates whether or not this command is used during - # command parsing and whether or not it should be shown in the - # help banner or to show its subcommands instead. - # - # Setting this to `true` implies it’s an abstract command. - # - attr_reader :ignore_in_command_lookup - alias_method :ignore_in_command_lookup?, :ignore_in_command_lookup - def ignore_in_command_lookup=(flag) - @ignore_in_command_lookup = self.abstract_command = flag - end - - # @return [String] The subcommand which an abstract command should invoke - # by default. - # - attr_accessor :default_subcommand - - # @return [String] A brief description of the command, which is shown - # next to the command in the help banner of a parent command. - # - attr_accessor :summary - - # @return [String] A longer description of the command, which is shown - # underneath the usage section of the command’s help banner. Any - # indentation in this value will be ignored. - # - attr_accessor :description - - # @return [Array] The prefixes used to search for CLAide plugins. - # Plugins are loaded via their `_plugin.rb` file. - # Defaults to search for `claide` plugins. - # - def plugin_prefixes - @plugin_prefixes ||= ['claide'] - end - attr_writer :plugin_prefixes - - # @return [Array] - # A list of arguments the command handles. This is shown - # in the usage section of the command’s help banner. - # Each Argument in the array represents an argument by its name - # (or list of alternatives) and whether it's required or optional - # - def arguments - @arguments ||= [] - end - - # @param [Array] arguments - # An array listing the command arguments. - # Each Argument object describe the argument by its name - # (or list of alternatives) and whether it's required or optional - # - # @todo Remove deprecation - # - def arguments=(arguments) - if arguments.is_a?(Array) - if arguments.empty? || arguments[0].is_a?(Argument) - @arguments = arguments - else - self.arguments_array = arguments - end - else - self.arguments_string = arguments - end - end - - # @return [Boolean] The default value for {Command#ansi_output}. This - # defaults to `true` if `STDOUT` is connected to a TTY and - # `String` has the instance methods `#red`, `#green`, and - # `#yellow` (which are defined by, for instance, the - # [colored](https://github.com/defunkt/colored) gem). - # - def ansi_output - if @ansi_output.nil? - @ansi_output = STDOUT.tty? - end - @ansi_output - end - attr_writer :ansi_output - alias_method :ansi_output?, :ansi_output - - # @return [String] The name of the command. Defaults to a snake-cased - # version of the class’ name. - # - def command - @command ||= name.split('::').last.gsub(/[A-Z]+[a-z]*/) do |part| - part.downcase << '-' - end[0..-2] - end - attr_writer :command - - # @return [String] The version of the command. This value will be printed - # by the `--version` flag if used for the root command. - # - attr_accessor :version - end - - #-------------------------------------------------------------------------# - - # @return [String] The full command up-to this command, as it would be - # looked up during parsing. - # - # @note (see #ignore_in_command_lookup) - # - # @example - # - # BevarageMaker::Tea.full_command # => "beverage-maker tea" - # - def self.full_command - if superclass == Command - ignore_in_command_lookup? ? '' : command - else - if ignore_in_command_lookup? - superclass.full_command - else - "#{superclass.full_command} #{command}" - end - end - end - - # @return [Bool] Whether this is the root command class - # - def self.root_command? - superclass == CLAide::Command - end - - # @return [Array] A list of all command classes that are nested - # under this command. - # - def self.subcommands - @subcommands ||= [] - end - - # @return [Array] A list of command classes that are nested under - # this command _or_ the subcommands of those command classes in - # case the command class should be ignored in command lookup. - # - def self.subcommands_for_command_lookup - subcommands.map do |subcommand| - if subcommand.ignore_in_command_lookup? - subcommand.subcommands_for_command_lookup - else - subcommand - end - end.flatten - end - - # Searches the list of subcommands that should not be ignored for command - # lookup for a subcommand with the given `name`. - # - # @param [String] name - # The name of the subcommand to be found. - # - # @return [CLAide::Command, nil] The subcommand, if found. - # - def self.find_subcommand(name) - subcommands_for_command_lookup.find { |sc| sc.command == name } - end - - # @visibility private - # - # Automatically registers a subclass as a subcommand. - # - def self.inherited(subcommand) - subcommands << subcommand - end - - DEFAULT_ROOT_OPTIONS = [ - ['--version', 'Show the version of the tool'], - ] - - DEFAULT_OPTIONS = [ - ['--verbose', 'Show more debugging information'], - ['--no-ansi', 'Show output without ANSI codes'], - ['--help', 'Show help banner of specified command'], - ] - - # Should be overridden by a subclass if it handles any options. - # - # The subclass has to combine the result of calling `super` and its own - # list of options. The recommended way of doing this is by concatenating - # to this classes’ own options. - # - # @return [Array] - # - # A list of option name and description tuples. - # - # @example - # - # def self.options - # [ - # ['--verbose', 'Print more info'], - # ['--help', 'Print help banner'], - # ].concat(super) - # end - # - def self.options - if root_command? - DEFAULT_ROOT_OPTIONS + DEFAULT_OPTIONS - else - DEFAULT_OPTIONS - end - end - - # Adds a new option for the current command. - # - # This method can be used in conjunction with overriding `options`. - # - # @return [void] - # - # @example - # - # option '--help', 'Print help banner ' - # - def self.option(name, description) - mod = Module.new do - define_method(:options) do - [ - [name, description], - ].concat(super()) - end - end - extend(mod) - end - private_class_method :option - - # Handles root commands options if appropriate. - # - # @param [ARGV] argv - # The parameters of the command. - # - # @return [Bool] Whether any root command option was handled. - # - def handle_root_options(argv) - return false unless self.class.root_command? - if argv.flag?('version') - print_version - return true - end - false - end - - # Prints the version of the command optionally including plugins. - # - def print_version - puts self.class.version - if verbose? - PluginManager.specifications.each do |spec| - puts "#{spec.name}: #{spec.version}" - end - end - end - - # Instantiates the command class matching the parameters through - # {Command.parse}, validates it through {Command#validate!}, and runs it - # through {Command#run}. - # - # @note The ANSI support is configured before running a command to allow - # the same process to run multiple commands with different - # settings. For example a process with ANSI output enabled might - # want to programmatically invoke another command with the output - # enabled. - # - # @param [Array, ARGV] argv - # A list of parameters. For instance, the standard `ARGV` constant, - # which contains the parameters passed to the program. - # - # @return [void] - # - def self.run(argv = []) - plugin_prefixes.each do |plugin_prefix| - PluginManager.load_plugins(plugin_prefix) - end - - argv = ARGV.coerce(argv) - command = parse(argv) - ANSI.disabled = !command.ansi_output? - unless command.handle_root_options(argv) - command.validate! - command.run - end - rescue Object => exception - handle_exception(command, exception) - end - - # @param [Array, ARGV] argv - # A list of (remaining) parameters. - # - # @return [Command] An instance of the command class that was matched by - # going through the arguments in the parameters and drilling down - # command classes. - # - def self.parse(argv) - argv = ARGV.coerce(argv) - cmd = argv.arguments.first - if cmd && subcommand = find_subcommand(cmd) - argv.shift_argument - subcommand.parse(argv) - elsif abstract_command? && default_subcommand - load_default_subcommand(argv) - else - new(argv) - end - end - - # @param [Array, ARGV] argv - # A list of (remaining) parameters. - # - # @return [Command] Returns the default subcommand initialized with the - # given arguments. - # - def self.load_default_subcommand(argv) - unless subcommand = find_subcommand(default_subcommand) - raise 'Unable to find the default subcommand ' \ - "`#{default_subcommand}` for command `#{self}`." - end - result = subcommand.parse(argv) - result.invoked_as_default = true - result - end - - # Presents an exception to the user in a short manner in case of an - # `InformativeError` or in long form in other cases, - # - # @param [Command, nil] command - # The command from where the exception originated. - # - # @param [Object] exception - # The exception to present. - # - # @return [void] - # - def self.handle_exception(command, exception) - if exception.is_a?(InformativeError) - puts exception.message - if command.nil? || command.verbose? - puts - puts(*exception.backtrace) - end - exit exception.exit_status - else - report_error(exception) - end - end - - # Allows the application to perform custom error reporting, by overriding - # this method. - # - # @param [Exception] exception - # - # An exception that occurred while running a command through - # {Command.run}. - # - # @raise - # - # By default re-raises the specified exception. - # - # @return [void] - # - def self.report_error(exception) - plugins = PluginManager.plugins_involved_in_exception(exception) - unless plugins.empty? - puts '[!] The exception involves the following plugins:' \ - "\n - #{plugins.join("\n - ")}\n".ansi.yellow - end - raise exception - end - - # @visibility private - # - # @param [String] error_message - # The error message to show to the user. - # - # @param [Class] help_class - # The class to use to raise a ‘help’ error. - # - # @raise [Help] - # - # Signals CLAide that a help banner for this command should be shown, - # with an optional error message. - # - # @return [void] - # - def self.help!(error_message = nil, help_class = Help) - raise help_class.new(banner, error_message) - end - - # @visibility private - # - # Returns the banner for the command. - # - # @param [Class] banner_class - # The class to use to format help banners. - # - # @return [String] The banner for the command. - # - def self.banner(banner_class = Banner) - banner_class.new(self).formatted_banner - end - - # @visibility private - # - # Print banner and exit - # - # @note Calling this method exits the current process. - # - # @return [void] - # - def self.banner! - puts banner - exit 0 - end - - #-------------------------------------------------------------------------# - - # Set to `true` if the user specifies the `--verbose` option. - # - # @note - # - # If you want to make use of this value for your own configuration, you - # should check the value _after_ calling the `super` {Command#initialize} - # implementation. - # - # @return [Boolean] - # - # Wether or not backtraces should be included when presenting the user an - # exception that includes the {InformativeError} module. - # - attr_accessor :verbose - alias_method :verbose?, :verbose - - # Set to `true` if {Command.ansi_output} returns `true` and the user - # did **not** specify the `--no-ansi` option. - # - # @note (see #verbose) - # - # @return [Boolean] - # - # Whether or not to use ANSI codes to prettify output. For instance, by - # default {InformativeError} exception messages will be colored red and - # subcommands in help banners green. - # - attr_accessor :ansi_output - alias_method :ansi_output?, :ansi_output - - # Set to `true` if initialized with a `--help` flag - # - # @return [Boolean] - # - # Whether the command was initialized with argv containing --help - # - attr_accessor :help_arg - alias_method :help?, :help_arg - - # Subclasses should override this method to remove the arguments/options - # they support from `argv` _before_ calling `super`. - # - # The `super` implementation sets the {#verbose} attribute based on whether - # or not the `--verbose` option is specified; and the {#ansi_output} - # attribute to `false` if {Command.ansi_output} returns `true`, but the - # user specified the `--no-ansi` option. - # - # @param [ARGV, Array] argv - # - # A list of (user-supplied) params that should be handled. - # - def initialize(argv) - argv = ARGV.coerce(argv) - @verbose = argv.flag?('verbose') - @ansi_output = argv.flag?('ansi', Command.ansi_output?) - @argv = argv - @help_arg = argv.flag?('help') - end - - # Convenience method. - # Instantiate the command and run it with the provided arguments at once. - # - # @note This method validate! the command before running it, but contrary to - # CLAide::Command::run, it does not load plugins nor exit on failure. - # It is up to the caller to rescue any possible exception raised. - # - # @param [String..., Array] args - # The arguments to initialize the command with - # - # @raise [Help] If validate! fails - # - def self.invoke(*args) - command = new(ARGV.new(args.flatten)) - command.validate! - command.run - end - - # @return [Bool] Whether the command was invoked by an abstract command by - # default. - # - attr_accessor :invoked_as_default - alias_method :invoked_as_default?, :invoked_as_default - - # Raises a Help exception if the `--help` option is specified, if `argv` - # still contains remaining arguments/options by the time it reaches this - # implementation, or when called on an ‘abstract command’. - # - # Subclasses should call `super` _before_ doing their own validation. This - # way when the user specifies the `--help` flag a help banner is shown, - # instead of possible actual validation errors. - # - # @raise [Help] - # - # @return [void] - # - def validate! - banner! if help? - unless @argv.empty? - argument = @argv.remainder.first - help! ArgumentSuggester.new(argument, self.class).suggestion - end - help! if self.class.abstract_command? - end - - # This method should be overridden by the command class to perform its - # work. - # - # @return [void] - # - def run - raise 'A subclass should override the `CLAide::Command#run` method to ' \ - 'actually perform some work.' - end - - protected - - # Returns the class of the invoked command - # - # @return [Command] - # - def invoked_command_class - if invoked_as_default? - self.class.superclass - else - self.class - end - end - - # @param [String] error_message - # A custom optional error message - # - # @raise [Help] - # - # Signals CLAide that a help banner for this command should be shown, - # with an optional error message. - # - # @return [void] - # - def help!(error_message = nil) - invoked_command_class.help!(error_message) - end - - # Print banner and exit - # - # @note Calling this method exits the current process. - # - # @return [void] - # - def banner! - invoked_command_class.banner! - end - - #-------------------------------------------------------------------------# - - # Handle deprecated form of self.arguments as an - # Array> like in: - # - # self.arguments = [ ['NAME', :required], ['QUERY', :optional] ] - # - # @todo Remove deprecated format support - # - def self.arguments_array=(arguments) - warn '[!] The signature of CLAide#arguments has changed. ' \ - "Use CLAide::Argument (#{self}: `#{arguments}`)".ansi.yellow - @arguments = arguments.map do |(name_str, type)| - names = name_str.split('|') - required = (type == :required) - Argument.new(names, required) - end - end - - # Handle deprecated form of self.arguments as a String, like in: - # - # self.arguments = 'NAME [QUERY]' - # - # @todo Remove deprecated format support - # - def self.arguments_string=(arguments) - warn '[!] The specification of arguments as a string has been' \ - " deprecated #{self}: `#{arguments}`".ansi.yellow - @arguments = arguments.split(' ').map do |argument| - if argument.start_with?('[') - Argument.new(argument.sub(/\[(.*)\]/, '\1').split('|'), false) - else - Argument.new(argument.split('|'), true) - end - end - end - - # Handle depracted form of assigning a plugin prefix. - # - # @todo Remove deprecated form. - # - def self.plugin_prefix=(prefix) - warn '[!] The specification of a singular plugin prefix has been ' \ - "deprecated. Use `#{self}::plugin_prefixes` instead." - plugin_prefixes << prefix - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/command/argument_suggester.rb b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/command/argument_suggester.rb deleted file mode 100644 index a13575c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/command/argument_suggester.rb +++ /dev/null @@ -1,99 +0,0 @@ -# encoding: utf-8 - -module CLAide - class Command - class ArgumentSuggester - # @param [String] argument - # The unrecognized argument for which to make a suggestion. - # - # @param [Class] command_class - # The class of the command which encountered the unrecognized - # arguments. - # - def initialize(argument, command_class) - @argument, @command_class = argument, command_class - @argument_type = ARGV::Parser.argument_type(@argument) - end - - # @return [Array] The list of the valid arguments for a command - # according to the type of the argument. - # - def possibilities - case @argument_type - when :option, :flag - @command_class.options.map(&:first) - when :arg - @command_class.subcommands_for_command_lookup.map(&:command) - end - end - - # @return [String] Returns a suggested argument from `possibilities` based - # on the `levenshtein_distance` score. - # - def suggested_argument - possibilities.sort_by do |element| - self.class.levenshtein_distance(@argument, element) - end.first - end - - # @return [String] Returns a message including a suggestion for the given - # suggestion. - # - def suggestion - argument_description = @argument_type == :arg ? 'command' : 'option' - if suggestion = suggested_argument - pretty_suggestion = self.class.prettify_suggestion(suggestion, - @argument_type) - "Unknown #{argument_description}: `#{@argument}`\n" \ - "Did you mean: #{pretty_suggestion}?" - else - "Unknown #{argument_description}: `#{@argument}`" - end - end - - # Prettifies the given validation suggestion according to the type. - # - # @param [String] suggestion - # The suggestion to prettify. - # - # @param [Type] argument_type - # The type of the suggestion: either `:command` or `:option`. - # - # @return [String] A handsome suggestion. - # - def self.prettify_suggestion(suggestion, argument_type) - case argument_type - when :option, :flag - suggestion = suggestion.to_s - suggestion.ansi.blue - when :arg - suggestion.ansi.green - end - end - - # Returns the Levenshtein distance between the given strings. - # From: http://rosettacode.org/wiki/Levenshtein_distance#Ruby - # - # @param [String] a - # The first string to compare. - # - # @param [String] b - # The second string to compare. - # - # @return [Fixnum] The distance between the strings. - def self.levenshtein_distance(a, b) - a, b = a.downcase, b.downcase - costs = Array(0..b.length) - (1..a.length).each do |i| - costs[0], nw = i, i - 1 - (1..b.length).each do |j| - costs[j], nw = [ - costs[j] + 1, costs[j - 1] + 1, a[i - 1] == b[j - 1] ? nw : nw + 1 - ].min, costs[j] - end - end - costs[b.length] - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/command/banner.rb b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/command/banner.rb deleted file mode 100644 index d87c699..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/command/banner.rb +++ /dev/null @@ -1,307 +0,0 @@ -# encoding: utf-8 - -module CLAide - class Command - # Creates the formatted banner to present as help of the provided command - # class. - # - class Banner - # @return [Class] The command for which the banner should be created. - # - attr_accessor :command - - # @param [Class] command @see command - # - def initialize(command) - @command = command - end - - # @return [String] The banner for the command. - # - def formatted_banner - sections = [ - ['Usage', formatted_usage_description], - ['Commands', formatted_subcommand_summaries], - ['Options', formatted_options_description], - ] - banner = sections.map do |(title, body)| - [prettify_title("#{title}:"), body] unless body.empty? - end.compact.join("\n\n") - banner - end - - private - - # @!group Banner sections - #-----------------------------------------------------------------------# - - # @return [String] The indentation of the text. - # - TEXT_INDENT = 6 - - # @return [Fixnum] The maximum width of the text. - # - MAX_WIDTH = TEXT_INDENT + 80 - - # @return [Fixnum] The minimum between a name and its description. - # - DESCRIPTION_SPACES = 3 - - # @return [Fixnum] The minimum between a name and its description. - # - SUBCOMMAND_BULLET_SIZE = 2 - - # @return [String] The section describing the usage of the command. - # - def formatted_usage_description - message = command.description || command.summary || '' - message = TextWrapper.wrap_formatted_text(message, - TEXT_INDENT, - MAX_WIDTH) - message = prettify_message(command, message) - "#{signature}\n\n#{message}" - end - - # @return [String] The signature of the command. - # - def signature - full_command = command.full_command - sub_command = signature_sub_command - arguments = signature_arguments - result = prettify_signature(full_command, sub_command, arguments) - result.insert(0, '$ ') - result.insert(0, ' ' * (TEXT_INDENT - '$ '.size)) - end - - # @return [String] The subcommand indicator of the signature. - # - def signature_sub_command - return '[COMMAND]' if command.default_subcommand - return 'COMMAND' if command.subcommands.any? - end - - # @return [String] The arguments of the signature. - # - def signature_arguments - command.arguments.map do |arg| - names = arg.names.join('|') - names.concat(' ' + Argument::ELLIPSIS) if arg.repeatable? - arg.required? ? names : "[#{names}]" - end.join(' ') - end - - # @return [String] The section describing the subcommands of the command. - # - # @note The plus sign emphasizes the that the subcommands are added to - # the command. The square brackets conveys a sense of direction - # and indicates the gravitational force towards the default - # command. - # - def formatted_subcommand_summaries - subcommands = subcommands_for_banner - subcommands.map do |subcommand| - name = subcommand.command - bullet = (name == command.default_subcommand) ? '>' : '+' - name = "#{bullet} #{name}" - pretty_name = prettify_subcommand(name) - entry_description(pretty_name, subcommand.summary, name.size) - end.join("\n") - end - - # @return [String] The section describing the options of the command. - # - def formatted_options_description - options = command.options - options.map do |name, description| - pretty_name = prettify_option_name(name) - entry_description(pretty_name, description, name.size) - end.join("\n") - end - - # @return [String] The line describing a single entry (subcommand or - # option). - # - def entry_description(name, description, name_width) - max_name_width = compute_max_name_width - desc_start = max_name_width + (TEXT_INDENT - 2) + DESCRIPTION_SPACES - result = ' ' * (TEXT_INDENT - 2) - result << name - result << ' ' * DESCRIPTION_SPACES - result << ' ' * (max_name_width - name_width) - result << TextWrapper.wrap_with_indent(description, - desc_start, - MAX_WIDTH) - end - - # @!group Overrides - #-----------------------------------------------------------------------# - - # @return [String] A decorated title. - # - def prettify_title(title) - title.ansi.underline - end - - # @return [String] A decorated textual representation of the subcommand - # name. - # - def prettify_subcommand(name) - name.chomp.ansi.green - end - - # @return [String] A decorated textual representation of the option name. - # - # - def prettify_option_name(name) - name.chomp.ansi.blue - end - - # @return [String] A decorated textual representation of the command. - # - def prettify_signature(command, subcommand, argument) - components = [ - [command, :green], - [subcommand, :green], - [argument, :magenta], - ] - components.reduce('') do |memo, (string, ansi_key)| - next memo if !string || string.empty? - memo << ' ' << string.ansi.apply(ansi_key) - end.lstrip - end - - # @return [String] A decorated command description. - # - def prettify_message(command, message) - message = message.dup - command.arguments.each do |arg| - arg.names.each do |name| - message.gsub!("`#{name.gsub(/\.{3}$/, '')}`", '\0'.ansi.magenta) - end - end - command.options.each do |(name, _description)| - message.gsub!("`#{name}`", '\0'.ansi.blue) - end - message - end - - # @!group Private helpers - #-----------------------------------------------------------------------# - - # @return [Array] The list of the subcommands to use in the - # banner. - # - def subcommands_for_banner - command.subcommands_for_command_lookup.reject do |subcommand| - subcommand.summary.nil? - end.sort_by(&:command) - end - - # @return [Fixnum] The width of the largest command name or of the - # largest option name. Used to align all the descriptions. - # - def compute_max_name_width - widths = [] - widths << command.options.map { |option| option.first.size } - widths << subcommands_for_banner.map do |cmd| - cmd.command.size + SUBCOMMAND_BULLET_SIZE - end.max - widths.flatten.compact.max || 1 - end - - module TextWrapper - # @return [String] Wraps a formatted string (e.g. markdown) by stripping - # heredoc indentation and wrapping by word to the terminal width - # taking into account a maximum one, and indenting the string. - # Code lines (i.e. indented by four spaces) are not wrapped. - # - # @param [String] string - # The string to format. - # - # @param [Fixnum] indent - # The number of spaces to insert before the string. - # - # @param [Fixnum] max_width - # The maximum width to use to format the string if the terminal - # is too wide. - # - def self.wrap_formatted_text(string, indent = 0, max_width = 80) - paragraphs = strip_heredoc(string).split("\n\n") - paragraphs = paragraphs.map do |paragraph| - if paragraph.start_with?(' ' * 4) - paragraph.gsub!(/\n/, "\n#{' ' * indent}") - else - paragraph = wrap_with_indent(paragraph, indent, max_width) - end - paragraph.insert(0, ' ' * indent).rstrip - end - paragraphs.join("\n\n") - end - - # @return [String] Wraps a string to the terminal width taking into - # account the given indentation. - # - # @param [String] string - # The string to indent. - # - # @param [Fixnum] indent - # The number of spaces to insert before the string. - # - # @param [Fixnum] max_width - # The maximum width to use to format the string if the terminal - # is too wide. - # - def self.wrap_with_indent(string, indent = 0, max_width = 80) - if terminal_width == 0 - width = max_width - else - width = [terminal_width, max_width].min - end - - full_line = string.gsub("\n", ' ') - available_width = width - indent - space = ' ' * indent - word_wrap(full_line, available_width).split("\n").join("\n#{space}") - end - - # @return [String] Lifted straight from ActionView. Thanks guys! - # - def self.word_wrap(line, line_width) - line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n").strip - end - - # @return [String] Lifted straight from ActiveSupport. Thanks guys! - # - def self.strip_heredoc(string) - if min = string.scan(/^[ \t]*(?=\S)/).min - string.gsub(/^[ \t]{#{min.size}}/, '') - else - string - end - end - - # @!group Private helpers - #---------------------------------------------------------------------# - - # @return [Fixnum] The width of the current terminal unless being piped. - # - def self.terminal_width - @terminal_width ||= - (!ENV['CLAIDE_DISABLE_AUTO_WRAP'] && - STDOUT.tty? && - calculate_terminal_width) || 0 - end - - def self.calculate_terminal_width - require 'io/console' - STDOUT.winsize.last - rescue LoadError - (system('which tput > /dev/null 2>&1') && `tput cols`.to_i) || 0 - rescue - 0 - end - private_class_method :calculate_terminal_width - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/command/plugin_manager.rb b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/command/plugin_manager.rb deleted file mode 100644 index 184a5ea..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/command/plugin_manager.rb +++ /dev/null @@ -1,124 +0,0 @@ -# encoding: utf-8 - -module CLAide - class Command - # Handles plugin related logic logic for the `Command` class. - # - # Plugins are loaded the first time a command run and are identified by the - # prefix specified in the command class. Plugins must adopt the following - # conventions: - # - # - Support being loaded by a file located under the - # `lib/#{plugin_prefix}_plugin` relative path. - # - Be stored in a folder named after the plugin. - # - class PluginManager - # @return [Hash] The loaded plugins, - # grouped by plugin prefix. - # - def self.loaded_plugins - @loaded_plugins ||= {} - end - - # @return [Array] Loads plugins via RubyGems looking - # for files named after the `PLUGIN_PREFIX_plugin` and returns the - # specifications of the gems loaded successfully. - # Plugins are required safely. - # - def self.load_plugins(plugin_prefix) - loaded_plugins[plugin_prefix] ||= - plugin_gems_for_prefix(plugin_prefix).map do |spec, paths| - spec if safe_require(paths) - end.compact - end - - # @return [Array] The RubyGems specifications for the - # loaded plugins. - # - def self.specifications - loaded_plugins.values.flatten.uniq - end - - # @return [Array] The RubyGems specifications for the - # installed plugins that match the given `plugin_prefix`. - # - def self.installed_specifications_for_prefix(plugin_prefix) - loaded_plugins[plugin_prefix] || - plugin_gems_for_prefix(plugin_prefix).map(&:first) - end - - # @return [Array] The list of the plugins whose root path appears - # in the backtrace of an exception. - # - # @param [Exception] exception - # The exception to analyze. - # - def self.plugins_involved_in_exception(exception) - specifications.select do |gemspec| - exception.backtrace.any? do |line| - full_require_paths_for(gemspec).any? do |plugin_path| - line.include?(plugin_path) - end - end - end.map(&:name) - end - - # @group Helper Methods - - # @return [Array<[Gem::Specification, Array]>] - # Returns an array of tuples containing the specifications and - # plugin files to require for a given plugin prefix. - # - def self.plugin_gems_for_prefix(prefix) - glob = "#{prefix}_plugin#{Gem.suffix_pattern}" - Gem::Specification.latest_specs(true).map do |spec| - matches = spec.matches_for_glob(glob) - [spec, matches] unless matches.empty? - end.compact - end - - # Requires the given paths. - # If any exception occurs it is caught and an - # informative message is printed. - # - # @param [String] paths - # The paths to require. - # - # @return [Bool] Whether requiring succeeded. - # - def self.safe_require(paths) - paths.each do |path| - begin - require(path) - rescue Exception => exception # rubocop:disable RescueException - message = "\n---------------------------------------------" - message << "\nError loading plugin file `#{path}`.\n" - message << "\n#{exception.class} - #{exception.message}" - message << "\n#{exception.backtrace.join("\n")}" - message << "\n---------------------------------------------\n" - warn message.ansi.yellow - return false - end - end - - true - end - - def self.full_require_paths_for(gemspec) - if gemspec.respond_to?(:full_require_paths) - return gemspec.full_require_paths - end - - # RubyGems < 2.2 - gemspec.require_paths.map do |require_path| - if require_path.include?(gemspec.full_gem_path) - require_path - else - File.join(gemspec.full_gem_path, require_path) - end - end - end - private_class_method :full_require_paths_for - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/gem_version.rb b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/gem_version.rb deleted file mode 100644 index cdb020c..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/gem_version.rb +++ /dev/null @@ -1,7 +0,0 @@ -module CLAide - # @return [String] - # - # CLAide’s version, following [semver](http://semver.org). - # - VERSION = '1.1.0'.freeze -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/help.rb b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/help.rb deleted file mode 100644 index 7d3b183..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/help.rb +++ /dev/null @@ -1,58 +0,0 @@ -# encoding: utf-8 - -module CLAide - require 'claide/informative_error' - - # The exception class that is raised to indicate a help banner should be - # shown while running {Command.run}. - # - class Help < StandardError - include InformativeError - - # @return [String] The banner containing the usage instructions of the - # command to show in the help. - # - attr_reader :banner - - # @return [String] An optional error message that will be shown before the - # help banner. - # - attr_reader :error_message - - # @param [String] banner @see banner - # @param [String] error_message @see error_message - # - # @note If an error message is provided, the exit status, used to - # terminate the program with, will be set to `1`, otherwise a {Help} - # exception is treated as not being a real error and exits with `0`. - # - def initialize(banner, error_message = nil) - @banner = banner - @error_message = error_message - @exit_status = @error_message.nil? ? 0 : 1 - end - - # @return [String] The optional error message, colored in red if - # {Command.ansi_output} is set to `true`. - # - def formatted_error_message - if error_message - message = "[!] #{error_message}" - prettify_error_message(message) - end - end - - # @return [String] - # - def prettify_error_message(message) - message.ansi.red - end - - # @return [String] The optional error message, combined with the help - # banner of the command. - # - def message - [formatted_error_message, banner].compact.join("\n\n") - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/informative_error.rb b/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/informative_error.rb deleted file mode 100644 index 8a92bd0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-1.1.0/lib/claide/informative_error.rb +++ /dev/null @@ -1,21 +0,0 @@ -# encoding: utf-8 - -module CLAide - # Including this module into an exception class will ensure that when raised, - # while running {Command.run}, only the message of the exception will be - # shown to the user. Unless disabled with the `--verbose` flag. - # - # In addition, the message will be colored red, if {Command.ansi_output} - # is set to `true`. - # - module InformativeError - # @return [Numeric] The exist status code that should be used to terminate - # the program with. Defaults to `1`. - # - attr_writer :exit_status - - def exit_status - @exit_status ||= 1 - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/.gitignore b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/.gitignore deleted file mode 100644 index 864ffe9..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/.gitignore +++ /dev/null @@ -1,41 +0,0 @@ -*.gem -*.rbc -/.config -/coverage/ -/InstalledFiles -/pkg/ -/spec/reports/ -/test/tmp/ -/test/version_tmp/ -/tmp/ - -## Specific to RubyMotion: -.dat* -.repl_history -build/ - -## Documentation cache and generated files: -/.yardoc/ -/_yardoc/ -/doc/ -/rdoc/ - -## Environment normalisation: -/.bundle/ -/lib/bundler/man/ -/vendor/ - -# for a library or gem, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# Gemfile.lock -# .ruby-version -# .ruby-gemset - -# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: -.rvmrc - -/coverage/ - -# RubyMine Editor -.idea - diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/.rubocop.yml b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/.rubocop.yml deleted file mode 100644 index 7583205..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/.rubocop.yml +++ /dev/null @@ -1,4 +0,0 @@ -inherit_from: - - .rubocop_cocoapods.yml - - diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/.rubocop_cocoapods.yml b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/.rubocop_cocoapods.yml deleted file mode 100644 index 9104ebd..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/.rubocop_cocoapods.yml +++ /dev/null @@ -1,116 +0,0 @@ -AllCops: - Include: - - ./Rakefile - - ./Gemfile - - ./*.gemspec - Exclude: - - ./spec/fixtures/**/* - -# At the moment not ready to be used -# https://github.com/bbatsov/rubocop/issues/947 -Documentation: - Enabled: false - -#- CocoaPods -----------------------------------------------------------------# - -# We adopted raise instead of fail. -SignalException: - EnforcedStyle: only_raise - -# They are idiomatic -AssignmentInCondition: - Enabled: false - -# Allow backticks -AsciiComments: - Enabled: false - -# Indentation clarifies logic branches in implementations -IfUnlessModifier: - Enabled: false - -# No enforced convention here. -SingleLineBlockParams: - Enabled: false - -# We only add the comment when needed. -Encoding: - Enabled: false - -# Having these make it easier to *not* forget to add one when adding a new -# value and you can simply copy the previous line. -TrailingComma: - EnforcedStyleForMultiline: comma - -Style/MultilineOperationIndentation: - EnforcedStyle: indented - -# Clashes with CLAide Command#validate! -GuardClause: - Enabled: false - -# Not always desirable: lib/claide/command/plugins_helper.rb:12:15 -Next: - Enabled: false - -# Arbitrary max lengths for classes simply do not work and enabling this will -# lead to a never ending stream of annoyance and changes. -Metrics/ClassLength: - Enabled: false - -# Arbitrary max lengths for methods simply do not work and enabling this will -# lead to a never ending stream of annoyance and changes. -Metrics/MethodLength: - Enabled: false - -# No enforced convention here. -Metrics/BlockNesting: - Enabled: false - -# It will be obvious which code is complex, Rubocop should only lint simple -# rules for us. -Metrics/AbcSize: - Enabled: false - -# It will be obvious which code is complex, Rubocop should only lint simple -# rules for us. -Metrics/CyclomaticComplexity: - Enabled: false - -#- CocoaPods support for Ruby 1.8.7 ------------------------------------------# - -HashSyntax: - EnforcedStyle: hash_rockets - -Lambda: - Enabled: false - -DotPosition: - EnforcedStyle: trailing - -EachWithObject: - Enabled: false - -Style/SpecialGlobalVars: - Enabled: false - -#- CocoaPods specs -----------------------------------------------------------# - -# Allow for `should.match /regexp/`. -AmbiguousRegexpLiteral: - Exclude: - - spec/**/* - -# Allow `object.should == object` syntax. -Void: - Exclude: - - spec/**/* - -ClassAndModuleChildren: - Exclude: - - spec/**/* - -UselessComparison: - Exclude: - - spec/**/* - diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/.tm_properties b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/.tm_properties deleted file mode 100644 index 7f6f10f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/.tm_properties +++ /dev/null @@ -1,2 +0,0 @@ -scmStatus = false - diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/.travis.yml b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/.travis.yml deleted file mode 100644 index 282bfc7..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -# Sets Travis to run the Ruby specs on OS X machines to be as close as possible -# to the user environment. -# -language: objective-c -addons: - code_climate: - repo_token: 2926ae7ea0b2a6ced8b0d67efa235769ab85de1d9c9f6702f40d80bacec3c9c4 - -env: - - RVM_RUBY_VERSION=system - # - RVM_RUBY_VERSION=1.8.7-p358 - -before_install: - - export LANG=en_US.UTF-8 - - curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem - - source ~/.rvm/scripts/rvm - - if [[ $RVM_RUBY_VERSION != 'system' ]]; then rvm install $RVM_RUBY_VERSION; fi - - rvm use $RVM_RUBY_VERSION - - if [[ $RVM_RUBY_VERSION == 'system' ]]; then sudo gem install bundler --no-ri --no-rdoc; else gem install bundler --no-ri --no-rdoc; fi - -install: - - sudo bundle install --without=documentation - -script: bundle exec rake spec diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/CHANGELOG.md b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/CHANGELOG.md deleted file mode 100644 index 5746303..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/CHANGELOG.md +++ /dev/null @@ -1,113 +0,0 @@ -# Cocoapods::Plugins Changelog - -## Master - -##### Enhancements - -* None. - -##### Bug Fixes - -* None. - - -## 1.0.0 (2016-05-10) - -##### Enhancements - -* None. - -##### Bug Fixes - -* None. - - -## 1.0.0.rc.1 (2016-04-30) - -This version contains no changes. - - -## 1.0.0.beta.1 (2015-12-30) - -This version contains no changes. - - -## 0.4.2 (2015-04-03) - - -## 0.4.1 (2015-02-25) - -* Added the `pod plugins installed` subcommand. - [Olivier Halligon](https://github.com/AliSoftware) - -## 0.4.0 (2014-12-25) - -* Added the `pod plugins publish` subcommand. - [Olivier Halligon](https://github.com/AliSoftware) - -## 0.3.2 (2014-11-02) - -* Switch to using cocoapods-plugins JSON file instead of from Cocoapods.org's repo. - [542919](https://github.com/CocoaPods/cocoapods-plugins/commit/542919902e611c33bb0e02848037474529ddd0f9) - [Florian Hanke](https://github.com/floere) - - -## 0.3.1 (2014-09-12) - -* Restore compatibility with Ruby 1.8.7. - [#30](https://github.com/CocoaPods/cocoapods-plugins/issues/30) - [Fabio Pelosin](https://github.com/fabiopelosin) - -## 0.3.0 (2014-09-11) - -* Added a reminder to add plugin to `plugins.json` once released. - [#27](https://github.com/CocoaPods/cocoapods-plugins/issues/27) - [Olivier Halligon](https://github.com/AliSoftware) - -* Print out the version of plugins when invoked with `--verbose`. - [#16](https://github.com/CocoaPods/cocoapods-plugins/issues/16) - [David Grandinetti](https://github.com/dbgrandi) - -## 0.2.0 (2014-05-20) - -* Migrating to new syntax of CLAide::Command#arguments. - [#23](https://github.com/CocoaPods/cocoapods-plugins/issues/23) - [Olivier Halligon](https://github.com/AliSoftware) - -* Printing URL of template used. - [#21](https://github.com/CocoaPods/cocoapods-plugins/issues/21) - [Olivier Halligon](https://github.com/AliSoftware) - -* `create` subcommand now prefixes the given name if not already. - [#20](https://github.com/CocoaPods/cocoapods-plugins/issues/20) - [Olivier Halligon](https://github.com/AliSoftware) - -## 0.1.1 (2014-05-02) - -* Making `pod plugins` an abstract command, with `list` the default subcommand. - [#11](https://github.com/CocoaPods/cocoapods-plugins/issues/11) - [#12](https://github.com/CocoaPods/cocoapods-plugins/issues/12) - [Olivier Halligon](https://github.com/AliSoftware) - -* Added `search` subcommand to search plugins by name, author and description. - [#6](https://github.com/CocoaPods/cocoapods-plugins/issues/6) - [Olivier Halligon](https://github.com/AliSoftware) - -* Refactoring and improved output formatting. - [#8](https://github.com/CocoaPods/cocoapods-plugins/issues/8) - [#10](https://github.com/CocoaPods/cocoapods-plugins/issues/10) - [#13](https://github.com/CocoaPods/cocoapods-plugins/issues/13) - [Olivier Halligon](https://github.com/AliSoftware) - -* Fixing coding conventions and RuboCop offenses. - [#17](https://github.com/CocoaPods/cocoapods-plugins/issues/17) - [Olivier Halligon](https://github.com/AliSoftware) - -## 0.1.0 (2014-04-22) - -* Initial implementation. - [David Grandinetti](https://github.com/dbgrandi) - -* Added `create` subcommand to create an empty project for a new plugin. - [#6](https://github.com/CocoaPods/cocoapods-plugins/issues/6) - [Boris Bügling](https://github.com/neonichu) diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/Gemfile b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/Gemfile deleted file mode 100644 index 14a4ed4..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/Gemfile +++ /dev/null @@ -1,18 +0,0 @@ -source 'https://rubygems.org' - -gemspec - -group :development do - # gem 'cocoapods', :git => 'https://github.com/CocoaPods/CocoaPods.git', :branch => 'master' - # gem 'cocoapods-core', :git => 'https://github.com/CocoaPods/Core.git', :branch => 'master' - gem 'claide', :git => 'https://github.com/CocoaPods/CLAide.git', :branch => 'master' - - gem 'bacon' - gem 'mocha-on-bacon' - gem 'prettybacon' - gem 'vcr' - gem 'webmock' - - gem 'codeclimate-test-reporter', :require => nil - gem 'rubocop' -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/LICENSE b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/LICENSE deleted file mode 100644 index 0d932da..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 David Grandinetti - -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. \ No newline at end of file diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/README.md b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/README.md deleted file mode 100644 index f79fb35..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/README.md +++ /dev/null @@ -1,73 +0,0 @@ -# CLAide plugins - -[![Build Status](https://img.shields.io/travis/CocoaPods/cocoapods-plugins/master.svg?style=flat)](https://travis-ci.org/CocoaPods/cocoapods-plugins) -[![Coverage](https://img.shields.io/codeclimate/coverage/github/CocoaPods/cocoapods-plugins.svg?style=flat)](https://codeclimate.com/github/CocoaPods/cocoapods-plugins) -[![Code Climate](https://img.shields.io/codeclimate/github/CocoaPods/cocoapods-plugins.svg?style=flat)](https://codeclimate.com/github/CocoaPods/cocoapods-plugins) - -CLAide plugin which shows info about available CLAide plugins or helps you get started developing a new plugin. Yeah, it's very meta. - -It provides the foundations for CocoaPods and Danger's plugin infrastructure. - -## Installation - -This isn't really a user-facing gem, you need to add it to your library. - -Here is how it is added into Danger: - -```ruby -module Danger - class Runner < CLAide::Command - require "danger/commands/init" - require "danger/commands/local" - require "danger/commands/systems" - - # manually add claide plugins as subcommands - require "claide_plugin" - @subcommands << CLAide::Command::Plugins - CLAide::Plugins.config = - CLAide::Plugins::Configuration.new( - "Danger", - "danger", - "https://raw.githubusercontent.com/danger/danger.systems/master/plugins-search-generated.json", - "https://github.com/danger/danger-plugin-template" - ) - - require "danger/commands/plugins/plugin_lint" - require "danger/commands/plugins/plugin_json" - require "danger/commands/plugins/plugin_readme" - -``` - -## Usage - -##### List installed plugins - - $ [your tool] plugins installed - -List all installed plugins with their respective version - -##### List known plugins - - $ [your tool] plugins list - -List all known plugins (according to the list hosted on `http://github.com/CocoaPods/cocoapods-plugins`) - -##### Search plugins - - $ [your tool] plugins search QUERY - -Search plugins whose name contains the given text (ignoring case). With --full, it searches by name but also by author and description. - -##### Create a new plugin - - $ [your tool] plugins create NAME [TEMPLATE_URL] - -Create a scaffold for the development of a new plugin according to the your tool's best practices. - -If a `TEMPLATE_URL`, pointing to a git repo containing a compatible template, is specified, it will be used in place of the default one. - -## Get your plugin listed - - $ [your tool] plugins publish - -Create an issue in the plugins search GitHub repository to ask for your plugin to be added to the official list (with the proper JSON fragment to be added to `plugins.json` so we just have to copy/paste it). diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/Rakefile b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/Rakefile deleted file mode 100644 index 3a2faa0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/Rakefile +++ /dev/null @@ -1,90 +0,0 @@ -# Bootstrap -#-----------------------------------------------------------------------------# - -task :bootstrap do - if system('which bundle') - sh 'bundle install' - else - $stderr.puts "\033[0;31m" \ - "[!] Please install the bundler gem manually:\n" \ - ' $ [sudo] gem install bundler' \ - "\e[0m" - exit 1 - end -end - -begin - - require 'bundler/gem_tasks' - - task :default => 'spec' - - # Spec - #-----------------------------------------------------------------------------# - - desc 'Runs all the specs' - task :spec do - start_time = Time.now - sh "bundle exec bacon #{specs('**')}" - duration = Time.now - start_time - puts "Tests completed in #{duration}s" - Rake::Task['rubocop'].invoke - - # This is not used in this library - # Rake::Task['validate_json'].invoke - end - - def specs(dir) - FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ') - end - - # Rubocop - #-----------------------------------------------------------------------------# - - desc 'Checks code style' - task :rubocop do - require 'rubocop' - cli = RuboCop::CLI.new - result = cli.run(FileList['{spec,lib}/**/*.rb']) - abort('RuboCop failed!') unless result == 0 - end - - # plugins.json - #----------------------------------------------------------------------------# - - desc 'Validates plugins.json' - task :validate_json do - require 'json' - require 'pathname' - - puts 'Validating plugins.json' - - json_file = Pathname(__FILE__).parent + 'plugins.json' - json = json_file.read - plugins = JSON.load(json) - abort('Invalid JSON in plugins.json') unless plugins - keys = %w(gem name author social_media_url url description) - optional_keys = %w(social_media_url) - errors = plugins['plugins'].reduce([]) do |errors, plugin| - extra_keys = plugin.keys - keys - unless extra_keys.empty? - errors << "plugin `#{plugin['name']}` has extra keys #{extra_keys}" - end - (keys - optional_keys).each do |key| - unless plugin[key] - errors << "plugin `#{plugin['name']}` is missing key `#{key}`" - end - end - errors - end - unless errors.empty? - abort("Invalid plugins.json:\n\n#{errors.join("\n")}") - end - end - -rescue LoadError - $stderr.puts "\033[0;31m" \ - '[!] Some Rake tasks haven been disabled because the environment' \ - ' couldn’t be loaded. Be sure to run `rake bootstrap` first.' \ - "\e[0m" -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/claide-plugins.gemspec b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/claide-plugins.gemspec deleted file mode 100644 index 39186c5..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/claide-plugins.gemspec +++ /dev/null @@ -1,33 +0,0 @@ -# coding: utf-8 -lib = File.expand_path('../lib', __FILE__) -$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'claide_plugins.rb' - -Gem::Specification.new do |spec| - spec.name = 'claide-plugins' - spec.version = CLAidePlugins::VERSION - spec.authors = ['David Grandinetti', 'Olivier Halligon'] - spec.summary = %q{CLAide plugin which shows info about available CLAide plugins.} - spec.description = <<-DESC - This CLAide plugin shows information about all available CLAide plugins - (yes, this is very meta!). - This plugin adds the "plugins" subcommand to a binary so that you can list - all plugins (registered in the reference JSON hosted at CocoaPods/cocoapods-plugins) - DESC - spec.homepage = 'https://github.com/cocoapods/claide-plugins' - spec.license = 'MIT' - - spec.files = `git ls-files`.split($/) - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) - spec.require_paths = ['lib'] - - spec.add_runtime_dependency 'nap' - spec.add_runtime_dependency 'cork' - spec.add_runtime_dependency 'open4', '~> 1.3' - - spec.add_development_dependency 'bundler', '~> 1.3' - spec.add_development_dependency 'rake' - spec.add_development_dependency 'pry' - - spec.required_ruby_version = '>= 2.0.0' -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/gem_helper.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/gem_helper.rb deleted file mode 100644 index ece0103..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/gem_helper.rb +++ /dev/null @@ -1,120 +0,0 @@ -require 'claide/command/gem_index_cache' - -module CLAide - class Command - # This module is used by Command::PluginsHelper to download the Gem - # Specification data, check if a Gem is installed, and provide info - # on all versions of a Gem. - # - module GemHelper - # A GemIndexCache to manage downloading/caching the spec index. - # - @cache = nil - - # Getter for GemIndexCache - # - # @return [GemIndexCache] a new or memoized GemIndexCache - # - def self.cache - @cache ||= GemIndexCache.new - end - - # Instantiate a cache and download the spec index if it has - # not already been done. - # - def self.download_and_cache_specs - cache.download_and_cache_specs - end - - # Tells if a gem is installed - # - # @param [String] gem_name - # The name of the plugin gem to test - # - # @param [String] version_string - # An optional version string, used to check if a specific - # version of a gem is installed - # - # @return [Bool] true if the gem is installed, false otherwise. - # - def self.gem_installed?(gem_name, version_string = nil) - version = Gem::Version.new(version_string) if version_string - - if Gem::Specification.respond_to?(:find_all_by_name) - gems = Gem::Specification.find_all_by_name(gem_name) - return !gems.empty? unless version - gems.each { |gem| return true if gem.version == version } - false - else - dep = Gem::Dependency.new(gem_name, version_string) - !Gem.source_index.search(dep).empty? - end - end - - # Get the version of a gem that is installed locally. If more than - # one version is installed, this returns the first version found, - # which MAY not be the highest/newest version. - # - # @return [String] The version of the gem that is installed, - # or nil if it is not installed. - # - def self.installed_version(gem_name) - if Gem::Specification.respond_to?(:find_all_by_name) - gem = Gem::Specification.find_all_by_name(gem_name).first - else - dep = Gem::Dependency.new(gem_name) - gem = Gem.source_index.search(dep).first - end - gem ? gem.version.to_s : nil - end - - # Create a string containing all versions of a plugin, - # colored to indicate if a specific version is installed - # locally. - # - # @param [String] plugin_name - # The name of the plugin gem - # - # @param [GemIndexCache] index_cache - # Optional index cache can be passed in, otherwise - # the module instance is used. - # - # @return [String] a string containing a comma separated - # concatenation of all versions of a plugin - # that were found on rubygems.org - # - def self.versions_string(plugin_name, index_cache = @cache) - name_tuples = index_cache.specs_with_name(plugin_name) - sorted_versions = name_tuples.sort_by(&:version) - version_strings = colorize_versions(sorted_versions) - version_strings.join ', ' - end - - #----------------# - - private - - # Colorize an Array of version strings so versions that are installed - # are green and uninstalled versions are yellow. - # - # @param [Array] versions - # sorted array of Gem::NameTuples representing all versions of - # a plugin gem. - # - # @return [Array] An array of strings, each one being the version - # string of the same plugin - # - def self.colorize_versions(versions) - colored_strings = [] - versions.reverse_each do |name_tuple| - if gem_installed?(name_tuple.name, name_tuple.version.to_s) - colored_strings << name_tuple.version.to_s.green - else - colored_strings << name_tuple.version.to_s.yellow - end - end - colored_strings - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/gem_index_cache.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/gem_index_cache.rb deleted file mode 100644 index aceeb1d..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/gem_index_cache.rb +++ /dev/null @@ -1,87 +0,0 @@ -require 'claide/command/gem_helper' - -module CLAide - class Command - # This class is used by Command::GemsHelper to download the Gem - # Specification index from rubygems.org and provide info about - # the index. - # - class GemIndexCache - # A memoized hash of all the rubygem specs. If it is nil, the specs will - # be downloaded, which will take a few seconds to download. - # - # @return [Hash] The hash of all rubygems - # - def specs - @specs ||= download_specs - end - - # Alias to make the initial caching process more readable. - # - alias_method :download_and_cache_specs, :specs - - # Get an Array of Gem::NameTuple objects that match a given - # spec name. - # - # @param [String] name - # The name of the gem to match on (e.g. 'cocoapods-try') - # - # @return [Array] Array of Gem::NameTuple that match the name - # - def specs_with_name(name) - matching_specs = @specs.select do |spec| - spec[0].name == name - end - - name_tuples = [] - matching_specs.each do |(name_tuple, _)| - name_tuples << name_tuple - end - - name_tuples - end - - #----------------# - - private - - # Force the rubygem spec index file - # - # @return [Hash] The hash of all rubygems - # - def download_specs - UI.puts 'Downloading Rubygem specification index...' - fetcher = Gem::SpecFetcher.fetcher - results, errors = fetcher.available_specs(:released) - - unless errors.empty? - UI.puts 'Error downloading Rubygem specification index: ' + - errors.first.error.to_s - return [] - end - - flatten_fetcher_results(results) - end - - # Flatten the dictionary returned from Gem::SpecFetcher - # to a simple array. - # - # @param [Hash] results - # the hash returned from the call to - # Gem::SpecFetcher.available_specs() - # - # @return [Array] Array of all spec results - # - def flatten_fetcher_results(results) - specs = [] - results.each do |source, source_specs| - source_specs.each do |tuple| - specs << [tuple, source] - end - end - - specs - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/plugins.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/plugins.rb deleted file mode 100644 index 444778f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/plugins.rb +++ /dev/null @@ -1,47 +0,0 @@ -require 'rest' -require 'json' -require 'cork' -require 'claide' -require 'claide/command/plugins_config' - -UI = Cork::Board.new - -module CLAide - module Plugins - class << self - attr_accessor :config - end - # set a default configuration that will work with claide-plugins - self.config = Configuration.new - end - - # Indicates a runtime error **not** caused by a bug. - # - class PlainInformative < StandardError; end - - # Indicates a user error. - # - class Informative < PlainInformative; end - - class Command - # The claide plugins command. - # - class Plugins < Command - require 'claide/command/plugins/list' - require 'claide/command/plugins/search' - require 'claide/command/plugins/create' - - self.abstract_command = true - self.default_subcommand = 'list' - - self.summary = 'Show available plugins' - self.description = <<-DESC - Lists or searches the available plugins - and show if you have them installed or not. - - Also allows you to quickly create a new - plugin using a provided template. - DESC - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/plugins/create.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/plugins/create.rb deleted file mode 100644 index 28e81ea..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/plugins/create.rb +++ /dev/null @@ -1,71 +0,0 @@ -require 'claide/command/plugins_helper' -require 'claide/command/gem_helper' -require 'claide/command/template_runner' - -module CLAide - class Command - class Plugins - # The create subcommand. Used to create a new plugin using either the - # default template (CocoaPods/cocoapods-plugin-template) or a custom - # template - # - class Create < Plugins - self.summary = 'Creates a new plugin' - def self.description - <<-DESC - Creates a scaffold for the development of a new plugin - named `NAME` according to the best practices. - - If a `TEMPLATE_URL`, pointing to a git repo containing a - compatible template, is specified, it will be used - in place of the default one. - DESC - end - - self.arguments = [ - CLAide::Argument.new('NAME', true), - CLAide::Argument.new('TEMPLATE_URL', false), - ] - - def initialize(argv) - @name = argv.shift_argument - prefix = CLAide::Plugins.config.plugin_prefix + '-' - unless @name.nil? || @name.empty? || @name.start_with?(prefix) - @name = prefix + @name.dup - end - @template_url = argv.shift_argument - super - end - - def validate! - super - if @name.nil? || @name.empty? - help! 'A name for the plugin is required.' - end - - help! 'The plugin name cannot contain spaces.' if @name.match(/\s/) - end - - def run - runner = TemplateRunner.new @name, @template_url - runner.clone_template - runner.configure_template - show_reminder - end - - #----------------------------------------# - - private - - # Shows a reminder to the plugin author to make a Pull Request - # in order to update plugins.json once the plugin is released - # - def show_reminder - repo = PluginsHelper.plugins_raw_url - UI.notice "Don't forget to create a Pull Request on #{repo}\n" \ - ' to add your plugin to the plugins.json file once it is released!' - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/plugins/list.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/plugins/list.rb deleted file mode 100644 index 4ff258f..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/plugins/list.rb +++ /dev/null @@ -1,34 +0,0 @@ -require 'claide/command/plugins_helper' -require 'claide/command/gem_helper' - -module CLAide - class Command - class Plugins - # The list subcommand. Used to list all known plugins - # - class List < Plugins - self.summary = 'List all known plugins' - def self.description - "List all known plugins (according to the list - hosted on #{ CLAide::Plugins.config.plugin_list_url })" - end - - def self.options - super.reject { |option, _| option == '--silent' } - end - - def run - plugins = PluginsHelper.known_plugins - GemHelper.download_and_cache_specs if self.verbose? - - name = CLAide::Plugins.config.name - UI.title "Available #{name} Plugins:" do - plugins.each do |plugin| - PluginsHelper.print_plugin plugin, self.verbose? - end - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/plugins/search.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/plugins/search.rb deleted file mode 100644 index 7e763c5..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/plugins/search.rb +++ /dev/null @@ -1,60 +0,0 @@ -require 'claide/command/plugins_helper' -require 'claide/command/gem_helper' -require 'claide/command' - -module CLAide - class Command - class Plugins - # The search subcommand. - # Used to search a plugin in the list of known plugins, - # searching into the name, author description fields - # - class Search < Plugins - self.summary = 'Search for known plugins' - self.description = <<-DESC - Searches plugins whose 'name' contains the given `QUERY`. - `QUERY` is a regular expression, ignoring case. - - With `--full`, it also searches by 'author' and 'description'. - DESC - - self.arguments = [ - CLAide::Argument.new('QUERY', true), - ] - - def self.options - [ - ['--full', 'Search by name, author, and description'], - ].concat(super.reject { |option, _| option == '--silent' }) - end - - def initialize(argv) - @full_text_search = argv.flag?('full') - @query = argv.shift_argument unless argv.arguments.empty? - super - end - - def validate! - super - help! 'A search query is required.' if @query.nil? || @query.empty? - begin - /#{@query}/ - rescue RegexpError - help! 'A valid regular expression is required.' - end - end - - def run - plugins = PluginsHelper.matching_plugins(@query, @full_text_search) - GemHelper.download_and_cache_specs if self.verbose? - - name = CLAide::Plugins.config.name - UI.title "Available #{name} Plugins matching '#{@query}':" - plugins.each do |plugin| - PluginsHelper.print_plugin plugin, self.verbose? - end - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/plugins_config.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/plugins_config.rb deleted file mode 100644 index 74d4bff..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/plugins_config.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'claide' - -module CLAide - module Plugins - class Configuration - # name of the plugin - attr_accessor :name - - # prefix to use when searching for gems to load at runtime - attr_accessor :plugin_prefix - - # url for JSON file that holds list of plugins to show when searching - attr_accessor :plugin_list_url - - # url for repo that holds template to use when creating a new plugin - attr_accessor :plugin_template_url - - def initialize(name = 'default name', - plugin_prefix = 'claide', - plugin_list_url = 'https://github.com/cocoapods/claide-plugins/something.json', - plugin_template_url = 'https://github.com/cocoapods/claide-plugins-template') - @name = name - @plugin_prefix = plugin_prefix - @plugin_list_url = plugin_list_url - @plugin_template_url = plugin_template_url - end - end - - class << self - attr_accessor :config - end - # set a default configuration that will work with claide-plugins - self.config = Configuration.new - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/plugins_helper.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/plugins_helper.rb deleted file mode 100644 index 24e4858..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/plugins_helper.rb +++ /dev/null @@ -1,139 +0,0 @@ -require 'claide/command/gem_helper' - -module CLAide - class Command - # This module is used by Command::Plugins::List - # and Command::Plugins::Search to download and parse - # the JSON describing the plugins list and manipulate it - # - module PluginsHelper - def self.plugins_raw_url - CLAide::Plugins.config.plugin_list_url - end - - def self.plugin_prefix - CLAide::Plugins.config.plugin_prefix - end - - # Force-download the JSON - # - # @return [Hash] The hash representing the JSON with all known plugins - # - def self.download_json - UI.puts 'Downloading Plugins list...' - response = REST.get(plugins_raw_url) - if response.ok? - parse_json(response.body) - else - raise Informative, 'Could not download plugins list ' \ - "from #{plugin_prefix}-plugins: #{response.inspect}" - end - end - - # The list of all known plugins, according to - # the JSON hosted on github's cocoapods-plugins - # - # @return [Array] all known plugins, as listed in the downloaded JSON - # - def self.known_plugins - json = download_json - json['plugins'] - end - - # Filter plugins to return only matching ones - # - # @param [String] query - # A query string that corresponds to a valid RegExp pattern. - # - # @param [Bool] full_text_search - # false only searches in the plugin's name. - # true searches in the plugin's name, author and description. - # - # @return [Array] all plugins matching the query - # - def self.matching_plugins(query, full_text_search) - query_regexp = /#{query}/i - known_plugins.reject do |plugin| - texts = [plugin['name']] - if full_text_search - texts << plugin['author'] if plugin['author'] - texts << plugin['description'] if plugin['description'] - end - texts.grep(query_regexp).empty? - end - end - - # Display information about a plugin - # - # @param [Hash] plugin - # The hash describing the plugin - # - # @param [Bool] verbose - # If true, will also print the author of the plugins. - # Defaults to false. - # - def self.print_plugin(plugin, verbose = false) - plugin_colored_name = plugin_title(plugin) - - UI.title(plugin_colored_name, '', 1) do - UI.puts_indented plugin['description'] - ljust = verbose ? 16 : 11 - UI.labeled('Gem', plugin['gem'], ljust) - UI.labeled('URL', plugin['url'], ljust) - print_verbose_plugin(plugin, ljust) if verbose - end - end - - #----------------# - - private - - # Smaller helper to print out the verbose details - # for a plugin. - # - # @param [Hash] plugin - # The hash describing the plugin - # - # @param [Integer] ljust - # The left justification that is passed into UI.labeled - # - def self.print_verbose_plugin(plugin, ljust) - UI.labeled('Author', plugin['author'], ljust) - unless GemHelper.cache.specs.empty? - versions = GemHelper.versions_string(plugin['gem']) - UI.labeled('Versions', versions, ljust) - end - end - - # Parse the given JSON data, handling parsing errors if any - # - # @param [String] json_str - # The string representation of the JSON to parse - # - def self.parse_json(json_str) - JSON.parse(json_str) - rescue JSON::ParserError => e - raise Informative, - "Invalid plugins list from #{plugin_prefix}-plugins: #{e}" - end - - # Format the title line to print the plugin info with print_plugin - # coloring it according to whether the plugin is installed or not - # - # @param [Hash] plugin - # The hash describing the plugin - # - # @return [String] The formatted and colored title - # - def self.plugin_title(plugin) - plugin_name = "-> #{plugin['name']}" - if GemHelper.gem_installed?(plugin['gem']) - plugin_name += " (#{GemHelper.installed_version(plugin['gem'])})" - plugin_name.green - else - plugin_name.yellow - end - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/template_runner.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/template_runner.rb deleted file mode 100644 index 0919dc3..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/command/template_runner.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'claide/command/plugins_helper' -require 'claide/executable' - -module CLAide - class TemplateRunner - extend CLAide::Executable - executable :git - - def initialize(name, template_url) - @name = name - @template_url = template_url - end - - # Clones the template from the remote in the working directory using - # the name of the plugin. - # - # @return [void] - # - def clone_template - UI.section("-> Creating `#{@name}` plugin") do - UI.notice "using template '#{template_repo_url}'" - command = ['clone', template_repo_url, @name] - git! command - end - end - - # Runs the template configuration utilities. - # - # @return [void] - # - def configure_template - UI.section('-> Configuring template') do - Dir.chdir(@name) do - if File.file? 'configure' - system "./configure #{@name}" - else - UI.warn 'Template does not have a configure file.' - end - end - end - end - - # Checks if a template URL is given else returns the Plugins.config URL - # - # @return String - # - def template_repo_url - @template_url || CLAide::Plugins.config.plugin_template_url - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/executable.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/executable.rb deleted file mode 100644 index 1b839bf..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide/executable.rb +++ /dev/null @@ -1,116 +0,0 @@ -module CLAide - # Module which provides support for running executables. - # - # In a class it can be used as: - # - # extend Executable - # executable :git - # - # This will create two methods `git` and `git!` both accept a command but - # the latter will raise on non successful executions. The methods return the - # output of the command. - # - module Executable - # Creates the methods for the executable with the given name. - # - # @param [Symbol] name - # the name of the executable. - # - # @return [void] - # - def executable(name) - define_method(name) do |*command| - Executable.execute_command(name, Array(command).flatten, false) - end - - define_method(name.to_s + '!') do |*command| - Executable.execute_command(name, Array(command).flatten, true) - end - end - - # Executes the given command. Displays output if in verbose mode. - # - # @param [String] bin - # The binary to use. - # - # @param [Array<#to_s>] command - # The command to send to the binary. - # - # @param [Bool] raise_on_failure - # Whether it should raise if the command fails. - # - # @raise If the executable could not be located. - # - # @raise If the command fails and the `raise_on_failure` is set to true. - # - # @return [String] the output of the command (STDOUT and STDERR). - # - # @todo Find a way to display the live output of the commands. - # - def self.execute_command(exe, command, raise_on_failure) - bin = `which #{exe}`.strip - raise Informative, "Unable to locate `#{exe}`" if bin.empty? - - require 'open4' - require 'shellwords' - - command = command.map(&:to_s) - full_command = \ - "#{bin.shellescape} #{command.map(&:shellescape).join(' ')}" - - # if Config.instance.verbose? - # UI.message("$ #{full_command}") - # stdout, stderr = Indenter.new(STDOUT), Indenter.new(STDERR) - # else - stdout, stderr = Indenter.new, Indenter.new - # end - - options = { :stdout => stdout, :stderr => stderr, :status => true } - status = Open4.spawn(bin, command, options) - output = stdout.join("\n") + stderr.join("\n") - unless status.success? - if raise_on_failure - raise Informative, "#{full_command}\n\n#{output}" - else - UI.message("[!] Failed: #{full_command}".red) - end - end - output - end - - #-------------------------------------------------------------------------# - - # Helper class that allows to write to an {IO} instance taking into account - # the UI indentation level. - # - class Indenter < ::Array - # @return [Fixnum] The indentation level of the UI. - # - attr_accessor :indent - - # @return [IO] the {IO} to which the output should be printed. - # - attr_accessor :io - - # @param [IO] io @see io - # - def initialize(io = nil) - @io = io - @indent = ' ' * UI.indentation_level - end - - # Stores a portion of the output and prints it to the {IO} instance. - # - # @param [String] value - # the output to print. - # - # @return [void] - # - def <<(value) - super - ensure - @io << "#{ indent }#{ value }" if @io - end - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide_plugin.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide_plugin.rb deleted file mode 100644 index c0a4508..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide_plugin.rb +++ /dev/null @@ -1 +0,0 @@ -require 'claide/command/plugins' diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide_plugins.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide_plugins.rb deleted file mode 100644 index c77c66e..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/lib/claide_plugins.rb +++ /dev/null @@ -1,3 +0,0 @@ -module CLAidePlugins - VERSION = '0.9.2'.freeze -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/gem_helper_spec.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/gem_helper_spec.rb deleted file mode 100644 index 3b7612b..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/gem_helper_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -require File.expand_path('../spec_helper', File.dirname(__FILE__)) -require 'claide/command/gem_helper' - -# The CLAide namespace -# -module CLAide - describe Command::GemHelper do - before do - UI_OUT.reopen - end - - after do - mocha_teardown - end - - it 'detects if a gem is installed' do - Command::GemHelper.gem_installed?('bacon').should.be.true - Command::GemHelper.gem_installed?('fake-fake-fake-gem').should.be.false - end - - it 'detects if a specific version of a gem is installed' do - Command::GemHelper.gem_installed?('bacon', Bacon::VERSION).should.be.true - impossibacon = Gem::Version.new(Bacon::VERSION).bump - Command::GemHelper.gem_installed?('bacon', impossibacon).should.be.false - end - - it 'creates a version list that includes all versions of a single gem' do - spec2 = Gem::NameTuple.new('cocoapods-plugins', Gem::Version.new('0.2.0')) - spec1 = Gem::NameTuple.new('cocoapods-plugins', Gem::Version.new('0.1.0')) - response = [{ 1 => [spec2, spec1] }, []] - Gem::SpecFetcher.any_instance.stubs(:available_specs).returns(response) - - @cache = Command::GemIndexCache.new - @cache.download_and_cache_specs - versions_string = - Command::GemHelper.versions_string('cocoapods-plugins', @cache) - versions_string.should.include('0.2.0') - versions_string.should.include('0.1.0') - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/gem_index_cache_spec.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/gem_index_cache_spec.rb deleted file mode 100644 index 22e6baf..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/gem_index_cache_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -require File.expand_path('../spec_helper', File.dirname(__FILE__)) - -# The CocoaPods namespace -# -module CLAide - describe Command::GemIndexCache do - before do - @cache = Command::GemIndexCache.new - UI_OUT.reopen - end - - after do - mocha_teardown - end - - it 'notifies the user that it is downloading the spec index' do - response = [{}, []] - Gem::SpecFetcher.any_instance.stubs(:available_specs).returns(response) - - @cache.download_and_cache_specs - out = UI_OUT.string - out.should.include('Downloading Rubygem specification index...') - out.should.not.include('Error downloading Rubygem specification') - end - - it 'notifies the user when getting the spec index fails' do - error = Gem::RemoteFetcher::FetchError.new('no host', 'bad url') - wrapper_error = stub(:error => error) - response = [[], [wrapper_error]] - Gem::SpecFetcher.any_instance.stubs(:available_specs).returns(response) - - @cache.download_and_cache_specs - @cache.specs.should.be.empty? - UI_OUT.string.should.include('Downloading Rubygem specification index...') - UI_OUT.string.should.include('Error downloading Rubygem specification') - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/plugins/create_spec.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/plugins/create_spec.rb deleted file mode 100644 index 59156af..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/plugins/create_spec.rb +++ /dev/null @@ -1,105 +0,0 @@ -require File.expand_path('../../../spec_helper', __FILE__) -require 'tmpdir' - -# The CocoaPods namespace -# -module CLAide - describe Command::Plugins::Create do - extend SpecHelper::PluginsCreateCommand - - # We need to have a working repo for the template inside this test - # suite so we're using the real Danger config file, then setting - # it back to the default. - before do - UI_OUT.reopen - config = CLAide::Plugins::Configuration.new('Danger', - 'danger', - 'https://raw.githubusercontent.com/danger/danger.systems/master/plugins-search-generated.json', - 'https://github.com/danger/danger-plugin-template') - CLAide::Plugins.config = config - end - - after do - CLAide::Plugins.config = default_testing_config - end - - it 'registers itself' do - Command.parse(%w(plugins create)). - should.be.instance_of Command::Plugins::Create - end - - #--- Validation - - it 'should require a name is passed in' do - @command = create_command - should.raise(CLAide::Help) do - @command.validate! - end.message.should.match(/A name for the plugin is required./) - end - - it 'should require a non-empty name is passed in' do - @command = create_command('') - should.raise(CLAide::Help) do - @command.validate! - end.message.should.match(/A name for the plugin is required./) - end - - it 'should require the name does not have spaces' do - @command = create_command('my gem') - should.raise(CLAide::Help) do - @command.validate! - end.message.should.match(/The plugin name cannot contain spaces./) - end - - #--- Naming - - # These have to be `danger` as the configure script runs from the danger - # plugin template repo. - - it 'should prefix the given name if not already' do - @command = create_command('unprefixed') - Dir.mktmpdir do |tmpdir| - Dir.chdir(tmpdir) do - @command.run - end - end - UI_OUT.string.should.include('Creating `danger-unprefixed` plugin') - end - - it 'should not prefix the name if already prefixed' do - @command = create_command('danger-prefixed') - Dir.mktmpdir do |tmpdir| - Dir.chdir(tmpdir) do - @command.run - end - end - UI_OUT.string.should.include('Creating `danger-prefixed` plugin') - end - - #--- Template download - - it 'should download the default template repository' do - @command = create_command('danger-banana') - - template_repo = 'https://github.com/danger/' \ - 'danger-plugin-template' - git_command = ['clone', template_repo, 'danger-banana'] - CLAide::TemplateRunner.any_instance.expects(:git!).with(git_command) - CLAide::TemplateRunner.any_instance.expects(:configure_template) - @command.run - UI_OUT.string.should.include('Creating `danger-banana` plugin') - end - - it 'should download the passed in template repository' do - alt_repo = 'https://github.com/danger/' \ - 'danger-banana-plugin-template' - @command = create_command('danger-banana', alt_repo) - - git_command = ['clone', alt_repo, 'danger-banana'] - CLAide::TemplateRunner.any_instance.expects(:git!).with(git_command) - CLAide::TemplateRunner.any_instance.expects(:configure_template) - @command.run - UI_OUT.string.should.include('Creating `danger-banana` plugin') - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/plugins/list_spec.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/plugins/list_spec.rb deleted file mode 100644 index 9fffc82..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/plugins/list_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -require File.expand_path('../../../spec_helper', __FILE__) - -# The CocoaPods namespace -# -module CLAide - describe Command::Plugins::List do - extend SpecHelper::PluginsStubs - - before do - UI_OUT.reopen - @command = CLAide::Command::Plugins::List.new CLAide::ARGV.new [] - end - - it 'registers itself' do - Command.parse(%w(plugins list)). - should.be.instance_of Command::Plugins::List - end - - #--- Output printing - - it 'prints out all plugins' do - stub_plugins_json_request - @command.run - UI_OUT.string.should.include('github.com/CLAide/claide-fake-1') - UI_OUT.string.should.include('github.com/CLAide/claide-fake-2') - UI_OUT.string.should.include('github.com/chneukirchen/bacon') - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/plugins/search_spec.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/plugins/search_spec.rb deleted file mode 100644 index 488ebbb..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/plugins/search_spec.rb +++ /dev/null @@ -1,55 +0,0 @@ -require File.expand_path('../../../spec_helper', __FILE__) - -# The CocoaPods namespace -# -module CLAide - describe Command::Plugins::Search do - extend SpecHelper::PluginsStubs - extend SpecHelper::PluginsSearchCommand - - before do - UI_OUT.reopen - end - - it 'registers itself' do - Command.parse(%w(plugins search)). - should.be.instance_of Command::Plugins::Search - end - - #--- Validation - - it 'should require a non-empty query' do - @command = search_command - should.raise(CLAide::Help) do - @command.validate! - end.message.should.match(/A search query is required./) - end - - it 'should require a valid RegExp as query' do - @command = search_command('[invalid') - should.raise(CLAide::Help) do - @command.validate! - end.message.should.match(/A valid regular expression is required./) - end - - #--- Output printing - - it 'should filter plugins only by name without full search' do - stub_plugins_json_request - @command = search_command('search') - @command.run - UI_OUT.string.should.not.include('-> CLAide Fake Gem') - UI_OUT.string.should.include('-> CLAide Searchable Fake Gem') - UI_OUT.string.should.not.include('-> Bacon') - end - - it 'should filter plugins by name, author, description with full search' do - stub_plugins_json_request - @command = search_command('--full', 'search') - @command.run - UI_OUT.string.should.include('-> CLAide Fake Gem') - UI_OUT.string.should.include('-> CLAide Searchable Fake Gem') - UI_OUT.string.should.not.include('-> Bacon') - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/plugins_helper_spec.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/plugins_helper_spec.rb deleted file mode 100644 index 9a2e5cd..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/plugins_helper_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -require File.expand_path('../spec_helper', File.dirname(__FILE__)) - -# The CocoaPods namespace -# -module CLAide - describe Command::PluginsHelper do - extend SpecHelper::PluginsStubs - - it 'downloads the json file' do - stub_plugins_json_request - json = Command::PluginsHelper.download_json - json.should.not.be.nil? - json.should.be.is_a? Hash - json['plugins'].size.should.eql? 3 - end - - it 'handles empty/bad JSON' do - stub_plugins_json_request 'This is not JSON' - expected_error = /Invalid plugins list from claidetest-plugins/ - should.raise(CLAide::Informative) do - Command::PluginsHelper.download_json - end.message.should.match(expected_error) - end - - it 'notifies the user if the download fails' do - stub_plugins_json_request '', [404, 'Not Found'] - expected_error = /Could not download plugins list from claidetest-plugins/ - should.raise(CLAide::Informative) do - Command::PluginsHelper.download_json - end.message.should.match(expected_error) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/plugins_spec.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/plugins_spec.rb deleted file mode 100644 index 4bc6cbd..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/command/plugins_spec.rb +++ /dev/null @@ -1,45 +0,0 @@ -require File.expand_path('../../spec_helper', __FILE__) - -# The CocoaPods namespace -# -module CLAide - describe Command::Plugins do - before do - argv = CLAide::ARGV.new([]) - @command = Command::Plugins.new(argv) - end - - it 'registers itself and uses the default subcommand' do - Command.parse(%w(plugins)).should.be.instance_of Command::Plugins::List - end - - it 'exists' do - @command.should.not.be.nil? - end - end - - describe Plugins do - it 'should have a default config' do - config = CLAide::Plugins.config - config.should.be.instance_of CLAide::Plugins::Configuration - end - - it 'should default to a CLAide plugin config' do - config = CLAide::Plugins::Configuration.new - config.name.should.equal('default name') - config.plugin_prefix.should.equal('claide') - config.plugin_list_url.should.equal('https://github.com/cocoapods/claide-plugins/something.json') - url = config.plugin_template_url - url.should.equal('https://github.com/cocoapods/claide-plugins-template') - end - - it 'should set the plugin_prefix in the claide plugin manager' do - CLAide::Plugins.config = - CLAide::Plugins::Configuration.new('testing', - 'pants', - 'http://example.com/pants.json', - 'http://example.com/pants_template') - CLAide::Plugins.config.plugin_prefix.should.equal('pants') - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/fixtures/claide-foo1.gemspec b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/fixtures/claide-foo1.gemspec deleted file mode 100644 index 7aa0e36..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/fixtures/claide-foo1.gemspec +++ /dev/null @@ -1,10 +0,0 @@ -# coding: utf-8 -Gem::Specification.new do |spec| - spec.name = 'claide-foo1' - spec.version = '2.0.1' - spec.authors = ['Author 1'] - spec.summary = 'Gem Summary 1' - spec.description = 'Gem Description 1' - spec.homepage = 'https://github.com/proper-man/claide-foo1' - spec.license = 'MIT' -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/fixtures/claide-foo2.gemspec b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/fixtures/claide-foo2.gemspec deleted file mode 100644 index a4bfc41..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/fixtures/claide-foo2.gemspec +++ /dev/null @@ -1,9 +0,0 @@ -# coding: utf-8 -Gem::Specification.new do |spec| - spec.name = 'claide-foo2' - spec.version = '2.0.2' - spec.authors = ['Author 1', 'Author 2'] - spec.description = 'Gem Description 2' - spec.homepage = 'https://github.com/proper-man/claide-foo2' - spec.license = 'MIT' -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/fixtures/plugins.json b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/fixtures/plugins.json deleted file mode 100644 index 3725d2b..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/fixtures/plugins.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "plugins":[ - { - "gem":"claide-fake-fake-fake-1", - "name":"CLAide Fake Gem", - "url":"https://github.com/CLAide/claide-fake-1", - "description":"A Pod that should not exist and should only be found by full search" - }, - { - "gem":"bacon", - "name":"Bacon", - "url":"https://github.com/chneukirchen/bacon", - "description":"A minimal RSpec clone." - }, - { - "gem":"claide-fake-fake-fake-2", - "name":"CLAide Searchable Fake Gem", - "url":"https://github.com/CLAide/claide-fake-2", - "description":"A Pod that should not exist but should be found with search" - } - ] -} diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/fixtures/unprefixed.gemspec b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/fixtures/unprefixed.gemspec deleted file mode 100644 index abd90e6..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/fixtures/unprefixed.gemspec +++ /dev/null @@ -1,10 +0,0 @@ -# coding: utf-8 -Gem::Specification.new do |spec| - spec.name = 'unprefixed-plugin' - spec.version = '1.2.3' - spec.authors = ['Author 1', 'Author 2'] - spec.summary = 'Gem Summary' - spec.description = 'Gem Description' - spec.homepage = 'https://github.com/messy-man/unprefixed-plugins' - spec.license = 'MIT' -end diff --git a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/spec_helper.rb b/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/spec_helper.rb deleted file mode 100644 index 5288ccd..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/claide-plugins-0.9.2/spec/spec_helper.rb +++ /dev/null @@ -1,106 +0,0 @@ -# Set up coverage analysis -#-----------------------------------------------------------------------------# - -require 'codeclimate-test-reporter' -CodeClimate::TestReporter.configure do |config| - config.logger.level = Logger::WARN -end -CodeClimate::TestReporter.start - -# Set up -#-----------------------------------------------------------------------------# - -require 'pathname' -ROOT = Pathname.new(File.expand_path('../../', __FILE__)) -$LOAD_PATH.unshift((ROOT + 'lib').to_s) -$LOAD_PATH.unshift((ROOT + 'spec').to_s) - -require 'bundler/setup' -require 'bacon' -require 'mocha-on-bacon' -require 'pretty_bacon' - -require 'webmock' -include WebMock::API - -require 'claide_plugin' - -# VCR -#--------------------------------------# - -require 'vcr' -VCR.configure do |c| - c.cassette_library_dir = ROOT + 'spec/fixtures/vcr_cassettes' - c.hook_into :webmock - c.ignore_hosts 'codeclimate.com' -end - -#-----------------------------------------------------------------------------# - -# Disable the wrapping so the output is deterministic in the tests. -# -UI_OUT = StringIO.new -UI_ERR = StringIO.new -UI = Cork::Board.new(:out => UI_OUT, :err => UI_ERR) - -UI.disable_wrap = true - -#-----------------------------------------------------------------------------# - -# Bacon namespace -# -module Bacon - # Add a fixture helper to the Bacon Context - class Context - ROOT = ::ROOT + 'spec/fixtures' - - def fixture(name) - ROOT + name - end - end -end - -#-----------------------------------------------------------------------------# - -# Use test specific settings inside all of the tests -# - -def default_testing_config - CLAide::Plugins::Configuration.new('CLAideTesting', - 'claidetest', - 'https://github.com/cocoapods/claide-plugins/something.json', - 'https://github.com/danger/danger-plugin-template') -end - -CLAide::Plugins.config = default_testing_config -#-----------------------------------------------------------------------------# - -# SpecHelper namespace -# -module SpecHelper - # Add this as an extension into the Search and List specs - # to help stub the plugins.json request - module PluginsStubs - def stub_plugins_json_request(json = nil, status = 200) - body = json || File.read(fixture('plugins.json')) - stub_request(:get, 'http://example.com/pants.json'). - to_return(:status => status, :body => body, :headers => {}) - stub_request(:get, 'https://github.com/cocoapods/claide-plugins/something.json'). - to_return(:status => status, :body => body, :headers => {}) - end - end - - # Add this as an extension into the Create specs - module PluginsCreateCommand - def create_command(*args) - CLAide::Command::Plugins::Create.new CLAide::ARGV.new(args) - end - end - - # Add this as an extension into the Search specs - module PluginsSearchCommand - def search_command(*args) - CLAide::Command::Plugins::Search.new CLAide::ARGV.new(args) - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/LICENSE b/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/LICENSE deleted file mode 100644 index e543acb..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2010 Chris Wanstrath -Copyright (c) 2016 Konstantin Gredeskoul - -MIT License - -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/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/README.md b/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/README.md deleted file mode 100644 index f2da87b..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/README.md +++ /dev/null @@ -1,93 +0,0 @@ -[![Gem Version](https://badge.fury.io/rb/colored2.svg)](https://badge.fury.io/rb/colored2) -[![Downloads](http://ruby-gem-downloads-badge.herokuapp.com/colored2?type=total)](https://rubygems.org/gems/colored2) -[![Gitter](https://img.shields.io/gitter/room/gitterHQ/gitter.svg)](https://gitter.im/colored2) - -[![Build Status](https://travis-ci.org/kigster/colored2.svg?branch=master)](https://travis-ci.org/kigster/colored2) -[![Test Coverage](https://codeclimate.com/github/kigster/colored2/badges/coverage.svg)](https://codeclimate.com/github/kigster/colored2/coverage) -[![Code Climate](https://codeclimate.com/github/kigster/colored2/badges/gpa.svg)](https://codeclimate.com/github/kigster/colored2) -[![Issue Count](https://codeclimate.com/github/kigster/colored2/badges/issue_count.svg)](https://codeclimate.com/github/kigster/colored2) - -## Colored2 - -This is an actively maintained fork of Chris (defunkt) Wanstrath's gem [colored](https://github.com/defunkt/colored), which appears to be no longer supported. - -This fork comes with a slightly spruced up syntax, some additional features, and a test suite written in [RSpec](http://rspec.info/). - -## Usage - -In addition to the simple syntax of the original gem, which affected only the string to the left of the method call, the new "bang" syntax affects a string to the right. If the block or a method argument is provided, the contents is wrapped in the color, and the color is then reset back. - -If no block or argument is provided, the color is left open-ended, and must be explicitly reset – when using the 'bang' notation. - -![](doc/colored2-session1.png) - -### Complete set of colors: - - * black - * red - * green - * yellow - * blue - * magenta - * cyan - * white - -### Complete Set of Effects - -> Note: previous versions used method name `clear` instead of `no_color`, which clashed with many 3rd party frameworks that defined similarly named method in the global namespace. -> This highlights the dangers of introducing so many words into the `String` namespace. - - * no_color - * bold - * dark - * italic - * underlined - * reversed - * plain - * normal - -## Usage in Other Classes - -With this gem you can add color to not just strings, but to any other class. `String` class is automatically decorated as soon as `require 'colored2'` is parsed by the ruby interpreter. Note that future versions may refrain from auto-requiring `colored2/strings`, and rely on explicitly requiring components they need colorized, eg `require 'colored2/numbers'`. - -To color numbers, require the following file, which automatically decorates `Integer` and `Float`. You can also add color methods to the `Object`. Finally, you can add the methods to any custom class by including the `Colored2` Module. - -Below is an `IRB` — session that shows a slightly more advanced usage. - -![](doc/colored2-session2.png) - -## Additional Helpers - -There are several additional helpers tucked onto the `String` class. - - * `#to_bol` (to beginning of the line) will rewind the cursor back to the beginning of the current line. - * `#to_eol` (to end of line) - -## Installation - -Add this line to your application's Gemfile: - - - gem 'colored2' - - -And then execute: - - $ bundle - -Or install it yourself as: - - $ gem install colored2 - - -## Development - -To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). - -## Contributing - -Bug reports and pull requests are welcome on GitHub at [https://github.com/kigster/colored2](https://github.com/kigster/colored2). - -## License - -The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). diff --git a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/Rakefile b/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/Rakefile deleted file mode 100644 index 47ca61b..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/Rakefile +++ /dev/null @@ -1,13 +0,0 @@ -require 'bundler' -require 'bundler/gem_tasks' -require 'rake/clean' - -CLEAN.include %w(pkg coverage *.gem) - -begin - require 'rspec/core/rake_task' - RSpec::Core::RakeTask.new(:spec) -rescue LoadError -end - -task :default => [:spec] diff --git a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2.rb b/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2.rb deleted file mode 100644 index c4305dd..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2.rb +++ /dev/null @@ -1,85 +0,0 @@ -require 'colored2/codes' -require 'colored2/ascii_decorator' - -module Colored2 - def self.decorate(a_class) - a_class.send(:include, Colored2) - end - - def self.included(from_class) - from_class.class_eval do - - def surround_with_color(color: nil, effect: nil, color_self: nil, string: nil, &block) - color_type = if Colored2.background_next? && effect.nil? - Colored2.foreground_next! - :background - else - :foreground - end - - opts = {} - opts.merge!(color_type => color) if color - opts.merge!(effect: effect) if effect - - if color_self then - opts.merge!( beginning: :on, end: :off) - colored = Colored2::AsciiDecorator.new(self).decorate(opts) - if string || block - arg = "#{string}#{block.call if block}" - colored << Colored2::AsciiDecorator.new(arg).decorate(opts) if arg.length > 0 - end - else - opts.merge!( end: :on ) - colored = Colored2::AsciiDecorator.new(self).decorate(opts) - if string || block - arg = "#{string}#{block.call if block}" - colored << Colored2::AsciiDecorator.new(arg).decorate(opts.merge(end: :off)) if arg.length > 0 - end - end - colored - end - - def on - Colored2.background_next! - self - end - end - - from_class.instance_eval do - COLORS.keys.each do |color| - define_method(color) do |string = nil, &block| - surround_with_color(color: color, color_self: true, string: string, &block) - end - - define_method("#{color}!".to_sym) do |string = nil, &block| - surround_with_color(color: color, color_self: false, string: string, &block) - end - end - - EFFECTS.keys.each do |effect| - next if effect == 'no_color' - define_method(effect) do |string = nil, &block| - surround_with_color(effect: effect, color_self: true, string: string, &block) - end - - define_method("#{effect}!".to_sym) do |string = nil, &block| - surround_with_color(effect: effect, color_self: false, string: string, &block) - end - end - - define_method(:to_eol) do - tmp = sub(/^(\e\[[\[\e0-9;m]+m)/, "\\1\e[2K") - if tmp == self - return "\e[2K" << self - end - tmp - end - - define_method(:to_bol) do - "#{self}\033[#{length}D\033[0D" - end - end - end -end - -require 'colored2/strings' diff --git a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2/ascii_decorator.rb b/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2/ascii_decorator.rb deleted file mode 100644 index c491e61..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2/ascii_decorator.rb +++ /dev/null @@ -1,86 +0,0 @@ -require 'colored2/codes' -require 'forwardable' - -module Colored2 - def self.enable! - Colored2::AsciiDecorator.enable! - end - def self.disable! - Colored2::AsciiDecorator.disable! - end - def self.background_next! - Colored2::AsciiDecorator.background_next! - end - def self.foreground_next! - Colored2::AsciiDecorator.foreground_next! - end - def self.background_next? - Colored2::AsciiDecorator.background_next? - end - - class AsciiDecorator - @__background_next = false - @__colors_disabled = false - class << self - attr_accessor :__background_next, :__colors_disabled - def enable! - self.__colors_disabled = false - end - def enabled? - !self.__colors_disabled - end - def disable! - self.__colors_disabled = true - end - def background_next! - self.__background_next = true - end - def foreground_next! - self.__background_next = false - end - def background_next? - self.__background_next - end - end - - extend Forwardable - def_delegators :@my_class, :enable!, :disable! - - attr_accessor :string, :my_class - - def initialize(a_string) - self.string = a_string.instance_of?(Object) ? '' : a_string.to_s - self.my_class = self.class - end - - # options[:start] = :color - # options[:end] = :color | :no_color - def decorate(options = {}) - return string if !self.class.enabled? || string.length == 0 - escape_sequence = [ - Colored2::TextColor.new(options[:foreground]), - Colored2::BackgroundColor.new(options[:background]), - Colored2::Effect.new(options[:effect]) - ].compact.join - - colored = '' - colored << escape_sequence if options[:beginning] == :on - colored << string - if options[:end] - colored << no_color if options[:end] == :off && !colored.end_with?(no_color) - colored << escape_sequence if options[:end] == :on - end - colored - end - - def un_decorate - string.gsub(%r{\e\[\d+(;\d+)*m}, '') - end - - private - - def no_color - @no_color ||= Colored2::Effect.new(:no_color).to_s - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2/codes.rb b/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2/codes.rb deleted file mode 100644 index 8f46f43..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2/codes.rb +++ /dev/null @@ -1,63 +0,0 @@ -module Colored2 - - COLORS = { - black: 30, - red: 31, - green: 32, - yellow: 33, - blue: 34, - magenta: 35, - cyan: 36, - white: 37 - } - - EFFECTS = { - no_color: 0, - bold: 1, - dark: 2, - italic: 3, - underlined: 4, - reversed: 7, - plain: 21, # non-bold - normal: 22 - } - - class Code - attr_accessor :name, :escape - def initialize(name) - @name = name - return if name.nil? - @escape = codes[name.to_sym] - raise ArgumentError.new("No color or effect named #{name} exists for #{self.class}.") if @escape.nil? - end - - def value(shift = nil) - escape_code = escape - escape_code += shift if shift && escape_code - name && escape ? "\e[#{escape_code}m" : '' - end - - def to_s - value - end - end - - class Effect < Code - def codes - EFFECTS - end - end - - class TextColor < Code - def codes - COLORS - end - end - - class BackgroundColor < TextColor - def value - super 10 - end - end - -end diff --git a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2/numbers.rb b/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2/numbers.rb deleted file mode 100644 index 64161b0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2/numbers.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'colored2' unless defined?(Colored2) && Colored2.respond_to?(:decorate) - -module Colored2 - def self.integer_class - major, minor = RUBY_VERSION.split(/\./).map(&:to_i) - major >= 2 && minor >= 4 ? Integer : Kernel.const_get(:Fixnum) - end -end - -Colored2.decorate(Colored2.integer_class) -Colored2.decorate(Float) diff --git a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2/object.rb b/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2/object.rb deleted file mode 100644 index 439b0f9..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2/object.rb +++ /dev/null @@ -1,2 +0,0 @@ -require 'colored2' unless defined?(Colored2) && Colored2.respond_to?(:decorate) -Colored2.decorate(Object) diff --git a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2/strings.rb b/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2/strings.rb deleted file mode 100644 index 8e099e8..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2/strings.rb +++ /dev/null @@ -1,2 +0,0 @@ -require 'colored2' unless defined?(Colored2) && Colored2.respond_to?(:decorate) -Colored2.decorate(String) diff --git a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2/version.rb b/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2/version.rb deleted file mode 100644 index ab0f8a7..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/lib/colored2/version.rb +++ /dev/null @@ -1,3 +0,0 @@ -module Colored2 - VERSION = '3.1.2' -end diff --git a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/spec/colored2/numbers_spec.rb b/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/spec/colored2/numbers_spec.rb deleted file mode 100644 index f686bfa..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/spec/colored2/numbers_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -require File.expand_path('spec/spec_helper') -require 'colored2/numbers' -require 'colored2/strings' - -RSpec.describe Colored2.integer_class do - describe 'with foreground and background colors' do - it 'should work with one color' do - expect(32.red).to eql('32'.red) - end - it 'should insert escape sequences' do - expect(32.red).to eql("\e[31m32\e[0m") - end - end -end - -RSpec.describe Float do - describe 'with foreground and background colors' do - it 'should add two colors chained' do - expect((32.5).blue.on.red).to eql('32.5'.blue.on.red) - end - - it 'should insert escape sequences' do - expect((32.5).blue.on.red).to eql("\e[41m\e[34m32.5\e[0m") - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/spec/colored2/object_spec.rb b/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/spec/colored2/object_spec.rb deleted file mode 100644 index 6256254..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/spec/colored2/object_spec.rb +++ /dev/null @@ -1,24 +0,0 @@ -require File.expand_path('spec/spec_helper') -require 'colored2/object' - -subject1 = red('hello') -subject2 = red('blue').on.blue -subject3 = on.yellow('on yellow') - -RSpec.describe Object do - - describe 'with foreground and background colors' do - it 'should work with one color' do - expect(subject1).to eql('hello'.red) - end - - it 'should work with color on color' do - expect(subject2).to eql('blue'.red.on.blue) - end - - it 'should add background color using on_' do - expect(subject3).to eql('on yellow'.on.yellow) - end - - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/spec/colored2/strings_spec.rb b/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/spec/colored2/strings_spec.rb deleted file mode 100644 index 10da2a4..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/spec/colored2/strings_spec.rb +++ /dev/null @@ -1,77 +0,0 @@ -require File.expand_path('spec/spec_helper') -require 'colored2/strings' - -RSpec.describe String do - before do - Colored2.decorate(String) - end - - describe 'with foreground and background colors' do - it 'should work with one color' do - expect('red'.red).to eql("\e[31mred\e[0m") - end - - it 'should add two colors chained' do - expect('blue'.red.blue).to eql("\e[34m\e[31mblue\e[0m") - end - - it 'should add background color using on_' do - expect('on yellow'.on.yellow).to eql("\e[43mon yellow\e[0m") - end - - it 'should work with _on_ syntax' do - expect('red on blue'.red.on.blue).to eql("\e[44m\e[31mred on blue\e[0m") - end - end - - describe 'with effects' do - it 'should add a bold modifier' do - expect('way bold'.bold).to eql("\e[1mway bold\e[0m") - end - - it 'should let modifiers stack' do - expect('underlinedd bold'.bold.underlined).to eql("\e[4m\e[1munderlinedd bold\e[0m") - end - - it 'should let modifiers stack with colors' do - expect('cyan underlinedd bold'.bold.underlined.cyan).to eql("\e[36m\e[4m\e[1mcyan underlinedd bold\e[0m") - end - end - - describe 'new block syntax' do - it 'should defined block syntax nested colors' do - expect('No Color, then'.blue!('blue inside')).to eql('No Color, then' + 'blue inside'.blue) - end - - it 'should defined block syntax nested colors two levels deep' do - expect('regular here'.blue! + 'blue here'.no_color!).to eql('regular here' << 'blue here'.blue) - end - - it 'should defined block syntax nested colors two levels deep' do - expect('regular here'.blue! { 'something else'.red!('red riding hood') }).to eql('regular here'.blue! << 'something else'.red! << 'red riding hood'.no_color!) - end - - it 'should defined block syntax nested colors two levels deep' do - expectation = 'this is regular, but '.red! do - 'this is red '.yellow! do - ' and yellow'.no_color! - end - end - expect(expectation).to eql('this is regular, but '.red! << 'this is red '.yellow! << ' and yellow'.no_color!) - end - end - - describe 'end of line' do - it 'should work with eol' do - expect('nothing to see here really.'.to_eol).to eql("\e[2Knothing to see here really.") - end - - it 'should work with eol_with_with_two_colors' do - expect('blue'.red.blue.to_eol).to eql("\e[34m\e[31m\e[2Kblue\e[0m") - end - - it 'should work with eol_with_modifiers_stack_with_colors' do - expect('cyan underlinedd bold'.bold.underlined.cyan.to_eol).to eql("\e[36m\e[4m\e[1m\e[2Kcyan underlinedd bold\e[0m") - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/spec/colored2_spec.rb b/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/spec/colored2_spec.rb deleted file mode 100644 index 3b55f07..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/spec/colored2_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'spec_helper' -require 'colored2/strings' - -RSpec.describe Colored2 do - describe 'global enable and disable' do - before do - Colored2.disable! - end - after do - Colored2.enable! - end - let(:sample) { 'sample string' } - - describe 'colors' do - subject { sample.red.on.blue } - it { should eql(sample) } - end - describe 'effects' do - subject { sample.bold.on.red } - it { should eql(sample) } - end - end -end diff --git a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/spec/spec_helper.rb b/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/spec/spec_helper.rb deleted file mode 100644 index 3f2faa0..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/colored2-3.1.2/spec/spec_helper.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'simplecov' -SimpleCov.start - -require 'rspec/core' - diff --git a/vendor/bundle/ruby/3.3.0/gems/commonmarker-2.10.1-x86_64-linux/LICENSE.txt b/vendor/bundle/ruby/3.3.0/gems/commonmarker-2.10.1-x86_64-linux/LICENSE.txt deleted file mode 100644 index 452887a..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/commonmarker-2.10.1-x86_64-linux/LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2015 Garen J. Torikian - -MIT License - -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/vendor/bundle/ruby/3.3.0/gems/commonmarker-2.10.1-x86_64-linux/README.md b/vendor/bundle/ruby/3.3.0/gems/commonmarker-2.10.1-x86_64-linux/README.md deleted file mode 100644 index 101f843..0000000 --- a/vendor/bundle/ruby/3.3.0/gems/commonmarker-2.10.1-x86_64-linux/README.md +++ /dev/null @@ -1,385 +0,0 @@ -# Commonmarker - -Ruby wrapper for Rust's [comrak](https://github.com/kivikakk/comrak) crate. - -It passes all of the CommonMark test suite, and is therefore spec-complete. It also includes extensions to the CommonMark spec as documented in the [GitHub Flavored Markdown spec](http://github.github.com/gfm/), such as support for tables, strikethroughs, and autolinking. - -> [!NOTE] -> By default, the following extensions are enabled for end user convenience: `strikethrough`, `table`, `autolink`, `tasklist` (all from the [GFM spec](http://github.github.com/gfm/)), and `shortcodes`. The `syntax_highlighter` plugin is also enabled by default, using the `"base16-ocean.dark"` theme. -> -> For more information on the available options and extensions, see [the documentation below](#options-and-plugins). - -## Installation - -Add this line to your application's Gemfile: - - gem 'commonmarker' - -And then execute: - - $ bundle - -Or install it yourself as: - - $ gem install commonmarker - -## Usage - -This gem expects to receive UTF-8 strings. Ensure your strings are the right encoding before passing them into `Commonmarker`. - -### Converting to HTML - -Call `to_html` on a string to convert it to HTML: - -```ruby -require 'commonmarker' -Commonmarker.to_html('"Hi *there*"', options: { - parse: { smart: true } -}) -# =>

“Hi there”

\n -``` - -(The second argument is optional--[see below](#options-and-plugins) for more information.) - -### Generating a document - -You can also parse a string to receive a `:document` node. You can then print that node to HTML, iterate over the children, and do other fun node stuff. For example: - -```ruby -require 'commonmarker' - -doc = Commonmarker.parse("*Hello* world", options: { - parse: { smart: true } -}) -puts(doc.to_html) # =>

Hello world

\n - -doc.walk do |node| - puts node.type # => [:document, :paragraph, :emph, :text, :text] -end -``` - -(The second argument is optional--[see below](#options-and-plugins) for more information.) - -When it comes to modifying the document, you can perform the following operations: - -- `insert_before` -- `insert_after` -- `prepend_child` -- `append_child` -- `delete` - -You can also get the source position of a node by calling `source_position`: - -```ruby -doc = Commonmarker.parse("*Hello* world") -puts doc.first_child.first_child.source_position -# => {:start_line=>1, :start_column=>1, :end_line=>1, :end_column=>7} -``` - -You can also modify the following attributes: - -- `url` -- `title` -- `header_level` -- `list_type` -- `list_start` -- `list_tight` -- `fence_info` -- `alert_type` - -#### Example: Walking the AST - -You can use `walk` or `each` to iterate over nodes: - -- `walk` will iterate on a node and recursively iterate on a node's children. -- `each` will iterate on a node's direct children, but no further. - -```ruby -require 'commonmarker' - -# parse some string -doc = Commonmarker.parse("# The site\n\n [GitHub](https://www.github.com)") - -# Walk tree and print out URLs for links -doc.walk do |node| - if node.type == :link - printf("URL = %s\n", node.url) - end -end -# => URL = https://www.github.com - -# Transform links to regular text -doc.walk do |node| - if node.type == :link - node.insert_before(node.first_child) - node.delete - end -end -# =>

The site

\n

GitHub

\n -``` - -#### Example: Converting a document back into raw CommonMark - -You can use `to_commonmark` on a node to render it as raw text: - -```ruby -require 'commonmarker' - -# parse some string -doc = Commonmarker.parse("# The site\n\n [GitHub](https://www.github.com)") - -# Transform links to regular text -doc.walk do |node| - if node.type == :link - node.insert_before(node.first_child) - node.delete - end -end - -doc.to_commonmark -# => # The site\n\nGitHub\n -``` - -### Reading and writing node content - -`string_content` reads and writes the text of nodes whose content is plain text (like `:text`, `:code`, and `:code_block`). - -`literal` reads and writes the raw string a node carries, for every node type that has one (like `:text`, `:code`, `:code_block`, `:html_block`, `:html_inline`, `:raw`, `:math`, and `:frontmatter`). - -The two exist separately because they mean different things. Rewriting `string_content` only ever swaps text for text. Rewriting `literal` on an `:html_block`, `:html_inline`, or `:raw` node writes markup that is emitted unescaped: - -```ruby -doc = Commonmarker.parse("A bold claim") - -doc.walk do |node| - node.literal = "" if node.type == :html_inline && node.literal == "" -end -``` - -Note that a `:frontmatter` node's literal includes its delimiters and trailing newlines, so anything you assign must include them too. - -## Options and plugins - -### Options - -Commonmarker accepts the same parse, render, and extensions options that comrak does, as a hash dictionary with symbol keys: - -```ruby -Commonmarker.to_html('"Hi *there*"', options:{ - parse: { smart: true }, - render: { hardbreaks: false} -}) -``` - -Note that there is a distinction in comrak for "parse" options and "render" options, which are represented in the tables below. As well, if you wish to disable any-non boolean option, pass in `nil`. - -### Parse options - -| Name | Description | Default | -| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------- | -| `smart` | Punctuation (quotes, full-stops and hyphens) are converted into 'smart' punctuation. | `false` | -| `default_info_string` | The default info string for fenced code blocks. | `""` | -| `relaxed_tasklist_matching` | Enables relaxing of the tasklist extension matching, allowing any non-space to be used for the "checked" state instead of only `x` and `X`. | `false` | -| `relaxed_autolinks` | Enable relaxing of the autolink extension parsing, allowing links to be recognized when in brackets, as well as permitting any url scheme. | `false` | -| `leave_footnote_definitions` | Allow footnote definitions to remain in their original positions instead of being moved to the document's end (only affects AST) | `false` | -| `ignore_setext` | Ignores setext-style headings. | `false` | -| `sourcepos_chars` | Use character-based column tracking in source positions instead of byte-based. Relevant for multi-byte UTF-8 documents with `sourcepos`. | `false` | -| `max_nesting_depth` | The deepest a node may nest below the document. Deeper documents raise `Commonmarker::NestingDepthExceededError` instead of being parsed. | `1000` | - -### Render options - -| Name | Description | Default | -| -------------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------ | -| `hardbreaks` | [Soft line breaks](http://spec.commonmark.org/0.27/#soft-line-breaks) translate into hard line breaks. | `true` | -| `github_pre_lang` | GitHub-style `
` is used for fenced code blocks with info tags.                                           | `true`       |
-| `full_info_string`   | Gives info string data after a space in a `data-meta` attribute on code blocks.                                          | `false`      |
-| `width`              | The wrap column when outputting CommonMark.                                                                              | `80`         |
-| `unsafe`             | Allow rendering of raw HTML and potentially dangerous links.                                                             | `false`      |
-| `escape`             | Escape raw HTML instead of clobbering it.                                                                                | `false`      |
-| `sourcepos`          | Include source position attribute in HTML and XML output.                                                                | `false`      |
-| `escaped_char_spans` | Wrap escaped characters in span tags.                                                                                    | `true`       |
-| `ignore_empty_links` | Ignores empty links, leaving the Markdown text in place.                                                                 | `false`      |
-| `gfm_quirks`         | Outputs HTML with GFM-style quirks; namely, not nesting `` inlines.                                              | `false`      |
-| `prefer_fenced`      | Always output fenced code blocks, even where an indented one could be used.                                              | `false`      |
-| `tasklist_classes`   | Add CSS classes to the HTML output of the tasklist extension                                                             | `false`      |
-| `compact_html`       | Suppress newlines in pretty-printed HTML output.                                                                         | `false`      |
-| `alert_style`        | The style of alert output: `"specific"` (`
`) or `"semantic"` (`