diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index ee3320916f..377dc5b1cb 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -5,14 +5,15 @@ ruby_version = RbConfig::CONFIG["ruby_version"] path = File.expand_path('..', __FILE__) $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.1.5/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.7.0/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.12.2/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.13.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thread_safe-0.3.6/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-1.2.5/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-5.2.3/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.2.1/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.0.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ast-2.4.0/lib" $:.unshift "#{path}/" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/connection_pool-2.2.2/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/x86_64-darwin-13/2.6.0-static/json-2.2.0" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/json-2.2.0" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/json-2.2.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/docile-1.3.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-html-0.10.2/lib" @@ -22,22 +23,22 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/term-ansicolor-1.7.1/ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thor-0.20.3/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/coveralls-0.8.23/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/diff-lcs-1.3/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/x86_64-darwin-13/2.6.0-static/unf_ext-0.0.7.6" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/unf_ext-0.0.7.6" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unf_ext-0.0.7.6/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unf-0.1.4/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/domain_name-0.5.20190701/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/x86_64-darwin-13/2.6.0-static/hpricot-0.8.6" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/hpricot-0.8.6" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/hpricot-0.8.6/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/http-cookie-1.0.3/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/x86_64-darwin-13/2.6.0-static/jaro_winkler-1.5.3" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/jaro_winkler-1.5.3/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/jaro_winkler-1.5.4" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/jaro_winkler-1.5.4/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mime-types-data-3.2019.1009/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mime-types-3.3/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/net-http-digest_auth-1.4.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/net-http-persistent-3.1.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mini_portile2-2.4.0/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/x86_64-darwin-13/2.6.0-static/nokogiri-1.10.4" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/nokogiri-1.10.4/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/nokogiri-1.10.5" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/nokogiri-1.10.5/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ntlm-http-0.1.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/webrobots-0.1.2/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/mechanize-2.7.6/lib" @@ -47,7 +48,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel_tests-2.29.2 $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-2.6.5.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.5.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rainbow-3.0.0/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/x86_64-darwin-13/2.6.0-static/rdiscount-2.2.0.1" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/extensions/universal-darwin-19/2.6.0/rdiscount-2.2.0.1" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rdiscount-2.2.0.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ronn-0.7.3/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-support-3.9.0/lib" @@ -60,7 +61,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-retry-0.6.1/lib $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rspec-wait-0.0.9/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.10.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-1.6.0/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.75.0/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-0.76.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.5.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-1.36.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-2.2.0/lib" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array/prepend_and_append.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array/prepend_and_append.rb deleted file mode 100644 index 661971d7cd..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array/prepend_and_append.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class Array - # The human way of thinking about adding stuff to the end of a list is with append. - alias_method :append, :push unless [].respond_to?(:append) - - # The human way of thinking about adding stuff to the beginning of a list is with prepend. - alias_method :prepend, :unshift unless [].respond_to?(:prepend) -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/enumerable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/enumerable.rb deleted file mode 100644 index cea6f98cfa..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/enumerable.rb +++ /dev/null @@ -1,164 +0,0 @@ -# frozen_string_literal: true - -module Enumerable - # Enumerable#sum was added in Ruby 2.4, but it only works with Numeric elements - # when we omit an identity. - # - # We tried shimming it to attempt the fast native method, rescue TypeError, - # and fall back to the compatible implementation, but that's much slower than - # just calling the compat method in the first place. - if Enumerable.instance_methods(false).include?(:sum) && !((?a..?b).sum rescue false) - # :stopdoc: - - # We can't use Refinements here because Refinements with Module which will be prepended - # doesn't work well https://bugs.ruby-lang.org/issues/13446 - alias :_original_sum_with_required_identity :sum - private :_original_sum_with_required_identity - - # :startdoc: - - # Calculates a sum from the elements. - # - # payments.sum { |p| p.price * p.tax_rate } - # payments.sum(&:price) - # - # The latter is a shortcut for: - # - # payments.inject(0) { |sum, p| sum + p.price } - # - # It can also calculate the sum without the use of a block. - # - # [5, 15, 10].sum # => 30 - # ['foo', 'bar'].sum # => "foobar" - # [[1, 2], [3, 1, 5]].sum # => [1, 2, 3, 1, 5] - # - # The default sum of an empty list is zero. You can override this default: - # - # [].sum(Payment.new(0)) { |i| i.amount } # => Payment.new(0) - def sum(identity = nil, &block) - if identity - _original_sum_with_required_identity(identity, &block) - elsif block_given? - map(&block).sum(identity) - else - inject(:+) || 0 - end - end - else - def sum(identity = nil, &block) - if block_given? - map(&block).sum(identity) - else - sum = identity ? inject(identity, :+) : inject(:+) - sum || identity || 0 - end - end - end - - # Convert an enumerable to a hash. - # - # 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 - - # 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 |element| - cnt += 1 if yield element - cnt > 1 - end - else - any? { (cnt += 1) > 1 } - end - 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 without the specified elements. - # - # ["David", "Rafael", "Aaron", "Todd"].without "Aaron", "Todd" - # # => ["David", "Rafael"] - # - # {foo: 1, bar: 2, baz: 3}.without :bar - # # => {foo: 1, baz: 3} - def without(*elements) - reject { |element| elements.include?(element) } - end - - # Convert an enumerable to an array based on the given key. - # - # [{ 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 - map { |element| element[keys.first] } - end - 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(identity = nil) - 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 = identity || 0 - sum + (actual_last - first + 1) * (actual_last + first) / 2 - else - identity || 0 - end - end - end -end - -# Array#sum was added in Ruby 2.4 but it only works with Numeric elements. -# -# We tried shimming it to attempt the fast native method, rescue TypeError, -# and fall back to the compatible implementation, but that's much slower than -# just calling the compat method in the first place. -if Array.instance_methods(false).include?(:sum) && !(%w[a].sum rescue false) - # Using Refinements here in order not to expose our internal method - using Module.new { - refine Array do - alias :orig_sum :sum - end - } - - class Array - def sum(init = nil, &block) #:nodoc: - if init.is_a?(Numeric) || first.is_a?(Numeric) - init ||= 0 - orig_sum(init, &block) - else - super - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/compact.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/compact.rb deleted file mode 100644 index d6364dd9f3..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/compact.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class Hash - unless Hash.instance_methods(false).include?(:compact) - # Returns a hash with non +nil+ values. - # - # hash = { a: true, b: false, c: nil } - # hash.compact # => { a: true, b: false } - # hash # => { a: true, b: false, c: nil } - # { c: nil }.compact # => {} - # { c: true }.compact # => { c: true } - def compact - select { |_, value| !value.nil? } - end - end - - unless Hash.instance_methods(false).include?(:compact!) - # Replaces current hash with non +nil+ values. - # Returns +nil+ if no changes were made, otherwise returns the hash. - # - # hash = { a: true, b: false, c: nil } - # hash.compact! # => { a: true, b: false } - # hash # => { a: true, b: false } - # { c: true }.compact! # => nil - def compact! - reject! { |_, value| value.nil? } - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/slice.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/slice.rb deleted file mode 100644 index 2bd0a56ea4..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/slice.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -class Hash - # Slices a hash to include only the given keys. Returns a hash containing - # the given keys. - # - # { a: 1, b: 2, c: 3, d: 4 }.slice(:a, :b) - # # => {:a=>1, :b=>2} - # - # This is useful for limiting an options hash to valid keys before - # passing to a method: - # - # def search(criteria = {}) - # criteria.assert_valid_keys(:mass, :velocity, :time) - # end - # - # search(options.slice(:mass, :velocity, :time)) - # - # If you have an array of keys you want to limit to, you should splat them: - # - # valid_keys = [:mass, :velocity, :time] - # search(options.slice(*valid_keys)) - def slice(*keys) - keys.each_with_object(Hash.new) { |k, hash| hash[k] = self[k] if has_key?(k) } - end unless method_defined?(:slice) - - # Replaces the hash with only the given keys. - # Returns a hash containing the removed key/value pairs. - # - # { a: 1, b: 2, c: 3, d: 4 }.slice!(:a, :b) - # # => {:c=>3, :d=>4} - 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. - # - # { a: 1, b: 2, c: 3, d: 4 }.extract!(:a, :b) # => {:a=>1, :b=>2} - # { a: 1, b: 2 }.extract!(:a, :x) # => {:a=>1} - 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/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/transform_values.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/transform_values.rb deleted file mode 100644 index 4b19c9fc1f..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/transform_values.rb +++ /dev/null @@ -1,32 +0,0 @@ -# frozen_string_literal: true - -class Hash - # Returns a new hash with the results of running +block+ once for every value. - # The keys are unchanged. - # - # { a: 1, b: 2, c: 3 }.transform_values { |x| x * 2 } # => { a: 2, b: 4, c: 6 } - # - # If you do not provide a +block+, it will return an Enumerator - # for chaining with other methods: - # - # { a: 1, b: 2 }.transform_values.with_index { |v, i| [v, i].join.to_i } # => { a: 10, b: 21 } - def transform_values - return enum_for(:transform_values) { size } unless block_given? - return {} if empty? - result = self.class.new - each do |key, value| - result[key] = yield(value) - end - result - end unless method_defined? :transform_values - - # Destructively converts all values using the +block+ operations. - # Same as +transform_values+ but modifies +self+. - def transform_values! - return enum_for(:transform_values!) { size } unless block_given? - each do |key, value| - self[key] = yield(value) - end - end unless method_defined? :transform_values! - # TODO: Remove this file when supporting only Ruby 2.4+. -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/kernel/agnostics.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/kernel/agnostics.rb deleted file mode 100644 index 403b5f31f0..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/kernel/agnostics.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class Object - # Makes backticks behave (somewhat more) similarly on all platforms. - # On win32 `nonexistent_command` raises Errno::ENOENT; on Unix, the - # spawned shell prints a message to stderr and sets $?. We emulate - # Unix on the former but not the latter. - def `(command) #:nodoc: - super - rescue Errno::ENOENT => e - STDERR.puts "#$0: #{e}" - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/introspection.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/introspection.rb deleted file mode 100644 index c5bb598bd1..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/introspection.rb +++ /dev/null @@ -1,62 +0,0 @@ -# frozen_string_literal: true - -require "active_support/inflector" - -class Module - # Returns the name of the module containing this one. - # - # M::N.parent_name # => "M" - def parent_name - if defined?(@parent_name) - @parent_name - else - parent_name = name =~ /::[^:]+\Z/ ? $`.freeze : 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.parent # => M - # X.parent # => M - # - # The parent of top-level and anonymous modules is Object. - # - # M.parent # => Object - # Module.new.parent # => Object - def parent - parent_name ? ActiveSupport::Inflector.constantize(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.parents # => [Object] - # M::N.parents # => [M, Object] - # X.parents # => [M, Object] - def parents - parents = [] - if parent_name - parts = 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/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/numeric/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/numeric/conversions.rb deleted file mode 100644 index f6c2713986..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/numeric/conversions.rb +++ /dev/null @@ -1,140 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/big_decimal/conversions" -require "active_support/number_helper" -require "active_support/core_ext/module/deprecation" - -module ActiveSupport::NumericWithFormat - # Provides options for converting numbers into formatted strings. - # Options are provided for phone numbers, currency, percentage, - # precision, positional notation, file size and pretty printing. - # - # ==== Options - # - # For details on which formats use which options, see ActiveSupport::NumberHelper - # - # ==== Examples - # - # Phone Numbers: - # 5551234.to_s(:phone) # => "555-1234" - # 1235551234.to_s(:phone) # => "123-555-1234" - # 1235551234.to_s(:phone, area_code: true) # => "(123) 555-1234" - # 1235551234.to_s(:phone, delimiter: ' ') # => "123 555 1234" - # 1235551234.to_s(:phone, area_code: true, extension: 555) # => "(123) 555-1234 x 555" - # 1235551234.to_s(:phone, country_code: 1) # => "+1-123-555-1234" - # 1235551234.to_s(:phone, country_code: 1, extension: 1343, delimiter: '.') - # # => "+1.123.555.1234 x 1343" - # - # Currency: - # 1234567890.50.to_s(:currency) # => "$1,234,567,890.50" - # 1234567890.506.to_s(:currency) # => "$1,234,567,890.51" - # 1234567890.506.to_s(:currency, precision: 3) # => "$1,234,567,890.506" - # 1234567890.506.to_s(:currency, locale: :fr) # => "1 234 567 890,51 €" - # -1234567890.50.to_s(:currency, negative_format: '(%u%n)') - # # => "($1,234,567,890.50)" - # 1234567890.50.to_s(:currency, unit: '£', separator: ',', delimiter: '') - # # => "£1234567890,50" - # 1234567890.50.to_s(:currency, unit: '£', separator: ',', delimiter: '', format: '%n %u') - # # => "1234567890,50 £" - # - # Percentage: - # 100.to_s(:percentage) # => "100.000%" - # 100.to_s(:percentage, precision: 0) # => "100%" - # 1000.to_s(:percentage, delimiter: '.', separator: ',') # => "1.000,000%" - # 302.24398923423.to_s(:percentage, precision: 5) # => "302.24399%" - # 1000.to_s(:percentage, locale: :fr) # => "1 000,000%" - # 100.to_s(:percentage, format: '%n %') # => "100.000 %" - # - # Delimited: - # 12345678.to_s(:delimited) # => "12,345,678" - # 12345678.05.to_s(:delimited) # => "12,345,678.05" - # 12345678.to_s(:delimited, delimiter: '.') # => "12.345.678" - # 12345678.to_s(:delimited, delimiter: ',') # => "12,345,678" - # 12345678.05.to_s(:delimited, separator: ' ') # => "12,345,678 05" - # 12345678.05.to_s(:delimited, locale: :fr) # => "12 345 678,05" - # 98765432.98.to_s(:delimited, delimiter: ' ', separator: ',') - # # => "98 765 432,98" - # - # Rounded: - # 111.2345.to_s(:rounded) # => "111.235" - # 111.2345.to_s(:rounded, precision: 2) # => "111.23" - # 13.to_s(:rounded, precision: 5) # => "13.00000" - # 389.32314.to_s(:rounded, precision: 0) # => "389" - # 111.2345.to_s(:rounded, significant: true) # => "111" - # 111.2345.to_s(:rounded, precision: 1, significant: true) # => "100" - # 13.to_s(:rounded, precision: 5, significant: true) # => "13.000" - # 111.234.to_s(:rounded, locale: :fr) # => "111,234" - # 13.to_s(:rounded, precision: 5, significant: true, strip_insignificant_zeros: true) - # # => "13" - # 389.32314.to_s(:rounded, precision: 4, significant: true) # => "389.3" - # 1111.2345.to_s(:rounded, precision: 2, separator: ',', delimiter: '.') - # # => "1.111,23" - # - # Human-friendly size in Bytes: - # 123.to_s(:human_size) # => "123 Bytes" - # 1234.to_s(:human_size) # => "1.21 KB" - # 12345.to_s(:human_size) # => "12.1 KB" - # 1234567.to_s(:human_size) # => "1.18 MB" - # 1234567890.to_s(:human_size) # => "1.15 GB" - # 1234567890123.to_s(:human_size) # => "1.12 TB" - # 1234567890123456.to_s(:human_size) # => "1.1 PB" - # 1234567890123456789.to_s(:human_size) # => "1.07 EB" - # 1234567.to_s(:human_size, precision: 2) # => "1.2 MB" - # 483989.to_s(:human_size, precision: 2) # => "470 KB" - # 1234567.to_s(:human_size, precision: 2, separator: ',') # => "1,2 MB" - # 1234567890123.to_s(:human_size, precision: 5) # => "1.1228 TB" - # 524288000.to_s(:human_size, precision: 5) # => "500 MB" - # - # Human-friendly format: - # 123.to_s(:human) # => "123" - # 1234.to_s(:human) # => "1.23 Thousand" - # 12345.to_s(:human) # => "12.3 Thousand" - # 1234567.to_s(:human) # => "1.23 Million" - # 1234567890.to_s(:human) # => "1.23 Billion" - # 1234567890123.to_s(:human) # => "1.23 Trillion" - # 1234567890123456.to_s(:human) # => "1.23 Quadrillion" - # 1234567890123456789.to_s(:human) # => "1230 Quadrillion" - # 489939.to_s(:human, precision: 2) # => "490 Thousand" - # 489939.to_s(:human, precision: 4) # => "489.9 Thousand" - # 1234567.to_s(:human, precision: 4, - # significant: false) # => "1.2346 Million" - # 1234567.to_s(:human, precision: 1, - # separator: ',', - # significant: false) # => "1,2 Million" - def to_s(format = nil, options = nil) - case format - when nil - super() - when Integer, String - super(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 - super() - else - super(format) - end - end -end - -# Ruby 2.4+ unifies Fixnum & Bignum into Integer. -if 0.class == Integer - Integer.prepend ActiveSupport::NumericWithFormat -else - Fixnum.prepend ActiveSupport::NumericWithFormat - Bignum.prepend ActiveSupport::NumericWithFormat -end -Float.prepend ActiveSupport::NumericWithFormat -BigDecimal.prepend ActiveSupport::NumericWithFormat diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/numeric/inquiry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/numeric/inquiry.rb deleted file mode 100644 index 15334c91f1..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/numeric/inquiry.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -unless 1.respond_to?(:positive?) # TODO: Remove this file when we drop support to ruby < 2.3 - class Numeric - # Returns true if the number is positive. - # - # 1.positive? # => true - # 0.positive? # => false - # -1.positive? # => false - def positive? - self > 0 - end - - # Returns true if the number is negative. - # - # -1.negative? # => true - # 0.negative? # => false - # 1.negative? # => false - def negative? - self < 0 - end - end - - class Complex - undef :positive? - undef :negative? - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/duplicable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/duplicable.rb deleted file mode 100644 index 9bb99087bc..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/duplicable.rb +++ /dev/null @@ -1,156 +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 - -class NilClass - begin - nil.dup - rescue TypeError - - # +nil+ is not duplicable: - # - # nil.duplicable? # => false - # nil.dup # => TypeError: can't dup NilClass - def duplicable? - false - end - end -end - -class FalseClass - begin - false.dup - rescue TypeError - - # +false+ is not duplicable: - # - # false.duplicable? # => false - # false.dup # => TypeError: can't dup FalseClass - def duplicable? - false - end - end -end - -class TrueClass - begin - true.dup - rescue TypeError - - # +true+ is not duplicable: - # - # true.duplicable? # => false - # true.dup # => TypeError: can't dup TrueClass - def duplicable? - false - end - end -end - -class Symbol - begin - :symbol.dup # Ruby 2.4.x. - "symbol_from_string".to_sym.dup # Some symbols can't `dup` in Ruby 2.4.0. - rescue TypeError - - # Symbols are not duplicable: - # - # :my_symbol.duplicable? # => false - # :my_symbol.dup # => TypeError: can't dup Symbol - def duplicable? - false - end - end -end - -class Numeric - begin - 1.dup - rescue TypeError - - # Numbers are not duplicable: - # - # 3.duplicable? # => false - # 3.dup # => TypeError: can't dup Integer - def duplicable? - false - end - end -end - -require "bigdecimal" -class BigDecimal - # BigDecimals are duplicable: - # - # BigDecimal("1.2").duplicable? # => true - # BigDecimal("1.2").dup # => # - def duplicable? - true - end -end - -class Method - # Methods are not duplicable: - # - # method(:puts).duplicable? # => false - # method(:puts).dup # => TypeError: allocator undefined for Method - def duplicable? - false - end -end - -class Complex - begin - Complex(1).dup - rescue TypeError - - # Complexes are not duplicable: - # - # Complex(1).duplicable? # => false - # Complex(1).dup # => TypeError: can't copy Complex - def duplicable? - false - end - end -end - -class Rational - begin - Rational(1).dup - rescue TypeError - - # Rationals are not duplicable: - # - # Rational(1).duplicable? # => false - # Rational(1).dup # => TypeError: can't copy Rational - def duplicable? - false - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/conversions.rb deleted file mode 100644 index 8832fbcb3c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/conversions.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport::RangeWithFormat - RANGE_FORMATS = { - db: -> (start, stop) do - case start - when String then "BETWEEN '#{start}' AND '#{stop}'" - else - "BETWEEN '#{start.to_s(:db)}' AND '#{stop.to_s(:db)}'" - end - end - } - - # Convert range to a formatted string. See RANGE_FORMATS for predefined formats. - # - # range = (1..100) # => 1..100 - # - # range.to_s # => "1..100" - # range.to_s(:db) # => "BETWEEN '1' AND '100'" - # - # == Adding your own range formats to to_s - # 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_s(:db)} and #{stop.to_s(:db)}" } - def to_s(format = :default) - if formatter = RANGE_FORMATS[format] - formatter.call(first, last) - else - super() - end - end - - alias_method :to_default_s, :to_s - alias_method :to_formatted_s, :to_s -end - -Range.prepend(ActiveSupport::RangeWithFormat) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/include_range.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/include_range.rb deleted file mode 100644 index 4812e274a3..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/include_range.rb +++ /dev/null @@ -1,3 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/range/compare_range" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/securerandom.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/securerandom.rb deleted file mode 100644 index b4a491f5fd..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/securerandom.rb +++ /dev/null @@ -1,25 +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"] - # 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" - # - 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 diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/descendants_tracker.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/descendants_tracker.rb deleted file mode 100644 index a4cee788b6..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/descendants_tracker.rb +++ /dev/null @@ -1,62 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # This module provides an internal implementation to track descendants - # which is faster than iterating through ObjectSpace. - module DescendantsTracker - @@direct_descendants = {} - - class << self - def direct_descendants(klass) - @@direct_descendants[klass] || [] - end - - def descendants(klass) - arr = [] - accumulate_descendants(klass, arr) - arr - end - - def clear - if defined? ActiveSupport::Dependencies - @@direct_descendants.each do |klass, descendants| - if ActiveSupport::Dependencies.autoloaded?(klass) - @@direct_descendants.delete(klass) - else - descendants.reject! { |v| ActiveSupport::Dependencies.autoloaded?(v) } - end - end - else - @@direct_descendants.clear - end - end - - # This is the only method that is not thread safe, but is only ever called - # during the eager loading phase. - def store_inherited(klass, descendant) - (@@direct_descendants[klass] ||= []) << descendant - end - - private - def accumulate_descendants(klass, acc) - if direct_descendants = @@direct_descendants[klass] - acc.concat(direct_descendants) - direct_descendants.each { |direct_descendant| accumulate_descendants(direct_descendant, acc) } - end - end - end - - def inherited(base) - DescendantsTracker.store_inherited(self, base) - super - end - - def direct_descendants - DescendantsTracker.direct_descendants(self) - end - - def descendants - DescendantsTracker.descendants(self) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/logger_silence.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/logger_silence.rb deleted file mode 100644 index 89f32b6782..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/logger_silence.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require "active_support/concern" -require "active_support/core_ext/module/attribute_accessors" -require "concurrent" - -module LoggerSilence - extend ActiveSupport::Concern - - included do - cattr_accessor :silencer, default: true - end - - # Silences the logger for the duration of the block. - def silence(temporary_level = Logger::ERROR) - if silencer - begin - old_local_level = local_level - self.local_level = temporary_level - - yield self - ensure - self.local_level = old_local_level - end - else - yield self - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/logger_thread_safe_level.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/logger_thread_safe_level.rb deleted file mode 100644 index ba32813d3d..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/logger_thread_safe_level.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -require "active_support/concern" - -module ActiveSupport - module LoggerThreadSafeLevel # :nodoc: - extend ActiveSupport::Concern - - def after_initialize - @local_levels = Concurrent::Map.new(initial_capacity: 2) - end - - def local_log_id - Thread.current.__id__ - end - - def local_level - @local_levels[local_log_id] - end - - def local_level=(level) - if level - @local_levels[local_log_id] = level - else - @local_levels.delete(local_log_id) - end - end - - def level - local_level || super - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications/instrumenter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications/instrumenter.rb deleted file mode 100644 index e99f5ee688..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications/instrumenter.rb +++ /dev/null @@ -1,93 +0,0 @@ -# frozen_string_literal: true - -require "securerandom" - -module ActiveSupport - module Notifications - # Instrumenters are stored in a thread local. - class Instrumenter - attr_reader :id - - def initialize(notifier) - @id = unique_id - @notifier = notifier - end - - # Instrument the given block by measuring the time taken to execute it - # and publish it. Notice that events get sent even if an error occurs - # in the passed-in block. - def instrument(name, payload = {}) - # some of the listeners might have state - listeners_state = start name, payload - begin - yield payload - rescue Exception => e - payload[:exception] = [e.class.name, e.message] - payload[:exception_object] = e - raise e - ensure - finish_with_state listeners_state, name, payload - end - 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, :time, :transaction_id, :payload, :children - attr_accessor :end - - def initialize(name, start, ending, transaction_id, payload) - @name = name - @payload = payload.dup - @time = start - @transaction_id = transaction_id - @end = ending - @children = [] - @duration = nil - end - - # Returns the difference in milliseconds between when the execution of the - # event started and when it ended. - # - # ActiveSupport::Notifications.subscribe('wait') do |*args| - # @event = ActiveSupport::Notifications::Event.new(*args) - # end - # - # ActiveSupport::Notifications.instrument('wait') do - # sleep 1 - # end - # - # @event.duration # => 1000.138 - def duration - @duration ||= 1000.0 * (self.end - time) - end - - def <<(event) - @children << event - end - - def parent_of?(event) - @children.include? event - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/test_case.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/test_case.rb deleted file mode 100644 index 69d69c84ef..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/test_case.rb +++ /dev/null @@ -1,72 +0,0 @@ -# frozen_string_literal: true - -gem "minitest" # make sure we get the gem, not stdlib -require "minitest" -require "active_support/testing/tagged_logging" -require "active_support/testing/setup_and_teardown" -require "active_support/testing/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/file_fixtures" - -module ActiveSupport - class TestCase < ::Minitest::Test - Assertion = Minitest::Assertion - - class << self - # 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 - end - - alias_method :method_name, :name - - include ActiveSupport::Testing::TaggedLogging - prepend ActiveSupport::Testing::SetupAndTeardown - include ActiveSupport::Testing::Assertions - include ActiveSupport::Testing::Deprecation - include ActiveSupport::Testing::TimeHelpers - include ActiveSupport::Testing::FileFixtures - extend ActiveSupport::Testing::Declarative - - # test/unit backwards compatibility methods - alias :assert_raise :assert_raises - alias :assert_not_empty :refute_empty - alias :assert_not_equal :refute_equal - alias :assert_not_in_delta :refute_in_delta - alias :assert_not_in_epsilon :refute_in_epsilon - alias :assert_not_includes :refute_includes - alias :assert_not_instance_of :refute_instance_of - alias :assert_not_kind_of :refute_kind_of - alias :assert_no_match :refute_match - alias :assert_not_nil :refute_nil - alias :assert_not_operator :refute_operator - alias :assert_not_predicate :refute_predicate - alias :assert_not_respond_to :refute_respond_to - alias :assert_not_same :refute_same - - ActiveSupport.run_load_hooks(:active_support_test_case, self) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/values/unicode_tables.dat b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/values/unicode_tables.dat deleted file mode 100644 index f7d9c48bbe..0000000000 Binary files a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/values/unicode_tables.dat and /dev/null differ diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/actionable_error.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/actionable_error.rb new file mode 100644 index 0000000000..7db14cd178 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/actionable_error.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +module ActiveSupport + # Actionable errors let's 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/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/array_inquirer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/array_inquirer.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/array_inquirer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/array_inquirer.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/backtrace_cleaner.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/backtrace_cleaner.rb similarity index 82% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/backtrace_cleaner.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/backtrace_cleaner.rb index 16dd733ddb..02cbfbaee6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/backtrace_cleaner.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/backtrace_cleaner.rb @@ -31,6 +31,9 @@ module ActiveSupport class BacktraceCleaner def initialize @filters, @silencers = [], [] + add_gem_filter + add_gem_silencer + add_stdlib_silencer end # Returns the backtrace after all filters and silencers have been run @@ -82,6 +85,26 @@ module ActiveSupport end private + + FORMATTED_GEMS_PATTERN = /\A[^\/]+ \([\w.]+\) / + + def add_gem_filter + gems_paths = (Gem.path | [Gem.default_dir]).map { |p| Regexp.escape(p) } + return if gems_paths.empty? + + gems_regexp = %r{(#{gems_paths.join('|')})/(bundler/)?gems/([^/]+)-([\w.]+)/(.*)} + gems_result = '\3 (\4) \5' + add_filter { |line| line.sub(gems_regexp, gems_result) } + end + + def add_gem_silencer + add_silencer { |line| FORMATTED_GEMS_PATTERN.match?(line) } + end + + def add_stdlib_silencer + add_silencer { |line| line.start_with?(RbConfig::CONFIG["rubylibdir"]) } + end + def filter_backtrace(backtrace) @filters.each do |f| backtrace = backtrace.map { |line| f.call(line) } @@ -99,7 +122,11 @@ module ActiveSupport end def noise(backtrace) - backtrace - silence(backtrace) + backtrace.select do |line| + @silencers.any? do |s| + s.call(line) + end + end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/benchmarkable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/benchmarkable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/benchmarkable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/benchmarkable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/builder.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/builder.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/builder.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/builder.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/callbacks.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/callbacks.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb index 9a3728d986..d0644a0f7e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/callbacks.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/callbacks.rb @@ -23,6 +23,9 @@ module ActiveSupport # +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 @@ -497,9 +500,7 @@ module ActiveSupport arg.halted || !@user_conditions.all? { |c| c.call(arg.target, arg.value) } end - def nested - @nested - end + attr_reader :nested def final? !@call_template @@ -578,7 +579,7 @@ module ActiveSupport end protected - def chain; @chain; end + attr_reader :chain private @@ -659,9 +660,17 @@ module ActiveSupport # * :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) @@ -809,7 +818,9 @@ module ActiveSupport names.each do |name| name = name.to_sym - set_callbacks name, CallbackChain.new(name, options) + ([self] + ActiveSupport::DescendantsTracker.descendants(self)).each do |target| + target.set_callbacks name, CallbackChain.new(name, options) + end module_eval <<-RUBY, __FILE__, __LINE__ + 1 def _run_#{name}_callbacks(&block) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/concern.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/concern.rb similarity index 83% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/concern.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/concern.rb index 5d356a0ab6..708c445031 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/concern.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/concern.rb @@ -110,7 +110,7 @@ module ActiveSupport base.instance_variable_set(:@_dependencies, []) end - def append_features(base) + def append_features(base) #:nodoc: if base.instance_variable_defined?(:@_dependencies) base.instance_variable_get(:@_dependencies) << self false @@ -123,6 +123,9 @@ module ActiveSupport 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) @@ -137,6 +140,26 @@ module ActiveSupport 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) : diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/configurable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/configurable.rb similarity index 86% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/configurable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/configurable.rb index 4d6f7819bb..71c23dae9b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/configurable.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/configurable.rb @@ -2,8 +2,6 @@ require "active_support/concern" require "active_support/ordered_options" -require "active_support/core_ext/array/extract_options" -require "active_support/core_ext/regexp" module ActiveSupport # Configurable provides a config method to store and retrieve @@ -69,8 +67,8 @@ module ActiveSupport # end # # => NameError: invalid config attribute name # - # To opt out of the instance writer method, pass instance_writer: false. - # To opt out of the instance reader method, pass instance_reader: false. + # 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 @@ -83,7 +81,7 @@ module ActiveSupport # User.new.allowed_access = true # => NoMethodError # User.new.allowed_access # => NoMethodError # - # Or pass instance_accessor: false, to opt out both instance methods. + # Or pass instance_accessor: false, to omit both instance methods. # # class User # include ActiveSupport::Configurable @@ -106,9 +104,7 @@ module ActiveSupport # end # # User.hair_colors # => [:brown, :black, :blonde, :red] - def config_accessor(*names) - options = names.extract_options! - + def config_accessor(*names, instance_reader: true, instance_writer: true, instance_accessor: true) # :doc: names.each do |name| raise NameError.new("invalid config attribute name") unless /\A[_A-Za-z]\w*\z/.match?(name) @@ -118,9 +114,9 @@ module ActiveSupport singleton_class.class_eval reader, __FILE__, reader_line singleton_class.class_eval writer, __FILE__, writer_line - unless options[:instance_accessor] == false - class_eval reader, __FILE__, reader_line unless options[:instance_reader] == false - class_eval writer, __FILE__, writer_line unless options[:instance_writer] == false + if instance_accessor + class_eval reader, __FILE__, reader_line if instance_reader + class_eval writer, __FILE__, writer_line if instance_writer end send("#{name}=", yield) if block_given? end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array.rb similarity index 84% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array.rb index 6d83b76882..88b6567712 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array.rb @@ -3,7 +3,7 @@ require "active_support/core_ext/array/wrap" require "active_support/core_ext/array/access" require "active_support/core_ext/array/conversions" +require "active_support/core_ext/array/extract" require "active_support/core_ext/array/extract_options" require "active_support/core_ext/array/grouping" -require "active_support/core_ext/array/prepend_and_append" require "active_support/core_ext/array/inquiry" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array/access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/access.rb similarity index 71% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array/access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/access.rb index b7ff7a3907..ea01e5891c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array/access.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/access.rb @@ -29,16 +29,28 @@ class Array end end - # Returns a copy of the Array without the specified elements. + # Returns a new array that includes the passed elements. # - # people = ["David", "Rafael", "Aaron", "Todd"] - # people.without "Aaron", "Todd" - # # => ["David", "Rafael"] + # [ 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. # - # Note: This is an optimization of Enumerable#without that uses Array#- + # ["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 for #excluding. def without(*elements) - self - elements + excluding(*elements) end # Equal to self[1]. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/extract.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/extract.rb new file mode 100644 index 0000000000..cc5a8a3f88 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/extract.rb @@ -0,0 +1,21 @@ +# 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/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array/extract_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/extract_options.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array/extract_options.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/extract_options.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array/grouping.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/grouping.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array/grouping.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/grouping.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array/inquiry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/inquiry.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array/inquiry.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/inquiry.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/prepend_and_append.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/prepend_and_append.rb new file mode 100644 index 0000000000..ba3739f640 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/prepend_and_append.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +require "active_support/deprecation" + +ActiveSupport::Deprecation.warn "Ruby 2.5+ (required by Rails 6) provides Array#append and Array#prepend natively, so requiring active_support/core_ext/array/prepend_and_append is no longer necessary. Requiring it will raise LoadError in Rails 6.1." diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array/wrap.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/wrap.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/array/wrap.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/array/wrap.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/benchmark.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/benchmark.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/benchmark.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/benchmark.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/big_decimal.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/big_decimal.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/big_decimal.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/big_decimal.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/big_decimal/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/big_decimal/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/big_decimal/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/big_decimal/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/class.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/class.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/class.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/class.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/class/attribute.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/class/attribute.rb similarity index 87% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/class/attribute.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/class/attribute.rb index 7928efb871..255cbee55c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/class/attribute.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/class/attribute.rb @@ -84,27 +84,26 @@ class Class # To set a default value for the attribute, pass default:, like so: # # class_attribute :settings, default: {} - def class_attribute(*attrs) - options = attrs.extract_options! - instance_reader = options.fetch(:instance_accessor, true) && options.fetch(:instance_reader, true) - instance_writer = options.fetch(:instance_accessor, true) && options.fetch(:instance_writer, true) - instance_predicate = options.fetch(:instance_predicate, true) - default_value = options.fetch(:default, nil) - + def class_attribute( + *attrs, + instance_accessor: true, + instance_reader: instance_accessor, + instance_writer: instance_accessor, + instance_predicate: true, + default: nil + ) attrs.each do |name| singleton_class.silence_redefinition_of_method(name) - define_singleton_method(name) { nil } + define_singleton_method(name) { default } singleton_class.silence_redefinition_of_method("#{name}?") define_singleton_method("#{name}?") { !!public_send(name) } if instance_predicate - ivar = "@#{name}" + ivar = "@#{name}".to_sym singleton_class.silence_redefinition_of_method("#{name}=") define_singleton_method("#{name}=") do |val| - singleton_class.class_eval do - redefine_method(name) { val } - end + redefine_singleton_method(name) { val } if singleton_class? class_eval do @@ -137,10 +136,6 @@ class Class instance_variable_set ivar, val end end - - unless default_value.nil? - self.send("#{name}=", default_value) - end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/class/attribute_accessors.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/class/attribute_accessors.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/class/attribute_accessors.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/class/attribute_accessors.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/class/subclasses.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/class/subclasses.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/class/subclasses.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/class/subclasses.rb index 75e65337b7..56fb46a88d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/class/subclasses.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/class/subclasses.rb @@ -3,7 +3,7 @@ class Class begin # Test if this Ruby supports each_object against singleton_class - ObjectSpace.each_object(Numeric.singleton_class) {} + ObjectSpace.each_object(Numeric.singleton_class) { } # Returns an array with all classes that are < than its receiver. # diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date/acts_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date/acts_like.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date/acts_like.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date/acts_like.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date/blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date/blank.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date/blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date/blank.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date/calculations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date/calculations.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date/calculations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date/calculations.rb index 1cd7acb05d..d03a8d3997 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date/calculations.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date/calculations.rb @@ -110,12 +110,13 @@ class Date # Provides precise Date calculations for years, months, and days. The +options+ parameter takes a hash with # any of these keys: :years, :months, :weeks, :days. def advance(options) - options = options.dup d = self - d = d >> options.delete(:years) * 12 if options[:years] - d = d >> options.delete(:months) if options[:months] - d = d + options.delete(:weeks) * 7 if options[:weeks] - d = d + options.delete(:days) if options[:days] + + 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 diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date/zones.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date/zones.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date/zones.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date/zones.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_and_time/calculations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_and_time/calculations.rb similarity index 87% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_and_time/calculations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_and_time/calculations.rb index f6cb1a384c..c7a2378e41 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_and_time/calculations.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_and_time/calculations.rb @@ -5,13 +5,13 @@ require "active_support/core_ext/object/try" module DateAndTime module Calculations DAYS_INTO_WEEK = { - monday: 0, - tuesday: 1, - wednesday: 2, - thursday: 3, - friday: 4, - saturday: 5, - sunday: 6 + sunday: 0, + monday: 1, + tuesday: 2, + wednesday: 3, + thursday: 4, + friday: 5, + saturday: 6 } WEEKEND_DAYS = [ 6, 0 ] @@ -20,21 +20,11 @@ module DateAndTime advance(days: -1) end - # Returns a new date/time the specified number of days ago. - def prev_day(days = 1) - advance(days: -days) - end - # Returns a new date/time representing tomorrow. def tomorrow advance(days: 1) end - # Returns a new date/time the specified number of days in the future. - def next_day(days = 1) - advance(days: days) - end - # Returns true if the date/time is today. def today? to_date == ::Date.current @@ -60,6 +50,16 @@ module DateAndTime !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) @@ -124,7 +124,7 @@ module DateAndTime # 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 = [10, 7, 4, 1].detect { |m| m <= month } + first_quarter_month = month - (2 + month) % 3 beginning_of_month.change(month: first_quarter_month) end alias :at_beginning_of_quarter :beginning_of_quarter @@ -139,7 +139,7 @@ module DateAndTime # 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 = [3, 6, 9, 12].detect { |m| m >= month } + 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 @@ -188,21 +188,11 @@ module DateAndTime end end - # Returns a new date/time the specified number of months in the future. - def next_month(months = 1) - advance(months: months) - end - # Short-hand for months_since(3) def next_quarter months_since(3) end - # Returns a new date/time the specified number of years in the future. - def next_year(years = 1) - advance(years: years) - 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. @@ -223,11 +213,6 @@ module DateAndTime end alias_method :last_weekday, :prev_weekday - # Returns a new date/time the specified number of months ago. - def prev_month(months = 1) - advance(months: -months) - end - # Short-hand for months_ago(1). def last_month months_ago(1) @@ -239,11 +224,6 @@ module DateAndTime end alias_method :last_quarter, :prev_quarter - # Returns a new date/time the specified number of years ago. - def prev_year(years = 1) - advance(years: -years) - end - # Short-hand for years_ago(1). def last_year years_ago(1) @@ -253,9 +233,8 @@ module DateAndTime # 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[start_day] - current_day_number = wday != 0 ? wday - 1 : 6 - (current_day_number - start_day_number) % 7 + 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. @@ -336,8 +315,7 @@ module DateAndTime # today.next_occurring(:monday) # => Mon, 18 Dec 2017 # today.next_occurring(:thursday) # => Thu, 21 Dec 2017 def next_occurring(day_of_week) - current_day_number = wday != 0 ? wday - 1 : 6 - from_now = DAYS_INTO_WEEK.fetch(day_of_week) - current_day_number + from_now = DAYS_INTO_WEEK.fetch(day_of_week) - wday from_now += 7 unless from_now > 0 advance(days: from_now) end @@ -348,8 +326,7 @@ module DateAndTime # today.prev_occurring(:monday) # => Mon, 11 Dec 2017 # today.prev_occurring(:thursday) # => Thu, 07 Dec 2017 def prev_occurring(day_of_week) - current_day_number = wday != 0 ? wday - 1 : 6 - ago = current_day_number - DAYS_INTO_WEEK.fetch(day_of_week) + ago = wday - DAYS_INTO_WEEK.fetch(day_of_week) ago += 7 unless ago > 0 advance(days: -ago) end @@ -364,7 +341,7 @@ module DateAndTime end def days_span(day) - (DAYS_INTO_WEEK[day] - DAYS_INTO_WEEK[Date.beginning_of_week]) % 7 + (DAYS_INTO_WEEK.fetch(day) - DAYS_INTO_WEEK.fetch(Date.beginning_of_week)) % 7 end def copy_time_to(other) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_and_time/compatibility.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_and_time/compatibility.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_and_time/compatibility.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_and_time/compatibility.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_and_time/zones.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_and_time/zones.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_and_time/zones.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_and_time/zones.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_time/acts_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_time/acts_like.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_time/acts_like.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_time/acts_like.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_time/blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_time/blank.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_time/blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_time/blank.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_time/calculations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_time/calculations.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_time/calculations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_time/calculations.rb index e61b23f842..bc670c3e76 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_time/calculations.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_time/calculations.rb @@ -110,7 +110,7 @@ class DateTime # instance time. Do not use this method in combination with x.months, use # months_since instead! def since(seconds) - self + Rational(seconds.round, 86400) + self + Rational(seconds, 86400) end alias :in :since diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_time/compatibility.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_time/compatibility.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_time/compatibility.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_time/compatibility.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_time/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_time/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/date_time/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/date_time/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/digest.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/digest.rb new file mode 100644 index 0000000000..ce1427e13a --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/digest.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require "active_support/core_ext/digest/uuid" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/digest/uuid.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/digest/uuid.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/digest/uuid.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/digest/uuid.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/enumerable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/enumerable.rb new file mode 100644 index 0000000000..4675c41936 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/enumerable.rb @@ -0,0 +1,188 @@ +# frozen_string_literal: true + +module Enumerable + INDEX_WITH_DEFAULT = Object.new + private_constant :INDEX_WITH_DEFAULT + + # Enumerable#sum was added in Ruby 2.4, but it only works with Numeric elements + # when we omit an identity. + + # :stopdoc: + + # We can't use Refinements here because Refinements with Module which will be prepended + # doesn't work well https://bugs.ruby-lang.org/issues/13446 + alias :_original_sum_with_required_identity :sum + private :_original_sum_with_required_identity + + # :startdoc: + + # Calculates a sum from the elements. + # + # payments.sum { |p| p.price * p.tax_rate } + # payments.sum(&:price) + # + # The latter is a shortcut for: + # + # payments.inject(0) { |sum, p| sum + p.price } + # + # It can also calculate the sum without the use of a block. + # + # [5, 15, 10].sum # => 30 + # ['foo', 'bar'].sum # => "foobar" + # [[1, 2], [3, 1, 5]].sum # => [1, 2, 3, 1, 5] + # + # The default sum of an empty list is zero. You can override this default: + # + # [].sum(Payment.new(0)) { |i| i.amount } # => Payment.new(0) + def sum(identity = nil, &block) + if identity + _original_sum_with_required_identity(identity, &block) + elsif block_given? + map(&block).sum(identity) + else + inject(:+) || 0 + end + end + + # Convert an enumerable to a hash keying it by the block return 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 keying it with the enumerable items and with the values returned in the block. + # + # 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?" } + def index_with(default = INDEX_WITH_DEFAULT) + if block_given? + result = {} + each { |elem| result[elem] = yield(elem) } + result + elsif default != INDEX_WITH_DEFAULT + result = {} + each { |elem| result[elem] = default } + result + else + to_enum(:index_with) { size if respond_to?(:size) } + 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 |element| + cnt += 1 if yield element + 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 for #excluding. + def without(*elements) + excluding(*elements) + end + + # Convert an enumerable to an array based on the given key. + # + # [{ 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 + map { |element| element[keys.first] } + end + 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(identity = nil) + 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 = identity || 0 + sum + (actual_last - first + 1) * (actual_last + first) / 2 + else + identity || 0 + end + end + end +end + +# Using Refinements here in order not to expose our internal method +using Module.new { + refine Array do + alias :orig_sum :sum + end +} + +class Array #:nodoc: + # Array#sum was added in Ruby 2.4 but it only works with Numeric elements. + def sum(init = nil, &block) + if init.is_a?(Numeric) || first.is_a?(Numeric) + init ||= 0 + orig_sum(init, &block) + else + super + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/file.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/file.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/file.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/file.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/file/atomic.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/file/atomic.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/file/atomic.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/file/atomic.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash.rb similarity index 78% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash.rb index e19aeaa983..2f0901d853 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash.rb @@ -1,11 +1,10 @@ # frozen_string_literal: true -require "active_support/core_ext/hash/compact" require "active_support/core_ext/hash/conversions" require "active_support/core_ext/hash/deep_merge" +require "active_support/core_ext/hash/deep_transform_values" require "active_support/core_ext/hash/except" require "active_support/core_ext/hash/indifferent_access" require "active_support/core_ext/hash/keys" require "active_support/core_ext/hash/reverse_merge" require "active_support/core_ext/hash/slice" -require "active_support/core_ext/hash/transform_values" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/compact.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/compact.rb new file mode 100644 index 0000000000..5cb858af5c --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/compact.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +require "active_support/deprecation" + +ActiveSupport::Deprecation.warn "Ruby 2.5+ (required by Rails 6) provides Hash#compact and Hash#compact! natively, so requiring active_support/core_ext/hash/compact is no longer necessary. Requiring it will raise LoadError in Rails 6.1." diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/deep_merge.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/deep_merge.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/deep_merge.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/deep_merge.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/deep_transform_values.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/deep_transform_values.rb new file mode 100644 index 0000000000..18acb1e70c --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/deep_transform_values.rb @@ -0,0 +1,46 @@ +# 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/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/except.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/except.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/except.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/except.rb index 6258610c98..5013812460 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/except.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/except.rb @@ -10,7 +10,7 @@ class Hash # This is useful for limiting a set of parameters to everything but a few known toggles: # @person.update(params[:person].except(:admin)) def except(*keys) - dup.except!(*keys) + slice(*self.keys - keys) end # Removes the given keys from hash and returns it. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/indifferent_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/indifferent_access.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/indifferent_access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/indifferent_access.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/keys.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/keys.rb similarity index 82% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/keys.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/keys.rb index bdf196ec3d..7d3495db2c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/keys.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/keys.rb @@ -1,35 +1,6 @@ # frozen_string_literal: true class Hash - # Returns a new hash with all keys converted using the +block+ operation. - # - # hash = { name: 'Rob', age: '28' } - # - # hash.transform_keys { |key| key.to_s.upcase } # => {"NAME"=>"Rob", "AGE"=>"28"} - # - # If you do not provide a +block+, it will return an Enumerator - # for chaining with other methods: - # - # hash.transform_keys.with_index { |k, i| [k, i].join } # => {"name0"=>"Rob", "age1"=>"28"} - def transform_keys - return enum_for(:transform_keys) { size } unless block_given? - result = {} - each_key do |key| - result[yield(key)] = self[key] - end - result - end unless method_defined? :transform_keys - - # Destructively converts all keys using the +block+ operations. - # Same as +transform_keys+ but modifies +self+. - def transform_keys! - return enum_for(:transform_keys!) { size } unless block_given? - keys.each do |key| - self[yield(key)] = delete(key) - end - self - end unless method_defined? :transform_keys! - # Returns a new hash with all keys converted to strings. # # hash = { name: 'Rob', age: '28' } diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/reverse_merge.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/reverse_merge.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/hash/reverse_merge.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/reverse_merge.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/slice.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/slice.rb new file mode 100644 index 0000000000..3d0f8a1e62 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/slice.rb @@ -0,0 +1,26 @@ +# 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. + # + # { a: 1, b: 2, c: 3, d: 4 }.extract!(:a, :b) # => {:a=>1, :b=>2} + # { a: 1, b: 2 }.extract!(:a, :x) # => {:a=>1} + 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/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/transform_values.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/transform_values.rb new file mode 100644 index 0000000000..e4aeb0e891 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/hash/transform_values.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +require "active_support/deprecation" + +ActiveSupport::Deprecation.warn "Ruby 2.5+ (required by Rails 6) provides Hash#transform_values natively, so requiring active_support/core_ext/hash/transform_values is no longer necessary. Requiring it will raise LoadError in Rails 6.1." diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/integer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/integer.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/integer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/integer.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/integer/inflections.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/integer/inflections.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/integer/inflections.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/integer/inflections.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/integer/multiple.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/integer/multiple.rb similarity index 84% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/integer/multiple.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/integer/multiple.rb index e7606662d3..bd57a909c5 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/integer/multiple.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/integer/multiple.rb @@ -7,6 +7,6 @@ class Integer # 6.multiple_of?(5) # => false # 10.multiple_of?(2) # => true def multiple_of?(number) - number != 0 ? self % number == 0 : zero? + number == 0 ? self == 0 : self % number == 0 end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/integer/time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/integer/time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/integer/time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/integer/time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/kernel.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/kernel.rb similarity index 78% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/kernel.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/kernel.rb index 0f4356fbdd..7708069301 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/kernel.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/kernel.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require "active_support/core_ext/kernel/agnostics" require "active_support/core_ext/kernel/concern" require "active_support/core_ext/kernel/reporting" require "active_support/core_ext/kernel/singleton_class" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/kernel/concern.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/kernel/concern.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/kernel/concern.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/kernel/concern.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/kernel/reporting.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/kernel/reporting.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/kernel/reporting.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/kernel/reporting.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/kernel/singleton_class.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/kernel/singleton_class.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/kernel/singleton_class.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/kernel/singleton_class.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/load_error.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/load_error.rb similarity index 77% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/load_error.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/load_error.rb index 750f858fcc..b81ed0605e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/load_error.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/load_error.rb @@ -4,6 +4,6 @@ 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.sub(/\.rb$/, "".freeze) == path.sub(/\.rb$/, "".freeze) + location.sub(/\.rb$/, "") == path.to_s.sub(/\.rb$/, "") end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/marshal.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/marshal.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/marshal.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/marshal.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module.rb index d91e3fba6a..542af98c04 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module.rb @@ -3,7 +3,6 @@ require "active_support/core_ext/module/aliasing" require "active_support/core_ext/module/introspection" require "active_support/core_ext/module/anonymous" -require "active_support/core_ext/module/reachable" require "active_support/core_ext/module/attribute_accessors" require "active_support/core_ext/module/attribute_accessors_per_thread" require "active_support/core_ext/module/attr_internal" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/aliasing.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/aliasing.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/aliasing.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/aliasing.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/anonymous.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/anonymous.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/anonymous.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/anonymous.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/attr_internal.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/attr_internal.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/attr_internal.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/attr_internal.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/attribute_accessors.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/attribute_accessors.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/attribute_accessors.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/attribute_accessors.rb index 580baffa2b..cc1926e022 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/attribute_accessors.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/attribute_accessors.rb @@ -1,8 +1,5 @@ # frozen_string_literal: true -require "active_support/core_ext/array/extract_options" -require "active_support/core_ext/regexp" - # Extends the module object with class/module and instance accessors for # class/module attributes, just like the native attr* accessors for instance # attributes. @@ -27,7 +24,7 @@ class Module # end # # => NameError: invalid attribute name: 1_Badname # - # If you want to opt out the creation on the instance reader method, pass + # To omit the instance reader method, pass # instance_reader: false or instance_accessor: false. # # module HairColors @@ -94,7 +91,7 @@ class Module # Person.new.hair_colors = [:blonde, :red] # HairColors.class_variable_get("@@hair_colors") # => [:blonde, :red] # - # If you want to opt out the instance writer method, pass + # To omit the instance writer method, pass # instance_writer: false or instance_accessor: false. # # module HairColors @@ -163,14 +160,14 @@ class Module # parent class. Similarly if parent class changes the value then that would # change the value of subclasses too. # - # class Male < Person + # class Citizen < Person # end # - # Male.new.hair_colors << :blue + # Citizen.new.hair_colors << :blue # Person.new.hair_colors # => [:brown, :black, :blonde, :red, :blue] # - # To opt out of the instance writer method, pass instance_writer: false. - # To opt out of the instance reader method, pass instance_reader: false. + # 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 @@ -183,7 +180,7 @@ class Module # Person.new.hair_colors = [:brown] # => NoMethodError # Person.new.hair_colors # => NoMethodError # - # Or pass instance_accessor: false, to opt out both instance methods. + # Or pass instance_accessor: false, to omit both instance methods. # # module HairColors # mattr_accessor :hair_colors, instance_accessor: false diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb similarity index 79% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb index 4b9b6ea9bd..a6e87aeb68 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb @@ -1,8 +1,5 @@ # frozen_string_literal: true -require "active_support/core_ext/array/extract_options" -require "active_support/core_ext/regexp" - # 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. @@ -28,7 +25,7 @@ class Module # end # # => NameError: invalid attribute name: 1_Badname # - # If you want to opt out of the creation of the instance reader method, pass + # To omit the instance reader method, pass # instance_reader: false or instance_accessor: false. # # class Current @@ -36,9 +33,7 @@ class Module # end # # Current.new.user # => NoMethodError - def thread_mattr_reader(*syms) # :nodoc: - options = syms.extract_options! - + def thread_mattr_reader(*syms, instance_reader: true, instance_accessor: true) # :nodoc: syms.each do |sym| raise NameError.new("invalid attribute name: #{sym}") unless /^[_A-Za-z]\w*$/.match?(sym) @@ -50,7 +45,7 @@ class Module end EOS - unless options[:instance_reader] == false || options[:instance_accessor] == false + if instance_reader && instance_accessor class_eval(<<-EOS, __FILE__, __LINE__ + 1) def #{sym} self.class.#{sym} @@ -71,7 +66,7 @@ class Module # Current.user = "DHH" # Thread.current[:attr_Current_user] # => "DHH" # - # If you want to opt out of the creation of the instance writer method, pass + # To omit the instance writer method, pass # instance_writer: false or instance_accessor: false. # # class Current @@ -79,8 +74,7 @@ class Module # end # # Current.new.user = "DHH" # => NoMethodError - def thread_mattr_writer(*syms) # :nodoc: - options = syms.extract_options! + 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) @@ -92,7 +86,7 @@ class Module end EOS - unless options[:instance_writer] == false || options[:instance_accessor] == false + if instance_writer && instance_accessor class_eval(<<-EOS, __FILE__, __LINE__ + 1) def #{sym}=(obj) self.class.#{sym} = obj @@ -124,8 +118,8 @@ class Module # Customer.user # => "Rafael" # Account.user # => "DHH" # - # To opt out of the instance writer method, pass instance_writer: false. - # To opt out of the instance reader method, pass instance_reader: false. + # 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 @@ -134,17 +128,17 @@ class Module # Current.new.user = "DHH" # => NoMethodError # Current.new.user # => NoMethodError # - # Or pass instance_accessor: false, to opt out both instance methods. + # Or pass instance_accessor: false, to omit both instance methods. # # class Current - # mattr_accessor :user, instance_accessor: false + # thread_mattr_accessor :user, instance_accessor: false # end # # Current.new.user = "DHH" # => NoMethodError # Current.new.user # => NoMethodError - def thread_mattr_accessor(*syms) - thread_mattr_reader(*syms) - thread_mattr_writer(*syms) + def thread_mattr_accessor(*syms, instance_reader: true, instance_writer: true, instance_accessor: true) + thread_mattr_reader(*syms, instance_reader: instance_reader, instance_accessor: instance_accessor) + thread_mattr_writer(*syms, instance_writer: instance_writer, instance_accessor: instance_accessor) end alias :thread_cattr_accessor :thread_mattr_accessor end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/concerning.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/concerning.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/concerning.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/concerning.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/delegation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/delegation.rb similarity index 86% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/delegation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/delegation.rb index 4310df3024..ccdb6f0a7f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/delegation.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/delegation.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require "set" -require "active_support/core_ext/regexp" class Module # Error generated by +delegate+ when a method is called on +nil+ and +allow_nil+ @@ -20,10 +19,11 @@ class Module # public methods as your own. # # ==== Options - # * :to - Specifies the target object + # * :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 +Module::DelegationError+ + # * :allow_nil - If set to true, prevents a +Module::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 @@ -114,6 +114,23 @@ class Module # 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 # +Module::DelegationError+ is raised. If you wish to instead return +nil+, # use the :allow_nil option. @@ -151,7 +168,7 @@ class Module # 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) + def delegate(*methods, to: nil, prefix: nil, allow_nil: nil, private: nil) unless to raise ArgumentError, "Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, to: :greeter)." end @@ -173,7 +190,7 @@ class Module to = to.to_s to = "self.#{to}" if DELEGATION_RESERVED_METHOD_NAMES.include?(to) - methods.map do |method| + method_names = methods.map do |method| # Attribute writer methods only accept one argument. Makes sure []= # methods still accept two arguments. definition = /[^\]]=$/.match?(method) ? "arg" : "*args, &block" @@ -213,6 +230,9 @@ class Module module_eval(method_def, file, line) end + + private(*method_names) if private + method_names end # When building decorators, a common pattern may emerge: @@ -223,7 +243,7 @@ class Module # end # # def person - # @event.detail.person || @event.creator + # detail.person || creator # end # # private @@ -246,7 +266,7 @@ class Module # end # # def person - # @event.detail.person || @event.creator + # detail.person || creator # end # end # @@ -255,6 +275,11 @@ class Module # # The delegated method must be public on the target, otherwise it will # raise +NoMethodError+. + # + # 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) target = target.to_s target = "self.#{target}" if DELEGATION_RESERVED_METHOD_NAMES.include?(target) @@ -264,6 +289,7 @@ class Module # 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 diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/deprecation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/deprecation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/deprecation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/deprecation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/introspection.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/introspection.rb new file mode 100644 index 0000000000..9b6df40596 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/introspection.rb @@ -0,0 +1,86 @@ +# 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 + parent_name = name =~ /::[^:]+\Z/ ? $`.freeze : nil + @parent_name = parent_name unless frozen? + parent_name + end + end + + def parent_name + ActiveSupport::Deprecation.warn(<<-MSG.squish) + `Module#parent_name` has been renamed to `module_parent_name`. + `parent_name` is deprecated and will be removed in Rails 6.1. + MSG + module_parent_name + 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 + + def parent + ActiveSupport::Deprecation.warn(<<-MSG.squish) + `Module#parent` has been renamed to `module_parent`. + `parent` is deprecated and will be removed in Rails 6.1. + MSG + module_parent + 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 + + def parents + ActiveSupport::Deprecation.warn(<<-MSG.squish) + `Module#parents` has been renamed to `module_parents`. + `parents` is deprecated and will be removed in Rails 6.1. + MSG + module_parents + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/reachable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/reachable.rb similarity index 51% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/reachable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/reachable.rb index e9cbda5245..2020f5204c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/reachable.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/reachable.rb @@ -3,9 +3,4 @@ require "active_support/core_ext/module/anonymous" require "active_support/core_ext/string/inflections" -class Module - def reachable? #:nodoc: - !anonymous? && name.safe_constantize.equal?(self) - end - deprecate :reachable? -end +ActiveSupport::Deprecation.warn("reachable is deprecated and will be removed from the framework.") diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/redefine_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/redefine_method.rb similarity index 51% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/redefine_method.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/redefine_method.rb index a0a6622ca4..5bd8e6e973 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/redefine_method.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/redefine_method.rb @@ -1,23 +1,14 @@ # frozen_string_literal: true class Module - if RUBY_VERSION >= "2.3" - # 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 - else - def silence_redefinition_of_method(method) - if method_defined?(method) || private_method_defined?(method) - alias_method :__rails_redefine, method - remove_method :__rails_redefine - end + # 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 diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/remove_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/remove_method.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/remove_method.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/module/remove_method.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/name_error.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/name_error.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/name_error.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/name_error.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/numeric.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/numeric.rb similarity index 78% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/numeric.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/numeric.rb index 0b04e359f9..fe778470f1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/numeric.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/numeric.rb @@ -2,5 +2,4 @@ require "active_support/core_ext/numeric/bytes" require "active_support/core_ext/numeric/time" -require "active_support/core_ext/numeric/inquiry" require "active_support/core_ext/numeric/conversions" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/numeric/bytes.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/numeric/bytes.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/numeric/bytes.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/numeric/bytes.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/numeric/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/numeric/conversions.rb new file mode 100644 index 0000000000..8acad6164a --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/numeric/conversions.rb @@ -0,0 +1,136 @@ +# frozen_string_literal: true + +require "active_support/core_ext/big_decimal/conversions" +require "active_support/number_helper" +require "active_support/core_ext/module/deprecation" + +module ActiveSupport + module NumericWithFormat + # Provides options for converting numbers into formatted strings. + # Options are provided for phone numbers, currency, percentage, + # precision, positional notation, file size and pretty printing. + # + # ==== Options + # + # For details on which formats use which options, see ActiveSupport::NumberHelper + # + # ==== Examples + # + # Phone Numbers: + # 5551234.to_s(:phone) # => "555-1234" + # 1235551234.to_s(:phone) # => "123-555-1234" + # 1235551234.to_s(:phone, area_code: true) # => "(123) 555-1234" + # 1235551234.to_s(:phone, delimiter: ' ') # => "123 555 1234" + # 1235551234.to_s(:phone, area_code: true, extension: 555) # => "(123) 555-1234 x 555" + # 1235551234.to_s(:phone, country_code: 1) # => "+1-123-555-1234" + # 1235551234.to_s(:phone, country_code: 1, extension: 1343, delimiter: '.') + # # => "+1.123.555.1234 x 1343" + # + # Currency: + # 1234567890.50.to_s(:currency) # => "$1,234,567,890.50" + # 1234567890.506.to_s(:currency) # => "$1,234,567,890.51" + # 1234567890.506.to_s(:currency, precision: 3) # => "$1,234,567,890.506" + # 1234567890.506.to_s(:currency, locale: :fr) # => "1 234 567 890,51 €" + # -1234567890.50.to_s(:currency, negative_format: '(%u%n)') + # # => "($1,234,567,890.50)" + # 1234567890.50.to_s(:currency, unit: '£', separator: ',', delimiter: '') + # # => "£1234567890,50" + # 1234567890.50.to_s(:currency, unit: '£', separator: ',', delimiter: '', format: '%n %u') + # # => "1234567890,50 £" + # + # Percentage: + # 100.to_s(:percentage) # => "100.000%" + # 100.to_s(:percentage, precision: 0) # => "100%" + # 1000.to_s(:percentage, delimiter: '.', separator: ',') # => "1.000,000%" + # 302.24398923423.to_s(:percentage, precision: 5) # => "302.24399%" + # 1000.to_s(:percentage, locale: :fr) # => "1 000,000%" + # 100.to_s(:percentage, format: '%n %') # => "100.000 %" + # + # Delimited: + # 12345678.to_s(:delimited) # => "12,345,678" + # 12345678.05.to_s(:delimited) # => "12,345,678.05" + # 12345678.to_s(:delimited, delimiter: '.') # => "12.345.678" + # 12345678.to_s(:delimited, delimiter: ',') # => "12,345,678" + # 12345678.05.to_s(:delimited, separator: ' ') # => "12,345,678 05" + # 12345678.05.to_s(:delimited, locale: :fr) # => "12 345 678,05" + # 98765432.98.to_s(:delimited, delimiter: ' ', separator: ',') + # # => "98 765 432,98" + # + # Rounded: + # 111.2345.to_s(:rounded) # => "111.235" + # 111.2345.to_s(:rounded, precision: 2) # => "111.23" + # 13.to_s(:rounded, precision: 5) # => "13.00000" + # 389.32314.to_s(:rounded, precision: 0) # => "389" + # 111.2345.to_s(:rounded, significant: true) # => "111" + # 111.2345.to_s(:rounded, precision: 1, significant: true) # => "100" + # 13.to_s(:rounded, precision: 5, significant: true) # => "13.000" + # 111.234.to_s(:rounded, locale: :fr) # => "111,234" + # 13.to_s(:rounded, precision: 5, significant: true, strip_insignificant_zeros: true) + # # => "13" + # 389.32314.to_s(:rounded, precision: 4, significant: true) # => "389.3" + # 1111.2345.to_s(:rounded, precision: 2, separator: ',', delimiter: '.') + # # => "1.111,23" + # + # Human-friendly size in Bytes: + # 123.to_s(:human_size) # => "123 Bytes" + # 1234.to_s(:human_size) # => "1.21 KB" + # 12345.to_s(:human_size) # => "12.1 KB" + # 1234567.to_s(:human_size) # => "1.18 MB" + # 1234567890.to_s(:human_size) # => "1.15 GB" + # 1234567890123.to_s(:human_size) # => "1.12 TB" + # 1234567890123456.to_s(:human_size) # => "1.1 PB" + # 1234567890123456789.to_s(:human_size) # => "1.07 EB" + # 1234567.to_s(:human_size, precision: 2) # => "1.2 MB" + # 483989.to_s(:human_size, precision: 2) # => "470 KB" + # 1234567.to_s(:human_size, precision: 2, separator: ',') # => "1,2 MB" + # 1234567890123.to_s(:human_size, precision: 5) # => "1.1228 TB" + # 524288000.to_s(:human_size, precision: 5) # => "500 MB" + # + # Human-friendly format: + # 123.to_s(:human) # => "123" + # 1234.to_s(:human) # => "1.23 Thousand" + # 12345.to_s(:human) # => "12.3 Thousand" + # 1234567.to_s(:human) # => "1.23 Million" + # 1234567890.to_s(:human) # => "1.23 Billion" + # 1234567890123.to_s(:human) # => "1.23 Trillion" + # 1234567890123456.to_s(:human) # => "1.23 Quadrillion" + # 1234567890123456789.to_s(:human) # => "1230 Quadrillion" + # 489939.to_s(:human, precision: 2) # => "490 Thousand" + # 489939.to_s(:human, precision: 4) # => "489.9 Thousand" + # 1234567.to_s(:human, precision: 4, + # significant: false) # => "1.2346 Million" + # 1234567.to_s(:human, precision: 1, + # separator: ',', + # significant: false) # => "1,2 Million" + def to_s(format = nil, options = nil) + case format + when nil + super() + when Integer, String + super(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 + super() + else + super(format) + end + end + end +end + +Integer.prepend ActiveSupport::NumericWithFormat +Float.prepend ActiveSupport::NumericWithFormat +BigDecimal.prepend ActiveSupport::NumericWithFormat diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/numeric/inquiry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/numeric/inquiry.rb new file mode 100644 index 0000000000..6b5240d051 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/numeric/inquiry.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +require "active_support/deprecation" + +ActiveSupport::Deprecation.warn "Ruby 2.5+ (required by Rails 6) provides Numeric#positive? and Numeric#negative? natively, so requiring active_support/core_ext/numeric/inquiry is no longer necessary. Requiring it will raise LoadError in Rails 6.1." diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/numeric/time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/numeric/time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/numeric/time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/numeric/time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/acts_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/acts_like.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/acts_like.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/acts_like.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/blank.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/blank.rb index 2ca431ab10..f36fef6cc9 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/blank.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/blank.rb @@ -1,11 +1,10 @@ # frozen_string_literal: true -require "active_support/core_ext/regexp" require "concurrent/map" class Object # An object is blank if it's false, empty, or a whitespace string. - # For example, +false+, '', ' ', +nil+, [], and {} are all blank. + # For example, +nil+, '', ' ', [], {}, and +false+ are all blank. # # This simplifies # diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/deep_dup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/deep_dup.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/deep_dup.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/deep_dup.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/duplicable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/duplicable.rb new file mode 100644 index 0000000000..3ebcdca02b --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/duplicable.rb @@ -0,0 +1,49 @@ +# 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 + +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 diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/inclusion.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/inclusion.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/inclusion.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/inclusion.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/instance_variables.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/instance_variables.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/instance_variables.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/instance_variables.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/json.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/json.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/json.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/json.rb index f7c623fe13..416059d17b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/json.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/json.rb @@ -14,6 +14,7 @@ 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 diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/to_param.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/to_param.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/to_param.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/to_param.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/to_query.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/to_query.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/to_query.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/to_query.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/try.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/try.rb similarity index 87% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/try.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/try.rb index c874691629..ef8a1f476d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/try.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/try.rb @@ -4,19 +4,27 @@ require "delegate" module ActiveSupport module Tryable #:nodoc: - def try(*a, &b) - try!(*a, &b) if a.empty? || respond_to?(a.first) + def try(method_name = nil, *args, &b) + if method_name.nil? && block_given? + if b.arity == 0 + instance_eval(&b) + else + yield self + end + elsif respond_to?(method_name) + public_send(method_name, *args, &b) + end end - def try!(*a, &b) - if a.empty? && block_given? + def try!(method_name = nil, *args, &b) + if method_name.nil? && block_given? if b.arity == 0 instance_eval(&b) else yield self end else - public_send(*a, &b) + public_send(method_name, *args, &b) end end end @@ -135,14 +143,14 @@ class NilClass # # With +try+ # @person.try(:children).try(:first).try(:name) - def try(*args) + def try(method_name = nil, *args) nil end # Calling +try!+ on +nil+ always returns +nil+. # # nil.try!(:name) # => nil - def try!(*args) + def try!(method_name = nil, *args) nil end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/with_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/with_options.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/with_options.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/with_options.rb index 2838fd76be..1d46add6e0 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/object/with_options.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/object/with_options.rb @@ -68,7 +68,7 @@ class Object # You can access these methods using the class name instead: # # class Phone < ActiveRecord::Base - # enum phone_number_type: [home: 0, office: 1, mobile: 2] + # 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 } diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/compare_range.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range/compare_range.rb similarity index 50% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/compare_range.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range/compare_range.rb index 704041f6de..d2c85d7679 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/compare_range.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range/compare_range.rb @@ -1,56 +1,71 @@ # frozen_string_literal: true module ActiveSupport - module CompareWithRange #:nodoc: + module CompareWithRange # Extends the default Range#=== to support range comparisons. - # (1..5) === (1..5) # => true - # (1..5) === (2..3) # => true - # (1..5) === (2..6) # => false + # (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) # 1...10 includes 1..9 but it does not include 1..10. + # 1..10 includes 1...11 but it does not include 1...12. operator = exclude_end? && !value.exclude_end? ? :< : :<= - super(value.first) && value.last.send(operator, last) + value_max = !exclude_end? && value.exclude_end? ? value.max : value.last + super(value.first) && (self.end.nil? || value_max.send(operator, last)) 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?(2..6) # => false + # (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) # 1...10 includes 1..9 but it does not include 1..10. + # 1..10 includes 1...11 but it does not include 1...12. operator = exclude_end? && !value.exclude_end? ? :< : :<= - super(value.first) && value.last.send(operator, last) + value_max = !exclude_end? && value.exclude_end? ? value.max : value.last + super(value.first) && (self.end.nil? || value_max.send(operator, last)) else super end end # Extends the default Range#cover? to support range comparisons. - # (1..5).cover?(1..5) # => true - # (1..5).cover?(2..3) # => true - # (1..5).cover?(2..6) # => false + # (1..5).cover?(1..5) # => true + # (1..5).cover?(2..3) # => true + # (1..5).cover?(1...6) # => true + # (1..5).cover?(2..6) # => false # # The native Range#cover? behavior is untouched. # ('a'..'f').cover?('c') # => true # (5..9).cover?(11) # => false + # + # The given range must be fully bounded, with both start and end. def cover?(value) if value.is_a?(::Range) # 1...10 covers 1..9 but it does not cover 1..10. + # 1..10 covers 1...11 but it does not cover 1...12. operator = exclude_end? && !value.exclude_end? ? :< : :<= - super(value.first) && value.last.send(operator, last) + value_max = !exclude_end? && value.exclude_end? ? value.max : value.last + super(value.first) && (self.end.nil? || value_max.send(operator, last)) else super end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range/conversions.rb new file mode 100644 index 0000000000..024e32db40 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range/conversions.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +module ActiveSupport + module RangeWithFormat + RANGE_FORMATS = { + db: -> (start, stop) do + case start + when String then "BETWEEN '#{start}' AND '#{stop}'" + else + "BETWEEN '#{start.to_s(:db)}' AND '#{stop.to_s(:db)}'" + end + end + } + + # Convert range to a formatted string. See RANGE_FORMATS for predefined formats. + # + # range = (1..100) # => 1..100 + # + # range.to_s # => "1..100" + # range.to_s(:db) # => "BETWEEN '1' AND '100'" + # + # == Adding your own range formats to to_s + # 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_s(:db)} and #{stop.to_s(:db)}" } + def to_s(format = :default) + if formatter = RANGE_FORMATS[format] + formatter.call(first, last) + else + super() + end + end + + alias_method :to_default_s, :to_s + alias_method :to_formatted_s, :to_s + end +end + +Range.prepend(ActiveSupport::RangeWithFormat) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/each.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range/each.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/each.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range/each.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range/include_range.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range/include_range.rb new file mode 100644 index 0000000000..2da2c587a3 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range/include_range.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require "active_support/deprecation" + +ActiveSupport::Deprecation.warn "You have required `active_support/core_ext/range/include_range`. " \ +"This file will be removed in Rails 6.1. You should require `active_support/core_ext/range/compare_range` " \ + "instead." + +require "active_support/core_ext/range/compare_range" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/include_time_with_zone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range/include_time_with_zone.rb similarity index 85% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/include_time_with_zone.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range/include_time_with_zone.rb index 5f80acf68e..2b458717ec 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/include_time_with_zone.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range/include_time_with_zone.rb @@ -9,9 +9,9 @@ module ActiveSupport # (1.hour.ago..1.hour.from_now).include?(Time.current) # => true # def include?(value) - if first.is_a?(TimeWithZone) + if self.begin.is_a?(TimeWithZone) cover?(value) - elsif last.is_a?(TimeWithZone) + elsif self.end.is_a?(TimeWithZone) cover?(value) else super diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/overlaps.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range/overlaps.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/range/overlaps.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/range/overlaps.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/regexp.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/regexp.rb similarity index 55% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/regexp.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/regexp.rb index efbd708aee..d92943c7ae 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/regexp.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/regexp.rb @@ -4,8 +4,4 @@ class Regexp #:nodoc: def multiline? options & MULTILINE == MULTILINE end - - def match?(string, pos = 0) - !!match(string, pos) - end unless //.respond_to?(:match?) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/securerandom.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/securerandom.rb new file mode 100644 index 0000000000..ef812f7e1a --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/securerandom.rb @@ -0,0 +1,45 @@ +# 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" + 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 + + # 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" + 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 diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/access.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/access.rb index 58591bbaaf..4ca24028b0 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/access.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/access.rb @@ -75,6 +75,10 @@ class String # str.first(0) # => "" # str.first(6) # => "hello" def first(limit = 1) + ActiveSupport::Deprecation.warn( + "Calling String#first with a negative integer limit " \ + "will raise an ArgumentError in Rails 6.1." + ) if limit < 0 if limit == 0 "" elsif limit >= size @@ -95,6 +99,10 @@ class String # str.last(0) # => "" # str.last(6) # => "hello" def last(limit = 1) + ActiveSupport::Deprecation.warn( + "Calling String#last with a negative integer limit " \ + "will raise an ArgumentError in Rails 6.1." + ) if limit < 0 if limit == 0 "" elsif limit >= size diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/behavior.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/behavior.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/behavior.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/behavior.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/exclude.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/exclude.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/exclude.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/exclude.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/filters.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/filters.rb similarity index 71% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/filters.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/filters.rb index 66e721eea3..7f28bd52f2 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/filters.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/filters.rb @@ -75,7 +75,48 @@ class String length_with_room_for_omission end - "#{self[0, stop]}#{omission}" + +"#{self[0, stop]}#{omission}" + end + + # Truncates +text+ to at most bytesize 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 bytesize. + def truncate_bytes(truncate_at, omission: "…") + omission ||= "" + + case + when bytesize <= truncate_at + dup + when omission.bytesize > truncate_at + raise ArgumentError, "Omission #{omission.inspect} is #{omission.bytesize}, larger than the truncation length of #{truncate_at} bytes" + when omission.bytesize == truncate_at + omission.dup + else + self.class.new.tap do |cut| + cut_at = truncate_at - omission.bytesize + + scan(/\X/) 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): diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/indent.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/indent.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/indent.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/indent.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/inflections.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/inflections.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/inflections.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/inflections.rb index 8af301734a..5eb8d9f99b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/inflections.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/inflections.rb @@ -162,6 +162,11 @@ class String # 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}" @@ -187,8 +192,8 @@ class String # # <%= link_to(@person.name, person_path) %> # # => Donald E. Knuth - def parameterize(separator: "-", preserve_case: false) - ActiveSupport::Inflector.parameterize(self, separator: separator, preserve_case: preserve_case) + 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 diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/inquiry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/inquiry.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/inquiry.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/inquiry.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/multibyte.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/multibyte.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/multibyte.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/multibyte.rb index 07c0d16398..6cceb46507 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/multibyte.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/multibyte.rb @@ -11,12 +11,13 @@ class String # 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".upcase - # => "lj" # >> "lj".mb_chars.upcase.to_s # => "LJ" # - # NOTE: An above example is useful for pre Ruby 2.4. Ruby 2.4 supports Unicode case mappings. + # NOTE: Ruby 2.4 and later support native Unicode case mappings: + # + # >> "lj".upcase + # => "LJ" # # == Method chaining # diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/output_safety.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/output_safety.rb similarity index 74% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/output_safety.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/output_safety.rb index f3bdc2977e..62c628e23f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/output_safety.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/output_safety.rb @@ -134,10 +134,13 @@ end module ActiveSupport #:nodoc: class SafeBuffer < String UNSAFE_STRING_METHODS = %w( - capitalize chomp chop delete downcase gsub lstrip next reverse rstrip - slice squeeze strip sub succ swapcase tr tr_s upcase + capitalize chomp chop delete delete_prefix delete_suffix + downcase lstrip next reverse rstrip slice 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 @@ -149,9 +152,7 @@ module ActiveSupport #:nodoc: end def [](*args) - if args.size < 2 - super - elsif html_safe? + if html_safe? new_safe_buffer = super if new_safe_buffer @@ -188,14 +189,36 @@ module ActiveSupport #:nodoc: end alias << concat + def insert(index, value) + super(index, html_escape_interpolated_argument(value)) + end + def prepend(value) super(html_escape_interpolated_argument(value)) end + def replace(value) + super(html_escape_interpolated_argument(value)) + end + + def []=(*args) + if args.count == 3 + super(args[0], args[1], html_escape_interpolated_argument(args[2])) + else + super(args[0], html_escape_interpolated_argument(args[1])) + end + end + def +(other) dup.concat(other) end + def *(*) + new_safe_buffer = super + new_safe_buffer.instance_variable_set(:@html_safe, @html_safe) + new_safe_buffer + end + def %(args) case args when Hash @@ -238,11 +261,46 @@ module ActiveSupport #:nodoc: end end + UNSAFE_STRING_METHODS_WITH_BACKREF.each do |unsafe_method| + if unsafe_method.respond_to?(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_safe = false # @html_safe = false + 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 + end + private def html_escape_interpolated_argument(arg) (!html_safe? || arg.html_safe?) ? arg : CGI.escapeHTML(arg.to_s) 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 end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/starts_ends_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/starts_ends_with.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/starts_ends_with.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/starts_ends_with.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/strip.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/strip.rb similarity index 84% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/strip.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/strip.rb index cc26274e4a..60e9952ee6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/strip.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/strip.rb @@ -20,6 +20,8 @@ class String # 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}/, "".freeze) + gsub(/^#{scan(/^[ \t]*(?=\S)/).min}/, "").tap do |stripped| + stripped.freeze if frozen? + end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/zones.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/zones.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/string/zones.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/string/zones.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/time/acts_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/time/acts_like.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/time/acts_like.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/time/acts_like.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/time/calculations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/time/calculations.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/time/calculations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/time/calculations.rb index 120768dec5..eed34965e3 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/time/calculations.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/time/calculations.rb @@ -170,8 +170,7 @@ class Time options[:hours] = options.fetch(:hours, 0) + 24 * partial_days end - d = to_date.advance(options) - d = d.gregorian if d.julian? + 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) + @@ -312,4 +311,34 @@ class Time 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/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/time/compatibility.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/time/compatibility.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/time/compatibility.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/time/compatibility.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/time/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/time/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/time/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/time/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/time/zones.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/time/zones.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/time/zones.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/time/zones.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/uri.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/uri.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/uri.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/uri.rb index 9def947f8e..cdd81ae562 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/uri.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/core_ext/uri.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "uri" + if RUBY_VERSION < "2.6.0" require "active_support/core_ext/module/redefine_method" URI::Parser.class_eval do diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/current_attributes.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/current_attributes.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/current_attributes.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/current_attributes.rb index 4e6d8e4585..67ebe102d7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/current_attributes.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/current_attributes.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "active_support/callbacks" + module ActiveSupport # 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 @@ -117,10 +119,16 @@ module ActiveSupport end end + # Calls this block before #reset is called on the instance. Used for resetting external collaborators that depend on current values. + def before_reset(&block) + set_callback :reset, :before, &block + end + # Calls this block after #reset is called on the instance. Used for resetting external collaborators, like Time.zone. def resets(&block) set_callback :reset, :after, &block end + alias_method :after_reset, :resets delegate :set, :reset, to: :instance diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/deprecation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/deprecation.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/deprecation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/deprecation.rb index a1ad2ca465..7271ab565b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/deprecation.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/deprecation.rb @@ -35,7 +35,7 @@ module ActiveSupport # and the second is a library name. # # ActiveSupport::Deprecation.new('2.0', 'MyLibrary') - def initialize(deprecation_horizon = "6.0", gem_name = "Rails") + def initialize(deprecation_horizon = "6.1", gem_name = "Rails") self.gem_name = gem_name self.deprecation_horizon = deprecation_horizon # By default, warnings are not silenced and debugging is off. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/deprecation/behaviors.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/deprecation/behaviors.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/deprecation/behaviors.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/deprecation/behaviors.rb index 3abd25aa85..725667d139 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/deprecation/behaviors.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/deprecation/behaviors.rb @@ -43,7 +43,7 @@ module ActiveSupport deprecation_horizon: deprecation_horizon) }, - silence: ->(message, callstack, deprecation_horizon, gem_name) {}, + silence: ->(message, callstack, deprecation_horizon, gem_name) { }, } # Behavior module allows to determine how to display deprecation messages. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/deprecation/constant_accessor.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/deprecation/constant_accessor.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/deprecation/constant_accessor.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/deprecation/constant_accessor.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/deprecation/instance_delegator.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/deprecation/instance_delegator.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/deprecation/instance_delegator.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/deprecation/instance_delegator.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/deprecation/method_wrappers.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/deprecation/method_wrappers.rb similarity index 71% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/deprecation/method_wrappers.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/deprecation/method_wrappers.rb index 3c5d9cef26..7c0a54a1d0 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/deprecation/method_wrappers.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/deprecation/method_wrappers.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require "active_support/core_ext/module/aliasing" require "active_support/core_ext/array/extract_options" +require "active_support/core_ext/module/redefine_method" module ActiveSupport class Deprecation @@ -53,37 +53,25 @@ module ActiveSupport options = method_names.extract_options! deprecator = options.delete(:deprecator) || self method_names += options.keys - mod = Module.new + mod = nil method_names.each do |method_name| if target_module.method_defined?(method_name) || target_module.private_method_defined?(method_name) - aliased_method, punctuation = method_name.to_s.sub(/([?!=])$/, ""), $1 - with_method = "#{aliased_method}_with_deprecation#{punctuation}" - without_method = "#{aliased_method}_without_deprecation#{punctuation}" - - target_module.send(:define_method, with_method) do |*args, &block| + method = target_module.instance_method(method_name) + target_module.redefine_method(method_name) do |*args, &block| deprecator.deprecation_warning(method_name, options[method_name]) - send(without_method, *args, &block) - end - - target_module.send(:alias_method, without_method, method_name) - target_module.send(:alias_method, method_name, with_method) - - case - when target_module.protected_method_defined?(without_method) - target_module.send(:protected, method_name) - when target_module.private_method_defined?(without_method) - target_module.send(:private, method_name) + method.bind(self).call(*args, &block) end else - mod.send(:define_method, method_name) do |*args, &block| + mod ||= Module.new + mod.define_method(method_name) do |*args, &block| deprecator.deprecation_warning(method_name, options[method_name]) super(*args, &block) end end end - target_module.prepend(mod) unless mod.instance_methods(false).empty? + target_module.prepend(mod) if mod end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/deprecation/proxy_wrappers.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/deprecation/proxy_wrappers.rb similarity index 87% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/deprecation/proxy_wrappers.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/deprecation/proxy_wrappers.rb index 896c0d2d8e..24c75b5661 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/deprecation/proxy_wrappers.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/deprecation/proxy_wrappers.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require "active_support/core_ext/regexp" - module ActiveSupport class Deprecation class DeprecationProxy #:nodoc: @@ -122,7 +120,14 @@ module ActiveSupport # # => DEPRECATION WARNING: PLANETS is deprecated! Use PLANETS_POST_2006 instead. # (Backtrace information…) # ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"] - class DeprecatedConstantProxy < DeprecationProxy + class DeprecatedConstantProxy < Module + def self.new(*args, &block) + object = args.first + + return object unless object + super + end + def initialize(old_const, new_const, deprecator = ActiveSupport::Deprecation.instance, message: "#{old_const} is deprecated! Use #{new_const} instead.") require "active_support/inflector/methods" @@ -132,6 +137,14 @@ module ActiveSupport @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 + # Returns the class of the new constant. # # PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune) @@ -146,8 +159,14 @@ module ActiveSupport ActiveSupport::Inflector.constantize(@new_const.to_s) end - def warn(callstack, called, args) - @deprecator.warn(@message, callstack) + def const_missing(name) + @deprecator.warn(@message, caller_locations) + target.const_get(name) + end + + def method_missing(called, *args, &block) + @deprecator.warn(@message, caller_locations) + target.__send__(called, *args, &block) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/deprecation/reporting.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/deprecation/reporting.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/deprecation/reporting.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/deprecation/reporting.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/descendants_tracker.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/descendants_tracker.rb new file mode 100644 index 0000000000..21565138a7 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/descendants_tracker.rb @@ -0,0 +1,109 @@ +# frozen_string_literal: true + +require "weakref" + +module ActiveSupport + # This module provides an internal implementation to track descendants + # which is faster than iterating through ObjectSpace. + module DescendantsTracker + @@direct_descendants = {} + + class << self + def direct_descendants(klass) + descendants = @@direct_descendants[klass] + descendants ? descendants.to_a : [] + end + + def descendants(klass) + arr = [] + accumulate_descendants(klass, arr) + arr + end + + def clear + if defined? ActiveSupport::Dependencies + @@direct_descendants.each do |klass, descendants| + if Dependencies.autoloaded?(klass) + @@direct_descendants.delete(klass) + else + descendants.reject! { |v| Dependencies.autoloaded?(v) } + end + end + else + @@direct_descendants.clear + end + end + + # This is the only method that is not thread safe, but is only ever called + # during the eager loading phase. + def store_inherited(klass, descendant) + (@@direct_descendants[klass] ||= DescendantsArray.new) << descendant + end + + private + + def accumulate_descendants(klass, acc) + if direct_descendants = @@direct_descendants[klass] + direct_descendants.each do |direct_descendant| + acc << direct_descendant + accumulate_descendants(direct_descendant, acc) + end + end + end + end + + def inherited(base) + DescendantsTracker.store_inherited(self, base) + super + end + + def direct_descendants + DescendantsTracker.direct_descendants(self) + end + + def descendants + DescendantsTracker.descendants(self) + end + + # DescendantsArray is an array that contains weak references to classes. + class DescendantsArray # :nodoc: + include Enumerable + + def initialize + @refs = [] + end + + def initialize_copy(orig) + @refs = @refs.dup + end + + def <<(klass) + cleanup! + @refs << WeakRef.new(klass) + end + + def each + @refs.each do |ref| + yield ref.__getobj__ + rescue WeakRef::RefError + end + end + + def refs_size + @refs.size + end + + def cleanup! + @refs.delete_if { |ref| !ref.weakref_alive? } + end + + def reject! + @refs.reject! do |ref| + yield ref.__getobj__ + rescue WeakRef::RefError + true + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/digest.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/digest.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/digest.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/digest.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/duration.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/duration.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/duration.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/duration.rb index 88897f811e..4ab7b827bb 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/duration.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/duration.rb @@ -4,7 +4,6 @@ require "active_support/core_ext/array/conversions" require "active_support/core_ext/module/delegation" require "active_support/core_ext/object/acts_like" require "active_support/core_ext/string/filters" -require "active_support/deprecation" module ActiveSupport # Provides accurate date and time measurements using Date#advance and @@ -214,8 +213,11 @@ module ActiveSupport end def coerce(other) #:nodoc: - if Scalar === other + case other + when Scalar [other, self] + when Duration + [Scalar.new(other.value), self] else [Scalar.new(other), self] end @@ -336,8 +338,8 @@ module ActiveSupport # 1.year.to_i # => 31556952 # # In such cases, Ruby's core - # Date[http://ruby-doc.org/stdlib/libdoc/date/rdoc/Date.html] and - # Time[http://ruby-doc.org/stdlib/libdoc/time/rdoc/Time.html] should be used for precision + # Date[https://ruby-doc.org/stdlib/libdoc/date/rdoc/Date.html] and + # Time[https://ruby-doc.org/stdlib/libdoc/time/rdoc/Time.html] should be used for precision # date and time arithmetic. def to_i @value.to_i @@ -373,7 +375,6 @@ module ActiveSupport return "0 seconds" if parts.empty? parts. - reduce(::Hash.new(0)) { |h, (l, r)| h[l] += r; h }. sort_by { |unit, _ | PARTS.index(unit) }. map { |unit, val| "#{val} #{val == 1 ? unit.to_s.chop : unit.to_s}" }. to_sentence(locale: ::I18n.default_locale) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/encrypted_configuration.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/encrypted_configuration.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/encrypted_configuration.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/encrypted_configuration.rb index b17695fe82..cc1d026737 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/encrypted_configuration.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/encrypted_configuration.rb @@ -38,10 +38,6 @@ module ActiveSupport @options ||= ActiveSupport::InheritableOptions.new(config) end - def serialize(config) - config.present? ? YAML.dump(config) : "" - end - def deserialize(config) YAML.load(config).presence || {} end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/encrypted_file.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/encrypted_file.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/encrypted_file.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/encrypted_file.rb index c66f1b557e..2b7db568a5 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/encrypted_file.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/encrypted_file.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "pathname" +require "tmpdir" require "active_support/message_encryptor" module ActiveSupport @@ -67,7 +68,7 @@ module ActiveSupport write(updated_contents) if updated_contents != contents ensure - FileUtils.rm(tmp_path) if tmp_path.exist? + FileUtils.rm(tmp_path) if tmp_path&.exist? end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/evented_file_update_checker.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/evented_file_update_checker.rb similarity index 84% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/evented_file_update_checker.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/evented_file_update_checker.rb index 97e982eb05..98f9508071 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/evented_file_update_checker.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/evented_file_update_checker.rb @@ -52,16 +52,17 @@ module ActiveSupport @pid = Process.pid @boot_mutex = Mutex.new - if (@dtw = directories_to_watch).any? + dtw = directories_to_watch + @dtw, @missing = dtw.partition(&:exist?) + + if @dtw.any? # Loading listen triggers warnings. These are originated by a legit # usage of attr_* macros for private attributes, but adds a lot of noise # to our test suite. Thus, we lazy load it and disable warnings locally. silence_warnings do - begin - require "listen" - rescue LoadError => e - raise LoadError, "Could not load the 'listen' gem. Add `gem 'listen'` to the development group of your Gemfile", e.backtrace - end + require "listen" + rescue LoadError => e + raise LoadError, "Could not load the 'listen' gem. Add `gem 'listen'` to the development group of your Gemfile", e.backtrace end end boot! @@ -75,6 +76,19 @@ module ActiveSupport @updated.make_true end end + + if @missing.any?(&:exist?) + @boot_mutex.synchronize do + appeared, @missing = @missing.partition(&:exist?) + shutdown! + + @dtw += appeared + boot! + + @updated.make_true + end + end + @updated.true? end @@ -93,7 +107,21 @@ module ActiveSupport private def boot! - Listen.to(*@dtw, &method(:changed)).start + normalize_dirs! + + unless @dtw.empty? + Listen.to(*@dtw, &method(:changed)).start + end + end + + def shutdown! + Listen.stop + end + + def normalize_dirs! + @dirs.transform_keys! do |dir| + dir.exist? ? dir.realpath : dir + end end def changed(modified, added, removed) @@ -113,7 +141,9 @@ module ActiveSupport ext = @ph.normalize_extension(file.extname) file.dirname.ascend do |dir| - if @dirs.fetch(dir, []).include?(ext) + matching = @dirs[dir] + + if matching && (matching.empty? || matching.include?(ext)) break true elsif dir == @lcsp || dir.root? break false @@ -123,7 +153,7 @@ module ActiveSupport end def directories_to_watch - dtw = (@files + @dirs.keys).map { |f| @ph.existing_parent(f) } + dtw = @files.map(&:dirname) + @dirs.keys dtw.compact! dtw.uniq! diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/execution_wrapper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/execution_wrapper.rb similarity index 99% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/execution_wrapper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/execution_wrapper.rb index f48c586cad..ca810db584 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/execution_wrapper.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/execution_wrapper.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "active_support/callbacks" +require "concurrent/hash" module ActiveSupport class ExecutionWrapper diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/executor.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/executor.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/executor.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/executor.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/file_update_checker.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/file_update_checker.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/file_update_checker.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/file_update_checker.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/gem_version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/gem_version.rb similarity index 88% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/gem_version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/gem_version.rb index e7b802d773..1736cc0ff8 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/gem_version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/gem_version.rb @@ -7,9 +7,9 @@ module ActiveSupport end module VERSION - MAJOR = 5 - MINOR = 2 - TINY = 3 + MAJOR = 6 + MINOR = 0 + TINY = 1 PRE = nil STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/gzip.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/gzip.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/gzip.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/gzip.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/hash_with_indifferent_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/hash_with_indifferent_access.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/hash_with_indifferent_access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/hash_with_indifferent_access.rb index 24d3aed419..42ae7e9b7b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/hash_with_indifferent_access.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/hash_with_indifferent_access.rb @@ -2,6 +2,7 @@ require "active_support/core_ext/hash/keys" require "active_support/core_ext/hash/reverse_merge" +require "active_support/core_ext/hash/except" module ActiveSupport # Implements a hash where keys :foo and "foo" are considered @@ -190,20 +191,18 @@ module ActiveSupport super(convert_key(key), *extras) end - if Hash.new.respond_to?(:dig) - # 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#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 @@ -226,8 +225,8 @@ module ActiveSupport # hash[:a] = 'x' # hash[:b] = 'y' # hash.values_at('a', 'b') # => ["x", "y"] - def values_at(*indices) - indices.collect { |key| self[convert_key(key)] } + def values_at(*keys) + super(*keys.map { |key| convert_key(key) }) end # Returns an array of the values at the specified indices, but also @@ -240,8 +239,8 @@ module ActiveSupport # 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.collect { |key| fetch(key, &block) } - end if Hash.method_defined?(:fetch_values) + super(*indices.map { |key| convert_key(key) }, &block) + end # Returns a shallow copy of the hash. # @@ -294,6 +293,11 @@ module ActiveSupport super(convert_key(key)) end + def except(*keys) + slice(*self.keys - keys.map { |key| convert_key(key) }) + end + alias_method :without, :except + def stringify_keys!; self end def deep_stringify_keys!; self end def stringify_keys; dup end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/i18n.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/i18n.rb similarity index 88% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/i18n.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/i18n.rb index d60b3eff30..39dab1cc71 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/i18n.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/i18n.rb @@ -13,3 +13,4 @@ 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/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/i18n_railtie.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/i18n_railtie.rb similarity index 85% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/i18n_railtie.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/i18n_railtie.rb index ee24ebd68c..8faa93a3e4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/i18n_railtie.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/i18n_railtie.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require "active_support" -require "active_support/file_update_checker" require "active_support/core_ext/array/wrap" # :enddoc: @@ -92,6 +91,15 @@ module I18n end if args.empty? || args.first.is_a?(Hash) + ActiveSupport::Deprecation.warn(<<-MSG.squish) + Using I18n fallbacks with an empty `defaults` sets the defaults to + include the `default_locale`. This behavior will change in Rails 6.1. + If you desire the default locale to be included in the defaults, please + explicitly configure it with `config.i18n.fallbacks.defaults = + [I18n.default_locale]` or `config.i18n.fallbacks = [I18n.default_locale, + {...}]`. If you want to opt-in to the new behavior, use + `config.i18n.fallbacks.defaults = [nil, {...}]`. + MSG args.unshift I18n.default_locale end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflections.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/inflections.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflections.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/inflections.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflector.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/inflector.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflector.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/inflector.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflector/inflections.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/inflector/inflections.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflector/inflections.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/inflector/inflections.rb index 7e5dff1d6d..88cdd99dbd 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflector/inflections.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/inflector/inflections.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true require "concurrent/map" -require "active_support/core_ext/array/prepend_and_append" -require "active_support/core_ext/regexp" require "active_support/i18n" require "active_support/deprecation" @@ -67,8 +65,7 @@ module ActiveSupport @__instance__[locale] ||= new end - attr_reader :plurals, :singulars, :uncountables, :humans, :acronyms, :acronym_regex - deprecate :acronym_regex + attr_reader :plurals, :singulars, :uncountables, :humans, :acronyms attr_reader :acronyms_camelize_regex, :acronyms_underscore_regex # :nodoc: diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/inflector/methods.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/inflector/methods.rb index ad90a0b7bf..ee193add6f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflector/methods.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/inflector/methods.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require "active_support/inflections" -require "active_support/core_ext/regexp" module ActiveSupport # The Inflector transforms words from singular to plural, class names to table @@ -74,7 +73,7 @@ module ActiveSupport string = string.sub(inflections.acronyms_camelize_regex) { |match| match.downcase } end string.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{inflections.acronyms[$2] || $2.capitalize}" } - string.gsub!("/".freeze, "::".freeze) + string.gsub!("/", "::") string end @@ -91,11 +90,11 @@ module ActiveSupport # camelize(underscore('SSLError')) # => "SslError" def underscore(camel_cased_word) return camel_cased_word unless /[A-Z-]|::/.match?(camel_cased_word) - word = camel_cased_word.to_s.gsub("::".freeze, "/".freeze) - word.gsub!(inflections.acronyms_underscore_regex) { "#{$1 && '_'.freeze }#{$2.downcase}" } - word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2'.freeze) - word.gsub!(/([a-z\d])([A-Z])/, '\1_\2'.freeze) - word.tr!("-".freeze, "_".freeze) + word = camel_cased_word.to_s.gsub("::", "/") + word.gsub!(inflections.acronyms_underscore_regex) { "#{$1 && '_' }#{$2.downcase}" } + word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2') + word.gsub!(/([a-z\d])([A-Z])/, '\1_\2') + word.tr!("-", "_") word.downcase! word end @@ -131,11 +130,11 @@ module ActiveSupport inflections.humans.each { |(rule, replacement)| break if result.sub!(rule, replacement) } - result.sub!(/\A_+/, "".freeze) + result.sub!(/\A_+/, "") unless keep_id_suffix - result.sub!(/_id\z/, "".freeze) + result.sub!(/_id\z/, "") end - result.tr!("_".freeze, " ".freeze) + result.tr!("_", " ") result.gsub!(/([a-z\d]*)/i) do |match| "#{inflections.acronyms[match.downcase] || match.downcase}" @@ -200,14 +199,14 @@ module ActiveSupport # classify('calculus') # => "Calculus" def classify(table_name) # strip out any leading schema name - camelize(singularize(table_name.to_s.sub(/.*\./, "".freeze))) + 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("_".freeze, "-".freeze) + underscored_word.tr("_", "-") end # Removes the module part from the expression in the string. @@ -270,7 +269,7 @@ module ActiveSupport # NameError is raised when the name is not in CamelCase or the constant is # unknown. def constantize(camel_cased_word) - names = camel_cased_word.split("::".freeze) + names = camel_cased_word.split("::") # Trigger a built-in NameError exception including the ill-formed constant in the message. Object.const_get(camel_cased_word) if names.empty? @@ -343,18 +342,7 @@ module ActiveSupport # ordinal(-11) # => "th" # ordinal(-1021) # => "st" def ordinal(number) - abs_number = number.to_i.abs - - if (11..13).include?(abs_number % 100) - "th" - else - case abs_number % 10 - when 1; "st" - when 2; "nd" - when 3; "rd" - else "th" - end - end + I18n.translate("number.nth.ordinals", number: number) end # Turns a number into an ordinal string used to denote the position in an @@ -367,7 +355,7 @@ module ActiveSupport # ordinalize(-11) # => "-11th" # ordinalize(-1021) # => "-1021st" def ordinalize(number) - "#{number}#{ordinal(number)}" + I18n.translate("number.nth.ordinalized", number: number) end private @@ -378,7 +366,7 @@ module ActiveSupport # const_regexp("Foo::Bar::Baz") # => "Foo(::Bar(::Baz)?)?" # const_regexp("::") # => "::" def const_regexp(camel_cased_word) - parts = camel_cased_word.split("::".freeze) + parts = camel_cased_word.split("::") return Regexp.escape(camel_cased_word) if parts.blank? diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflector/transliterate.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/inflector/transliterate.rb similarity index 58% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflector/transliterate.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/inflector/transliterate.rb index 6f2ca4999c..3e8ffd46a0 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/inflector/transliterate.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/inflector/transliterate.rb @@ -51,20 +51,45 @@ module ActiveSupport # # Now you can have different transliterations for each locale: # - # I18n.locale = :en - # transliterate('Jürgen') + # transliterate('Jürgen', locale: :en) # # => "Jurgen" # - # I18n.locale = :de - # transliterate('Jürgen') + # transliterate('Jürgen', locale: :de) # # => "Juergen" - def transliterate(string, replacement = "?".freeze) + # + # Transliteration is restricted to UTF-8, US-ASCII and GB18030 strings + # Other encodings will raise an ArgumentError. + def transliterate(string, replacement = "?", locale: nil) + string = string.dup if string.frozen? raise ArgumentError, "Can only transliterate strings. Received #{string.class.name}" unless string.is_a?(String) - I18n.transliterate( - ActiveSupport::Multibyte::Unicode.normalize( - ActiveSupport::Multibyte::Unicode.tidy_bytes(string), :c), - replacement: replacement) + allowed_encodings = [Encoding::UTF_8, Encoding::US_ASCII, Encoding::GB18030] + raise ArgumentError, "Can not transliterate strings with #{string.encoding} encoding" unless allowed_encodings.include?(string.encoding) + + 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 @@ -75,8 +100,8 @@ module ActiveSupport # # To use a custom separator, override the +separator+ argument. # - # parameterize("Donald E. Knuth", separator: '_') # => "donald_e_knuth" - # parameterize("^très|Jolie__ ", separator: '_') # => "tres_jolie" + # parameterize("Donald E. Knuth", separator: '_') # => "donald_e_knuth" + # parameterize("^très|Jolie__ ", separator: '_') # => "tres_jolie" # # To preserve the case of the characters in a string, use the +preserve_case+ argument. # @@ -85,19 +110,23 @@ module ActiveSupport # # 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--" + # parameterize("^très|Jolie__ ") # => "tres-jolie__" + # parameterize("^très|Jolie-- ", separator: "_") # => "tres_jolie--" + # parameterize("^très_Jolie-- ", separator: ".") # => "tres_jolie--" # - def parameterize(string, separator: "-", preserve_case: false) + # 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) # Replace accented chars with their ASCII equivalents. - parameterized_string = transliterate(string) + parameterized_string = transliterate(string, locale: locale) # Turn unwanted chars into the separator. parameterized_string.gsub!(/[^a-z0-9\-_]+/i, separator) unless separator.nil? || separator.empty? - if separator == "-".freeze + if separator == "-" re_duplicate_separator = /-{2,}/ re_leading_trailing_separator = /^-|-$/i else @@ -108,7 +137,7 @@ module ActiveSupport # No more than one of the separator in a row. parameterized_string.gsub!(re_duplicate_separator, separator) # Remove leading/trailing separator. - parameterized_string.gsub!(re_leading_trailing_separator, "".freeze) + parameterized_string.gsub!(re_leading_trailing_separator, "") end parameterized_string.downcase! unless preserve_case diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/key_generator.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/key_generator.rb similarity index 58% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/key_generator.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/key_generator.rb index 78f7d7ca8d..8b61982883 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/key_generator.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/key_generator.rb @@ -38,36 +38,4 @@ module ActiveSupport @cache_keys[args.join] ||= @key_generator.generate_key(*args) end end - - class LegacyKeyGenerator # :nodoc: - SECRET_MIN_LENGTH = 30 # Characters - - def initialize(secret) - ensure_secret_secure(secret) - @secret = secret - end - - def generate_key(salt) - @secret - end - - private - - # To prevent users from using something insecure like "Password" we make sure that the - # secret they've provided is at least 30 characters in length. - def ensure_secret_secure(secret) - if secret.blank? - raise ArgumentError, "A secret is required to generate an integrity hash " \ - "for cookie session data. Set a secret_key_base of at least " \ - "#{SECRET_MIN_LENGTH} characters in via `bin/rails credentials:edit`." - end - - if secret.length < SECRET_MIN_LENGTH - raise ArgumentError, "Secret should be something secure, " \ - "like \"#{SecureRandom.hex(16)}\". The value you " \ - "provided, \"#{secret}\", is shorter than the minimum length " \ - "of #{SECRET_MIN_LENGTH} characters." - end - end - end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb index dc8080c469..a6b096a973 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/lazy_load_hooks.rb @@ -68,7 +68,11 @@ module ActiveSupport if options[:yield] block.call(base) else - base.instance_eval(&block) + if base.is_a?(Module) + base.class_eval(&block) + else + base.instance_eval(&block) + end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/locale/en.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/locale/en.rb new file mode 100644 index 0000000000..a2a7ea7ae1 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/locale/en.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +{ + en: { + number: { + nth: { + ordinals: lambda do |_key, number:, **_options| + 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, number:, **_options| + "#{number}#{ActiveSupport::Inflector.ordinal(number)}" + end + } + } + } +} diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/locale/en.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/locale/en.yml similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/locale/en.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/locale/en.yml diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/logger.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/logger.rb similarity index 81% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/logger.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/logger.rb index 8152a182b4..b8555c887b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/logger.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/logger.rb @@ -6,7 +6,6 @@ require "logger" module ActiveSupport class Logger < ::Logger - include ActiveSupport::LoggerThreadSafeLevel include LoggerSilence # Returns true if the logger destination matches one of the sources @@ -81,20 +80,6 @@ module ActiveSupport def initialize(*args) super @formatter = SimpleFormatter.new - after_initialize if respond_to? :after_initialize - end - - def add(severity, message = nil, progname = nil, &block) - return true if @logdev.nil? || (severity || UNKNOWN) < level - super - end - - Logger::Severity.constants.each do |severity| - class_eval(<<-EOT, __FILE__, __LINE__ + 1) - def #{severity.downcase}? # def debug? - Logger::#{severity} >= level # DEBUG >= level - end # end - EOT end # Simple formatter which only displays the message. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/logger_silence.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/logger_silence.rb new file mode 100644 index 0000000000..b2444c1e34 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/logger_silence.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +require "active_support/concern" +require "active_support/core_ext/module/attribute_accessors" +require "active_support/logger_thread_safe_level" + +module LoggerSilence + extend ActiveSupport::Concern + + included do + ActiveSupport::Deprecation.warn( + "Including LoggerSilence is deprecated and will be removed in Rails 6.1. " \ + "Please use `ActiveSupport::LoggerSilence` instead" + ) + + include ActiveSupport::LoggerSilence + end +end + +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(temporary_level = Logger::ERROR) + if silencer + begin + old_local_level = local_level + self.local_level = temporary_level + + yield self + ensure + self.local_level = old_local_level + end + else + yield self + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/logger_thread_safe_level.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/logger_thread_safe_level.rb new file mode 100644 index 0000000000..1775a41492 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/logger_thread_safe_level.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +require "active_support/concern" +require "active_support/core_ext/module/attribute_accessors" +require "concurrent" +require "fiber" + +module ActiveSupport + module LoggerThreadSafeLevel # :nodoc: + extend ActiveSupport::Concern + + included do + cattr_accessor :local_levels, default: Concurrent::Map.new(initial_capacity: 2), instance_accessor: false + end + + Logger::Severity.constants.each do |severity| + class_eval(<<-EOT, __FILE__, __LINE__ + 1) + def #{severity.downcase}? # def debug? + Logger::#{severity} >= level # DEBUG >= level + end # end + EOT + end + + def after_initialize + ActiveSupport::Deprecation.warn( + "Logger don't need to call #after_initialize directly anymore. It will be deprecated without replacement in " \ + "Rails 6.1." + ) + end + + def local_log_id + Fiber.current.__id__ + end + + def local_level + self.class.local_levels[local_log_id] + end + + def local_level=(level) + if level + self.class.local_levels[local_log_id] = level + else + self.class.local_levels.delete(local_log_id) + end + end + + def level + local_level || super + end + + def add(severity, message = nil, progname = nil, &block) # :nodoc: + return true if @logdev.nil? || (severity || UNKNOWN) < level + super + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/message_encryptor.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/message_encryptor.rb index 8b73270894..7d6f8937f0 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/message_encryptor.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/message_encryptor.rb @@ -53,7 +53,7 @@ module ActiveSupport # 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 upto the expire time. + # Then the messages can be verified and returned up to the expire time. # Thereafter, verifying returns +nil+. # # === Rotating keys @@ -182,7 +182,7 @@ module ActiveSupport def _decrypt(encrypted_message, purpose) cipher = new_cipher - encrypted_data, iv, auth_tag = encrypted_message.split("--".freeze).map { |v| ::Base64.strict_decode64(v) } + encrypted_data, iv, auth_tag = encrypted_message.split("--").map { |v| ::Base64.strict_decode64(v) } # Currently the OpenSSL bindings do not raise an error if auth_tag is # truncated, which would allow an attacker to easily forge it. See @@ -210,9 +210,7 @@ module ActiveSupport OpenSSL::Cipher.new(@cipher) end - def verifier - @verifier - end + attr_reader :verifier def aead_mode? @aead_mode ||= new_cipher.authenticated? diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/message_verifier.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/message_verifier.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/message_verifier.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/message_verifier.rb index 83c39c0a86..c4a4afe95f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/message_verifier.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/message_verifier.rb @@ -71,7 +71,7 @@ module ActiveSupport # @verifier.generate(parcel, expires_in: 1.month) # @verifier.generate(doowad, expires_at: Time.now.end_of_year) # - # Then the messages can be verified and returned upto the expire time. + # Then the messages can be verified and returned up to the expire time. # Thereafter, the +verified+ method returns +nil+ while +verify+ raises # ActiveSupport::MessageVerifier::InvalidSignature. # @@ -122,7 +122,7 @@ module ActiveSupport def valid_message?(signed_message) return if signed_message.nil? || !signed_message.valid_encoding? || signed_message.blank? - data, digest = signed_message.split("--".freeze) + data, digest = signed_message.split("--") data.present? && digest.present? && ActiveSupport::SecurityUtils.secure_compare(digest, generate_digest(data)) end @@ -150,7 +150,7 @@ module ActiveSupport def verified(signed_message, purpose: nil, **) if valid_message?(signed_message) begin - data = signed_message.split("--".freeze)[0] + data = signed_message.split("--")[0] message = Messages::Metadata.verify(decode(data), purpose) @serializer.load(message) if message rescue ArgumentError => argument_error diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/multibyte.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/multibyte.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/multibyte.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/multibyte.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/notifications.rb similarity index 77% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/notifications.rb index 6207de8094..d9e93b530c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/notifications.rb @@ -34,7 +34,7 @@ module ActiveSupport # 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 this notification + # id # => String, unique ID for the instrumenter that fired the event # payload # => Hash, the payload # end # @@ -59,7 +59,7 @@ module ActiveSupport # event.payload # => { extra: :information } # # The block in the subscribe call gets the name of the event, start - # timestamp, end timestamp, a string with a unique identifier for that event + # timestamp, end timestamp, a string with a unique identifier for that event's instrumenter # (something like "535801666f04d0298cd6"), and a hash with the payload, in # that order. # @@ -67,9 +67,12 @@ module ActiveSupport # 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. + # itself as the value: # - # As the previous example depicts, the class ActiveSupport::Notifications::Event + # 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. # @@ -150,6 +153,15 @@ module ActiveSupport # # 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.matches?('render_template.action_view') # => false + # subscriber.matches?('render_partial.action_view') # => true + # # == Default Queue # # Notifications ships with a queue implementation that consumes and publishes events @@ -171,6 +183,31 @@ module ActiveSupport 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. + # + # ActiveSupport::Notifications.subscribe(/render/) do |*args| + # @event = ActiveSupport::Notifications::Event.new(*args) + # end + # + # The +block+ will receive five parameters 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 + # + # If the block passed to the method only takes one parameter, + # it will yield an event object to the block: + # + # ActiveSupport::Notifications.subscribe(/render/) do |event| + # @event = event + # end def subscribe(*args, &block) notifier.subscribe(*args, &block) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications/fanout.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/notifications/fanout.rb similarity index 51% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications/fanout.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/notifications/fanout.rb index 25aab175b4..c506b35b1e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications/fanout.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/notifications/fanout.rb @@ -2,6 +2,7 @@ require "mutex_m" require "concurrent/map" +require "set" module ActiveSupport module Notifications @@ -13,16 +14,22 @@ module ActiveSupport include Mutex_m def initialize - @subscribers = [] + @string_subscribers = Hash.new { |h, k| h[k] = [] } + @other_subscribers = [] @listeners_for = Concurrent::Map.new super end - def subscribe(pattern = nil, block = Proc.new) - subscriber = Subscribers.new pattern, block + def subscribe(pattern = nil, callable = nil, &block) + subscriber = Subscribers.new(pattern, callable || block) synchronize do - @subscribers << subscriber - @listeners_for.clear + if String === pattern + @string_subscribers[pattern] << subscriber + @listeners_for.delete(pattern) + else + @other_subscribers << subscriber + @listeners_for.clear + end end subscriber end @@ -31,12 +38,19 @@ module ActiveSupport synchronize do case subscriber_or_name when String - @subscribers.reject! { |s| s.matches?(subscriber_or_name) } + @string_subscribers[subscriber_or_name].clear + @listeners_for.delete(subscriber_or_name) + @other_subscribers.each { |sub| sub.unsubscribe!(subscriber_or_name) } else - @subscribers.delete(subscriber_or_name) + pattern = subscriber_or_name.try(:pattern) + if String === pattern + @string_subscribers[pattern].delete(subscriber_or_name) + @listeners_for.delete(pattern) + else + @other_subscribers.delete(subscriber_or_name) + @listeners_for.clear + end end - - @listeners_for.clear end end @@ -56,7 +70,8 @@ module ActiveSupport # this is correctly done double-checked locking (Concurrent::Map's lookups have volatile semantics) @listeners_for[name] || synchronize do # use synchronisation when accessing @subscribers - @listeners_for[name] ||= @subscribers.select { |s| s.subscribed_to?(name) } + @listeners_for[name] ||= + @string_subscribers[name] + @other_subscribers.select { |s| s.subscribed_to?(name) } end end @@ -70,12 +85,29 @@ module ActiveSupport module Subscribers # :nodoc: def self.new(pattern, listener) + subscriber_class = Timed + if listener.respond_to?(:start) && listener.respond_to?(:finish) - subscriber = Evented.new pattern, listener + subscriber_class = Evented else - subscriber = Timed.new pattern, listener + # Doing all this to detect a block like `proc { |x| }` vs + # `proc { |*x| }` or `proc { |**x| }` + if listener.respond_to?(:parameters) + params = listener.parameters + if params.length == 1 && params.first.first == :opt + subscriber_class = EventObject + end + end end + wrap_all pattern, subscriber_class.new(pattern, listener) + end + + def self.event_object_subscriber(pattern, block) + wrap_all pattern, EventObject.new(pattern, block) + end + + def self.wrap_all(pattern, subscriber) unless pattern AllMessages.new(subscriber) else @@ -83,9 +115,33 @@ module ActiveSupport end end - class Evented #:nodoc: - def initialize(pattern, delegate) + class Matcher #:nodoc: + attr_reader :pattern, :exclusions + + def self.wrap(pattern) + return pattern if String === pattern + new(pattern) + 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 + end + + class Evented #:nodoc: + attr_reader :pattern + + def initialize(pattern, delegate) + @pattern = Matcher.wrap(pattern) @delegate = delegate @can_publish = delegate.respond_to?(:publish) end @@ -105,11 +161,15 @@ module ActiveSupport end def subscribed_to?(name) - @pattern === name + pattern === name end def matches?(name) - @pattern && @pattern === name + pattern && pattern === name + end + + def unsubscribe!(name) + pattern.unsubscribe!(name) end end @@ -130,6 +190,27 @@ module ActiveSupport end end + class EventObject < Evented + def start(name, id, payload) + stack = Thread.current[:_event_stack] ||= [] + event = build_event name, id, payload + event.start! + stack.push event + end + + def finish(name, id, payload) + stack = Thread.current[:_event_stack] + event = stack.pop + event.finish! + @delegate.call event + end + + private + def build_event(name, id, payload) + ActiveSupport::Notifications::Event.new name, nil, nil, id, payload + end + end + class AllMessages # :nodoc: def initialize(delegate) @delegate = delegate @@ -151,6 +232,10 @@ module ActiveSupport true end + def unsubscribe!(*) + false + end + alias :matches? :=== end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/notifications/instrumenter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/notifications/instrumenter.rb new file mode 100644 index 0000000000..70de376452 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/notifications/instrumenter.rb @@ -0,0 +1,165 @@ +# frozen_string_literal: true + +require "securerandom" + +module ActiveSupport + module Notifications + # Instrumenters are stored in a thread local. + class Instrumenter + attr_reader :id + + def initialize(notifier) + @id = unique_id + @notifier = notifier + 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 = {}) + # some of the listeners might have state + listeners_state = start name, payload + begin + yield payload if block_given? + rescue Exception => e + payload[:exception] = [e.class.name, e.message] + payload[:exception_object] = e + raise e + ensure + finish_with_state listeners_state, name, payload + end + 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, :time, :end, :transaction_id, :payload, :children + + def self.clock_gettime_supported? # :nodoc: + defined?(Process::CLOCK_PROCESS_CPUTIME_ID) && + !Gem.win_platform? && + !RUBY_PLATFORM.match?(/solaris/i) + end + private_class_method :clock_gettime_supported? + + def initialize(name, start, ending, transaction_id, payload) + @name = name + @payload = payload.dup + @time = start + @transaction_id = transaction_id + @end = ending + @children = [] + @cpu_time_start = 0 + @cpu_time_finish = 0 + @allocation_count_start = 0 + @allocation_count_finish = 0 + end + + # Record information at the time this event starts + def start! + @time = now + @cpu_time_start = now_cpu + @allocation_count_start = now_allocations + end + + # Record information at the time this event finishes + def finish! + @cpu_time_finish = now_cpu + @end = now + @allocation_count_finish = now_allocations + end + + def end=(ending) + ActiveSupport::Deprecation.deprecation_warning(:end=, :finish!) + @end = ending + end + + # Returns the CPU time (in milliseconds) passed since the call to + # +start!+ and the call to +finish!+ + def cpu_time + (@cpu_time_finish - @cpu_time_start) * 1000 + end + + # Returns the idle time time (in milliseconds) passed since the call to + # +start!+ and the call to +finish!+ + def idle_time + duration - cpu_time + end + + # Returns the number of allocations made since the call to +start!+ and + # the call to +finish!+ + def allocations + @allocation_count_finish - @allocation_count_start + end + + # Returns the difference in milliseconds between when the execution of the + # event started and when it ended. + # + # ActiveSupport::Notifications.subscribe('wait') do |*args| + # @event = ActiveSupport::Notifications::Event.new(*args) + # end + # + # ActiveSupport::Notifications.instrument('wait') do + # sleep 1 + # end + # + # @event.duration # => 1000.138 + def duration + 1000.0 * (self.end - time) + end + + def <<(event) + @children << event + end + + def parent_of?(event) + @children.include? event + end + + private + def now + Concurrent.monotonic_time + end + + if clock_gettime_supported? + def now_cpu + Process.clock_gettime(Process::CLOCK_PROCESS_CPUTIME_ID) + end + else + def now_cpu + 0 + end + end + + if defined?(JRUBY_VERSION) + def now_allocations + 0 + end + else + def now_allocations + GC.stat :total_allocated_objects + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/option_merger.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/option_merger.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/option_merger.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/option_merger.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/ordered_hash.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/ordered_hash.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/ordered_hash.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/ordered_hash.rb index 5758513021..ad11524137 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/ordered_hash.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/ordered_hash.rb @@ -16,7 +16,7 @@ module ActiveSupport # oh.keys # => [:a, :b], this order is guaranteed # # Also, maps the +omap+ feature for YAML files - # (See http://yaml.org/type/omap.html) to support ordered items + # (See https://yaml.org/type/omap.html) to support ordered items # when loading from yaml. # # ActiveSupport::OrderedHash is namespaced to prevent conflicts diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/ordered_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/ordered_options.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/ordered_options.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/ordered_options.rb index c4e419f546..ea822706e8 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/ordered_options.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/ordered_options.rb @@ -39,7 +39,7 @@ module ActiveSupport end def method_missing(name, *args) - name_string = name.to_s + name_string = +name.to_s if name_string.chomp!("=") self[name_string] = args.first else diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/parameter_filter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/parameter_filter.rb new file mode 100644 index 0000000000..7114cc8efb --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/parameter_filter.rb @@ -0,0 +1,129 @@ +# frozen_string_literal: true + +require "active_support/core_ext/object/duplicable" +require "active_support/core_ext/array/extract" + +module ActiveSupport + # +ParameterFilter+ allows you to specify keys for sensitive data from + # hash-like object and replace corresponding value. Filtering only certain + # sub-keys from a hash is possible by using the dot notation: + # 'credit_card.number'. If a proc is given, each key and value of a hash and + # all sub-hashes are passed to it, where the value or the key can be replaced + # using String#replace or similar methods. + # + # ActiveSupport::ParameterFilter.new([:password]) + # => replaces the value to all keys matching /password/i with "[FILTERED]" + # + # ActiveSupport::ParameterFilter.new([:foo, "bar"]) + # => replaces the value to all keys matching /foo|bar/i with "[FILTERED]" + # + # ActiveSupport::ParameterFilter.new(["credit_card.code"]) + # => replaces { credit_card: {code: "xxxx"} } with "[FILTERED]", does not + # change { file: { code: "xxxx"} } + # + # ActiveSupport::ParameterFilter.new([-> (k, v) do + # v.reverse! if k =~ /secret/i + # end]) + # => reverses the value to all keys matching /secret/i + class ParameterFilter + FILTERED = "[FILTERED]" # :nodoc: + + # 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) + @filters = filters + @mask = mask + end + + # Mask value of +params+ if key matches one of filters. + def filter(params) + compiled_filter.call(params) + end + + # Returns filtered value for given key. For +Proc+ filters, third block argument is not populated. + def filter_param(key, value) + @filters.empty? ? value : compiled_filter.value_for_key(key, value) + end + + private + + def compiled_filter + @compiled_filter ||= CompiledFilter.compile(@filters, mask: @mask) + end + + class CompiledFilter # :nodoc: + def self.compile(filters, mask:) + return lambda { |params| params.dup } if filters.empty? + + strings, regexps, blocks = [], [], [] + + filters.each do |item| + case item + when Proc + blocks << item + when Regexp + regexps << item + else + strings << Regexp.escape(item.to_s) + end + end + + deep_regexps = regexps.extract! { |r| r.to_s.include?("\\.") } + deep_strings = strings.extract! { |s| s.include?("\\.") } + + regexps << Regexp.new(strings.join("|"), true) unless strings.empty? + deep_regexps << Regexp.new(deep_strings.join("|"), true) unless deep_strings.empty? + + new regexps, deep_regexps, blocks, mask: mask + end + + attr_reader :regexps, :deep_regexps, :blocks + + def initialize(regexps, deep_regexps, blocks, mask:) + @regexps = regexps + @deep_regexps = deep_regexps.any? ? deep_regexps : nil + @blocks = blocks + @mask = mask + end + + def call(params, parents = [], original_params = params) + filtered_params = params.class.new + + params.each do |key, value| + filtered_params[key] = value_for_key(key, value, parents, original_params) + end + + filtered_params + end + + def value_for_key(key, value, parents = [], original_params = nil) + parents.push(key) if deep_regexps + if regexps.any? { |r| r.match?(key) } + value = @mask + elsif deep_regexps && (joined = parents.join(".")) && deep_regexps.any? { |r| r.match?(joined) } + value = @mask + elsif value.is_a?(Hash) + value = call(value, parents, original_params) + elsif value.is_a?(Array) + # If we don't pop the current parent it will be duplicated as we + # process each array value. + parents.pop if deep_regexps + value = value.map { |v| value_for_key(key, v, parents, original_params) } + # Restore the parent stack after processing the array. + parents.push(key) if deep_regexps + elsif blocks.any? + 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 + parents.pop if deep_regexps + value + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/per_thread_registry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/per_thread_registry.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/per_thread_registry.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/per_thread_registry.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/proxy_object.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/proxy_object.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/proxy_object.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/proxy_object.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/rails.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/rails.rb similarity index 82% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/rails.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/rails.rb index 5c34a0abb3..8b727a69ec 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/rails.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/rails.rb @@ -27,9 +27,3 @@ require "active_support/core_ext/module/delegation" # Defines ActiveSupport::Deprecation. require "active_support/deprecation" - -# Defines Regexp#match?. -# -# This should be removed when Rails needs Ruby 2.4 or later, and the require -# added where other Regexp extensions are being used (easy to grep). -require "active_support/core_ext/regexp" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/railtie.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/railtie.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/railtie.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/railtie.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/reloader.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/reloader.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/reloader.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/reloader.rb index b26d9c3665..2f81cd4f80 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/reloader.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/reloader.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "active_support/execution_wrapper" +require "active_support/executor" module ActiveSupport #-- @@ -49,11 +50,9 @@ module ActiveSupport def self.reload! executor.wrap do new.tap do |instance| - begin - instance.run! - ensure - instance.complete! - end + instance.run! + ensure + instance.complete! end end prepare! diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/rescuable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/rescuable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/rescuable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/rescuable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/security_utils.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/security_utils.rb similarity index 89% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/security_utils.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/security_utils.rb index 20b6b9cd3f..5e455fca57 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/security_utils.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/security_utils.rb @@ -24,7 +24,7 @@ module ActiveSupport # The values are first processed by SHA256, so that we don't leak length info # via timing attacks. def secure_compare(a, b) - fixed_length_secure_compare(::Digest::SHA256.hexdigest(a), ::Digest::SHA256.hexdigest(b)) && a == b + fixed_length_secure_compare(::Digest::SHA256.digest(a), ::Digest::SHA256.digest(b)) && a == b end module_function :secure_compare end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/string_inquirer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/string_inquirer.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/string_inquirer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/string_inquirer.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/subscriber.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/subscriber.rb similarity index 55% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/subscriber.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/subscriber.rb index 9291b48ce8..c3cd175a52 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/subscriber.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/subscriber.rb @@ -24,6 +24,10 @@ module ActiveSupport # 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. @@ -40,6 +44,25 @@ module ActiveSupport 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. + subscriber.public_methods(false).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) # Only public methods are added as subscribers, and only if a notifier @@ -54,62 +77,78 @@ module ActiveSupport @@subscribers ||= [] end - # TODO Change this to private once we've dropped Ruby 2.2 support. - # Workaround for Ruby 2.2 "private attribute?" warning. - protected - - attr_reader :subscriber, :notifier, :namespace - private + attr_reader :subscriber, :notifier, :namespace - def add_event_subscriber(event) # :doc: - return if %w{ start finish }.include?(event.to_s) + def add_event_subscriber(event) # :doc: + return if invalid_event?(event.to_s) - pattern = "#{event}.#{namespace}" + pattern = prepare_pattern(event) - # Don't add multiple subscribers (eg. if methods are redefined). - return if subscriber.patterns.include?(pattern) + # Don't add multiple subscribers (eg. if methods are redefined). + return if pattern_subscribed?(pattern) - subscriber.patterns << pattern - notifier.subscribe(pattern, subscriber) - end + subscriber.patterns[pattern] = notifier.subscribe(pattern, subscriber) + end + + def remove_event_subscriber(event) # :doc: + return if invalid_event?(event.to_s) + + 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) + %w{ start finish }.include?(event.to_s) + end + + def prepare_pattern(event) + "#{event}.#{namespace}" + end + + def pattern_subscribed?(pattern) + subscriber.patterns.key?(pattern) + end end attr_reader :patterns # :nodoc: def initialize @queue_key = [self.class.name, object_id].join "-" - @patterns = [] + @patterns = {} super end def start(name, id, payload) - e = ActiveSupport::Notifications::Event.new(name, now, nil, id, payload) + event = ActiveSupport::Notifications::Event.new(name, nil, nil, id, payload) + event.start! parent = event_stack.last - parent << e if parent + parent << event if parent - event_stack.push e + event_stack.push event end def finish(name, id, payload) - finished = now - event = event_stack.pop - event.end = finished + event = event_stack.pop + event.finish! event.payload.merge!(payload) - method = name.split(".".freeze).first + method = name.split(".").first send(method, event) end private - def event_stack SubscriberQueueRegistry.instance.get_queue(@queue_key) end - - def now - Process.clock_gettime(Process::CLOCK_MONOTONIC) - end end # This is a registry for all the event stacks kept for subscribers. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/tagged_logging.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/tagged_logging.rb similarity index 86% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/tagged_logging.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/tagged_logging.rb index 8561cba9f1..d8a86d997e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/tagged_logging.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/tagged_logging.rb @@ -46,21 +46,30 @@ module ActiveSupport def current_tags # We use our object ID here to avoid conflicting with other instances - thread_key = @thread_key ||= "activesupport_tagged_logging_tags:#{object_id}".freeze + thread_key = @thread_key ||= "activesupport_tagged_logging_tags:#{object_id}" Thread.current[thread_key] ||= [] end def tags_text tags = current_tags - if tags.any? + if tags.one? + "[#{tags[0]}] " + elsif tags.any? tags.collect { |tag| "[#{tag}] " }.join end end end def self.new(logger) - # Ensure we set a default formatter so we aren't extending nil! - logger.formatter ||= ActiveSupport::Logger::SimpleFormatter.new + logger = logger.dup + + if logger.formatter + logger.formatter = logger.formatter.dup + 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 diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/test_case.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/test_case.rb new file mode 100644 index 0000000000..7be4108ed7 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/test_case.rb @@ -0,0 +1,163 @@ +# frozen_string_literal: true + +gem "minitest" # make sure we get the gem, not stdlib +require "minitest" +require "active_support/testing/tagged_logging" +require "active_support/testing/setup_and_teardown" +require "active_support/testing/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/file_fixtures" +require "active_support/testing/parallelization" +require "concurrent/utility/processor_counter" + +module ActiveSupport + class TestCase < ::Minitest::Test + Assertion = Minitest::Assertion + + class << self + # 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 + + # 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 + # database and will not work with system tests at this time. + # + # parallelize(workers: :number_of_processors, with: :threads) + # + # The threaded parallelization uses minitest's parallel executor directly. + # The processes parallelization uses a Ruby DRb server. + def parallelize(workers: :number_of_processors, with: :processes) + workers = Concurrent.physical_processor_count if workers == :number_of_processors + workers = ENV["PARALLEL_WORKERS"].to_i if ENV["PARALLEL_WORKERS"] + + return if workers <= 1 + + executor = case with + when :processes + Testing::Parallelization.new(workers) + when :threads + Minitest::Parallel::Executor.new(workers) + else + raise ArgumentError, "#{with} is not a supported parallelization executor." + end + + self.lock_threads = false if defined?(self.lock_threads) && with == :threads + + Minitest.parallel_executor = executor + + parallelize_me! + end + + # Set up 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 do |worker| + yield worker + end + 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 do |worker| + yield worker + end + end + end + + alias_method :method_name, :name + + include ActiveSupport::Testing::TaggedLogging + prepend ActiveSupport::Testing::SetupAndTeardown + include ActiveSupport::Testing::Assertions + include ActiveSupport::Testing::Deprecation + include ActiveSupport::Testing::TimeHelpers + include ActiveSupport::Testing::FileFixtures + extend ActiveSupport::Testing::Declarative + + # test/unit backwards compatibility methods + alias :assert_raise :assert_raises + alias :assert_not_empty :refute_empty + alias :assert_not_equal :refute_equal + alias :assert_not_in_delta :refute_in_delta + alias :assert_not_in_epsilon :refute_in_epsilon + alias :assert_not_includes :refute_includes + alias :assert_not_instance_of :refute_instance_of + alias :assert_not_kind_of :refute_kind_of + alias :assert_no_match :refute_match + alias :assert_not_nil :refute_nil + alias :assert_not_operator :refute_operator + alias :assert_not_predicate :refute_predicate + alias :assert_not_respond_to :refute_respond_to + alias :assert_not_same :refute_same + + ActiveSupport.run_load_hooks(:active_support_test_case, self) + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/time_with_zone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/time_with_zone.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/time_with_zone.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/time_with_zone.rb index 20650ce714..3be5f6f7b5 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/time_with_zone.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/time_with_zone.rb @@ -43,8 +43,8 @@ module ActiveSupport "Time" end - PRECISIONS = Hash.new { |h, n| h[n] = "%FT%T.%#{n}N".freeze } - PRECISIONS[0] = "%FT%T".freeze + PRECISIONS = Hash.new { |h, n| h[n] = "%FT%T.%#{n}N" } + PRECISIONS[0] = "%FT%T" include Comparable, DateAndTime::Compatibility attr_reader :time_zone @@ -147,7 +147,7 @@ module ActiveSupport # # Time.zone.now.xmlschema # => "2014-12-04T11:02:37-05:00" def xmlschema(fraction_digits = 0) - "#{time.strftime(PRECISIONS[fraction_digits.to_i])}#{formatted_offset(true, 'Z'.freeze)}" + "#{time.strftime(PRECISIONS[fraction_digits.to_i])}#{formatted_offset(true, 'Z')}" end alias_method :iso8601, :xmlschema alias_method :rfc3339, :xmlschema @@ -225,6 +225,8 @@ module ActiveSupport 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. @@ -284,8 +286,10 @@ module ActiveSupport alias_method :since, :+ alias_method :in, :+ - # Returns a new TimeWithZone object that represents the difference between - # the current object's time and the +other+ time. + # Subtracts an interval of time and returns a new TimeWithZone object unless + # the other value `acts_like?` time. Then it will return a Float of the difference + # between the two times that represents the difference between the current + # object's time and the +other+ time. # # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' # now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28 EST -05:00 @@ -300,6 +304,12 @@ module ActiveSupport # # now - 24.hours # => Sun, 02 Nov 2014 01:26:28 EDT -04:00 # now - 1.day # => Sun, 02 Nov 2014 00:26:28 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) to_time - other.to_time diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/values/time_zone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/values/time_zone.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/values/time_zone.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/values/time_zone.rb index 90501bc5f7..d9e033e23b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/values/time_zone.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/values/time_zone.rb @@ -2,7 +2,6 @@ require "tzinfo" require "concurrent/map" -require "active_support/core_ext/object/blank" module ActiveSupport # The TimeZone class serves as a wrapper around TZInfo::Timezone instances. @@ -183,8 +182,9 @@ module ActiveSupport "Samoa" => "Pacific/Apia" } - UTC_OFFSET_WITH_COLON = "%s%02d:%02d" - UTC_OFFSET_WITHOUT_COLON = UTC_OFFSET_WITH_COLON.tr(":", "") + 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 @@ -266,7 +266,7 @@ module ActiveSupport private def load_country_zones(code) country = TZInfo::Country.get(code) - country.zone_identifiers.map do |tz_id| + 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 @@ -275,7 +275,7 @@ module ActiveSupport else create(tz_id, nil, TZInfo::Timezone.new(tz_id)) end - end.flatten(1).sort! + end.sort! end def zones_map @@ -355,8 +355,13 @@ module ActiveSupport # 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 - def at(secs) - Time.at(secs).utc.in_time_zone(self) + # + # 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 diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/version.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/version.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini.rb index f087e2ce48..075cd4ed8b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini.rb @@ -3,6 +3,7 @@ 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" @@ -48,10 +49,6 @@ module ActiveSupport "Array" => "array", "Hash" => "hash" } - - # No need to map these on Ruby 2.4+ - TYPE_NAMES["Fixnum"] = "integer" unless 0.class == Integer - TYPE_NAMES["Bignum"] = "integer" unless 0.class == Integer end FORMATTING = { @@ -72,11 +69,7 @@ module ActiveSupport "float" => Proc.new { |float| float.to_f }, "decimal" => Proc.new do |number| if String === number - begin - BigDecimal(number) - rescue ArgumentError - BigDecimal(number.to_f.to_s) - end + number.to_d else BigDecimal(number) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini/jdom.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini/jdom.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini/jdom.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini/jdom.rb index 7f94a64016..32fe6ade28 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini/jdom.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini/jdom.rb @@ -18,7 +18,7 @@ module ActiveSupport module XmlMini_JDOM #:nodoc: extend self - CONTENT_KEY = "__content__".freeze + CONTENT_KEY = "__content__" NODE_TYPE_NAMES = %w{ATTRIBUTE_NODE CDATA_SECTION_NODE COMMENT_NODE DOCUMENT_FRAGMENT_NODE DOCUMENT_NODE DOCUMENT_TYPE_NODE ELEMENT_NODE ENTITY_NODE ENTITY_REFERENCE_NODE NOTATION_NODE @@ -169,7 +169,7 @@ module ActiveSupport # element:: # XML element to be checked. def empty_content?(element) - text = "".dup + text = +"" child_nodes = element.child_nodes (0...child_nodes.length).each do |i| item = child_nodes.item(i) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini/libxml.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini/libxml.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini/libxml.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini/libxml.rb index 0b000fea60..c2e999ef6c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini/libxml.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini/libxml.rb @@ -34,7 +34,7 @@ module LibXML #:nodoc: end module Node #:nodoc: - CONTENT_ROOT = "__content__".freeze + CONTENT_ROOT = "__content__" # Convert XML document to hash. # @@ -55,7 +55,7 @@ module LibXML #:nodoc: if c.element? c.to_hash(node_hash) elsif c.text? || c.cdata? - node_hash[CONTENT_ROOT] ||= "".dup + node_hash[CONTENT_ROOT] ||= +"" node_hash[CONTENT_ROOT] << c.content end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini/libxmlsax.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini/libxmlsax.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini/libxmlsax.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini/libxmlsax.rb index dcf16e6084..ac8acdfc3c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini/libxmlsax.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini/libxmlsax.rb @@ -13,8 +13,8 @@ module ActiveSupport class HashBuilder include LibXML::XML::SaxParser::Callbacks - CONTENT_KEY = "__content__".freeze - HASH_SIZE_KEY = "__hash_size__".freeze + CONTENT_KEY = "__content__" + HASH_SIZE_KEY = "__hash_size__" attr_reader :hash @@ -23,7 +23,7 @@ module ActiveSupport end def on_start_document - @hash = { CONTENT_KEY => "".dup } + @hash = { CONTENT_KEY => +"" } @hash_stack = [@hash] end @@ -33,7 +33,7 @@ module ActiveSupport end def on_start_element(name, attrs = {}) - new_hash = { CONTENT_KEY => "".dup }.merge!(attrs) + new_hash = { CONTENT_KEY => +"" }.merge!(attrs) new_hash[HASH_SIZE_KEY] = new_hash.size + 1 case current_hash[name] diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini/nokogiri.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini/nokogiri.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini/nokogiri.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini/nokogiri.rb index 5ee6fc8159..f76513f48b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini/nokogiri.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini/nokogiri.rb @@ -38,7 +38,7 @@ module ActiveSupport end module Node #:nodoc: - CONTENT_ROOT = "__content__".freeze + CONTENT_ROOT = "__content__" # Convert XML document to hash. # @@ -59,7 +59,7 @@ module ActiveSupport if c.element? c.to_hash(node_hash) elsif c.text? || c.cdata? - node_hash[CONTENT_ROOT] ||= "".dup + node_hash[CONTENT_ROOT] ||= +"" node_hash[CONTENT_ROOT] << c.content end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini/nokogirisax.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini/nokogirisax.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini/nokogirisax.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini/nokogirisax.rb index b01ed00a14..55cd72e093 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini/nokogirisax.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini/nokogirisax.rb @@ -16,8 +16,8 @@ module ActiveSupport # 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__".freeze - HASH_SIZE_KEY = "__hash_size__".freeze + CONTENT_KEY = "__content__" + HASH_SIZE_KEY = "__hash_size__" attr_reader :hash @@ -39,7 +39,7 @@ module ActiveSupport end def start_element(name, attrs = []) - new_hash = { CONTENT_KEY => "".dup }.merge!(Hash[attrs]) + new_hash = { CONTENT_KEY => +"" }.merge!(Hash[attrs]) new_hash[HASH_SIZE_KEY] = new_hash.size + 1 case current_hash[name] diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini/rexml.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini/rexml.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini/rexml.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini/rexml.rb index 32458d5b0d..8d6e3af066 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/xml_mini/rexml.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.1/lib/active_support/xml_mini/rexml.rb @@ -8,7 +8,7 @@ module ActiveSupport module XmlMini_REXML #:nodoc: extend self - CONTENT_KEY = "__content__".freeze + CONTENT_KEY = "__content__" # Parse an XML Document string or IO into a simple hash. # @@ -76,7 +76,7 @@ module ActiveSupport hash else # must use value to prevent double-escaping - texts = "".dup + texts = +"" element.texts.each { |t| texts << t.value } merge!(hash, CONTENT_KEY, texts) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk.rb new file mode 100644 index 0000000000..f3bb471a01 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Zeitwerk + require_relative "zeitwerk/real_mod_name" + require_relative "zeitwerk/loader" + require_relative "zeitwerk/registry" + require_relative "zeitwerk/explicit_namespace" + require_relative "zeitwerk/inflector" + require_relative "zeitwerk/gem_inflector" + require_relative "zeitwerk/kernel" + require_relative "zeitwerk/error" +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/error.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/error.rb new file mode 100644 index 0000000000..9b8ef27e2b --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/error.rb @@ -0,0 +1,10 @@ +module Zeitwerk + class Error < StandardError + end + + class ReloadingDisabledError < Error + end + + class NameError < ::NameError + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/explicit_namespace.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/explicit_namespace.rb new file mode 100644 index 0000000000..2d4f015a0d --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/explicit_namespace.rb @@ -0,0 +1,80 @@ +module Zeitwerk + # Centralizes the logic for the trace point used to detect the creation of + # explicit namespaces, needed to descend into matching subdirectories right + # after the constant has been defined. + # + # The implementation assumes an explicit namespace is managed by one loader. + # Loaders that reopen namespaces owned by other projects are responsible for + # loading their constant before setup. This is documented. + module ExplicitNamespace # :nodoc: all + class << self + include RealModName + + # Maps constant paths that correspond to explicit namespaces according to + # the file system, to the loader responsible for them. + # + # @private + # @return [{String => Zeitwerk::Loader}] + attr_reader :cpaths + + # @private + # @return [Mutex] + attr_reader :mutex + + # @private + # @return [TracePoint] + attr_reader :tracer + + # Asserts `cpath` corresponds to an explicit namespace for which `loader` + # is responsible. + # + # @private + # @param cpath [String] + # @param loader [Zeitwerk::Loader] + # @return [void] + def register(cpath, loader) + mutex.synchronize do + cpaths[cpath] = loader + # We check enabled? because, looking at the C source code, enabling an + # enabled tracer does not seem to be a simple no-op. + tracer.enable unless tracer.enabled? + end + end + + # @private + # @param loader [Zeitwerk::Loader] + # @return [void] + def unregister(loader) + cpaths.delete_if { |_cpath, l| l == loader } + disable_tracer_if_unneeded + end + + def disable_tracer_if_unneeded + mutex.synchronize do + tracer.disable if cpaths.empty? + end + end + + def tracepoint_class_callback(event) + # If the class is a singleton class, we won't do anything with it so we + # can bail out immediately. This is several orders of magnitude faster + # than accessing its name. + return if event.self.singleton_class? + + # Note that it makes sense to compute the hash code unconditionally, + # because the trace point is disabled if cpaths is empty. + if loader = cpaths.delete(real_mod_name(event.self)) + loader.on_namespace_loaded(event.self) + disable_tracer_if_unneeded + end + end + end + + @cpaths = {} + @mutex = Mutex.new + + # We go through a method instead of defining a block mainly to have a better + # label when profiling. + @tracer = TracePoint.new(:class, &method(:tracepoint_class_callback)) + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/gem_inflector.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/gem_inflector.rb new file mode 100644 index 0000000000..e104fb9811 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/gem_inflector.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Zeitwerk + class GemInflector < Inflector + # @param root_file [String] + def initialize(root_file) + namespace = File.basename(root_file, ".rb") + lib_dir = File.dirname(root_file) + @version_file = File.join(lib_dir, namespace, "version.rb") + end + + # @param basename [String] + # @param abspath [String] + # @return [String] + def camelize(basename, abspath) + abspath == @version_file ? "VERSION" : super + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/inflector.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/inflector.rb new file mode 100644 index 0000000000..b04bb74d02 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/inflector.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +module Zeitwerk + class Inflector + # Very basic snake case -> camel case conversion. + # + # inflector = Zeitwerk::Inflector.new + # inflector.camelize("post", ...) # => "Post" + # inflector.camelize("users_controller", ...) # => "UsersController" + # inflector.camelize("api", ...) # => "Api" + # + # Takes into account hard-coded mappings configured with `inflect`. + # + # @param basename [String] + # @param _abspath [String] + # @return [String] + def camelize(basename, _abspath) + overrides[basename] || basename.split('_').map!(&:capitalize).join + end + + # Configures hard-coded inflections: + # + # inflector = Zeitwerk::Inflector.new + # inflector.inflect( + # "html_parser" => "HTMLParser", + # "mysql_adapter" => "MySQLAdapter" + # ) + # + # inflector.camelize("html_parser", abspath) # => "HTMLParser" + # inflector.camelize("mysql_adapter", abspath) # => "MySQLAdapter" + # inflector.camelize("users_controller", abspath) # => "UsersController" + # + # @param inflections [{String => String}] + # @return [void] + def inflect(inflections) + overrides.merge!(inflections) + end + + private + + # Hard-coded basename to constant name user maps that override the default + # inflection logic. + # + # @return [{String => String}] + def overrides + @overrides ||= {} + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/kernel.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/kernel.rb new file mode 100644 index 0000000000..728b444a42 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/kernel.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +module Kernel + module_function + + # We cannot decorate with prepend + super because Kernel has already been + # included in Object, and changes in ancestors don't get propagated into + # already existing ancestor chains. + alias_method :zeitwerk_original_require, :require + + # @param path [String] + # @return [Boolean] + def require(path) + if loader = Zeitwerk::Registry.loader_for(path) + if path.end_with?(".rb") + zeitwerk_original_require(path).tap do |required| + loader.on_file_autoloaded(path) if required + end + else + loader.on_dir_autoloaded(path) + end + else + zeitwerk_original_require(path).tap do |required| + if required + realpath = $LOADED_FEATURES.last + if loader = Zeitwerk::Registry.loader_for(realpath) + loader.on_file_autoloaded(realpath) + end + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/loader.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/loader.rb new file mode 100644 index 0000000000..e47f44b13c --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/loader.rb @@ -0,0 +1,765 @@ +# frozen_string_literal: true + +require "set" +require "securerandom" + +module Zeitwerk + class Loader + require_relative "loader/callbacks" + include Callbacks + include RealModName + + # @return [String] + attr_reader :tag + + # @return [#camelize] + attr_accessor :inflector + + # @return [#call, #debug, nil] + attr_accessor :logger + + # Absolute paths of the root directories. Stored in a hash to preserve + # order, easily handle duplicates, and also be able to have a fast lookup, + # needed for detecting nested paths. + # + # "/Users/fxn/blog/app/assets" => true, + # "/Users/fxn/blog/app/channels" => true, + # ... + # + # This is a private collection maintained by the loader. The public + # interface for it is `push_dir` and `dirs`. + # + # @private + # @return [{String => true}] + attr_reader :root_dirs + + # Absolute paths of files or directories that have to be preloaded. + # + # @private + # @return [] + attr_reader :preloads + + # Absolute paths of files, directories, of glob patterns to be totally + # ignored. + # + # @private + # @return [Set] + attr_reader :ignored_glob_patterns + + # The actual collection of absolute file and directory names at the time the + # ignored glob patterns were expanded. Computed on setup, and recomputed on + # reload. + # + # @private + # @return [Set] + attr_reader :ignored_paths + + # Maps real absolute paths for which an autoload has been set ---and not + # executed--- to their corresponding parent class or module and constant + # name. + # + # "/Users/fxn/blog/app/models/user.rb" => [Object, :User], + # "/Users/fxn/blog/app/models/hotel/pricing.rb" => [Hotel, :Pricing] + # ... + # + # @private + # @return [{String => (Module, Symbol)}] + attr_reader :autoloads + + # We keep track of autoloaded directories to remove them from the registry + # at the end of eager loading. + # + # Files are removed as they are autoloaded, but directories need to wait due + # to concurrency (see why in Zeitwerk::Loader::Callbacks#on_dir_autoloaded). + # + # @private + # @return [] + attr_reader :autoloaded_dirs + + # Stores metadata needed for unloading. Its entries look like this: + # + # "Admin::Role" => [".../admin/role.rb", [Admin, :Role]] + # + # The cpath as key helps implementing unloadable_cpath? The real file name + # is stored in order to be able to delete it from $LOADED_FEATURES, and the + # pair [Module, Symbol] is used to remove_const the constant from the class + # or module object. + # + # If reloading is enabled, this hash is filled as constants are autoloaded + # or eager loaded. Otherwise, the collection remains empty. + # + # @private + # @return [{String => (String, (Module, Symbol))}] + attr_reader :to_unload + + # Maps constant paths of namespaces to arrays of corresponding directories. + # + # For example, given this mapping: + # + # "Admin" => [ + # "/Users/fxn/blog/app/controllers/admin", + # "/Users/fxn/blog/app/models/admin", + # ... + # ] + # + # when `Admin` gets defined we know that it plays the role of a namespace and + # that its children are spread over those directories. We'll visit them to set + # up the corresponding autoloads. + # + # @private + # @return [{String => }] + attr_reader :lazy_subdirs + + # Absolute paths of files or directories not to be eager loaded. + # + # @private + # @return [Set] + attr_reader :eager_load_exclusions + + # @private + # @return [Mutex] + attr_reader :mutex + + # @private + # @return [Mutex] + attr_reader :mutex2 + + def initialize + @initialized_at = Time.now + + @tag = SecureRandom.hex(3) + @inflector = Inflector.new + @logger = self.class.default_logger + + @root_dirs = {} + @preloads = [] + @ignored_glob_patterns = Set.new + @ignored_paths = Set.new + @autoloads = {} + @autoloaded_dirs = [] + @to_unload = {} + @lazy_subdirs = {} + @eager_load_exclusions = Set.new + + # TODO: find a better name for these mutexes. + @mutex = Mutex.new + @mutex2 = Mutex.new + @setup = false + @eager_loaded = false + + @reloading_enabled = false + + Registry.register_loader(self) + end + + # Sets a tag for the loader, useful for logging. + # + # @return [void] + def tag=(tag) + @tag = tag.to_s + end + + # Absolute paths of the root directories. This is a read-only collection, + # please push here via `push_dir`. + # + # @return [] + def dirs + root_dirs.keys.freeze + end + + # Pushes `path` to the list of root directories. + # + # Raises `Zeitwerk::Error` if `path` does not exist, or if another loader in + # the same process already manages that directory or one of its ascendants + # or descendants. + # + # @param path [] + # @raise [Zeitwerk::Error] + # @return [void] + def push_dir(path) + abspath = File.expand_path(path) + if dir?(abspath) + raise_if_conflicting_directory(abspath) + root_dirs[abspath] = true + else + raise Error, "the root directory #{abspath} does not exist" + end + end + + # You need to call this method before setup in order to be able to reload. + # There is no way to undo this, either you want to reload or you don't. + # + # @raise [Zeitwerk::Error] + # @return [void] + def enable_reloading + mutex.synchronize do + break if @reloading_enabled + + if @setup + raise Error, "cannot enable reloading after setup" + else + @reloading_enabled = true + end + end + end + + # @return [Boolean] + def reloading_enabled? + @reloading_enabled + end + + # Files or directories to be preloaded instead of lazy loaded. + # + # @param paths [>] + # @return [void] + def preload(*paths) + mutex.synchronize do + expand_paths(paths).each do |abspath| + preloads << abspath + do_preload_abspath(abspath) if @setup + end + end + end + + # Configure files, directories, or glob patterns to be totally ignored. + # + # @param paths [>] + # @return [void] + def ignore(*glob_patterns) + glob_patterns = expand_paths(glob_patterns) + mutex.synchronize do + ignored_glob_patterns.merge(glob_patterns) + ignored_paths.merge(expand_glob_patterns(glob_patterns)) + end + end + + # Sets autoloads in the root namespace and preloads files, if any. + # + # @return [void] + def setup + mutex.synchronize do + break if @setup + + actual_root_dirs.each { |root_dir| set_autoloads_in_dir(root_dir, Object) } + do_preload + + @setup = true + end + end + + # Removes loaded constants and configured autoloads. + # + # The objects the constants stored are no longer reachable through them. In + # addition, since said objects are normally not referenced from anywhere + # else, they are eligible for garbage collection, which would effectively + # unload them. + # + # @private + # @return [void] + def unload + mutex.synchronize do + # We are going to keep track of the files that were required by our + # autoloads to later remove them from $LOADED_FEATURES, thus making them + # loadable by Kernel#require again. + # + # Directories are not stored in $LOADED_FEATURES, keeping track of files + # is enough. + unloaded_files = Set.new + + autoloads.each do |realpath, (parent, cname)| + if parent.autoload?(cname) + unload_autoload(parent, cname) + else + # Could happen if loaded with require_relative. That is unsupported, + # and the constant path would escape unloadable_cpath? This is just + # defensive code to clean things up as much as we are able to. + unload_cref(parent, cname) if cdef?(parent, cname) + unloaded_files.add(realpath) if ruby?(realpath) + end + end + + to_unload.each_value do |(realpath, (parent, cname))| + unload_cref(parent, cname) if cdef?(parent, cname) + unloaded_files.add(realpath) if ruby?(realpath) + end + + unless unloaded_files.empty? + # Bootsnap decorates Kernel#require to speed it up using a cache and + # this optimization does not check if $LOADED_FEATURES has the file. + # + # To make it aware of changes, the gem defines singleton methods in + # $LOADED_FEATURES: + # + # https://github.com/Shopify/bootsnap/blob/master/lib/bootsnap/load_path_cache/core_ext/loaded_features.rb + # + # Rails applications may depend on bootsnap, so for unloading to work + # in that setting it is preferable that we restrict our API choice to + # one of those methods. + $LOADED_FEATURES.reject! { |file| unloaded_files.member?(file) } + end + + autoloads.clear + autoloaded_dirs.clear + to_unload.clear + lazy_subdirs.clear + + Registry.on_unload(self) + ExplicitNamespace.unregister(self) + + @setup = false + end + end + + # Unloads all loaded code, and calls setup again so that the loader is able + # to pick any changes in the file system. + # + # This method is not thread-safe, please see how this can be achieved by + # client code in the README of the project. + # + # @raise [Zeitwerk::Error] + # @return [void] + def reload + if reloading_enabled? + unload + recompute_ignored_paths + setup + else + raise ReloadingDisabledError, "can't reload, please call loader.enable_reloading before setup" + end + end + + # Eager loads all files in the root directories, recursively. Files do not + # need to be in `$LOAD_PATH`, absolute file names are used. Ignored files + # are not eager loaded. You can opt-out specifically in specific files and + # directories with `do_not_eager_load`. + # + # @return [void] + def eager_load + mutex.synchronize do + break if @eager_loaded + + queue = actual_root_dirs.reject { |dir| eager_load_exclusions.member?(dir) } + queue.map! { |dir| [Object, dir] } + while to_eager_load = queue.shift + namespace, dir = to_eager_load + + ls(dir) do |basename, abspath| + next if eager_load_exclusions.member?(abspath) + + if ruby?(abspath) + if cref = autoloads[File.realpath(abspath)] + cref[0].const_get(cref[1], false) + end + elsif dir?(abspath) && !root_dirs.key?(abspath) + cname = inflector.camelize(basename, abspath) + queue << [namespace.const_get(cname, false), abspath] + end + end + end + + autoloaded_dirs.each do |autoloaded_dir| + Registry.unregister_autoload(autoloaded_dir) + end + autoloaded_dirs.clear + + @eager_loaded = true + end + end + + # Let eager load ignore the given files or directories. The constants + # defined in those files are still autoloadable. + # + # @param paths [>] + # @return [void] + def do_not_eager_load(*paths) + mutex.synchronize { eager_load_exclusions.merge(expand_paths(paths)) } + end + + # Says if the given constant path would be unloaded on reload. This + # predicate returns `false` if reloading is disabled. + # + # @param cpath [String] + # @return [Boolean] + def unloadable_cpath?(cpath) + to_unload.key?(cpath) + end + + # Returns an array with the constant paths that would be unloaded on reload. + # This predicate returns an empty array if reloading is disabled. + # + # @return [] + def unloadable_cpaths + to_unload.keys.freeze + end + + # Logs to `$stdout`, handy shortcut for debugging. + # + # @return [void] + def log! + @logger = ->(msg) { puts msg } + end + + # @private + # @param dir [String] + # @return [Boolean] + def manages?(dir) + dir = dir + "/" + ignored_paths.each do |ignored_path| + return false if dir.start_with?(ignored_path + "/") + end + + root_dirs.each_key do |root_dir| + return true if root_dir.start_with?(dir) || dir.start_with?(root_dir + "/") + end + + false + end + + # --- Class methods --------------------------------------------------------------------------- + + class << self + # @return [#call, #debug, nil] + attr_accessor :default_logger + + # @private + # @return [Mutex] + attr_accessor :mutex + + # This is a shortcut for + # + # require "zeitwerk" + # loader = Zeitwerk::Loader.new + # loader.tag = File.basename(__FILE__, ".rb") + # loader.inflector = Zeitwerk::GemInflector.new + # loader.push_dir(__dir__) + # + # except that this method returns the same object in subsequent calls from + # the same file, in the unlikely case the gem wants to be able to reload. + # + # @return [Zeitwerk::Loader] + def for_gem + called_from = caller_locations(1, 1).first.path + Registry.loader_for_gem(called_from) + end + + # Broadcasts `eager_load` to all loaders. + # + # @return [void] + def eager_load_all + Registry.loaders.each(&:eager_load) + end + + # Returns an array with the absolute paths of the root directories of all + # registered loaders. This is a read-only collection. + # + # @return [] + def all_dirs + Registry.loaders.flat_map(&:dirs).freeze + end + end + + self.mutex = Mutex.new + + private # ------------------------------------------------------------------------------------- + + # @return [] + def actual_root_dirs + root_dirs.keys.delete_if do |root_dir| + !dir?(root_dir) || ignored_paths.member?(root_dir) + end + end + + # @param dir [String] + # @param parent [Module] + # @return [void] + def set_autoloads_in_dir(dir, parent) + ls(dir) do |basename, abspath| + begin + if ruby?(basename) + basename.slice!(-3, 3) + cname = inflector.camelize(basename, abspath).to_sym + autoload_file(parent, cname, abspath) + elsif dir?(abspath) + # In a Rails application, `app/models/concerns` is a subdirectory of + # `app/models`, but both of them are root directories. + # + # To resolve the ambiguity file name -> constant path this introduces, + # the `app/models/concerns` directory is totally ignored as a namespace, + # it counts only as root. The guard checks that. + unless root_dirs.key?(abspath) + cname = inflector.camelize(basename, abspath).to_sym + autoload_subdir(parent, cname, abspath) + end + end + rescue ::NameError => error + path_type = ruby?(abspath) ? "file" : "directory" + + raise NameError, <<~MESSAGE + #{error.message} inferred by #{inflector.class} from #{path_type} + + #{abspath} + + Possible ways to address this: + + * Tell Zeitwerk to ignore this particular #{path_type}. + * Tell Zeitwerk to ignore one of its parent directories. + * Rename the #{path_type} to comply with the naming conventions. + * Modify the inflector to handle this case. + MESSAGE + end + end + end + + # @param parent [Module] + # @param cname [Symbol] + # @param subdir [String] + # @return [void] + def autoload_subdir(parent, cname, subdir) + if autoload_path = autoload_for?(parent, cname) + cpath = cpath(parent, cname) + register_explicit_namespace(cpath) if ruby?(autoload_path) + # We do not need to issue another autoload, the existing one is enough + # no matter if it is for a file or a directory. Just remember the + # subdirectory has to be visited if the namespace is used. + (lazy_subdirs[cpath] ||= []) << subdir + elsif !cdef?(parent, cname) + # First time we find this namespace, set an autoload for it. + (lazy_subdirs[cpath(parent, cname)] ||= []) << subdir + set_autoload(parent, cname, subdir) + else + # For whatever reason the constant that corresponds to this namespace has + # already been defined, we have to recurse. + set_autoloads_in_dir(subdir, parent.const_get(cname)) + end + end + + # @param parent [Module] + # @param cname [Symbol] + # @param file [String] + # @return [void] + def autoload_file(parent, cname, file) + if autoload_path = autoload_for?(parent, cname) + # First autoload for a Ruby file wins, just ignore subsequent ones. + if ruby?(autoload_path) + log("file #{file} is ignored because #{autoload_path} has precedence") if logger + else + promote_namespace_from_implicit_to_explicit( + dir: autoload_path, + file: file, + parent: parent, + cname: cname + ) + end + elsif cdef?(parent, cname) + log("file #{file} is ignored because #{cpath(parent, cname)} is already defined") if logger + else + set_autoload(parent, cname, file) + end + end + + # @param dir [String] directory that would have autovivified a module + # @param file [String] the file where the namespace is explictly defined + # @param parent [Module] + # @param cname [Symbol] + # @return [void] + def promote_namespace_from_implicit_to_explicit(dir:, file:, parent:, cname:) + autoloads.delete(dir) + Registry.unregister_autoload(dir) + + set_autoload(parent, cname, file) + register_explicit_namespace(cpath(parent, cname)) + end + + # @param parent [Module] + # @param cname [Symbol] + # @param abspath [String] + # @return [void] + def set_autoload(parent, cname, abspath) + # $LOADED_FEATURES stores real paths since Ruby 2.4.4. We set and save the + # real path to be able to delete it from $LOADED_FEATURES on unload, and to + # be able to do a lookup later in Kernel#require for manual require calls. + realpath = File.realpath(abspath) + parent.autoload(cname, realpath) + if logger + if ruby?(realpath) + log("autoload set for #{cpath(parent, cname)}, to be loaded from #{realpath}") + else + log("autoload set for #{cpath(parent, cname)}, to be autovivified from #{realpath}") + end + end + + autoloads[realpath] = [parent, cname] + Registry.register_autoload(self, realpath) + + # See why in the documentation of Zeitwerk::Registry.inceptions. + unless parent.autoload?(cname) + Registry.register_inception(cpath(parent, cname), realpath, self) + end + end + + # @param parent [Module] + # @param cname [Symbol] + # @return [String, nil] + def autoload_for?(parent, cname) + strict_autoload_path(parent, cname) || Registry.inception?(cpath(parent, cname)) + end + + # The autoload? predicate takes into account the ancestor chain of the + # receiver, like const_defined? and other methods in the constants API do. + # + # For example, given + # + # class A + # autoload :X, "x.rb" + # end + # + # class B < A + # end + # + # B.autoload?(:X) returns "x.rb". + # + # We need a way to strictly check in parent ignoring ancestors. + # + # @param parent [Module] + # @param cname [Symbol] + # @return [String, nil] + if method(:autoload?).arity == 1 + def strict_autoload_path(parent, cname) + parent.autoload?(cname) if cdef?(parent, cname) + end + else + def strict_autoload_path(parent, cname) + parent.autoload?(cname, false) + end + end + + # This method is called this way because I prefer `preload` to be the method + # name to configure preloads in the public interface. + # + # @return [void] + def do_preload + preloads.each do |abspath| + do_preload_abspath(abspath) + end + end + + # @param abspath [String] + # @return [void] + def do_preload_abspath(abspath) + if ruby?(abspath) + do_preload_file(abspath) + elsif dir?(abspath) + do_preload_dir(abspath) + end + end + + # @param dir [String] + # @return [void] + def do_preload_dir(dir) + ls(dir) do |_basename, abspath| + do_preload_abspath(abspath) + end + end + + # @param file [String] + # @return [Boolean] + def do_preload_file(file) + log("preloading #{file}") if logger + require file + end + + # @param parent [Module] + # @param cname [Symbol] + # @return [String] + def cpath(parent, cname) + parent.equal?(Object) ? cname.to_s : "#{real_mod_name(parent)}::#{cname}" + end + + # @param dir [String] + # @yieldparam path [String, String] + # @return [void] + def ls(dir) + Dir.foreach(dir) do |basename| + next if basename.start_with?(".") + abspath = File.join(dir, basename) + yield basename, abspath unless ignored_paths.member?(abspath) + end + end + + # @param path [String] + # @return [Boolean] + def ruby?(path) + path.end_with?(".rb") + end + + # @param path [String] + # @return [Boolean] + def dir?(path) + File.directory?(path) + end + + # @param paths [>] + # @return [] + def expand_paths(paths) + paths.flatten.map! { |path| File.expand_path(path) } + end + + # @param glob_patterns [] + # @return [] + def expand_glob_patterns(glob_patterns) + # Note that Dir.glob works with regular file names just fine. That is, + # glob patterns technically need no wildcards. + glob_patterns.flat_map { |glob_pattern| Dir.glob(glob_pattern) } + end + + # @return [void] + def recompute_ignored_paths + ignored_paths.replace(expand_glob_patterns(ignored_glob_patterns)) + end + + # @param message [String] + # @return [void] + def log(message) + method_name = logger.respond_to?(:debug) ? :debug : :call + logger.send(method_name, "Zeitwerk@#{tag}: #{message}") + end + + def cdef?(parent, cname) + parent.const_defined?(cname, false) + end + + def register_explicit_namespace(cpath) + ExplicitNamespace.register(cpath, self) + end + + def raise_if_conflicting_directory(dir) + self.class.mutex.synchronize do + Registry.loaders.each do |loader| + if loader != self && loader.manages?(dir) + require "pp" + raise Error, + "loader\n\n#{pretty_inspect}\n\nwants to manage directory #{dir}," \ + " which is already managed by\n\n#{loader.pretty_inspect}\n" + EOS + end + end + end + end + + # @param parent [Module] + # @param cname [Symbol] + # @return [void] + def unload_autoload(parent, cname) + parent.send(:remove_const, cname) + log("autoload for #{cpath(parent, cname)} removed") if logger + end + + # @param parent [Module] + # @param cname [Symbol] + # @return [void] + def unload_cref(parent, cname) + parent.send(:remove_const, cname) + log("#{cpath(parent, cname)} unloaded") if logger + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/loader/callbacks.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/loader/callbacks.rb new file mode 100644 index 0000000000..f46f60a01b --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/loader/callbacks.rb @@ -0,0 +1,71 @@ +module Zeitwerk::Loader::Callbacks + include Zeitwerk::RealModName + + # Invoked from our decorated Kernel#require when a managed file is autoloaded. + # + # @private + # @param file [String] + # @return [void] + def on_file_autoloaded(file) + cref = autoloads.delete(file) + to_unload[cpath(*cref)] = [file, cref] if reloading_enabled? + Zeitwerk::Registry.unregister_autoload(file) + + if logger && cdef?(*cref) + log("constant #{cpath(*cref)} loaded from file #{file}") + elsif !cdef?(*cref) + raise Zeitwerk::NameError, "expected file #{file} to define constant #{cpath(*cref)}, but didn't" + end + end + + # Invoked from our decorated Kernel#require when a managed directory is + # autoloaded. + # + # @private + # @param dir [String] + # @return [void] + def on_dir_autoloaded(dir) + # Module#autoload does not serialize concurrent requires, and we handle + # directories ourselves, so the callback needs to account for concurrency. + # + # Multi-threading would introduce a race condition here in which thread t1 + # autovivifies the module, and while autoloads for its children are being + # set, thread t2 autoloads the same namespace. + # + # Without the mutex and subsequent delete call, t2 would reset the module. + # That not only would reassign the constant (undesirable per se) but, worse, + # the module object created by t2 wouldn't have any of the autoloads for its + # children, since t1 would have correctly deleted its lazy_subdirs entry. + mutex2.synchronize do + if cref = autoloads.delete(dir) + autovivified_module = cref[0].const_set(cref[1], Module.new) + log("module #{autovivified_module.name} autovivified from directory #{dir}") if logger + + to_unload[autovivified_module.name] = [dir, cref] if reloading_enabled? + + # We don't unregister `dir` in the registry because concurrent threads + # wouldn't find a loader associated to it in Kernel#require and would + # try to require the directory. Instead, we are going to keep track of + # these to be able to unregister later if eager loading. + autoloaded_dirs << dir + + on_namespace_loaded(autovivified_module) + end + end + end + + # Invoked when a class or module is created or reopened, either from the + # tracer or from module autovivification. If the namespace has matching + # subdirectories, we descend into them now. + # + # @private + # @param namespace [Module] + # @return [void] + def on_namespace_loaded(namespace) + if subdirs = lazy_subdirs.delete(real_mod_name(namespace)) + subdirs.each do |subdir| + set_autoloads_in_dir(subdir, namespace) + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/real_mod_name.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/real_mod_name.rb new file mode 100644 index 0000000000..cfd6c44fa7 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/real_mod_name.rb @@ -0,0 +1,21 @@ +module Zeitwerk::RealModName + UNBOUND_METHOD_MODULE_NAME = Module.instance_method(:name) + private_constant :UNBOUND_METHOD_MODULE_NAME + + # Returns the real name of the class or module, as set after the first + # constant to which it was assigned (or nil). + # + # The name method can be overridden, hence the indirection in this method. + # + # @param mod [Class, Module] + # @return [String, nil] + if UnboundMethod.method_defined?(:bind_call) + def real_mod_name(mod) + UNBOUND_METHOD_MODULE_NAME.bind_call(mod) + end + else + def real_mod_name(mod) + UNBOUND_METHOD_MODULE_NAME.bind(mod).call + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/registry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/registry.rb new file mode 100644 index 0000000000..3f8e1d43dd --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/registry.rb @@ -0,0 +1,147 @@ +# frozen_string_literal: true + +module Zeitwerk + module Registry # :nodoc: all + class << self + # Keeps track of all loaders. Useful to broadcast messages and to prevent + # them from being garbage collected. + # + # @private + # @return [] + attr_reader :loaders + + # Registers loaders created with `for_gem` to make the method idempotent + # in case of reload. + # + # @private + # @return [{String => Zeitwerk::Loader}] + attr_reader :loaders_managing_gems + + # Maps real paths to the loaders responsible for them. + # + # This information is used by our decorated `Kernel#require` to be able to + # invoke callbacks and autovivify modules. + # + # @private + # @return [{String => Zeitwerk::Loader}] + attr_reader :autoloads + + # This hash table addresses an edge case in which an autoload is ignored. + # + # For example, let's suppose we want to autoload in a gem like this: + # + # # lib/my_gem.rb + # loader = Zeitwerk::Loader.new + # loader.push_dir(__dir__) + # loader.setup + # + # module MyGem + # end + # + # if you require "my_gem", as Bundler would do, this happens while setting + # up autoloads: + # + # 1. Object.autoload?(:MyGem) returns `nil` because the autoload for + # the constant is issued by Zeitwerk while the same file is being + # required. + # 2. The constant `MyGem` is undefined while setup runs. + # + # Therefore, a directory `lib/my_gem` would autovivify a module according to + # the existing information. But that would be wrong. + # + # To overcome this fundamental limitation, we keep track of the constant + # paths that are in this situation ---in the example above, "MyGem"--- and + # take this collection into account for the autovivification logic. + # + # Note that you cannot generally address this by moving the setup code + # below the constant definition, because we want libraries to be able to + # use managed constants in the module body: + # + # module MyGem + # include MyConcern + # end + # + # @private + # @return [{String => (String, Zeitwerk::Loader)}] + attr_reader :inceptions + + # Registers a loader. + # + # @private + # @param loader [Zeitwerk::Loader] + # @return [void] + def register_loader(loader) + loaders << loader + end + + # This method returns always a loader, the same instance for the same root + # file. That is how Zeitwerk::Loader.for_gem is idempotent. + # + # @private + # @param root_file [String] + # @return [Zeitwerk::Loader] + def loader_for_gem(root_file) + loaders_managing_gems[root_file] ||= begin + Loader.new.tap do |loader| + loader.tag = File.basename(root_file, ".rb") + loader.inflector = GemInflector.new(root_file) + loader.push_dir(File.dirname(root_file)) + end + end + end + + # @private + # @param loader [Zeitwerk::Loader] + # @param realpath [String] + # @return [void] + def register_autoload(loader, realpath) + autoloads[realpath] = loader + end + + # @private + # @param realpath [String] + # @return [void] + def unregister_autoload(realpath) + autoloads.delete(realpath) + end + + # @private + # @param cpath [String] + # @param realpath [String] + # @param loader [Zeitwerk::Loader] + # @return [void] + def register_inception(cpath, realpath, loader) + inceptions[cpath] = [realpath, loader] + end + + # @private + # @param cpath [String] + # @return [String, nil] + def inception?(cpath) + if pair = inceptions[cpath] + pair.first + end + end + + # @private + # @param path [String] + # @return [Zeitwerk::Loader, nil] + def loader_for(path) + autoloads[path] + end + + # @private + # @param loader [Zeitwerk::Loader] + # @return [void] + def on_unload(loader) + autoloads.delete_if { |_path, object| object == loader } + inceptions.delete_if { |_cpath, (_path, object)| object == loader } + end + end + + @loaders = [] + @loaders_managing_gems = {} + @autoloads = {} + @inceptions = {} + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/version.rb new file mode 100644 index 0000000000..9bc6e3ca36 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.2.1/lib/zeitwerk/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module Zeitwerk + VERSION = "2.2.1" +end