From b7fcd348aa2b047fd216dc3a7594449ca3b4262c Mon Sep 17 00:00:00 2001
From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>
Date: Thu, 9 May 2024 17:59:05 +0000
Subject: [PATCH] brew vendor-gems: commit updates.
---
Library/Homebrew/Gemfile.lock | 1 +
.../Homebrew/vendor/bundle/bundler/setup.rb | 5 +-
.../ruby/3.1.0/gems/base64-0.2.0/LICENSE.txt | 22 ++
.../3.1.0/gems/base64-0.2.0/lib/base64.rb | 363 ++++++++++++++++++
.../ruby/3.1.0/gems/bigdecimal-3.1.8/LICENSE | 56 +++
.../gems/bigdecimal-3.1.8/lib/bigdecimal.rb | 5 +
.../lib/bigdecimal/jacobian.rb | 90 +++++
.../bigdecimal-3.1.8/lib/bigdecimal/ludcmp.rb | 89 +++++
.../bigdecimal-3.1.8/lib/bigdecimal/math.rb | 232 +++++++++++
.../bigdecimal-3.1.8/lib/bigdecimal/newton.rb | 80 ++++
.../bigdecimal-3.1.8/lib/bigdecimal/util.rb | 185 +++++++++
11 files changed, 1127 insertions(+), 1 deletion(-)
create mode 100644 Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/base64-0.2.0/LICENSE.txt
create mode 100644 Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/base64-0.2.0/lib/base64.rb
create mode 100644 Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/LICENSE
create mode 100644 Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal.rb
create mode 100644 Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/jacobian.rb
create mode 100644 Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/ludcmp.rb
create mode 100644 Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/math.rb
create mode 100644 Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/newton.rb
create mode 100644 Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/util.rb
diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock
index 4daa3b4ac84d0..aad81af5dc7f5 100644
--- a/Library/Homebrew/Gemfile.lock
+++ b/Library/Homebrew/Gemfile.lock
@@ -163,6 +163,7 @@ GEM
PLATFORMS
aarch64-linux
+ arm-linux
arm64-darwin
x86_64-darwin
x86_64-linux
diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb
index 60c6a96ef96ad..00ba3d36f0ecd 100644
--- a/Library/Homebrew/vendor/bundle/bundler/setup.rb
+++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb
@@ -30,6 +30,9 @@ def self.extension_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/public_suffix-5.0.5/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/addressable-2.8.6/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/ast-2.4.2/lib")
+$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/base64-0.2.0/lib")
+$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/bigdecimal-3.1.8")
+$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/bigdecimal-3.1.8/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/bindata-2.5.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/arm64-darwin-20/#{Gem.extension_api_version}/msgpack-1.7.2")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/msgpack-1.7.2/lib")
@@ -50,7 +53,7 @@ def self.extension_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unf_ext-0.0.9.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/unf-0.1.4/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/simpleidn-0.2.2/lib")
-$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/json_schemer-2.1.1/lib")
+$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/json_schemer-2.2.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rexml-3.2.6/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/kramdown-2.4.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/language_server-protocol-3.17.0.3/lib")
diff --git a/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/base64-0.2.0/LICENSE.txt b/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/base64-0.2.0/LICENSE.txt
new file mode 100644
index 0000000000000..a009caefea81f
--- /dev/null
+++ b/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/base64-0.2.0/LICENSE.txt
@@ -0,0 +1,22 @@
+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/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/base64-0.2.0/lib/base64.rb b/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/base64-0.2.0/lib/base64.rb
new file mode 100644
index 0000000000000..cd2ecc18ea0ae
--- /dev/null
+++ b/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/base64-0.2.0/lib/base64.rb
@@ -0,0 +1,363 @@
+# 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 +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
+
+ VERSION = "0.2.0"
+
+ module_function
+
+ # 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 encode64(bin)
+ [bin].pack("m")
+ end
+
+ # 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 decode64(str)
+ str.unpack1("m")
+ end
+
+ # 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 strict_encode64(bin)
+ [bin].pack("m0")
+ end
+
+ # 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 strict_decode64(str)
+ str.unpack1("m0")
+ end
+
+ # 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 urlsafe_encode64(bin, padding: true)
+ str = strict_encode64(bin)
+ str.chomp!("==") or str.chomp!("=") unless padding
+ str.tr!("+/", "-_")
+ str
+ end
+
+ # 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 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/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/LICENSE b/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/LICENSE
new file mode 100644
index 0000000000000..a1f19ff99db14
--- /dev/null
+++ b/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/LICENSE
@@ -0,0 +1,56 @@
+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/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal.rb b/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal.rb
new file mode 100644
index 0000000000000..82b3e1b7b9880
--- /dev/null
+++ b/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal.rb
@@ -0,0 +1,5 @@
+if RUBY_ENGINE == 'jruby'
+ JRuby::Util.load_ext("org.jruby.ext.bigdecimal.BigDecimalLibrary")
+else
+ require 'bigdecimal.so'
+end
diff --git a/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/jacobian.rb b/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/jacobian.rb
new file mode 100644
index 0000000000000..4448024c74285
--- /dev/null
+++ b/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/jacobian.rb
@@ -0,0 +1,90 @@
+# frozen_string_literal: false
+
+require 'bigdecimal'
+
+# 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/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/ludcmp.rb b/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/ludcmp.rb
new file mode 100644
index 0000000000000..dd265e482a317
--- /dev/null
+++ b/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/ludcmp.rb
@@ -0,0 +1,89 @@
+# frozen_string_literal: false
+require 'bigdecimal'
+
+#
+# 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/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/math.rb b/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/math.rb
new file mode 100644
index 0000000000000..0b9d0648bb3e3
--- /dev/null
+++ b/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/math.rb
@@ -0,0 +1,232 @@
+# frozen_string_literal: false
+require 'bigdecimal'
+
+#
+#--
+# Contents:
+# sqrt(x, prec)
+# sin (x, prec)
+# cos (x, prec)
+# atan(x, prec) Note: |x|<1, x=0.9999 may not converge.
+# PI (prec)
+# E (prec) == exp(1.0,prec)
+#
+# where:
+# x ... BigDecimal number to be computed.
+# |x| must be small enough to get convergence.
+# prec ... Number of digits to be obtained.
+#++
+#
+# Provides mathematical functions.
+#
+# Example:
+#
+# require "bigdecimal/math"
+#
+# include BigMath
+#
+# a = BigDecimal((PI(100)/2).to_s)
+# puts sin(a,100) # => 0.99999999999999999999......e0
+#
+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'), 16).to_s
+ # #=> "0.1414213562373095048801688724e1"
+ #
+ def sqrt(x, prec)
+ x.sqrt(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, 5).to_s
+ # #=> "0.70710678118654752440082036563292800375e0"
+ #
+ def sin(x, prec)
+ raise ArgumentError, "Zero or negative precision for sin" if prec <= 0
+ return BigDecimal("NaN") if x.infinite? || x.nan?
+ n = prec + BigDecimal.double_fig
+ one = BigDecimal("1")
+ two = BigDecimal("2")
+ x = -x if neg = x < 0
+ if x > (twopi = two * BigMath.PI(prec))
+ if x > 30
+ x %= twopi
+ else
+ x -= twopi while x > twopi
+ end
+ end
+ x1 = x
+ x2 = x.mult(x,n)
+ sign = 1
+ y = x
+ d = y
+ i = one
+ z = one
+ while d.nonzero? && ((m = n - (y.exponent - d.exponent).abs) > 0)
+ m = BigDecimal.double_fig if m < BigDecimal.double_fig
+ sign = -sign
+ x1 = x2.mult(x1,n)
+ i += two
+ z *= (i-one) * i
+ d = sign * x1.div(z,m)
+ y += d
+ end
+ neg ? -y : y
+ 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(4), 16).to_s
+ # #=> "-0.999999999999999999999999999999856613163740061349e0"
+ #
+ def cos(x, prec)
+ raise ArgumentError, "Zero or negative precision for cos" if prec <= 0
+ return BigDecimal("NaN") if x.infinite? || x.nan?
+ n = prec + BigDecimal.double_fig
+ one = BigDecimal("1")
+ two = BigDecimal("2")
+ x = -x if x < 0
+ if x > (twopi = two * BigMath.PI(prec))
+ if x > 30
+ x %= twopi
+ else
+ x -= twopi while x > twopi
+ end
+ end
+ x1 = one
+ x2 = x.mult(x,n)
+ sign = 1
+ y = one
+ d = y
+ i = BigDecimal("0")
+ z = one
+ while d.nonzero? && ((m = n - (y.exponent - d.exponent).abs) > 0)
+ m = BigDecimal.double_fig if m < BigDecimal.double_fig
+ sign = -sign
+ x1 = x2.mult(x1,n)
+ i += two
+ z *= (i-one) * i
+ d = sign * x1.div(z,m)
+ y += d
+ end
+ y
+ 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'), 16).to_s
+ # #=> "-0.785398163397448309615660845819878471907514682065e0"
+ #
+ def atan(x, prec)
+ raise ArgumentError, "Zero or negative precision for atan" if prec <= 0
+ return BigDecimal("NaN") if x.nan?
+ pi = PI(prec)
+ x = -x if neg = x < 0
+ return pi.div(neg ? -2 : 2, prec) if x.infinite?
+ return pi / (neg ? -4 : 4) if x.round(prec) == 1
+ x = BigDecimal("1").div(x, prec) if inv = x > 1
+ x = (-1 + sqrt(1 + x**2, prec))/x if dbl = x > 0.5
+ n = prec + BigDecimal.double_fig
+ y = x
+ d = y
+ t = x
+ r = BigDecimal("3")
+ x2 = x.mult(x,n)
+ while d.nonzero? && ((m = n - (y.exponent - d.exponent).abs) > 0)
+ m = BigDecimal.double_fig if m < BigDecimal.double_fig
+ t = -t.mult(x2,n)
+ d = t.div(r,m)
+ y += d
+ r += 2
+ end
+ y *= 2 if dbl
+ y = pi / 2 - y if inv
+ y = -y if neg
+ y
+ end
+
+ # call-seq:
+ # PI(numeric) -> BigDecimal
+ #
+ # Computes the value of pi to the specified number of digits of precision,
+ # +numeric+.
+ #
+ # BigMath.PI(10).to_s
+ # #=> "0.3141592653589793238462643388813853786957412e1"
+ #
+ def PI(prec)
+ raise ArgumentError, "Zero or negative precision for PI" if prec <= 0
+ n = prec + BigDecimal.double_fig
+ zero = BigDecimal("0")
+ one = BigDecimal("1")
+ two = BigDecimal("2")
+
+ m25 = BigDecimal("-0.04")
+ m57121 = BigDecimal("-57121")
+
+ pi = zero
+
+ d = one
+ k = one
+ t = BigDecimal("-80")
+ while d.nonzero? && ((m = n - (pi.exponent - d.exponent).abs) > 0)
+ m = BigDecimal.double_fig if m < BigDecimal.double_fig
+ t = t*m25
+ d = t.div(k,m)
+ k = k+two
+ pi = pi + d
+ end
+
+ d = one
+ k = one
+ t = BigDecimal("956")
+ while d.nonzero? && ((m = n - (pi.exponent - d.exponent).abs) > 0)
+ m = BigDecimal.double_fig if m < BigDecimal.double_fig
+ t = t.div(m57121,n)
+ d = t.div(k,m)
+ pi = pi + d
+ k = k+two
+ end
+ pi
+ end
+
+ # call-seq:
+ # E(numeric) -> BigDecimal
+ #
+ # Computes e (the base of natural logarithms) to the specified number of
+ # digits of precision, +numeric+.
+ #
+ # BigMath.E(10).to_s
+ # #=> "0.271828182845904523536028752390026306410273e1"
+ #
+ def E(prec)
+ raise ArgumentError, "Zero or negative precision for E" if prec <= 0
+ BigMath.exp(1, prec)
+ end
+end
diff --git a/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/newton.rb b/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/newton.rb
new file mode 100644
index 0000000000000..85bacb7f2efbf
--- /dev/null
+++ b/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/newton.rb
@@ -0,0 +1,80 @@
+# frozen_string_literal: false
+require "bigdecimal/ludcmp"
+require "bigdecimal/jacobian"
+
+#
+# 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/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/util.rb b/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/util.rb
new file mode 100644
index 0000000000000..8bfc0ed8ed2a7
--- /dev/null
+++ b/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/bigdecimal-3.1.8/lib/bigdecimal/util.rb
@@ -0,0 +1,185 @@
+# frozen_string_literal: false
+#
+#--
+# 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 required +precision+ parameter is used to determine the number of
+ # significant digits for the result.
+ #
+ # require 'bigdecimal'
+ # require 'bigdecimal/util'
+ #
+ # Rational(22, 7).to_d(3) # => 0.314e1
+ #
+ # See also Kernel.BigDecimal.
+ #
+ def to_d(precision)
+ 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.
+ #
+ # The +precision+ parameter is required for a rational complex number.
+ # This parameter is used to determine the number of significant digits
+ # for the result.
+ #
+ # require 'bigdecimal'
+ # require 'bigdecimal/util'
+ #
+ # Complex(0.1234567, 0).to_d(4) # => 0.1235e0
+ # Complex(Rational(22, 7), 0).to_d(3) # => 0.314e1
+ #
+ # See also Kernel.BigDecimal.
+ #
+ def to_d(*args)
+ BigDecimal(self) unless self.imag.zero? # to raise eerror
+
+ if args.length == 0
+ case self.real
+ when Rational
+ BigDecimal(self.real) # to raise error
+ end
+ end
+ self.real.to_d(*args)
+ 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