diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/actionable_error.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/actionable_error.rb deleted file mode 100644 index 7db14cd178..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/actionable_error.rb +++ /dev/null @@ -1,48 +0,0 @@ -# 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-6.1.7.3/lib/active_support/array_inquirer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/array_inquirer.rb deleted file mode 100644 index 0cbba0b6df..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/array_inquirer.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/symbol/starts_ends_with" - -module ActiveSupport - # Wrapping an array in an +ArrayInquirer+ gives a friendlier way to check - # its string-like contents: - # - # variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet]) - # - # variants.phone? # => true - # variants.tablet? # => true - # variants.desktop? # => false - class ArrayInquirer < Array - # Passes each element of +candidates+ collection to ArrayInquirer collection. - # The method returns true if any element from the ArrayInquirer collection - # is equal to the stringified or symbolized form of any element in the +candidates+ collection. - # - # If +candidates+ collection is not given, method returns true. - # - # variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet]) - # - # variants.any? # => true - # variants.any?(:phone, :tablet) # => true - # variants.any?('phone', 'desktop') # => true - # variants.any?(:desktop, :watch) # => false - def any?(*candidates) - if candidates.none? - super - else - candidates.any? do |candidate| - include?(candidate.to_sym) || include?(candidate.to_s) - end - end - end - - private - def respond_to_missing?(name, include_private = false) - name.end_with?("?") || super - end - - def method_missing(name, *args) - if name.end_with?("?") - any?(name[0..-2]) - else - super - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/backtrace_cleaner.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/backtrace_cleaner.rb deleted file mode 100644 index 03c7dc75d6..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/backtrace_cleaner.rb +++ /dev/null @@ -1,131 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # Backtraces often include many lines that are not relevant for the context - # under review. This makes it hard to find the signal amongst the backtrace - # noise, and adds debugging time. With a BacktraceCleaner, filters and - # silencers are used to remove the noisy lines, so that only the most relevant - # lines remain. - # - # Filters are used to modify lines of data, while silencers are used to remove - # lines entirely. The typical filter use case is to remove lengthy path - # information from the start of each line, and view file paths relevant to the - # app directory instead of the file system root. The typical silencer use case - # is to exclude the output of a noisy library from the backtrace, so that you - # can focus on the rest. - # - # bc = ActiveSupport::BacktraceCleaner.new - # bc.add_filter { |line| line.gsub(Rails.root.to_s, '') } # strip the Rails.root prefix - # bc.add_silencer { |line| /puma|rubygems/.match?(line) } # skip any lines from puma or rubygems - # bc.clean(exception.backtrace) # perform the cleanup - # - # To reconfigure an existing BacktraceCleaner (like the default one in Rails) - # and show as much data as possible, you can always call - # BacktraceCleaner#remove_silencers!, which will restore the - # backtrace to a pristine state. If you need to reconfigure an existing - # BacktraceCleaner so that it does not filter or modify the paths of any lines - # of the backtrace, you can call BacktraceCleaner#remove_filters! - # These two methods will give you a completely untouched backtrace. - # - # Inspired by the Quiet Backtrace gem by thoughtbot. - class BacktraceCleaner - def initialize - @filters, @silencers = [], [] - add_gem_filter - add_gem_silencer - add_stdlib_silencer - end - - # Returns the backtrace after all filters and silencers have been run - # against it. Filters run first, then silencers. - def clean(backtrace, kind = :silent) - filtered = filter_backtrace(backtrace) - - case kind - when :silent - silence(filtered) - when :noise - noise(filtered) - else - filtered - end - end - alias :filter :clean - - # Adds a filter from the block provided. Each line in the backtrace will be - # mapped against this filter. - # - # # Will turn "/my/rails/root/app/models/person.rb" into "/app/models/person.rb" - # backtrace_cleaner.add_filter { |line| line.gsub(Rails.root, '') } - def add_filter(&block) - @filters << block - end - - # Adds a silencer from the block provided. If the silencer returns +true+ - # for a given line, it will be excluded from the clean backtrace. - # - # # Will reject all lines that include the word "puma", like "/gems/puma/server.rb" or "/app/my_puma_server/rb" - # backtrace_cleaner.add_silencer { |line| /puma/.match?(line) } - def add_silencer(&block) - @silencers << block - end - - # Removes all silencers, but leaves in the filters. Useful if your - # context of debugging suddenly expands as you suspect a bug in one of - # the libraries you use. - def remove_silencers! - @silencers = [] - end - - # Removes all filters, but leaves in the silencers. Useful if you suddenly - # need to see entire filepaths in the backtrace that you had already - # filtered out. - def remove_filters! - @filters = [] - end - - private - FORMATTED_GEMS_PATTERN = /\A[^\/]+ \([\w.]+\) / - - def add_gem_filter - gems_paths = (Gem.path | [Gem.default_dir]).map { |p| Regexp.escape(p) } - return if gems_paths.empty? - - gems_regexp = %r{\A(#{gems_paths.join('|')})/(bundler/)?gems/([^/]+)-([\w.]+)/(.*)} - gems_result = '\3 (\4) \5' - add_filter { |line| line.sub(gems_regexp, gems_result) } - end - - def add_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) } - end - - backtrace - end - - def silence(backtrace) - @silencers.each do |s| - backtrace = backtrace.reject { |line| s.call(line) } - end - - backtrace - end - - def noise(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-6.1.7.3/lib/active_support/benchmarkable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/benchmarkable.rb deleted file mode 100644 index abd0d59d9e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/benchmarkable.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/benchmark" -require "active_support/core_ext/hash/keys" - -module ActiveSupport - module Benchmarkable - # Allows you to measure the execution time of a block in a template and - # records the result to the log. Wrap this block around expensive operations - # or possible bottlenecks to get a time reading for the operation. For - # example, let's say you thought your file processing method was taking too - # long; you could wrap it in a benchmark block. - # - # <% benchmark 'Process data files' do %> - # <%= expensive_files_operation %> - # <% end %> - # - # That would add something like "Process data files (345.2ms)" to the log, - # which you can then use to compare timings when optimizing your code. - # - # You may give an optional logger level (:debug, :info, - # :warn, :error) as the :level option. The - # default logger level value is :info. - # - # <% benchmark 'Low-level files', level: :debug do %> - # <%= lowlevel_files_operation %> - # <% end %> - # - # Finally, you can pass true as the third argument to silence all log - # activity (other than the timing information) from inside the block. This - # is great for boiling down a noisy block to just a single statement that - # produces one log line: - # - # <% benchmark 'Process data files', level: :info, silence: true do %> - # <%= expensive_and_chatty_files_operation %> - # <% end %> - def benchmark(message = "Benchmarking", options = {}) - if logger - options.assert_valid_keys(:level, :silence) - options[:level] ||= :info - - result = nil - ms = Benchmark.ms { result = options[:silence] ? logger.silence { yield } : yield } - logger.public_send(options[:level], "%s (%.1fms)" % [ message, ms ]) - result - else - yield - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/builder.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/builder.rb deleted file mode 100644 index 3fa7e6b26d..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/builder.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -begin - require "builder" -rescue LoadError => e - $stderr.puts "You don't have builder installed in your application. Please add it to your Gemfile and run bundle install" - raise e -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb deleted file mode 100644 index 1a55f8af35..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/callbacks.rb +++ /dev/null @@ -1,862 +0,0 @@ -# frozen_string_literal: true - -require "active_support/concern" -require "active_support/descendants_tracker" -require "active_support/core_ext/array/extract_options" -require "active_support/core_ext/class/attribute" -require "active_support/core_ext/string/filters" -require "thread" - -module ActiveSupport - # Callbacks are code hooks that are run at key points in an object's life cycle. - # The typical use case is to have a base class define a set of callbacks - # relevant to the other functionality it supplies, so that subclasses can - # install callbacks that enhance or modify the base functionality without - # needing to override or redefine methods of the base class. - # - # Mixing in this module allows you to define the events in the object's - # life cycle that will support callbacks (via +ClassMethods.define_callbacks+), - # set the instance methods, procs, or callback objects to be called (via - # +ClassMethods.set_callback+), and run the installed callbacks at the - # appropriate times (via +run_callbacks+). - # - # By default callbacks are halted by throwing +:abort+. - # See +ClassMethods.define_callbacks+ for details. - # - # Three kinds of callbacks are supported: before callbacks, run before a - # certain event; after callbacks, run after the event; and around callbacks, - # blocks that surround the event, triggering it when they yield. Callback code - # can be contained in instance methods, procs or lambdas, or callback objects - # that respond to certain predetermined methods. See +ClassMethods.set_callback+ - # for details. - # - # class Record - # include ActiveSupport::Callbacks - # define_callbacks :save - # - # def save - # run_callbacks :save do - # puts "- save" - # end - # end - # end - # - # class PersonRecord < Record - # set_callback :save, :before, :saving_message - # def saving_message - # puts "saving..." - # end - # - # set_callback :save, :after do |object| - # puts "saved" - # end - # end - # - # person = PersonRecord.new - # person.save - # - # Output: - # saving... - # - save - # saved - module Callbacks - extend Concern - - included do - extend ActiveSupport::DescendantsTracker - class_attribute :__callbacks, instance_writer: false, default: {} - end - - CALLBACK_FILTER_TYPES = [:before, :after, :around] - - # Runs the callbacks for the given event. - # - # Calls the before and around callbacks in the order they were set, yields - # the block (if given one), and then runs the after callbacks in reverse - # order. - # - # If the callback chain was halted, returns +false+. Otherwise returns the - # result of the block, +nil+ if no callbacks have been set, or +true+ - # if callbacks have been set but no block is given. - # - # run_callbacks :save do - # save - # end - # - #-- - # - # As this method is used in many places, and often wraps large portions of - # user code, it has an additional design goal of minimizing its impact on - # the visible call stack. An exception from inside a :before or :after - # callback can be as noisy as it likes -- but when control has passed - # smoothly through and into the supplied block, we want as little evidence - # as possible that we were here. - def run_callbacks(kind) - callbacks = __callbacks[kind.to_sym] - - if callbacks.empty? - yield if block_given? - else - env = Filters::Environment.new(self, false, nil) - next_sequence = callbacks.compile - - # Common case: no 'around' callbacks defined - if next_sequence.final? - next_sequence.invoke_before(env) - env.value = !env.halted && (!block_given? || yield) - next_sequence.invoke_after(env) - env.value - else - invoke_sequence = Proc.new do - skipped = nil - - while true - current = next_sequence - current.invoke_before(env) - if current.final? - env.value = !env.halted && (!block_given? || yield) - elsif current.skip?(env) - (skipped ||= []) << current - next_sequence = next_sequence.nested - next - else - next_sequence = next_sequence.nested - begin - target, block, method, *arguments = current.expand_call_template(env, invoke_sequence) - target.send(method, *arguments, &block) - ensure - next_sequence = current - end - end - current.invoke_after(env) - skipped.pop.invoke_after(env) while skipped&.first - break env.value - end - end - - invoke_sequence.call - end - end - end - - private - # A hook invoked every time a before callback is halted. - # This can be overridden in ActiveSupport::Callbacks implementors in order - # to provide better debugging/logging. - def halted_callback_hook(filter, name) - end - - module Conditionals # :nodoc: - class Value - def initialize(&block) - @block = block - end - def call(target, value); @block.call(value); end - end - end - - module Filters - Environment = Struct.new(:target, :halted, :value) - - class Before - def self.build(callback_sequence, user_callback, user_conditions, chain_config, filter, name) - halted_lambda = chain_config[:terminator] - - if user_conditions.any? - halting_and_conditional(callback_sequence, user_callback, user_conditions, halted_lambda, filter, name) - else - halting(callback_sequence, user_callback, halted_lambda, filter, name) - end - end - - def self.halting_and_conditional(callback_sequence, user_callback, user_conditions, halted_lambda, filter, name) - callback_sequence.before do |env| - target = env.target - value = env.value - halted = env.halted - - if !halted && user_conditions.all? { |c| c.call(target, value) } - result_lambda = -> { user_callback.call target, value } - env.halted = halted_lambda.call(target, result_lambda) - if env.halted - target.send :halted_callback_hook, filter, name - end - end - - env - end - end - private_class_method :halting_and_conditional - - def self.halting(callback_sequence, user_callback, halted_lambda, filter, name) - callback_sequence.before do |env| - target = env.target - value = env.value - halted = env.halted - - unless halted - result_lambda = -> { user_callback.call target, value } - env.halted = halted_lambda.call(target, result_lambda) - if env.halted - target.send :halted_callback_hook, filter, name - end - end - - env - end - end - private_class_method :halting - end - - class After - def self.build(callback_sequence, user_callback, user_conditions, chain_config) - if chain_config[:skip_after_callbacks_if_terminated] - if user_conditions.any? - halting_and_conditional(callback_sequence, user_callback, user_conditions) - else - halting(callback_sequence, user_callback) - end - else - if user_conditions.any? - conditional callback_sequence, user_callback, user_conditions - else - simple callback_sequence, user_callback - end - end - end - - def self.halting_and_conditional(callback_sequence, user_callback, user_conditions) - callback_sequence.after do |env| - target = env.target - value = env.value - halted = env.halted - - if !halted && user_conditions.all? { |c| c.call(target, value) } - user_callback.call target, value - end - - env - end - end - private_class_method :halting_and_conditional - - def self.halting(callback_sequence, user_callback) - callback_sequence.after do |env| - unless env.halted - user_callback.call env.target, env.value - end - - env - end - end - private_class_method :halting - - def self.conditional(callback_sequence, user_callback, user_conditions) - callback_sequence.after do |env| - target = env.target - value = env.value - - if user_conditions.all? { |c| c.call(target, value) } - user_callback.call target, value - end - - env - end - end - private_class_method :conditional - - def self.simple(callback_sequence, user_callback) - callback_sequence.after do |env| - user_callback.call env.target, env.value - - env - end - end - private_class_method :simple - end - end - - class Callback #:nodoc:# - def self.build(chain, filter, kind, options) - if filter.is_a?(String) - raise ArgumentError, <<-MSG.squish - Passing string to define a callback is not supported. See the `.set_callback` - documentation to see supported values. - MSG - end - - new chain.name, filter, kind, options, chain.config - end - - attr_accessor :kind, :name - attr_reader :chain_config - - def initialize(name, filter, kind, options, chain_config) - @chain_config = chain_config - @name = name - @kind = kind - @filter = filter - @key = compute_identifier filter - @if = check_conditionals(options[:if]) - @unless = check_conditionals(options[:unless]) - end - - def filter; @key; end - def raw_filter; @filter; end - - def merge_conditional_options(chain, if_option:, unless_option:) - options = { - if: @if.dup, - unless: @unless.dup - } - - options[:if].concat Array(unless_option) - options[:unless].concat Array(if_option) - - self.class.build chain, @filter, @kind, options - end - - def matches?(_kind, _filter) - @kind == _kind && filter == _filter - end - - def duplicates?(other) - case @filter - when Symbol - matches?(other.kind, other.filter) - else - false - end - end - - # Wraps code with filter - def apply(callback_sequence) - user_conditions = conditions_lambdas - user_callback = CallTemplate.build(@filter, self) - - case kind - when :before - Filters::Before.build(callback_sequence, user_callback.make_lambda, user_conditions, chain_config, @filter, name) - when :after - Filters::After.build(callback_sequence, user_callback.make_lambda, user_conditions, chain_config) - when :around - callback_sequence.around(user_callback, user_conditions) - end - end - - def current_scopes - Array(chain_config[:scope]).map { |s| public_send(s) } - end - - private - EMPTY_ARRAY = [].freeze - private_constant :EMPTY_ARRAY - - def check_conditionals(conditionals) - return EMPTY_ARRAY if conditionals.blank? - - conditionals = Array(conditionals) - if conditionals.any? { |c| c.is_a?(String) } - raise ArgumentError, <<-MSG.squish - Passing string to be evaluated in :if and :unless conditional - options is not supported. Pass a symbol for an instance method, - or a lambda, proc or block, instead. - MSG - end - - conditionals.freeze - end - - def compute_identifier(filter) - case filter - when ::Proc - filter.object_id - else - filter - end - end - - def conditions_lambdas - @if.map { |c| CallTemplate.build(c, self).make_lambda } + - @unless.map { |c| CallTemplate.build(c, self).inverted_lambda } - end - end - - # A future invocation of user-supplied code (either as a callback, - # or a condition filter). - class CallTemplate # :nodoc: - def initialize(target, method, arguments, block) - @override_target = target - @method_name = method - @arguments = arguments - @override_block = block - end - - # Return the parts needed to make this call, with the given - # input values. - # - # Returns an array of the form: - # - # [target, block, method, *arguments] - # - # This array can be used as such: - # - # target.send(method, *arguments, &block) - # - # The actual invocation is left up to the caller to minimize - # call stack pollution. - def expand(target, value, block) - expanded = [@override_target || target, @override_block || block, @method_name] - - @arguments.each do |arg| - case arg - when :value then expanded << value - when :target then expanded << target - when :block then expanded << (block || raise(ArgumentError)) - end - end - - expanded - end - - # Return a lambda that will make this call when given the input - # values. - def make_lambda - lambda do |target, value, &block| - target, block, method, *arguments = expand(target, value, block) - target.send(method, *arguments, &block) - end - end - - # Return a lambda that will make this call when given the input - # values, but then return the boolean inverse of that result. - def inverted_lambda - lambda do |target, value, &block| - target, block, method, *arguments = expand(target, value, block) - ! target.send(method, *arguments, &block) - end - end - - # Filters support: - # - # Symbols:: A method to call. - # Procs:: A proc to call with the object. - # Objects:: An object with a before_foo method on it to call. - # - # All of these objects are converted into a CallTemplate and handled - # the same after this point. - def self.build(filter, callback) - case filter - when Symbol - new(nil, filter, [], nil) - when Conditionals::Value - new(filter, :call, [:target, :value], nil) - when ::Proc - if filter.arity > 1 - new(nil, :instance_exec, [:target, :block], filter) - elsif filter.arity > 0 - new(nil, :instance_exec, [:target], filter) - else - new(nil, :instance_exec, [], filter) - end - else - method_to_call = callback.current_scopes.join("_") - - new(filter, method_to_call, [:target], nil) - end - end - end - - # Execute before and after filters in a sequence instead of - # chaining them with nested lambda calls, see: - # https://github.com/rails/rails/issues/18011 - class CallbackSequence # :nodoc: - def initialize(nested = nil, call_template = nil, user_conditions = nil) - @nested = nested - @call_template = call_template - @user_conditions = user_conditions - - @before = [] - @after = [] - end - - def before(&before) - @before.unshift(before) - self - end - - def after(&after) - @after.push(after) - self - end - - def around(call_template, user_conditions) - CallbackSequence.new(self, call_template, user_conditions) - end - - def skip?(arg) - arg.halted || !@user_conditions.all? { |c| c.call(arg.target, arg.value) } - end - - attr_reader :nested - - def final? - !@call_template - end - - def expand_call_template(arg, block) - @call_template.expand(arg.target, arg.value, block) - end - - def invoke_before(arg) - @before.each { |b| b.call(arg) } - end - - def invoke_after(arg) - @after.each { |a| a.call(arg) } - end - end - - class CallbackChain #:nodoc:# - include Enumerable - - attr_reader :name, :config - - def initialize(name, config) - @name = name - @config = { - scope: [:kind], - terminator: default_terminator - }.merge!(config) - @chain = [] - @callbacks = nil - @mutex = Mutex.new - end - - def each(&block); @chain.each(&block); end - def index(o); @chain.index(o); end - def empty?; @chain.empty?; end - - def insert(index, o) - @callbacks = nil - @chain.insert(index, o) - end - - def delete(o) - @callbacks = nil - @chain.delete(o) - end - - def clear - @callbacks = nil - @chain.clear - self - end - - def initialize_copy(other) - @callbacks = nil - @chain = other.chain.dup - @mutex = Mutex.new - end - - def compile - @callbacks || @mutex.synchronize do - final_sequence = CallbackSequence.new - @callbacks ||= @chain.reverse.inject(final_sequence) do |callback_sequence, callback| - callback.apply callback_sequence - end - end - end - - def append(*callbacks) - callbacks.each { |c| append_one(c) } - end - - def prepend(*callbacks) - callbacks.each { |c| prepend_one(c) } - end - - protected - attr_reader :chain - - private - def append_one(callback) - @callbacks = nil - remove_duplicates(callback) - @chain.push(callback) - end - - def prepend_one(callback) - @callbacks = nil - remove_duplicates(callback) - @chain.unshift(callback) - end - - def remove_duplicates(callback) - @callbacks = nil - @chain.delete_if { |c| callback.duplicates?(c) } - end - - def default_terminator - Proc.new do |target, result_lambda| - terminate = true - catch(:abort) do - result_lambda.call - terminate = false - end - terminate - end - end - end - - module ClassMethods - def normalize_callback_params(filters, block) # :nodoc: - type = CALLBACK_FILTER_TYPES.include?(filters.first) ? filters.shift : :before - options = filters.extract_options! - filters.unshift(block) if block - [type, filters, options.dup] - end - - # This is used internally to append, prepend and skip callbacks to the - # CallbackChain. - def __update_callbacks(name) #:nodoc: - ([self] + ActiveSupport::DescendantsTracker.descendants(self)).reverse_each do |target| - chain = target.get_callbacks name - yield target, chain.dup - end - end - - # Install a callback for the given event. - # - # set_callback :save, :before, :before_method - # set_callback :save, :after, :after_method, if: :condition - # set_callback :save, :around, ->(r, block) { stuff; result = block.call; stuff } - # - # The second argument indicates whether the callback is to be run +:before+, - # +:after+, or +:around+ the event. If omitted, +:before+ is assumed. This - # means the first example above can also be written as: - # - # set_callback :save, :before_method - # - # The callback can be specified as a symbol naming an instance method; as a - # proc, lambda, or block; or as an object that responds to a certain method - # determined by the :scope argument to +define_callbacks+. - # - # If a proc, lambda, or block is given, its body is evaluated in the context - # of the current object. It can also optionally accept the current object as - # an argument. - # - # Before and around callbacks are called in the order that they are set; - # after callbacks are called in the reverse order. - # - # Around callbacks can access the return value from the event, if it - # wasn't halted, from the +yield+ call. - # - # ===== Options - # - # * :if - A symbol or an array of symbols, each naming an instance - # method or a proc; the callback will be called only when they all return - # a true value. - # - # If a proc is given, its body is evaluated in the context of the - # current object. It can also optionally accept the current object as - # an argument. - # * :unless - A symbol or an array of symbols, each naming an - # instance method or a proc; the callback will be called only when they - # all return a false value. - # - # If a proc is given, its body is evaluated in the context of the - # current object. It can also optionally accept the current object as - # an argument. - # * :prepend - If +true+, the callback will be prepended to the - # existing chain rather than appended. - def set_callback(name, *filter_list, &block) - type, filters, options = normalize_callback_params(filter_list, block) - - self_chain = get_callbacks name - mapped = filters.map do |filter| - Callback.build(self_chain, filter, type, options) - end - - __update_callbacks(name) do |target, chain| - options[:prepend] ? chain.prepend(*mapped) : chain.append(*mapped) - target.set_callbacks name, chain - end - end - - # Skip a previously set callback. Like +set_callback+, :if or - # :unless options may be passed in order to control when the - # callback is skipped. - # - # class Writer < Person - # skip_callback :validate, :before, :check_membership, if: -> { age > 18 } - # end - # - # An ArgumentError will be raised if the callback has not - # already been set (unless the :raise option is set to false). - def skip_callback(name, *filter_list, &block) - type, filters, options = normalize_callback_params(filter_list, block) - - options[:raise] = true unless options.key?(:raise) - - __update_callbacks(name) do |target, chain| - filters.each do |filter| - callback = chain.find { |c| c.matches?(type, filter) } - - if !callback && options[:raise] - raise ArgumentError, "#{type.to_s.capitalize} #{name} callback #{filter.inspect} has not been defined" - end - - if callback && (options.key?(:if) || options.key?(:unless)) - new_callback = callback.merge_conditional_options(chain, if_option: options[:if], unless_option: options[:unless]) - chain.insert(chain.index(callback), new_callback) - end - - chain.delete(callback) - end - target.set_callbacks name, chain - end - end - - # Remove all set callbacks for the given event. - def reset_callbacks(name) - callbacks = get_callbacks name - - ActiveSupport::DescendantsTracker.descendants(self).each do |target| - chain = target.get_callbacks(name).dup - callbacks.each { |c| chain.delete(c) } - target.set_callbacks name, chain - end - - set_callbacks(name, callbacks.dup.clear) - end - - # Define sets of events in the object life cycle that support callbacks. - # - # define_callbacks :validate - # define_callbacks :initialize, :save, :destroy - # - # ===== Options - # - # * :terminator - Determines when a before filter will halt the - # callback chain, preventing following before and around callbacks from - # being called and the event from being triggered. - # This should be a lambda to be executed. - # The current object and the result lambda of the callback will be provided - # to the terminator lambda. - # - # define_callbacks :validate, terminator: ->(target, result_lambda) { result_lambda.call == false } - # - # In this example, if any before validate callbacks returns +false+, - # any successive before and around callback is not executed. - # - # The default terminator halts the chain when a callback throws +:abort+. - # - # * :skip_after_callbacks_if_terminated - Determines if after - # callbacks should be terminated by the :terminator option. By - # default after callbacks are executed no matter if callback chain was - # terminated or not. This option has no effect if :terminator - # option is set to +nil+. - # - # * :scope - Indicates which methods should be executed when an - # object is used as a callback. - # - # class Audit - # def before(caller) - # puts 'Audit: before is called' - # end - # - # def before_save(caller) - # puts 'Audit: before_save is called' - # end - # end - # - # class Account - # include ActiveSupport::Callbacks - # - # define_callbacks :save - # set_callback :save, :before, Audit.new - # - # def save - # run_callbacks :save do - # puts 'save in main' - # end - # end - # end - # - # In the above case whenever you save an account the method - # Audit#before will be called. On the other hand - # - # define_callbacks :save, scope: [:kind, :name] - # - # would trigger Audit#before_save instead. That's constructed - # by calling #{kind}_#{name} on the given instance. In this - # case "kind" is "before" and "name" is "save". In this context +:kind+ - # and +:name+ have special meanings: +:kind+ refers to the kind of - # callback (before/after/around) and +:name+ refers to the method on - # which callbacks are being defined. - # - # A declaration like - # - # define_callbacks :save, scope: [:name] - # - # would call Audit#save. - # - # ===== Notes - # - # +names+ passed to +define_callbacks+ must not end with - # !, ? or =. - # - # Calling +define_callbacks+ multiple times with the same +names+ will - # overwrite previous callbacks registered with +set_callback+. - def define_callbacks(*names) - options = names.extract_options! - - names.each do |name| - name = name.to_sym - - ([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) - run_callbacks #{name.inspect}, &block - end - - def self._#{name}_callbacks - get_callbacks(#{name.inspect}) - end - - def self._#{name}_callbacks=(value) - set_callbacks(#{name.inspect}, value) - end - - def _#{name}_callbacks - __callbacks[#{name.inspect}] - end - RUBY - end - end - - protected - def get_callbacks(name) # :nodoc: - __callbacks[name.to_sym] - end - - if Module.instance_method(:method_defined?).arity == 1 # Ruby 2.5 and older - def set_callbacks(name, callbacks) # :nodoc: - self.__callbacks = __callbacks.merge(name.to_sym => callbacks) - end - else # Ruby 2.6 and newer - def set_callbacks(name, callbacks) # :nodoc: - unless singleton_class.method_defined?(:__callbacks, false) - self.__callbacks = __callbacks.dup - end - self.__callbacks[name.to_sym] = callbacks - self.__callbacks - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/concern.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/concern.rb deleted file mode 100644 index e88862bfb4..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/concern.rb +++ /dev/null @@ -1,215 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # A typical module looks like this: - # - # module M - # def self.included(base) - # base.extend ClassMethods - # base.class_eval do - # scope :disabled, -> { where(disabled: true) } - # end - # end - # - # module ClassMethods - # ... - # end - # end - # - # By using ActiveSupport::Concern the above module could instead be - # written as: - # - # require "active_support/concern" - # - # module M - # extend ActiveSupport::Concern - # - # included do - # scope :disabled, -> { where(disabled: true) } - # end - # - # class_methods do - # ... - # end - # end - # - # Moreover, it gracefully handles module dependencies. Given a +Foo+ module - # and a +Bar+ module which depends on the former, we would typically write the - # following: - # - # module Foo - # def self.included(base) - # base.class_eval do - # def self.method_injected_by_foo - # ... - # end - # end - # end - # end - # - # module Bar - # def self.included(base) - # base.method_injected_by_foo - # end - # end - # - # class Host - # include Foo # We need to include this dependency for Bar - # include Bar # Bar is the module that Host really needs - # end - # - # But why should +Host+ care about +Bar+'s dependencies, namely +Foo+? We - # could try to hide these from +Host+ directly including +Foo+ in +Bar+: - # - # module Bar - # include Foo - # def self.included(base) - # base.method_injected_by_foo - # end - # end - # - # class Host - # include Bar - # end - # - # Unfortunately this won't work, since when +Foo+ is included, its base - # is the +Bar+ module, not the +Host+ class. With ActiveSupport::Concern, - # module dependencies are properly resolved: - # - # require "active_support/concern" - # - # module Foo - # extend ActiveSupport::Concern - # included do - # def self.method_injected_by_foo - # ... - # end - # end - # end - # - # module Bar - # extend ActiveSupport::Concern - # include Foo - # - # included do - # self.method_injected_by_foo - # end - # end - # - # class Host - # include Bar # It works, now Bar takes care of its dependencies - # end - # - # === Prepending concerns - # - # Just like include, concerns also support prepend with a corresponding - # prepended do callback. module ClassMethods or class_methods do are - # prepended as well. - # - # prepend is also used for any dependencies. - module Concern - class MultipleIncludedBlocks < StandardError #:nodoc: - def initialize - super "Cannot define multiple 'included' blocks for a Concern" - end - end - - class MultiplePrependBlocks < StandardError #:nodoc: - def initialize - super "Cannot define multiple 'prepended' blocks for a Concern" - end - end - - def self.extended(base) #:nodoc: - base.instance_variable_set(:@_dependencies, []) - end - - def append_features(base) #:nodoc: - if base.instance_variable_defined?(:@_dependencies) - base.instance_variable_get(:@_dependencies) << self - false - else - return false if base < self - @_dependencies.each { |dep| base.include(dep) } - super - base.extend const_get(:ClassMethods) if const_defined?(:ClassMethods) - base.class_eval(&@_included_block) if instance_variable_defined?(:@_included_block) - end - end - - def prepend_features(base) #:nodoc: - if base.instance_variable_defined?(:@_dependencies) - base.instance_variable_get(:@_dependencies).unshift self - false - else - return false if base < self - @_dependencies.each { |dep| base.prepend(dep) } - super - base.singleton_class.prepend const_get(:ClassMethods) if const_defined?(:ClassMethods) - base.class_eval(&@_prepended_block) if instance_variable_defined?(:@_prepended_block) - end - end - - # Evaluate given block in context of base class, - # so that you can write class macros here. - # When you define more than one +included+ block, it raises an exception. - def included(base = nil, &block) - if base.nil? - if instance_variable_defined?(:@_included_block) - if @_included_block.source_location != block.source_location - raise MultipleIncludedBlocks - end - else - @_included_block = block - end - else - super - end - end - - # Evaluate given block in context of base class, - # so that you can write class macros here. - # When you define more than one +prepended+ block, it raises an exception. - def prepended(base = nil, &block) - if base.nil? - if instance_variable_defined?(:@_prepended_block) - if @_prepended_block.source_location != block.source_location - raise MultiplePrependBlocks - end - else - @_prepended_block = block - end - else - super - end - end - - # Define class methods from given block. - # You can define private class methods as well. - # - # module Example - # extend ActiveSupport::Concern - # - # class_methods do - # def foo; puts 'foo'; end - # - # private - # def bar; puts 'bar'; end - # end - # end - # - # class Buzz - # include Example - # end - # - # Buzz.foo # => "foo" - # Buzz.bar # => private method 'bar' called for Buzz:Class(NoMethodError) - def class_methods(&class_methods_module_definition) - mod = const_defined?(:ClassMethods, false) ? - const_get(:ClassMethods) : - const_set(:ClassMethods, Module.new) - - mod.module_eval(&class_methods_module_definition) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/configurable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/configurable.rb deleted file mode 100644 index 92bd411df5..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/configurable.rb +++ /dev/null @@ -1,146 +0,0 @@ -# frozen_string_literal: true - -require "active_support/concern" -require "active_support/ordered_options" - -module ActiveSupport - # Configurable provides a config method to store and retrieve - # configuration options as an OrderedOptions. - module Configurable - extend ActiveSupport::Concern - - class Configuration < ActiveSupport::InheritableOptions - def compile_methods! - self.class.compile_methods!(keys) - end - - # Compiles reader methods so we don't have to go through method_missing. - def self.compile_methods!(keys) - keys.reject { |m| method_defined?(m) }.each do |key| - class_eval <<-RUBY, __FILE__, __LINE__ + 1 - def #{key}; _get(#{key.inspect}); end - RUBY - end - end - end - - module ClassMethods - def config - @_config ||= if respond_to?(:superclass) && superclass.respond_to?(:config) - superclass.config.inheritable_copy - else - # create a new "anonymous" class that will host the compiled reader methods - Class.new(Configuration).new - end - end - - def configure - yield config - end - - # Allows you to add shortcut so that you don't have to refer to attribute - # through config. Also look at the example for config to contrast. - # - # Defines both class and instance config accessors. - # - # class User - # include ActiveSupport::Configurable - # config_accessor :allowed_access - # end - # - # User.allowed_access # => nil - # User.allowed_access = false - # User.allowed_access # => false - # - # user = User.new - # user.allowed_access # => false - # user.allowed_access = true - # user.allowed_access # => true - # - # User.allowed_access # => false - # - # The attribute name must be a valid method name in Ruby. - # - # class User - # include ActiveSupport::Configurable - # config_accessor :"1_Badname" - # end - # # => NameError: invalid config attribute name - # - # To omit the instance writer method, pass instance_writer: false. - # To omit the instance reader method, pass instance_reader: false. - # - # class User - # include ActiveSupport::Configurable - # config_accessor :allowed_access, instance_reader: false, instance_writer: false - # end - # - # User.allowed_access = false - # User.allowed_access # => false - # - # User.new.allowed_access = true # => NoMethodError - # User.new.allowed_access # => NoMethodError - # - # Or pass instance_accessor: false, to omit both instance methods. - # - # class User - # include ActiveSupport::Configurable - # config_accessor :allowed_access, instance_accessor: false - # end - # - # User.allowed_access = false - # User.allowed_access # => false - # - # User.new.allowed_access = true # => NoMethodError - # User.new.allowed_access # => NoMethodError - # - # Also you can pass a block to set up the attribute with a default value. - # - # class User - # include ActiveSupport::Configurable - # config_accessor :hair_colors do - # [:brown, :black, :blonde, :red] - # end - # end - # - # User.hair_colors # => [:brown, :black, :blonde, :red] - 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) - - reader, reader_line = "def #{name}; config.#{name}; end", __LINE__ - writer, writer_line = "def #{name}=(value); config.#{name} = value; end", __LINE__ - - singleton_class.class_eval reader, __FILE__, reader_line - singleton_class.class_eval writer, __FILE__, writer_line - - if instance_accessor - class_eval reader, __FILE__, reader_line if instance_reader - class_eval writer, __FILE__, writer_line if instance_writer - end - send("#{name}=", yield) if block_given? - end - end - private :config_accessor - end - - # Reads and writes attributes from a configuration OrderedOptions. - # - # require "active_support/configurable" - # - # class User - # include ActiveSupport::Configurable - # end - # - # user = User.new - # - # user.config.allowed_access = true - # user.config.level = 1 - # - # user.config.allowed_access # => true - # user.config.level # => 1 - def config - @_config ||= self.class.config.inheritable_copy - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/configuration_file.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/configuration_file.rb deleted file mode 100644 index 024f0e0bda..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/configuration_file.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # Reads a YAML configuration file, evaluating any ERB, then - # parsing the resulting YAML. - # - # Warns in case of YAML confusing characters, like invisible - # non-breaking spaces. - class ConfigurationFile # :nodoc: - class FormatError < StandardError; end - - def initialize(content_path) - @content_path = content_path.to_s - @content = read content_path - end - - def self.parse(content_path, **options) - new(content_path).parse(**options) - end - - def parse(context: nil, **options) - source = render(context) - if YAML.respond_to?(:unsafe_load) - YAML.unsafe_load(source, **options) || {} - else - YAML.load(source, **options) || {} - end - rescue Psych::SyntaxError => error - raise "YAML syntax error occurred while parsing #{@content_path}. " \ - "Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \ - "Error: #{error.message}" - end - - private - def read(content_path) - require "yaml" - require "erb" - - File.read(content_path).tap do |content| - if content.include?("\u00A0") - warn "File contains invisible non-breaking spaces, you may want to remove those" - end - end - end - - def render(context) - erb = ERB.new(@content).tap { |e| e.filename = @content_path } - context ? erb.result(context) : erb.result - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext.rb deleted file mode 100644 index 3f5d08186e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -Dir.glob(File.expand_path("core_ext/*.rb", __dir__)).sort.each do |path| - require path -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array.rb deleted file mode 100644 index 88b6567712..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -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/inquiry" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array/conversions.rb deleted file mode 100644 index 0780c4ed8a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array/conversions.rb +++ /dev/null @@ -1,213 +0,0 @@ -# frozen_string_literal: true - -require "active_support/xml_mini" -require "active_support/core_ext/hash/keys" -require "active_support/core_ext/string/inflections" -require "active_support/core_ext/object/to_param" -require "active_support/core_ext/object/to_query" - -class Array - # Converts the array to a comma-separated sentence where the last element is - # joined by the connector word. - # - # You can pass the following options to change the default behavior. If you - # pass an option key that doesn't exist in the list below, it will raise an - # ArgumentError. - # - # ==== Options - # - # * :words_connector - The sign or word used to join the elements - # in arrays with two or more elements (default: ", "). - # * :two_words_connector - The sign or word used to join the elements - # in arrays with two elements (default: " and "). - # * :last_word_connector - The sign or word used to join the last element - # in arrays with three or more elements (default: ", and "). - # * :locale - If +i18n+ is available, you can set a locale and use - # the connector options defined on the 'support.array' namespace in the - # corresponding dictionary file. - # - # ==== Examples - # - # [].to_sentence # => "" - # ['one'].to_sentence # => "one" - # ['one', 'two'].to_sentence # => "one and two" - # ['one', 'two', 'three'].to_sentence # => "one, two, and three" - # - # ['one', 'two'].to_sentence(passing: 'invalid option') - # # => ArgumentError: Unknown key: :passing. Valid keys are: :words_connector, :two_words_connector, :last_word_connector, :locale - # - # ['one', 'two'].to_sentence(two_words_connector: '-') - # # => "one-two" - # - # ['one', 'two', 'three'].to_sentence(words_connector: ' or ', last_word_connector: ' or at least ') - # # => "one or two or at least three" - # - # Using :locale option: - # - # # Given this locale dictionary: - # # - # # es: - # # support: - # # array: - # # words_connector: " o " - # # two_words_connector: " y " - # # last_word_connector: " o al menos " - # - # ['uno', 'dos'].to_sentence(locale: :es) - # # => "uno y dos" - # - # ['uno', 'dos', 'tres'].to_sentence(locale: :es) - # # => "uno o dos o al menos tres" - def to_sentence(options = {}) - options.assert_valid_keys(:words_connector, :two_words_connector, :last_word_connector, :locale) - - default_connectors = { - words_connector: ", ", - two_words_connector: " and ", - last_word_connector: ", and " - } - if defined?(I18n) - i18n_connectors = I18n.translate(:'support.array', locale: options[:locale], default: {}) - default_connectors.merge!(i18n_connectors) - end - options = default_connectors.merge!(options) - - case length - when 0 - +"" - when 1 - +"#{self[0]}" - when 2 - +"#{self[0]}#{options[:two_words_connector]}#{self[1]}" - else - +"#{self[0...-1].join(options[:words_connector])}#{options[:last_word_connector]}#{self[-1]}" - end - end - - # Extends Array#to_s to convert a collection of elements into a - # comma separated id list if :db argument is given as the format. - # - # Blog.all.to_formatted_s(:db) # => "1,2,3" - # Blog.none.to_formatted_s(:db) # => "null" - # [1,2].to_formatted_s # => "[1, 2]" - def to_formatted_s(format = :default) - case format - when :db - if empty? - "null" - else - collect(&:id).join(",") - end - else - to_default_s - end - end - alias_method :to_default_s, :to_s - alias_method :to_s, :to_formatted_s - - # Returns a string that represents the array in XML by invoking +to_xml+ - # on each element. Active Record collections delegate their representation - # in XML to this method. - # - # All elements are expected to respond to +to_xml+, if any of them does - # not then an exception is raised. - # - # The root node reflects the class name of the first element in plural - # if all elements belong to the same type and that's not Hash: - # - # customer.projects.to_xml - # - # - # - # - # 20000.0 - # 1567 - # 2008-04-09 - # ... - # - # - # 57230.0 - # 1567 - # 2008-04-15 - # ... - # - # - # - # Otherwise the root element is "objects": - # - # [{ foo: 1, bar: 2}, { baz: 3}].to_xml - # - # - # - # - # 2 - # 1 - # - # - # 3 - # - # - # - # If the collection is empty the root element is "nil-classes" by default: - # - # [].to_xml - # - # - # - # - # To ensure a meaningful root element use the :root option: - # - # customer_with_no_projects.projects.to_xml(root: 'projects') - # - # - # - # - # By default name of the node for the children of root is root.singularize. - # You can change it with the :children option. - # - # The +options+ hash is passed downwards: - # - # Message.all.to_xml(skip_types: true) - # - # - # - # - # 2008-03-07T09:58:18+01:00 - # 1 - # 1 - # 2008-03-07T09:58:18+01:00 - # 1 - # - # - # - def to_xml(options = {}) - require "active_support/builder" unless defined?(Builder::XmlMarkup) - - options = options.dup - options[:indent] ||= 2 - options[:builder] ||= Builder::XmlMarkup.new(indent: options[:indent]) - options[:root] ||= \ - if first.class != Hash && all? { |e| e.is_a?(first.class) } - underscored = ActiveSupport::Inflector.underscore(first.class.name) - ActiveSupport::Inflector.pluralize(underscored).tr("/", "_") - else - "objects" - end - - builder = options[:builder] - builder.instruct! unless options.delete(:skip_instruct) - - root = ActiveSupport::XmlMini.rename_key(options[:root].to_s, options) - children = options.delete(:children) || root.singularize - attributes = options[:skip_types] ? {} : { type: "array" } - - if empty? - builder.tag!(root, attributes) - else - builder.tag!(root, attributes) do - each { |value| ActiveSupport::XmlMini.to_tag(children, value, options) } - yield builder if block_given? - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array/extract.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array/extract.rb deleted file mode 100644 index cc5a8a3f88..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array/extract.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class Array - # Removes and returns the elements for which the block returns a true value. - # If no block is given, an Enumerator is returned instead. - # - # numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - # odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9] - # numbers # => [0, 2, 4, 6, 8] - def extract! - return to_enum(:extract!) { size } unless block_given? - - extracted_elements = [] - - reject! do |element| - extracted_elements << element if yield(element) - end - - extracted_elements - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array/extract_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array/extract_options.rb deleted file mode 100644 index 8c7cb2e780..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array/extract_options.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class Hash - # By default, only instances of Hash itself are extractable. - # Subclasses of Hash may implement this method and return - # true to declare themselves as extractable. If a Hash - # is extractable, Array#extract_options! pops it from - # the Array when it is the last element of the Array. - def extractable_options? - instance_of?(Hash) - end -end - -class Array - # Extracts options from a set of arguments. Removes and returns the last - # element in the array if it's a hash, otherwise returns a blank hash. - # - # def options(*args) - # args.extract_options! - # end - # - # options(1, 2) # => {} - # options(1, 2, a: :b) # => {:a=>:b} - def extract_options! - if last.is_a?(Hash) && last.extractable_options? - pop - else - {} - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array/grouping.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array/grouping.rb deleted file mode 100644 index 67e760bc4b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array/grouping.rb +++ /dev/null @@ -1,109 +0,0 @@ -# frozen_string_literal: true - -class Array - # Splits or iterates over the array in groups of size +number+, - # padding any remaining slots with +fill_with+ unless it is +false+. - # - # %w(1 2 3 4 5 6 7 8 9 10).in_groups_of(3) {|group| p group} - # ["1", "2", "3"] - # ["4", "5", "6"] - # ["7", "8", "9"] - # ["10", nil, nil] - # - # %w(1 2 3 4 5).in_groups_of(2, ' ') {|group| p group} - # ["1", "2"] - # ["3", "4"] - # ["5", " "] - # - # %w(1 2 3 4 5).in_groups_of(2, false) {|group| p group} - # ["1", "2"] - # ["3", "4"] - # ["5"] - def in_groups_of(number, fill_with = nil) - if number.to_i <= 0 - raise ArgumentError, - "Group size must be a positive integer, was #{number.inspect}" - end - - if fill_with == false - collection = self - else - # size % number gives how many extra we have; - # subtracting from number gives how many to add; - # modulo number ensures we don't add group of just fill. - padding = (number - size % number) % number - collection = dup.concat(Array.new(padding, fill_with)) - end - - if block_given? - collection.each_slice(number) { |slice| yield(slice) } - else - collection.each_slice(number).to_a - end - end - - # Splits or iterates over the array in +number+ of groups, padding any - # remaining slots with +fill_with+ unless it is +false+. - # - # %w(1 2 3 4 5 6 7 8 9 10).in_groups(3) {|group| p group} - # ["1", "2", "3", "4"] - # ["5", "6", "7", nil] - # ["8", "9", "10", nil] - # - # %w(1 2 3 4 5 6 7 8 9 10).in_groups(3, ' ') {|group| p group} - # ["1", "2", "3", "4"] - # ["5", "6", "7", " "] - # ["8", "9", "10", " "] - # - # %w(1 2 3 4 5 6 7).in_groups(3, false) {|group| p group} - # ["1", "2", "3"] - # ["4", "5"] - # ["6", "7"] - def in_groups(number, fill_with = nil) - # size.div number gives minor group size; - # size % number gives how many objects need extra accommodation; - # each group hold either division or division + 1 items. - division = size.div number - modulo = size % number - - # create a new array avoiding dup - groups = [] - start = 0 - - number.times do |index| - length = division + (modulo > 0 && modulo > index ? 1 : 0) - groups << last_group = slice(start, length) - last_group << fill_with if fill_with != false && - modulo > 0 && length == division - start += length - end - - if block_given? - groups.each { |g| yield(g) } - else - groups - end - end - - # Divides the array into one or more subarrays based on a delimiting +value+ - # or the result of an optional block. - # - # [1, 2, 3, 4, 5].split(3) # => [[1, 2], [4, 5]] - # (1..10).to_a.split { |i| i % 3 == 0 } # => [[1, 2], [4, 5], [7, 8], [10]] - def split(value = nil) - arr = dup - result = [] - if block_given? - while (idx = arr.index { |i| yield i }) - result << arr.shift(idx) - arr.shift - end - else - while (idx = arr.index(value)) - result << arr.shift(idx) - arr.shift - end - end - result << arr - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array/inquiry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array/inquiry.rb deleted file mode 100644 index 92c61bf201..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array/inquiry.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -require "active_support/array_inquirer" - -class Array - # Wraps the array in an +ArrayInquirer+ object, which gives a friendlier way - # to check its string-like contents. - # - # pets = [:cat, :dog].inquiry - # - # pets.cat? # => true - # pets.ferret? # => false - # - # pets.any?(:cat, :ferret) # => true - # pets.any?(:ferret, :alligator) # => false - def inquiry - ActiveSupport::ArrayInquirer.new(self) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array/wrap.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array/wrap.rb deleted file mode 100644 index d62f97edbf..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/array/wrap.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -class Array - # Wraps its argument in an array unless it is already an array (or array-like). - # - # Specifically: - # - # * If the argument is +nil+ an empty array is returned. - # * Otherwise, if the argument responds to +to_ary+ it is invoked, and its result returned. - # * Otherwise, returns an array with the argument as its single element. - # - # Array.wrap(nil) # => [] - # Array.wrap([1, 2, 3]) # => [1, 2, 3] - # Array.wrap(0) # => [0] - # - # This method is similar in purpose to Kernel#Array, but there are some differences: - # - # * If the argument responds to +to_ary+ the method is invoked. Kernel#Array - # moves on to try +to_a+ if the returned value is +nil+, but Array.wrap returns - # an array with the argument as its single element right away. - # * If the returned value from +to_ary+ is neither +nil+ nor an +Array+ object, Kernel#Array - # raises an exception, while Array.wrap does not, it just returns the value. - # * It does not call +to_a+ on the argument, if the argument does not respond to +to_ary+ - # it returns an array with the argument as its single element. - # - # The last point is easily explained with some enumerables: - # - # Array(foo: :bar) # => [[:foo, :bar]] - # Array.wrap(foo: :bar) # => [{:foo=>:bar}] - # - # There's also a related idiom that uses the splat operator: - # - # [*object] - # - # which returns [] for +nil+, but calls to Array(object) otherwise. - # - # The differences with Kernel#Array explained above - # apply to the rest of objects. - def self.wrap(object) - if object.nil? - [] - elsif object.respond_to?(:to_ary) - object.to_ary || [object] - else - [object] - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/benchmark.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/benchmark.rb deleted file mode 100644 index f6e1b72bcf..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/benchmark.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -require "benchmark" - -class << Benchmark - # Benchmark realtime in milliseconds. - # - # Benchmark.realtime { User.all } - # # => 8.0e-05 - # - # Benchmark.ms { User.all } - # # => 0.074 - def ms(&block) - 1000 * realtime(&block) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/big_decimal.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/big_decimal.rb deleted file mode 100644 index 9e6a9d6331..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/big_decimal.rb +++ /dev/null @@ -1,3 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/big_decimal/conversions" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/big_decimal/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/big_decimal/conversions.rb deleted file mode 100644 index 52bd229416..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/big_decimal/conversions.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -require "bigdecimal" -require "bigdecimal/util" - -module ActiveSupport - module BigDecimalWithDefaultFormat #:nodoc: - def to_s(format = "F") - super(format) - end - end -end - -BigDecimal.prepend(ActiveSupport::BigDecimalWithDefaultFormat) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/class.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/class.rb deleted file mode 100644 index 1c110fd07b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/class.rb +++ /dev/null @@ -1,4 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/class/attribute" -require "active_support/core_ext/class/subclasses" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/class/attribute.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/class/attribute.rb deleted file mode 100644 index ec78845159..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/class/attribute.rb +++ /dev/null @@ -1,131 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/module/redefine_method" - -class Class - # Declare a class-level attribute whose value is inheritable by subclasses. - # Subclasses can change their own value and it will not impact parent class. - # - # ==== Options - # - # * :instance_reader - Sets the instance reader method (defaults to true). - # * :instance_writer - Sets the instance writer method (defaults to true). - # * :instance_accessor - Sets both instance methods (defaults to true). - # * :instance_predicate - Sets a predicate method (defaults to true). - # * :default - Sets a default value for the attribute (defaults to nil). - # - # ==== Examples - # - # class Base - # class_attribute :setting - # end - # - # class Subclass < Base - # end - # - # Base.setting = true - # Subclass.setting # => true - # Subclass.setting = false - # Subclass.setting # => false - # Base.setting # => true - # - # In the above case as long as Subclass does not assign a value to setting - # by performing Subclass.setting = _something_, Subclass.setting - # would read value assigned to parent class. Once Subclass assigns a value then - # the value assigned by Subclass would be returned. - # - # This matches normal Ruby method inheritance: think of writing an attribute - # on a subclass as overriding the reader method. However, you need to be aware - # when using +class_attribute+ with mutable structures as +Array+ or +Hash+. - # In such cases, you don't want to do changes in place. Instead use setters: - # - # Base.setting = [] - # Base.setting # => [] - # Subclass.setting # => [] - # - # # Appending in child changes both parent and child because it is the same object: - # Subclass.setting << :foo - # Base.setting # => [:foo] - # Subclass.setting # => [:foo] - # - # # Use setters to not propagate changes: - # Base.setting = [] - # Subclass.setting += [:foo] - # Base.setting # => [] - # Subclass.setting # => [:foo] - # - # For convenience, an instance predicate method is defined as well. - # To skip it, pass instance_predicate: false. - # - # Subclass.setting? # => false - # - # Instances may overwrite the class value in the same way: - # - # Base.setting = true - # object = Base.new - # object.setting # => true - # object.setting = false - # object.setting # => false - # Base.setting # => true - # - # To opt out of the instance reader method, pass instance_reader: false. - # - # object.setting # => NoMethodError - # object.setting? # => NoMethodError - # - # To opt out of the instance writer method, pass instance_writer: false. - # - # object.setting = false # => NoMethodError - # - # To opt out of both instance methods, pass instance_accessor: false. - # - # To set a default value for the attribute, pass default:, like so: - # - # class_attribute :settings, default: {} - def class_attribute(*attrs, instance_accessor: true, - instance_reader: instance_accessor, instance_writer: instance_accessor, instance_predicate: true, default: nil) - - class_methods, methods = [], [] - attrs.each do |name| - unless name.is_a?(Symbol) || name.is_a?(String) - raise TypeError, "#{name.inspect} is not a symbol nor a string" - end - - class_methods << <<~RUBY # In case the method exists and is not public - silence_redefinition_of_method def #{name} - end - RUBY - - methods << <<~RUBY if instance_reader - silence_redefinition_of_method def #{name} - defined?(@#{name}) ? @#{name} : self.class.#{name} - end - RUBY - - class_methods << <<~RUBY - silence_redefinition_of_method def #{name}=(value) - redefine_method(:#{name}) { value } if singleton_class? - redefine_singleton_method(:#{name}) { value } - value - end - RUBY - - methods << <<~RUBY if instance_writer - silence_redefinition_of_method(:#{name}=) - attr_writer :#{name} - RUBY - - if instance_predicate - class_methods << "silence_redefinition_of_method def #{name}?; !!self.#{name}; end" - if instance_reader - methods << "silence_redefinition_of_method def #{name}?; !!self.#{name}; end" - end - end - end - - location = caller_locations(1, 1).first - class_eval(["class << self", *class_methods, "end", *methods].join(";").tr("\n", ";"), location.path, location.lineno) - - attrs.each { |name| public_send("#{name}=", default) } - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/class/attribute_accessors.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/class/attribute_accessors.rb deleted file mode 100644 index a77354e153..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/class/attribute_accessors.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -# cattr_* became mattr_* aliases in 7dfbd91b0780fbd6a1dd9bfbc176e10894871d2d, -# but we keep this around for libraries that directly require it knowing they -# want cattr_*. No need to deprecate. -require "active_support/core_ext/module/attribute_accessors" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/class/subclasses.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/class/subclasses.rb deleted file mode 100644 index 568b413516..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/class/subclasses.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -class Class - # Returns an array with all classes that are < than its receiver. - # - # class C; end - # C.descendants # => [] - # - # class B < C; end - # C.descendants # => [B] - # - # class A < B; end - # C.descendants # => [B, A] - # - # class D < C; end - # C.descendants # => [B, A, D] - def descendants - ObjectSpace.each_object(singleton_class).reject do |k| - k.singleton_class? || k == self - end - end - - # Returns an array with the direct children of +self+. - # - # class Foo; end - # class Bar < Foo; end - # class Baz < Bar; end - # - # Foo.subclasses # => [Bar] - def subclasses - descendants.select { |descendant| descendant.superclass == self } - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date.rb deleted file mode 100644 index cce73f2db2..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/date/acts_like" -require "active_support/core_ext/date/blank" -require "active_support/core_ext/date/calculations" -require "active_support/core_ext/date/conversions" -require "active_support/core_ext/date/zones" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date/acts_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date/acts_like.rb deleted file mode 100644 index c8077f3774..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date/acts_like.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/acts_like" - -class Date - # Duck-types as a Date-like class. See Object#acts_like?. - def acts_like_date? - true - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date/blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date/blank.rb deleted file mode 100644 index e6271c79b3..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date/blank.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -require "date" - -class Date #:nodoc: - # No Date is blank: - # - # Date.today.blank? # => false - # - # @return [false] - def blank? - false - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date/calculations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date/calculations.rb deleted file mode 100644 index d03a8d3997..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date/calculations.rb +++ /dev/null @@ -1,146 +0,0 @@ -# frozen_string_literal: true - -require "date" -require "active_support/duration" -require "active_support/core_ext/object/acts_like" -require "active_support/core_ext/date/zones" -require "active_support/core_ext/time/zones" -require "active_support/core_ext/date_and_time/calculations" - -class Date - include DateAndTime::Calculations - - class << self - attr_accessor :beginning_of_week_default - - # Returns the week start (e.g. :monday) for the current request, if this has been set (via Date.beginning_of_week=). - # If Date.beginning_of_week has not been set for the current request, returns the week start specified in config.beginning_of_week. - # If no config.beginning_of_week was specified, returns :monday. - def beginning_of_week - Thread.current[:beginning_of_week] || beginning_of_week_default || :monday - end - - # Sets Date.beginning_of_week to a week start (e.g. :monday) for current request/thread. - # - # This method accepts any of the following day symbols: - # :monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday - def beginning_of_week=(week_start) - Thread.current[:beginning_of_week] = find_beginning_of_week!(week_start) - end - - # Returns week start day symbol (e.g. :monday), or raises an +ArgumentError+ for invalid day symbol. - def find_beginning_of_week!(week_start) - raise ArgumentError, "Invalid beginning of week: #{week_start}" unless ::Date::DAYS_INTO_WEEK.key?(week_start) - week_start - end - - # Returns a new Date representing the date 1 day ago (i.e. yesterday's date). - def yesterday - ::Date.current.yesterday - end - - # Returns a new Date representing the date 1 day after today (i.e. tomorrow's date). - def tomorrow - ::Date.current.tomorrow - end - - # Returns Time.zone.today when Time.zone or config.time_zone are set, otherwise just returns Date.today. - def current - ::Time.zone ? ::Time.zone.today : ::Date.today - end - end - - # Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00) - # and then subtracts the specified number of seconds. - def ago(seconds) - in_time_zone.since(-seconds) - end - - # Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00) - # and then adds the specified number of seconds - def since(seconds) - in_time_zone.since(seconds) - end - alias :in :since - - # Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00) - def beginning_of_day - in_time_zone - end - alias :midnight :beginning_of_day - alias :at_midnight :beginning_of_day - alias :at_beginning_of_day :beginning_of_day - - # Converts Date to a Time (or DateTime if necessary) with the time portion set to the middle of the day (12:00) - def middle_of_day - in_time_zone.middle_of_day - end - alias :midday :middle_of_day - alias :noon :middle_of_day - alias :at_midday :middle_of_day - alias :at_noon :middle_of_day - alias :at_middle_of_day :middle_of_day - - # Converts Date to a Time (or DateTime if necessary) with the time portion set to the end of the day (23:59:59) - def end_of_day - in_time_zone.end_of_day - end - alias :at_end_of_day :end_of_day - - def plus_with_duration(other) #:nodoc: - if ActiveSupport::Duration === other - other.since(self) - else - plus_without_duration(other) - end - end - alias_method :plus_without_duration, :+ - alias_method :+, :plus_with_duration - - def minus_with_duration(other) #:nodoc: - if ActiveSupport::Duration === other - plus_with_duration(-other) - else - minus_without_duration(other) - end - end - alias_method :minus_without_duration, :- - alias_method :-, :minus_with_duration - - # Provides precise Date calculations for years, months, and days. The +options+ parameter takes a hash with - # any of these keys: :years, :months, :weeks, :days. - def advance(options) - d = self - - d = d >> options[:years] * 12 if options[:years] - d = d >> options[:months] if options[:months] - d = d + options[:weeks] * 7 if options[:weeks] - d = d + options[:days] if options[:days] - - d - end - - # Returns a new Date where one or more of the elements have been changed according to the +options+ parameter. - # The +options+ parameter is a hash with a combination of these keys: :year, :month, :day. - # - # Date.new(2007, 5, 12).change(day: 1) # => Date.new(2007, 5, 1) - # Date.new(2007, 5, 12).change(year: 2005, month: 1) # => Date.new(2005, 1, 12) - def change(options) - ::Date.new( - options.fetch(:year, year), - options.fetch(:month, month), - options.fetch(:day, day) - ) - end - - # Allow Date to be compared with Time by converting to DateTime and relying on the <=> from there. - def compare_with_coercion(other) - if other.is_a?(Time) - to_datetime <=> other - else - compare_without_coercion(other) - end - end - alias_method :compare_without_coercion, :<=> - alias_method :<=>, :compare_with_coercion -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date/conversions.rb deleted file mode 100644 index 050a62bb31..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date/conversions.rb +++ /dev/null @@ -1,97 +0,0 @@ -# frozen_string_literal: true - -require "date" -require "active_support/inflector/methods" -require "active_support/core_ext/date/zones" -require "active_support/core_ext/module/redefine_method" - -class Date - DATE_FORMATS = { - short: "%d %b", - long: "%B %d, %Y", - db: "%Y-%m-%d", - inspect: "%Y-%m-%d", - number: "%Y%m%d", - long_ordinal: lambda { |date| - day_format = ActiveSupport::Inflector.ordinalize(date.day) - date.strftime("%B #{day_format}, %Y") # => "April 25th, 2007" - }, - rfc822: "%d %b %Y", - iso8601: lambda { |date| date.iso8601 } - } - - # Convert to a formatted string. See DATE_FORMATS for predefined formats. - # - # This method is aliased to to_s. - # - # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007 - # - # date.to_formatted_s(:db) # => "2007-11-10" - # date.to_s(:db) # => "2007-11-10" - # - # date.to_formatted_s(:short) # => "10 Nov" - # date.to_formatted_s(:number) # => "20071110" - # date.to_formatted_s(:long) # => "November 10, 2007" - # date.to_formatted_s(:long_ordinal) # => "November 10th, 2007" - # date.to_formatted_s(:rfc822) # => "10 Nov 2007" - # date.to_formatted_s(:iso8601) # => "2007-11-10" - # - # == Adding your own date formats to to_formatted_s - # You can add your own formats to the Date::DATE_FORMATS hash. - # Use the format name as the hash key and either a strftime string - # or Proc instance that takes a date argument as the value. - # - # # config/initializers/date_formats.rb - # Date::DATE_FORMATS[:month_and_year] = '%B %Y' - # Date::DATE_FORMATS[:short_ordinal] = ->(date) { date.strftime("%B #{date.day.ordinalize}") } - def to_formatted_s(format = :default) - if formatter = DATE_FORMATS[format] - if formatter.respond_to?(:call) - formatter.call(self).to_s - else - strftime(formatter) - end - else - to_default_s - end - end - alias_method :to_default_s, :to_s - alias_method :to_s, :to_formatted_s - - # Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005" - def readable_inspect - strftime("%a, %d %b %Y") - end - alias_method :default_inspect, :inspect - alias_method :inspect, :readable_inspect - - silence_redefinition_of_method :to_time - - # Converts a Date instance to a Time, where the time is set to the beginning of the day. - # The timezone can be either :local or :utc (default :local). - # - # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007 - # - # date.to_time # => 2007-11-10 00:00:00 0800 - # date.to_time(:local) # => 2007-11-10 00:00:00 0800 - # - # date.to_time(:utc) # => 2007-11-10 00:00:00 UTC - # - # NOTE: The :local timezone is Ruby's *process* timezone, i.e. ENV['TZ']. - # If the *application's* timezone is needed, then use +in_time_zone+ instead. - def to_time(form = :local) - raise ArgumentError, "Expected :local or :utc, got #{form.inspect}." unless [:local, :utc].include?(form) - ::Time.public_send(form, year, month, day) - end - - silence_redefinition_of_method :xmlschema - - # Returns a string which represents the time in used time zone as DateTime - # defined by XML Schema: - # - # date = Date.new(2015, 05, 23) # => Sat, 23 May 2015 - # date.xmlschema # => "2015-05-23T00:00:00+04:00" - def xmlschema - in_time_zone.xmlschema - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date/zones.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date/zones.rb deleted file mode 100644 index 2dcf97cff8..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date/zones.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -require "date" -require "active_support/core_ext/date_and_time/zones" - -class Date - include DateAndTime::Zones -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_and_time/calculations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_and_time/calculations.rb deleted file mode 100644 index 21cfeed557..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_and_time/calculations.rb +++ /dev/null @@ -1,364 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/try" -require "active_support/core_ext/date_time/conversions" - -module DateAndTime - module Calculations - DAYS_INTO_WEEK = { - sunday: 0, - monday: 1, - tuesday: 2, - wednesday: 3, - thursday: 4, - friday: 5, - saturday: 6 - } - WEEKEND_DAYS = [ 6, 0 ] - - # Returns a new date/time representing yesterday. - def yesterday - advance(days: -1) - end - - # Returns a new date/time representing tomorrow. - def tomorrow - advance(days: 1) - end - - # Returns true if the date/time is today. - def today? - to_date == ::Date.current - end - - # Returns true if the date/time is tomorrow. - def tomorrow? - to_date == ::Date.current.tomorrow - end - alias :next_day? :tomorrow? - - # Returns true if the date/time is yesterday. - def yesterday? - to_date == ::Date.current.yesterday - end - alias :prev_day? :yesterday? - - # Returns true if the date/time is in the past. - def past? - self < self.class.current - end - - # Returns true if the date/time is in the future. - def future? - self > self.class.current - end - - # Returns true if the date/time falls on a Saturday or Sunday. - def on_weekend? - WEEKEND_DAYS.include?(wday) - end - - # Returns true if the date/time does not fall on a Saturday or Sunday. - def on_weekday? - !WEEKEND_DAYS.include?(wday) - end - - # Returns true if the date/time falls before date_or_time. - def before?(date_or_time) - self < date_or_time - end - - # Returns true if the date/time falls after date_or_time. - def after?(date_or_time) - self > date_or_time - end - - # Returns a new date/time the specified number of days ago. - def days_ago(days) - advance(days: -days) - end - - # Returns a new date/time the specified number of days in the future. - def days_since(days) - advance(days: days) - end - - # Returns a new date/time the specified number of weeks ago. - def weeks_ago(weeks) - advance(weeks: -weeks) - end - - # Returns a new date/time the specified number of weeks in the future. - def weeks_since(weeks) - advance(weeks: weeks) - end - - # Returns a new date/time the specified number of months ago. - def months_ago(months) - advance(months: -months) - end - - # Returns a new date/time the specified number of months in the future. - def months_since(months) - advance(months: months) - end - - # Returns a new date/time the specified number of years ago. - def years_ago(years) - advance(years: -years) - end - - # Returns a new date/time the specified number of years in the future. - def years_since(years) - advance(years: years) - end - - # Returns a new date/time at the start of the month. - # - # today = Date.today # => Thu, 18 Jun 2015 - # today.beginning_of_month # => Mon, 01 Jun 2015 - # - # +DateTime+ objects will have a time set to 0:00. - # - # now = DateTime.current # => Thu, 18 Jun 2015 15:23:13 +0000 - # now.beginning_of_month # => Mon, 01 Jun 2015 00:00:00 +0000 - def beginning_of_month - first_hour(change(day: 1)) - end - alias :at_beginning_of_month :beginning_of_month - - # Returns a new date/time at the start of the quarter. - # - # today = Date.today # => Fri, 10 Jul 2015 - # today.beginning_of_quarter # => Wed, 01 Jul 2015 - # - # +DateTime+ objects will have a time set to 0:00. - # - # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000 - # now.beginning_of_quarter # => Wed, 01 Jul 2015 00:00:00 +0000 - def beginning_of_quarter - first_quarter_month = month - (2 + month) % 3 - beginning_of_month.change(month: first_quarter_month) - end - alias :at_beginning_of_quarter :beginning_of_quarter - - # Returns a new date/time at the end of the quarter. - # - # today = Date.today # => Fri, 10 Jul 2015 - # today.end_of_quarter # => Wed, 30 Sep 2015 - # - # +DateTime+ objects will have a time set to 23:59:59. - # - # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000 - # now.end_of_quarter # => Wed, 30 Sep 2015 23:59:59 +0000 - def end_of_quarter - last_quarter_month = month + (12 - month) % 3 - beginning_of_month.change(month: last_quarter_month).end_of_month - end - alias :at_end_of_quarter :end_of_quarter - - # Returns a new date/time at the beginning of the year. - # - # today = Date.today # => Fri, 10 Jul 2015 - # today.beginning_of_year # => Thu, 01 Jan 2015 - # - # +DateTime+ objects will have a time set to 0:00. - # - # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000 - # now.beginning_of_year # => Thu, 01 Jan 2015 00:00:00 +0000 - def beginning_of_year - change(month: 1).beginning_of_month - end - alias :at_beginning_of_year :beginning_of_year - - # Returns a new date/time representing the given day in the next week. - # - # today = Date.today # => Thu, 07 May 2015 - # today.next_week # => Mon, 11 May 2015 - # - # The +given_day_in_next_week+ defaults to the beginning of the week - # which is determined by +Date.beginning_of_week+ or +config.beginning_of_week+ - # when set. - # - # today = Date.today # => Thu, 07 May 2015 - # today.next_week(:friday) # => Fri, 15 May 2015 - # - # +DateTime+ objects have their time set to 0:00 unless +same_time+ is true. - # - # now = DateTime.current # => Thu, 07 May 2015 13:31:16 +0000 - # now.next_week # => Mon, 11 May 2015 00:00:00 +0000 - def next_week(given_day_in_next_week = Date.beginning_of_week, same_time: false) - result = first_hour(weeks_since(1).beginning_of_week.days_since(days_span(given_day_in_next_week))) - same_time ? copy_time_to(result) : result - end - - # Returns a new date/time representing the next weekday. - def next_weekday - if next_day.on_weekend? - next_week(:monday, same_time: true) - else - next_day - end - end - - # Short-hand for months_since(3) - def next_quarter - months_since(3) - end - - # Returns a new date/time representing the given day in the previous week. - # Week is assumed to start on +start_day+, default is - # +Date.beginning_of_week+ or +config.beginning_of_week+ when set. - # DateTime objects have their time set to 0:00 unless +same_time+ is true. - def prev_week(start_day = Date.beginning_of_week, same_time: false) - result = first_hour(weeks_ago(1).beginning_of_week.days_since(days_span(start_day))) - same_time ? copy_time_to(result) : result - end - alias_method :last_week, :prev_week - - # Returns a new date/time representing the previous weekday. - def prev_weekday - if prev_day.on_weekend? - copy_time_to(beginning_of_week(:friday)) - else - prev_day - end - end - alias_method :last_weekday, :prev_weekday - - # Short-hand for months_ago(1). - def last_month - months_ago(1) - end - - # Short-hand for months_ago(3). - def prev_quarter - months_ago(3) - end - alias_method :last_quarter, :prev_quarter - - # Short-hand for years_ago(1). - def last_year - years_ago(1) - end - - # Returns the number of days to the start of the week on the given day. - # Week is assumed to start on +start_day+, default is - # +Date.beginning_of_week+ or +config.beginning_of_week+ when set. - def days_to_week_start(start_day = Date.beginning_of_week) - start_day_number = DAYS_INTO_WEEK.fetch(start_day) - (wday - start_day_number) % 7 - end - - # Returns a new date/time representing the start of this week on the given day. - # Week is assumed to start on +start_day+, default is - # +Date.beginning_of_week+ or +config.beginning_of_week+ when set. - # +DateTime+ objects have their time set to 0:00. - def beginning_of_week(start_day = Date.beginning_of_week) - result = days_ago(days_to_week_start(start_day)) - acts_like?(:time) ? result.midnight : result - end - alias :at_beginning_of_week :beginning_of_week - - # Returns Monday of this week assuming that week starts on Monday. - # +DateTime+ objects have their time set to 0:00. - def monday - beginning_of_week(:monday) - end - - # Returns a new date/time representing the end of this week on the given day. - # Week is assumed to start on +start_day+, default is - # +Date.beginning_of_week+ or +config.beginning_of_week+ when set. - # DateTime objects have their time set to 23:59:59. - def end_of_week(start_day = Date.beginning_of_week) - last_hour(days_since(6 - days_to_week_start(start_day))) - end - alias :at_end_of_week :end_of_week - - # Returns Sunday of this week assuming that week starts on Monday. - # +DateTime+ objects have their time set to 23:59:59. - def sunday - end_of_week(:monday) - end - - # Returns a new date/time representing the end of the month. - # DateTime objects will have a time set to 23:59:59. - def end_of_month - last_day = ::Time.days_in_month(month, year) - last_hour(days_since(last_day - day)) - end - alias :at_end_of_month :end_of_month - - # Returns a new date/time representing the end of the year. - # DateTime objects will have a time set to 23:59:59. - def end_of_year - change(month: 12).end_of_month - end - alias :at_end_of_year :end_of_year - - # Returns a Range representing the whole day of the current date/time. - def all_day - beginning_of_day..end_of_day - end - - # Returns a Range representing the whole week of the current date/time. - # Week starts on start_day, default is Date.beginning_of_week or config.beginning_of_week when set. - def all_week(start_day = Date.beginning_of_week) - beginning_of_week(start_day)..end_of_week(start_day) - end - - # Returns a Range representing the whole month of the current date/time. - def all_month - beginning_of_month..end_of_month - end - - # Returns a Range representing the whole quarter of the current date/time. - def all_quarter - beginning_of_quarter..end_of_quarter - end - - # Returns a Range representing the whole year of the current date/time. - def all_year - beginning_of_year..end_of_year - end - - # Returns a new date/time representing the next occurrence of the specified day of week. - # - # today = Date.today # => Thu, 14 Dec 2017 - # today.next_occurring(:monday) # => Mon, 18 Dec 2017 - # today.next_occurring(:thursday) # => Thu, 21 Dec 2017 - def next_occurring(day_of_week) - from_now = DAYS_INTO_WEEK.fetch(day_of_week) - wday - from_now += 7 unless from_now > 0 - advance(days: from_now) - end - - # Returns a new date/time representing the previous occurrence of the specified day of week. - # - # today = Date.today # => Thu, 14 Dec 2017 - # today.prev_occurring(:monday) # => Mon, 11 Dec 2017 - # today.prev_occurring(:thursday) # => Thu, 07 Dec 2017 - def prev_occurring(day_of_week) - ago = wday - DAYS_INTO_WEEK.fetch(day_of_week) - ago += 7 unless ago > 0 - advance(days: -ago) - end - - private - def first_hour(date_or_time) - date_or_time.acts_like?(:time) ? date_or_time.beginning_of_day : date_or_time - end - - def last_hour(date_or_time) - date_or_time.acts_like?(:time) ? date_or_time.end_of_day : date_or_time - end - - def days_span(day) - (DAYS_INTO_WEEK.fetch(day) - DAYS_INTO_WEEK.fetch(Date.beginning_of_week)) % 7 - end - - def copy_time_to(other) - other.change(hour: hour, min: min, sec: sec, nsec: try(:nsec)) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_and_time/compatibility.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_and_time/compatibility.rb deleted file mode 100644 index b40a0fabb1..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_and_time/compatibility.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/module/attribute_accessors" - -module DateAndTime - module Compatibility - # If true, +to_time+ preserves the timezone offset of receiver. - # - # NOTE: With Ruby 2.4+ the default for +to_time+ changed from - # converting to the local system time, to preserving the offset - # of the receiver. For backwards compatibility we're overriding - # this behavior, but new apps will have an initializer that sets - # this to true, because the new behavior is preferred. - mattr_accessor :preserve_timezone, instance_writer: false, default: false - - # Change the output of ActiveSupport::TimeZone.utc_to_local. - # - # When `true`, it returns local times with an UTC offset, with `false` local - # times are returned as UTC. - # - # # Given this zone: - # zone = ActiveSupport::TimeZone["Eastern Time (US & Canada)"] - # - # # With `utc_to_local_returns_utc_offset_times = false`, local time is converted to UTC: - # zone.utc_to_local(Time.utc(2000, 1)) # => 1999-12-31 19:00:00 UTC - # - # # With `utc_to_local_returns_utc_offset_times = true`, local time is returned with UTC offset: - # zone.utc_to_local(Time.utc(2000, 1)) # => 1999-12-31 19:00:00 -0500 - mattr_accessor :utc_to_local_returns_utc_offset_times, instance_writer: false, default: false - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_and_time/zones.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_and_time/zones.rb deleted file mode 100644 index fb6a27cb27..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_and_time/zones.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -module DateAndTime - module Zones - # Returns the simultaneous time in Time.zone if a zone is given or - # if Time.zone_default is set. Otherwise, it returns the current time. - # - # Time.zone = 'Hawaii' # => 'Hawaii' - # Time.utc(2000).in_time_zone # => Fri, 31 Dec 1999 14:00:00 HST -10:00 - # Date.new(2000).in_time_zone # => Sat, 01 Jan 2000 00:00:00 HST -10:00 - # - # This method is similar to Time#localtime, except that it uses Time.zone as the local zone - # instead of the operating system's time zone. - # - # You can also pass in a TimeZone instance or string that identifies a TimeZone as an argument, - # and the conversion will be based on that zone instead of Time.zone. - # - # Time.utc(2000).in_time_zone('Alaska') # => Fri, 31 Dec 1999 15:00:00 AKST -09:00 - # Date.new(2000).in_time_zone('Alaska') # => Sat, 01 Jan 2000 00:00:00 AKST -09:00 - def in_time_zone(zone = ::Time.zone) - time_zone = ::Time.find_zone! zone - time = acts_like?(:time) ? self : nil - - if time_zone - time_with_zone(time, time_zone) - else - time || to_time - end - end - - private - def time_with_zone(time, zone) - if time - ActiveSupport::TimeWithZone.new(time.utc? ? time : time.getutc, zone) - else - ActiveSupport::TimeWithZone.new(nil, zone, to_time(:utc)) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_time.rb deleted file mode 100644 index 790dbeec1b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_time.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/date_time/acts_like" -require "active_support/core_ext/date_time/blank" -require "active_support/core_ext/date_time/calculations" -require "active_support/core_ext/date_time/compatibility" -require "active_support/core_ext/date_time/conversions" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_time/acts_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_time/acts_like.rb deleted file mode 100644 index 5dccdfe219..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_time/acts_like.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -require "date" -require "active_support/core_ext/object/acts_like" - -class DateTime - # Duck-types as a Date-like class. See Object#acts_like?. - def acts_like_date? - true - end - - # Duck-types as a Time-like class. See Object#acts_like?. - def acts_like_time? - true - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_time/blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_time/blank.rb deleted file mode 100644 index a52c8bc150..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_time/blank.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -require "date" - -class DateTime #:nodoc: - # No DateTime is ever blank: - # - # DateTime.now.blank? # => false - # - # @return [false] - def blank? - false - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_time/calculations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_time/calculations.rb deleted file mode 100644 index bc670c3e76..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_time/calculations.rb +++ /dev/null @@ -1,211 +0,0 @@ -# frozen_string_literal: true - -require "date" - -class DateTime - class << self - # Returns Time.zone.now.to_datetime when Time.zone or - # config.time_zone are set, otherwise returns - # Time.now.to_datetime. - def current - ::Time.zone ? ::Time.zone.now.to_datetime : ::Time.now.to_datetime - end - end - - # Returns the number of seconds since 00:00:00. - # - # DateTime.new(2012, 8, 29, 0, 0, 0).seconds_since_midnight # => 0 - # DateTime.new(2012, 8, 29, 12, 34, 56).seconds_since_midnight # => 45296 - # DateTime.new(2012, 8, 29, 23, 59, 59).seconds_since_midnight # => 86399 - def seconds_since_midnight - sec + (min * 60) + (hour * 3600) - end - - # Returns the number of seconds until 23:59:59. - # - # DateTime.new(2012, 8, 29, 0, 0, 0).seconds_until_end_of_day # => 86399 - # DateTime.new(2012, 8, 29, 12, 34, 56).seconds_until_end_of_day # => 41103 - # DateTime.new(2012, 8, 29, 23, 59, 59).seconds_until_end_of_day # => 0 - def seconds_until_end_of_day - end_of_day.to_i - to_i - end - - # Returns the fraction of a second as a +Rational+ - # - # DateTime.new(2012, 8, 29, 0, 0, 0.5).subsec # => (1/2) - def subsec - sec_fraction - end - - # Returns a new DateTime where one or more of the elements have been changed - # according to the +options+ parameter. The time options (:hour, - # :min, :sec) reset cascadingly, so if only the hour is - # passed, then minute and sec is set to 0. If the hour and minute is passed, - # then sec is set to 0. The +options+ parameter takes a hash with any of these - # keys: :year, :month, :day, :hour, - # :min, :sec, :offset, :start. - # - # DateTime.new(2012, 8, 29, 22, 35, 0).change(day: 1) # => DateTime.new(2012, 8, 1, 22, 35, 0) - # DateTime.new(2012, 8, 29, 22, 35, 0).change(year: 1981, day: 1) # => DateTime.new(1981, 8, 1, 22, 35, 0) - # DateTime.new(2012, 8, 29, 22, 35, 0).change(year: 1981, hour: 0) # => DateTime.new(1981, 8, 29, 0, 0, 0) - def change(options) - if new_nsec = options[:nsec] - raise ArgumentError, "Can't change both :nsec and :usec at the same time: #{options.inspect}" if options[:usec] - new_fraction = Rational(new_nsec, 1000000000) - else - new_usec = options.fetch(:usec, (options[:hour] || options[:min] || options[:sec]) ? 0 : Rational(nsec, 1000)) - new_fraction = Rational(new_usec, 1000000) - end - - raise ArgumentError, "argument out of range" if new_fraction >= 1 - - ::DateTime.civil( - options.fetch(:year, year), - options.fetch(:month, month), - options.fetch(:day, day), - options.fetch(:hour, hour), - options.fetch(:min, options[:hour] ? 0 : min), - options.fetch(:sec, (options[:hour] || options[:min]) ? 0 : sec) + new_fraction, - options.fetch(:offset, offset), - options.fetch(:start, start) - ) - end - - # Uses Date to provide precise Time calculations for years, months, and days. - # The +options+ parameter takes a hash with any of these keys: :years, - # :months, :weeks, :days, :hours, - # :minutes, :seconds. - def advance(options) - unless options[:weeks].nil? - options[:weeks], partial_weeks = options[:weeks].divmod(1) - options[:days] = options.fetch(:days, 0) + 7 * partial_weeks - end - - unless options[:days].nil? - options[:days], partial_days = options[:days].divmod(1) - options[:hours] = options.fetch(:hours, 0) + 24 * partial_days - end - - d = to_date.advance(options) - datetime_advanced_by_date = change(year: d.year, month: d.month, day: d.day) - seconds_to_advance = \ - options.fetch(:seconds, 0) + - options.fetch(:minutes, 0) * 60 + - options.fetch(:hours, 0) * 3600 - - if seconds_to_advance.zero? - datetime_advanced_by_date - else - datetime_advanced_by_date.since(seconds_to_advance) - end - end - - # Returns a new DateTime representing the time a number of seconds ago. - # Do not use this method in combination with x.months, use months_ago instead! - def ago(seconds) - since(-seconds) - end - - # Returns a new DateTime representing the time a number of seconds since the - # instance time. Do not use this method in combination with x.months, use - # months_since instead! - def since(seconds) - self + Rational(seconds, 86400) - end - alias :in :since - - # Returns a new DateTime representing the start of the day (0:00). - def beginning_of_day - change(hour: 0) - end - alias :midnight :beginning_of_day - alias :at_midnight :beginning_of_day - alias :at_beginning_of_day :beginning_of_day - - # Returns a new DateTime representing the middle of the day (12:00) - def middle_of_day - change(hour: 12) - end - alias :midday :middle_of_day - alias :noon :middle_of_day - alias :at_midday :middle_of_day - alias :at_noon :middle_of_day - alias :at_middle_of_day :middle_of_day - - # Returns a new DateTime representing the end of the day (23:59:59). - def end_of_day - change(hour: 23, min: 59, sec: 59, usec: Rational(999999999, 1000)) - end - alias :at_end_of_day :end_of_day - - # Returns a new DateTime representing the start of the hour (hh:00:00). - def beginning_of_hour - change(min: 0) - end - alias :at_beginning_of_hour :beginning_of_hour - - # Returns a new DateTime representing the end of the hour (hh:59:59). - def end_of_hour - change(min: 59, sec: 59, usec: Rational(999999999, 1000)) - end - alias :at_end_of_hour :end_of_hour - - # Returns a new DateTime representing the start of the minute (hh:mm:00). - def beginning_of_minute - change(sec: 0) - end - alias :at_beginning_of_minute :beginning_of_minute - - # Returns a new DateTime representing the end of the minute (hh:mm:59). - def end_of_minute - change(sec: 59, usec: Rational(999999999, 1000)) - end - alias :at_end_of_minute :end_of_minute - - # Returns a Time instance of the simultaneous time in the system timezone. - def localtime(utc_offset = nil) - utc = new_offset(0) - - Time.utc( - utc.year, utc.month, utc.day, - utc.hour, utc.min, utc.sec + utc.sec_fraction - ).getlocal(utc_offset) - end - alias_method :getlocal, :localtime - - # Returns a Time instance of the simultaneous time in the UTC timezone. - # - # DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)) # => Mon, 21 Feb 2005 10:11:12 -0600 - # DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc # => Mon, 21 Feb 2005 16:11:12 UTC - def utc - utc = new_offset(0) - - Time.utc( - utc.year, utc.month, utc.day, - utc.hour, utc.min, utc.sec + utc.sec_fraction - ) - end - alias_method :getgm, :utc - alias_method :getutc, :utc - alias_method :gmtime, :utc - - # Returns +true+ if offset == 0. - def utc? - offset == 0 - end - - # Returns the offset value in seconds. - def utc_offset - (offset * 86400).to_i - end - - # Layers additional behavior on DateTime#<=> so that Time and - # ActiveSupport::TimeWithZone instances can be compared with a DateTime. - def <=>(other) - if other.respond_to? :to_datetime - super other.to_datetime rescue nil - else - super - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_time/compatibility.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_time/compatibility.rb deleted file mode 100644 index 7600a067cc..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_time/compatibility.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/date_and_time/compatibility" -require "active_support/core_ext/module/redefine_method" - -class DateTime - include DateAndTime::Compatibility - - silence_redefinition_of_method :to_time - - # Either return an instance of +Time+ with the same UTC offset - # as +self+ or an instance of +Time+ representing the same time - # in the local system timezone depending on the setting of - # on the setting of +ActiveSupport.to_time_preserves_timezone+. - def to_time - preserve_timezone ? getlocal(utc_offset) : getlocal - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_time/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_time/conversions.rb deleted file mode 100644 index 231bf870a2..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/date_time/conversions.rb +++ /dev/null @@ -1,106 +0,0 @@ -# frozen_string_literal: true - -require "date" -require "active_support/inflector/methods" -require "active_support/core_ext/time/conversions" -require "active_support/core_ext/date_time/calculations" -require "active_support/values/time_zone" - -class DateTime - # Convert to a formatted string. See Time::DATE_FORMATS for predefined formats. - # - # This method is aliased to to_s. - # - # === Examples - # datetime = DateTime.civil(2007, 12, 4, 0, 0, 0, 0) # => Tue, 04 Dec 2007 00:00:00 +0000 - # - # datetime.to_formatted_s(:db) # => "2007-12-04 00:00:00" - # datetime.to_s(:db) # => "2007-12-04 00:00:00" - # datetime.to_s(:number) # => "20071204000000" - # datetime.to_formatted_s(:short) # => "04 Dec 00:00" - # datetime.to_formatted_s(:long) # => "December 04, 2007 00:00" - # datetime.to_formatted_s(:long_ordinal) # => "December 4th, 2007 00:00" - # datetime.to_formatted_s(:rfc822) # => "Tue, 04 Dec 2007 00:00:00 +0000" - # datetime.to_formatted_s(:iso8601) # => "2007-12-04T00:00:00+00:00" - # - # == Adding your own datetime formats to to_formatted_s - # DateTime formats are shared with Time. You can add your own to the - # Time::DATE_FORMATS hash. Use the format name as the hash key and - # either a strftime string or Proc instance that takes a time or - # datetime argument as the value. - # - # # config/initializers/time_formats.rb - # Time::DATE_FORMATS[:month_and_year] = '%B %Y' - # Time::DATE_FORMATS[:short_ordinal] = lambda { |time| time.strftime("%B #{time.day.ordinalize}") } - def to_formatted_s(format = :default) - if formatter = ::Time::DATE_FORMATS[format] - formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter) - else - to_default_s - end - end - alias_method :to_default_s, :to_s if instance_methods(false).include?(:to_s) - alias_method :to_s, :to_formatted_s - - # Returns a formatted string of the offset from UTC, or an alternative - # string if the time zone is already UTC. - # - # datetime = DateTime.civil(2000, 1, 1, 0, 0, 0, Rational(-6, 24)) - # datetime.formatted_offset # => "-06:00" - # datetime.formatted_offset(false) # => "-0600" - def formatted_offset(colon = true, alternate_utc_string = nil) - utc? && alternate_utc_string || ActiveSupport::TimeZone.seconds_to_utc_offset(utc_offset, colon) - end - - # Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005 14:30:00 +0000". - def readable_inspect - to_s(:rfc822) - end - alias_method :default_inspect, :inspect - alias_method :inspect, :readable_inspect - - # Returns DateTime with local offset for given year if format is local else - # offset is zero. - # - # DateTime.civil_from_format :local, 2012 - # # => Sun, 01 Jan 2012 00:00:00 +0300 - # DateTime.civil_from_format :local, 2012, 12, 17 - # # => Mon, 17 Dec 2012 00:00:00 +0000 - def self.civil_from_format(utc_or_local, year, month = 1, day = 1, hour = 0, min = 0, sec = 0) - if utc_or_local.to_sym == :local - offset = ::Time.local(year, month, day).utc_offset.to_r / 86400 - else - offset = 0 - end - civil(year, month, day, hour, min, sec, offset) - end - - # Converts +self+ to a floating-point number of seconds, including fractional microseconds, since the Unix epoch. - def to_f - seconds_since_unix_epoch.to_f + sec_fraction - end - - # Converts +self+ to an integer number of seconds since the Unix epoch. - def to_i - seconds_since_unix_epoch.to_i - end - - # Returns the fraction of a second as microseconds - def usec - (sec_fraction * 1_000_000).to_i - end - - # Returns the fraction of a second as nanoseconds - def nsec - (sec_fraction * 1_000_000_000).to_i - end - - private - def offset_in_seconds - (offset * 86400).to_i - end - - def seconds_since_unix_epoch - (jd - 2440588) * 86400 - offset_in_seconds + seconds_since_midnight - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/digest.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/digest.rb deleted file mode 100644 index ce1427e13a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/digest.rb +++ /dev/null @@ -1,3 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/digest/uuid" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/digest/uuid.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/digest/uuid.rb deleted file mode 100644 index 37f0a8e66f..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/digest/uuid.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -require "securerandom" -require "digest" - -module Digest - module UUID - DNS_NAMESPACE = "k\xA7\xB8\x10\x9D\xAD\x11\xD1\x80\xB4\x00\xC0O\xD40\xC8" #:nodoc: - URL_NAMESPACE = "k\xA7\xB8\x11\x9D\xAD\x11\xD1\x80\xB4\x00\xC0O\xD40\xC8" #:nodoc: - OID_NAMESPACE = "k\xA7\xB8\x12\x9D\xAD\x11\xD1\x80\xB4\x00\xC0O\xD40\xC8" #:nodoc: - X500_NAMESPACE = "k\xA7\xB8\x14\x9D\xAD\x11\xD1\x80\xB4\x00\xC0O\xD40\xC8" #:nodoc: - - # Generates a v5 non-random UUID (Universally Unique IDentifier). - # - # Using Digest::MD5 generates version 3 UUIDs; Digest::SHA1 generates version 5 UUIDs. - # uuid_from_hash always generates the same UUID for a given name and namespace combination. - # - # See RFC 4122 for details of UUID at: https://www.ietf.org/rfc/rfc4122.txt - def self.uuid_from_hash(hash_class, uuid_namespace, name) - if hash_class == Digest::MD5 - version = 3 - elsif hash_class == Digest::SHA1 - version = 5 - else - raise ArgumentError, "Expected Digest::SHA1 or Digest::MD5, got #{hash_class.name}." - end - - hash = hash_class.new - hash.update(uuid_namespace) - hash.update(name) - - ary = hash.digest.unpack("NnnnnN") - ary[2] = (ary[2] & 0x0FFF) | (version << 12) - ary[3] = (ary[3] & 0x3FFF) | 0x8000 - - "%08x-%04x-%04x-%04x-%04x%08x" % ary - end - - # Convenience method for uuid_from_hash using Digest::MD5. - def self.uuid_v3(uuid_namespace, name) - uuid_from_hash(Digest::MD5, uuid_namespace, name) - end - - # Convenience method for uuid_from_hash using Digest::SHA1. - def self.uuid_v5(uuid_namespace, name) - uuid_from_hash(Digest::SHA1, uuid_namespace, name) - end - - # Convenience method for SecureRandom.uuid. - def self.uuid_v4 - SecureRandom.uuid - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/file.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/file.rb deleted file mode 100644 index 64553bfa4e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/file.rb +++ /dev/null @@ -1,3 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/file/atomic" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/hash.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/hash.rb deleted file mode 100644 index 2f0901d853..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/hash.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -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" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/hash/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/hash/conversions.rb deleted file mode 100644 index 2b5e484d21..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/hash/conversions.rb +++ /dev/null @@ -1,263 +0,0 @@ -# frozen_string_literal: true - -require "active_support/xml_mini" -require "active_support/core_ext/object/blank" -require "active_support/core_ext/object/to_param" -require "active_support/core_ext/object/to_query" -require "active_support/core_ext/object/try" -require "active_support/core_ext/array/wrap" -require "active_support/core_ext/hash/reverse_merge" -require "active_support/core_ext/string/inflections" - -class Hash - # Returns a string containing an XML representation of its receiver: - # - # { foo: 1, bar: 2 }.to_xml - # # => - # # - # # - # # 1 - # # 2 - # # - # - # To do so, the method loops over the pairs and builds nodes that depend on - # the _values_. Given a pair +key+, +value+: - # - # * If +value+ is a hash there's a recursive call with +key+ as :root. - # - # * If +value+ is an array there's a recursive call with +key+ as :root, - # and +key+ singularized as :children. - # - # * If +value+ is a callable object it must expect one or two arguments. Depending - # on the arity, the callable is invoked with the +options+ hash as first argument - # with +key+ as :root, and +key+ singularized as second argument. The - # callable can add nodes by using options[:builder]. - # - # {foo: lambda { |options, key| options[:builder].b(key) }}.to_xml - # # => "foo" - # - # * If +value+ responds to +to_xml+ the method is invoked with +key+ as :root. - # - # class Foo - # def to_xml(options) - # options[:builder].bar 'fooing!' - # end - # end - # - # { foo: Foo.new }.to_xml(skip_instruct: true) - # # => - # # - # # fooing! - # # - # - # * Otherwise, a node with +key+ as tag is created with a string representation of - # +value+ as text node. If +value+ is +nil+ an attribute "nil" set to "true" is added. - # Unless the option :skip_types exists and is true, an attribute "type" is - # added as well according to the following mapping: - # - # XML_TYPE_NAMES = { - # "Symbol" => "symbol", - # "Integer" => "integer", - # "BigDecimal" => "decimal", - # "Float" => "float", - # "TrueClass" => "boolean", - # "FalseClass" => "boolean", - # "Date" => "date", - # "DateTime" => "dateTime", - # "Time" => "dateTime" - # } - # - # By default the root node is "hash", but that's configurable via the :root option. - # - # The default XML builder is a fresh instance of Builder::XmlMarkup. You can - # configure your own builder with the :builder option. The method also accepts - # options like :dasherize and friends, they are forwarded to the builder. - def to_xml(options = {}) - require "active_support/builder" unless defined?(Builder::XmlMarkup) - - options = options.dup - options[:indent] ||= 2 - options[:root] ||= "hash" - options[:builder] ||= Builder::XmlMarkup.new(indent: options[:indent]) - - builder = options[:builder] - builder.instruct! unless options.delete(:skip_instruct) - - root = ActiveSupport::XmlMini.rename_key(options[:root].to_s, options) - - builder.tag!(root) do - each { |key, value| ActiveSupport::XmlMini.to_tag(key, value, options) } - yield builder if block_given? - end - end - - class << self - # Returns a Hash containing a collection of pairs when the key is the node name and the value is - # its content - # - # xml = <<-XML - # - # - # 1 - # 2 - # - # XML - # - # hash = Hash.from_xml(xml) - # # => {"hash"=>{"foo"=>1, "bar"=>2}} - # - # +DisallowedType+ is raised if the XML contains attributes with type="yaml" or - # type="symbol". Use Hash.from_trusted_xml to - # parse this XML. - # - # Custom +disallowed_types+ can also be passed in the form of an - # array. - # - # xml = <<-XML - # - # - # 1 - # "David" - # - # XML - # - # hash = Hash.from_xml(xml, ['integer']) - # # => ActiveSupport::XMLConverter::DisallowedType: Disallowed type attribute: "integer" - # - # Note that passing custom disallowed types will override the default types, - # which are Symbol and YAML. - def from_xml(xml, disallowed_types = nil) - ActiveSupport::XMLConverter.new(xml, disallowed_types).to_h - end - - # Builds a Hash from XML just like Hash.from_xml, but also allows Symbol and YAML. - def from_trusted_xml(xml) - from_xml xml, [] - end - end -end - -module ActiveSupport - class XMLConverter # :nodoc: - # Raised if the XML contains attributes with type="yaml" or - # type="symbol". Read Hash#from_xml for more details. - class DisallowedType < StandardError - def initialize(type) - super "Disallowed type attribute: #{type.inspect}" - end - end - - DISALLOWED_TYPES = %w(symbol yaml) - - def initialize(xml, disallowed_types = nil) - @xml = normalize_keys(XmlMini.parse(xml)) - @disallowed_types = disallowed_types || DISALLOWED_TYPES - end - - def to_h - deep_to_h(@xml) - end - - private - def normalize_keys(params) - case params - when Hash - Hash[params.map { |k, v| [k.to_s.tr("-", "_"), normalize_keys(v)] } ] - when Array - params.map { |v| normalize_keys(v) } - else - params - end - end - - def deep_to_h(value) - case value - when Hash - process_hash(value) - when Array - process_array(value) - when String - value - else - raise "can't typecast #{value.class.name} - #{value.inspect}" - end - end - - def process_hash(value) - if value.include?("type") && !value["type"].is_a?(Hash) && @disallowed_types.include?(value["type"]) - raise DisallowedType, value["type"] - end - - if become_array?(value) - _, entries = Array.wrap(value.detect { |k, v| not v.is_a?(String) }) - if entries.nil? || value["__content__"].try(:empty?) - [] - else - case entries - when Array - entries.collect { |v| deep_to_h(v) } - when Hash - [deep_to_h(entries)] - else - raise "can't typecast #{entries.inspect}" - end - end - elsif become_content?(value) - process_content(value) - - elsif become_empty_string?(value) - "" - elsif become_hash?(value) - xml_value = value.transform_values { |v| deep_to_h(v) } - - # Turn { files: { file: # } } into { files: # } so it is compatible with - # how multipart uploaded files from HTML appear - xml_value["file"].is_a?(StringIO) ? xml_value["file"] : xml_value - end - end - - def become_content?(value) - value["type"] == "file" || (value["__content__"] && (value.keys.size == 1 || value["__content__"].present?)) - end - - def become_array?(value) - value["type"] == "array" - end - - def become_empty_string?(value) - # { "string" => true } - # No tests fail when the second term is removed. - value["type"] == "string" && value["nil"] != "true" - end - - def become_hash?(value) - !nothing?(value) && !garbage?(value) - end - - def nothing?(value) - # blank or nil parsed values are represented by nil - value.blank? || value["nil"] == "true" - end - - def garbage?(value) - # If the type is the only element which makes it then - # this still makes the value nil, except if type is - # an XML node(where type['value'] is a Hash) - value["type"] && !value["type"].is_a?(::Hash) && value.size == 1 - end - - def process_content(value) - content = value["__content__"] - if parser = ActiveSupport::XmlMini::PARSING[value["type"]] - parser.arity == 1 ? parser.call(content) : parser.call(content, value) - else - content - end - end - - def process_array(value) - value.map! { |i| deep_to_h(i) } - value.length > 1 ? value : value.first - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/hash/indifferent_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/hash/indifferent_access.rb deleted file mode 100644 index a38f33f128..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/hash/indifferent_access.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -require "active_support/hash_with_indifferent_access" - -class Hash - # Returns an ActiveSupport::HashWithIndifferentAccess out of its receiver: - # - # { a: 1 }.with_indifferent_access['a'] # => 1 - def with_indifferent_access - ActiveSupport::HashWithIndifferentAccess.new(self) - end - - # Called when object is nested under an object that receives - # #with_indifferent_access. This method will be called on the current object - # by the enclosing object and is aliased to #with_indifferent_access by - # default. Subclasses of Hash may overwrite this method to return +self+ if - # converting to an ActiveSupport::HashWithIndifferentAccess would not be - # desirable. - # - # b = { b: 1 } - # { a: b }.with_indifferent_access['a'] # calls b.nested_under_indifferent_access - # # => {"b"=>1} - alias nested_under_indifferent_access with_indifferent_access -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/hash/reverse_merge.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/hash/reverse_merge.rb deleted file mode 100644 index ef8d592829..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/hash/reverse_merge.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -class Hash - # Merges the caller into +other_hash+. For example, - # - # options = options.reverse_merge(size: 25, velocity: 10) - # - # is equivalent to - # - # options = { size: 25, velocity: 10 }.merge(options) - # - # This is particularly useful for initializing an options hash - # with default values. - def reverse_merge(other_hash) - other_hash.merge(self) - end - alias_method :with_defaults, :reverse_merge - - # Destructive +reverse_merge+. - def reverse_merge!(other_hash) - replace(reverse_merge(other_hash)) - end - alias_method :reverse_update, :reverse_merge! - alias_method :with_defaults!, :reverse_merge! -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/integer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/integer.rb deleted file mode 100644 index d22701306a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/integer.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/integer/multiple" -require "active_support/core_ext/integer/inflections" -require "active_support/core_ext/integer/time" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/integer/inflections.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/integer/inflections.rb deleted file mode 100644 index aef3266f28..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/integer/inflections.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -require "active_support/inflector" - -class Integer - # Ordinalize turns a number into an ordinal string used to denote the - # position in an ordered sequence such as 1st, 2nd, 3rd, 4th. - # - # 1.ordinalize # => "1st" - # 2.ordinalize # => "2nd" - # 1002.ordinalize # => "1002nd" - # 1003.ordinalize # => "1003rd" - # -11.ordinalize # => "-11th" - # -1001.ordinalize # => "-1001st" - def ordinalize - ActiveSupport::Inflector.ordinalize(self) - end - - # Ordinal returns the suffix used to denote the position - # in an ordered sequence such as 1st, 2nd, 3rd, 4th. - # - # 1.ordinal # => "st" - # 2.ordinal # => "nd" - # 1002.ordinal # => "nd" - # 1003.ordinal # => "rd" - # -11.ordinal # => "th" - # -1001.ordinal # => "st" - def ordinal - ActiveSupport::Inflector.ordinal(self) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/integer/multiple.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/integer/multiple.rb deleted file mode 100644 index bd57a909c5..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/integer/multiple.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -class Integer - # Check whether the integer is evenly divisible by the argument. - # - # 0.multiple_of?(0) # => true - # 6.multiple_of?(5) # => false - # 10.multiple_of?(2) # => true - def multiple_of?(number) - number == 0 ? self == 0 : self % number == 0 - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/integer/time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/integer/time.rb deleted file mode 100644 index 5efb89cf9f..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/integer/time.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -require "active_support/duration" -require "active_support/core_ext/numeric/time" - -class Integer - # Returns a Duration instance matching the number of months provided. - # - # 2.months # => 2 months - def months - ActiveSupport::Duration.months(self) - end - alias :month :months - - # Returns a Duration instance matching the number of years provided. - # - # 2.years # => 2 years - def years - ActiveSupport::Duration.years(self) - end - alias :year :years -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/kernel.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/kernel.rb deleted file mode 100644 index 7708069301..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/kernel.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -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-6.1.7.3/lib/active_support/core_ext/kernel/concern.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/kernel/concern.rb deleted file mode 100644 index 0b2baed780..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/kernel/concern.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/module/concerning" - -module Kernel - module_function - - # A shortcut to define a toplevel concern, not within a module. - # - # See Module::Concerning for more. - def concern(topic, &module_definition) - Object.concern topic, &module_definition - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/kernel/singleton_class.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/kernel/singleton_class.rb deleted file mode 100644 index 6715eba80a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/kernel/singleton_class.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -module Kernel - # class_eval on an object acts like singleton_class.class_eval. - def class_eval(*args, &block) - singleton_class.class_eval(*args, &block) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/load_error.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/load_error.rb deleted file mode 100644 index 03df2ddac4..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/load_error.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class LoadError - # Returns true if the given path name (except perhaps for the ".rb" - # extension) is the missing file which caused the exception to be raised. - def is_missing?(location) - location.delete_suffix(".rb") == path.to_s.delete_suffix(".rb") - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/marshal.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/marshal.rb deleted file mode 100644 index 5ff0e34d82..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/marshal.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/string/inflections" - -module ActiveSupport - module MarshalWithAutoloading # :nodoc: - def load(source, proc = nil) - super(source, proc) - rescue ArgumentError, NameError => exc - if exc.message.match(%r|undefined class/module (.+?)(?:::)?\z|) - # try loading the class/module - loaded = $1.constantize - - raise unless $1 == loaded.name - - # if it is an IO we need to go back to read the object - source.rewind if source.respond_to?(:rewind) - retry - else - raise exc - end - end - end -end - -Marshal.singleton_class.prepend(ActiveSupport::MarshalWithAutoloading) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/module.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/module.rb deleted file mode 100644 index 542af98c04..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/module.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -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/attribute_accessors" -require "active_support/core_ext/module/attribute_accessors_per_thread" -require "active_support/core_ext/module/attr_internal" -require "active_support/core_ext/module/concerning" -require "active_support/core_ext/module/delegation" -require "active_support/core_ext/module/deprecation" -require "active_support/core_ext/module/redefine_method" -require "active_support/core_ext/module/remove_method" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/name_error.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/name_error.rb deleted file mode 100644 index 15255d58b9..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/name_error.rb +++ /dev/null @@ -1,65 +0,0 @@ -# frozen_string_literal: true - -class NameError - # Extract the name of the missing constant from the exception message. - # - # begin - # HelloWorld - # rescue NameError => e - # e.missing_name - # end - # # => "HelloWorld" - def missing_name - # Since ruby v2.3.0 `did_you_mean` gem is loaded by default. - # It extends NameError#message with spell corrections which are SLOW. - # We should use original_message message instead. - message = respond_to?(:original_message) ? original_message : self.message - return unless message.start_with?("uninitialized constant ") - - receiver = begin - self.receiver - rescue ArgumentError - nil - end - - if receiver == Object - name.to_s - elsif receiver - "#{real_mod_name(receiver)}::#{self.name}" - else - if match = message.match(/((::)?([A-Z]\w*)(::[A-Z]\w*)*)$/) - match[1] - end - end - end - - # Was this exception raised because the given name was missing? - # - # begin - # HelloWorld - # rescue NameError => e - # e.missing_name?("HelloWorld") - # end - # # => true - def missing_name?(name) - if name.is_a? Symbol - self.name == name - else - missing_name == name.to_s - end - end - - private - UNBOUND_METHOD_MODULE_NAME = Module.instance_method(:name) - private_constant :UNBOUND_METHOD_MODULE_NAME - - 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/activesupport-6.1.7.3/lib/active_support/core_ext/numeric.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/numeric.rb deleted file mode 100644 index fe778470f1..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/numeric.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/numeric/bytes" -require "active_support/core_ext/numeric/time" -require "active_support/core_ext/numeric/conversions" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object.rb deleted file mode 100644 index efd34cc692..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/acts_like" -require "active_support/core_ext/object/blank" -require "active_support/core_ext/object/duplicable" -require "active_support/core_ext/object/deep_dup" -require "active_support/core_ext/object/try" -require "active_support/core_ext/object/inclusion" - -require "active_support/core_ext/object/conversions" -require "active_support/core_ext/object/instance_variables" - -require "active_support/core_ext/object/json" -require "active_support/core_ext/object/to_param" -require "active_support/core_ext/object/to_query" -require "active_support/core_ext/object/with_options" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/acts_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/acts_like.rb deleted file mode 100644 index 403ee20e39..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/acts_like.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -class Object - # A duck-type assistant method. For example, Active Support extends Date - # to define an acts_like_date? method, and extends Time to define - # acts_like_time?. As a result, we can do x.acts_like?(:time) and - # x.acts_like?(:date) to do duck-type-safe comparisons, since classes that - # we want to act like Time simply need to define an acts_like_time? method. - def acts_like?(duck) - case duck - when :time - respond_to? :acts_like_time? - when :date - respond_to? :acts_like_date? - when :string - respond_to? :acts_like_string? - else - respond_to? :"acts_like_#{duck}?" - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/conversions.rb deleted file mode 100644 index 624fb8d77c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/conversions.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/to_param" -require "active_support/core_ext/object/to_query" -require "active_support/core_ext/array/conversions" -require "active_support/core_ext/hash/conversions" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/inclusion.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/inclusion.rb deleted file mode 100644 index 6064e92f20..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/inclusion.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -class Object - # Returns true if this object is included in the argument. Argument must be - # any object which responds to +#include?+. Usage: - # - # characters = ["Konata", "Kagami", "Tsukasa"] - # "Konata".in?(characters) # => true - # - # This will throw an +ArgumentError+ if the argument doesn't respond - # to +#include?+. - def in?(another_object) - another_object.include?(self) - rescue NoMethodError - raise ArgumentError.new("The parameter passed to #in? must respond to #include?") - end - - # Returns the receiver if it's included in the argument otherwise returns +nil+. - # Argument must be any object which responds to +#include?+. Usage: - # - # params[:bucket_type].presence_in %w( project calendar ) - # - # This will throw an +ArgumentError+ if the argument doesn't respond to +#include?+. - # - # @return [Object] - def presence_in(another_object) - in?(another_object) ? self : nil - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/instance_variables.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/instance_variables.rb deleted file mode 100644 index 12fdf840b5..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/instance_variables.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -class Object - # Returns a hash with string keys that maps instance variable names without "@" to their - # corresponding values. - # - # class C - # def initialize(x, y) - # @x, @y = x, y - # end - # end - # - # C.new(0, 1).instance_values # => {"x" => 0, "y" => 1} - def instance_values - Hash[instance_variables.map { |name| [name[1..-1], instance_variable_get(name)] }] - end - - # Returns an array of instance variable names as strings including "@". - # - # class C - # def initialize(x, y) - # @x, @y = x, y - # end - # end - # - # C.new(0, 1).instance_variable_names # => ["@y", "@x"] - def instance_variable_names - instance_variables.map(&:to_s) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/json.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/json.rb deleted file mode 100644 index a65e273236..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/json.rb +++ /dev/null @@ -1,239 +0,0 @@ -# frozen_string_literal: true - -# Hack to load json gem first so we can overwrite its to_json. -require "json" -require "bigdecimal" -require "ipaddr" -require "uri/generic" -require "pathname" -require "active_support/core_ext/big_decimal/conversions" # for #to_s -require "active_support/core_ext/hash/except" -require "active_support/core_ext/hash/slice" -require "active_support/core_ext/object/instance_variables" -require "time" -require "active_support/core_ext/time/conversions" -require "active_support/core_ext/date_time/conversions" -require "active_support/core_ext/date/conversions" - -#-- -# The JSON gem adds a few modules to Ruby core classes containing :to_json definition, overwriting -# their default behavior. That said, we need to define the basic to_json method in all of them, -# otherwise they will always use to_json gem implementation, which is backwards incompatible in -# several cases (for instance, the JSON implementation for Hash does not work) with inheritance -# and consequently classes as ActiveSupport::OrderedHash cannot be serialized to json. -# -# On the other hand, we should avoid conflict with ::JSON.{generate,dump}(obj). Unfortunately, the -# JSON gem's encoder relies on its own to_json implementation to encode objects. Since it always -# passes a ::JSON::State object as the only argument to to_json, we can detect that and forward the -# calls to the original to_json method. -# -# It should be noted that when using ::JSON.{generate,dump} directly, ActiveSupport's encoder is -# bypassed completely. This means that as_json won't be invoked and the JSON gem will simply -# ignore any options it does not natively understand. This also means that ::JSON.{generate,dump} -# should give exactly the same results with or without active support. - -module ActiveSupport - module ToJsonWithActiveSupportEncoder # :nodoc: - def to_json(options = nil) - if options.is_a?(::JSON::State) - # Called from JSON.{generate,dump}, forward it to JSON gem's to_json - super(options) - else - # to_json is being invoked directly, use ActiveSupport's encoder - ActiveSupport::JSON.encode(self, options) - end - end - end -end - -[Enumerable, Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass].reverse_each do |klass| - klass.prepend(ActiveSupport::ToJsonWithActiveSupportEncoder) -end - -class Object - def as_json(options = nil) #:nodoc: - if respond_to?(:to_hash) - to_hash.as_json(options) - else - instance_values.as_json(options) - end - end -end - -class Struct #:nodoc: - def as_json(options = nil) - Hash[members.zip(values)].as_json(options) - end -end - -class TrueClass - def as_json(options = nil) #:nodoc: - self - end -end - -class FalseClass - def as_json(options = nil) #:nodoc: - self - end -end - -class NilClass - def as_json(options = nil) #:nodoc: - self - end -end - -class String - def as_json(options = nil) #:nodoc: - self - end -end - -class Symbol - def as_json(options = nil) #:nodoc: - to_s - end -end - -class Numeric - def as_json(options = nil) #:nodoc: - self - end -end - -class Float - # Encoding Infinity or NaN to JSON should return "null". The default returns - # "Infinity" or "NaN" which are not valid JSON. - def as_json(options = nil) #:nodoc: - finite? ? self : nil - end -end - -class BigDecimal - # A BigDecimal would be naturally represented as a JSON number. Most libraries, - # however, parse non-integer JSON numbers directly as floats. Clients using - # those libraries would get in general a wrong number and no way to recover - # other than manually inspecting the string with the JSON code itself. - # - # That's why a JSON string is returned. The JSON literal is not numeric, but - # if the other end knows by contract that the data is supposed to be a - # BigDecimal, it still has the chance to post-process the string and get the - # real value. - def as_json(options = nil) #:nodoc: - finite? ? to_s : nil - end -end - -class Regexp - def as_json(options = nil) #:nodoc: - to_s - end -end - -module Enumerable - def as_json(options = nil) #:nodoc: - to_a.as_json(options) - end -end - -class IO - def as_json(options = nil) #:nodoc: - to_s - end -end - -class Range - def as_json(options = nil) #:nodoc: - to_s - end -end - -class Array - def as_json(options = nil) #:nodoc: - map { |v| options ? v.as_json(options.dup) : v.as_json } - end -end - -class Hash - def as_json(options = nil) #:nodoc: - # create a subset of the hash by applying :only or :except - subset = if options - if attrs = options[:only] - slice(*Array(attrs)) - elsif attrs = options[:except] - except(*Array(attrs)) - else - self - end - else - self - end - - result = {} - subset.each do |k, v| - result[k.to_s] = options ? v.as_json(options.dup) : v.as_json - end - result - end -end - -class Time - def as_json(options = nil) #:nodoc: - if ActiveSupport::JSON::Encoding.use_standard_json_time_format - xmlschema(ActiveSupport::JSON::Encoding.time_precision) - else - %(#{strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)}) - end - end -end - -class Date - def as_json(options = nil) #:nodoc: - if ActiveSupport::JSON::Encoding.use_standard_json_time_format - strftime("%Y-%m-%d") - else - strftime("%Y/%m/%d") - end - end -end - -class DateTime - def as_json(options = nil) #:nodoc: - if ActiveSupport::JSON::Encoding.use_standard_json_time_format - xmlschema(ActiveSupport::JSON::Encoding.time_precision) - else - strftime("%Y/%m/%d %H:%M:%S %z") - end - end -end - -class URI::Generic #:nodoc: - def as_json(options = nil) - to_s - end -end - -class Pathname #:nodoc: - def as_json(options = nil) - to_s - end -end - -class IPAddr # :nodoc: - def as_json(options = nil) - to_s - end -end - -class Process::Status #:nodoc: - def as_json(options = nil) - { exitstatus: exitstatus, pid: pid } - end -end - -class Exception - def as_json(options = nil) - to_s - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/to_param.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/to_param.rb deleted file mode 100644 index 6d2bdd70f3..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/to_param.rb +++ /dev/null @@ -1,3 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/to_query" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/to_query.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/to_query.rb deleted file mode 100644 index bac6ff9c97..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/to_query.rb +++ /dev/null @@ -1,89 +0,0 @@ -# frozen_string_literal: true - -require "cgi" - -class Object - # Alias of to_s. - def to_param - to_s - end - - # Converts an object into a string suitable for use as a URL query string, - # using the given key as the param name. - def to_query(key) - "#{CGI.escape(key.to_param)}=#{CGI.escape(to_param.to_s)}" - end -end - -class NilClass - # Returns +self+. - def to_param - self - end -end - -class TrueClass - # Returns +self+. - def to_param - self - end -end - -class FalseClass - # Returns +self+. - def to_param - self - end -end - -class Array - # Calls to_param on all its elements and joins the result with - # slashes. This is used by url_for in Action Pack. - def to_param - collect(&:to_param).join "/" - end - - # Converts an array into a string suitable for use as a URL query string, - # using the given +key+ as the param name. - # - # ['Rails', 'coding'].to_query('hobbies') # => "hobbies%5B%5D=Rails&hobbies%5B%5D=coding" - def to_query(key) - prefix = "#{key}[]" - - if empty? - nil.to_query(prefix) - else - collect { |value| value.to_query(prefix) }.join "&" - end - end -end - -class Hash - # Returns a string representation of the receiver suitable for use as a URL - # query string: - # - # {name: 'David', nationality: 'Danish'}.to_query - # # => "name=David&nationality=Danish" - # - # An optional namespace can be passed to enclose key names: - # - # {name: 'David', nationality: 'Danish'}.to_query('user') - # # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish" - # - # The string pairs "key=value" that conform the query string - # are sorted lexicographically in ascending order. - # - # This method is also aliased as +to_param+. - def to_query(namespace = nil) - query = collect do |key, value| - unless (value.is_a?(Hash) || value.is_a?(Array)) && value.empty? - value.to_query(namespace ? "#{namespace}[#{key}]" : key) - end - end.compact - - query.sort! unless namespace.to_s.include?("[]") - query.join("&") - end - - alias_method :to_param, :to_query -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/with_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/with_options.rb deleted file mode 100644 index 1d46add6e0..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/object/with_options.rb +++ /dev/null @@ -1,82 +0,0 @@ -# frozen_string_literal: true - -require "active_support/option_merger" - -class Object - # An elegant way to factor duplication out of options passed to a series of - # method calls. Each method called in the block, with the block variable as - # the receiver, will have its options merged with the default +options+ hash - # provided. Each method called on the block variable must take an options - # hash as its final argument. - # - # Without with_options, this code contains duplication: - # - # class Account < ActiveRecord::Base - # has_many :customers, dependent: :destroy - # has_many :products, dependent: :destroy - # has_many :invoices, dependent: :destroy - # has_many :expenses, dependent: :destroy - # end - # - # Using with_options, we can remove the duplication: - # - # class Account < ActiveRecord::Base - # with_options dependent: :destroy do |assoc| - # assoc.has_many :customers - # assoc.has_many :products - # assoc.has_many :invoices - # assoc.has_many :expenses - # end - # end - # - # It can also be used with an explicit receiver: - # - # I18n.with_options locale: user.locale, scope: 'newsletter' do |i18n| - # subject i18n.t :subject - # body i18n.t :body, user_name: user.name - # end - # - # When you don't pass an explicit receiver, it executes the whole block - # in merging options context: - # - # class Account < ActiveRecord::Base - # with_options dependent: :destroy do - # has_many :customers - # has_many :products - # has_many :invoices - # has_many :expenses - # end - # end - # - # with_options can also be nested since the call is forwarded to its receiver. - # - # NOTE: Each nesting level will merge inherited defaults in addition to their own. - # - # class Post < ActiveRecord::Base - # with_options if: :persisted?, length: { minimum: 50 } do - # validates :content, if: -> { content.present? } - # end - # end - # - # The code is equivalent to: - # - # validates :content, length: { minimum: 50 }, if: -> { content.present? } - # - # Hence the inherited default for +if+ key is ignored. - # - # NOTE: You cannot call class methods implicitly inside of with_options. - # You can access these methods using the class name instead: - # - # class Phone < ActiveRecord::Base - # enum phone_number_type: { home: 0, office: 1, mobile: 2 } - # - # with_options presence: true do - # validates :phone_number_type, inclusion: { in: Phone.phone_number_types.keys } - # end - # end - # - def with_options(options, &block) - option_merger = ActiveSupport::OptionMerger.new(self, options) - block.arity.zero? ? option_merger.instance_eval(&block) : block.call(option_merger) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/range.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/range.rb deleted file mode 100644 index 78814fd189..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/range.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/range/conversions" -require "active_support/core_ext/range/compare_range" -require "active_support/core_ext/range/include_time_with_zone" -require "active_support/core_ext/range/overlaps" -require "active_support/core_ext/range/each" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/range/compare_range.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/range/compare_range.rb deleted file mode 100644 index c6d5b77e8e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/range/compare_range.rb +++ /dev/null @@ -1,82 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module CompareWithRange - # Extends the default Range#=== to support range comparisons. - # (1..5) === (1..5) # => true - # (1..5) === (2..3) # => true - # (1..5) === (1...6) # => true - # (1..5) === (2..6) # => false - # - # The native Range#=== behavior is untouched. - # ('a'..'f') === ('c') # => true - # (5..9) === (11) # => false - # - # The given range must be fully bounded, with both start and end. - def ===(value) - if value.is_a?(::Range) - is_backwards_op = value.exclude_end? ? :>= : :> - return false if value.begin && value.end && value.begin.public_send(is_backwards_op, value.end) - # 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? ? :< : :<= - value_max = !exclude_end? && value.exclude_end? ? value.max : value.last - super(value.first) && (self.end.nil? || value_max.public_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?(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) - is_backwards_op = value.exclude_end? ? :>= : :> - return false if value.begin && value.end && value.begin.public_send(is_backwards_op, value.end) - # 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? ? :< : :<= - value_max = !exclude_end? && value.exclude_end? ? value.max : value.last - super(value.first) && (self.end.nil? || value_max.public_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?(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) - is_backwards_op = value.exclude_end? ? :>= : :> - return false if value.begin && value.end && value.begin.public_send(is_backwards_op, value.end) - # 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? ? :< : :<= - value_max = !exclude_end? && value.exclude_end? ? value.max : value.last - super(value.first) && (self.end.nil? || value_max.public_send(operator, last)) - else - super - end - end - end -end - -Range.prepend(ActiveSupport::CompareWithRange) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/range/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/range/conversions.rb deleted file mode 100644 index 024e32db40..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/range/conversions.rb +++ /dev/null @@ -1,41 +0,0 @@ -# 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-6.1.7.3/lib/active_support/core_ext/range/each.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/range/each.rb deleted file mode 100644 index 2d86997edf..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/range/each.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -require "active_support/time_with_zone" - -module ActiveSupport - module EachTimeWithZone #:nodoc: - def each(&block) - ensure_iteration_allowed - super - end - - def step(n = 1, &block) - ensure_iteration_allowed - super - end - - private - def ensure_iteration_allowed - raise TypeError, "can't iterate from #{first.class}" if first.is_a?(TimeWithZone) - end - end -end - -Range.prepend(ActiveSupport::EachTimeWithZone) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/range/include_time_with_zone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/range/include_time_with_zone.rb deleted file mode 100644 index 89e911b11d..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/range/include_time_with_zone.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -require "active_support/time_with_zone" -require "active_support/deprecation" - -module ActiveSupport - module IncludeTimeWithZone #:nodoc: - # Extends the default Range#include? to support ActiveSupport::TimeWithZone. - # - # (1.hour.ago..1.hour.from_now).include?(Time.current) # => true - # - def include?(value) - if self.begin.is_a?(TimeWithZone) || self.end.is_a?(TimeWithZone) - ActiveSupport::Deprecation.warn(<<-MSG.squish) - Using `Range#include?` to check the inclusion of a value in - a date time range is deprecated. - It is recommended to use `Range#cover?` instead of `Range#include?` to - check the inclusion of a value in a date time range. - MSG - cover?(value) - else - super - end - end - end -end - -Range.prepend(ActiveSupport::IncludeTimeWithZone) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/range/overlaps.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/range/overlaps.rb deleted file mode 100644 index f753607f8b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/range/overlaps.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -class Range - # Compare two ranges and see if they overlap each other - # (1..5).overlaps?(4..6) # => true - # (1..5).overlaps?(7..9) # => false - def overlaps?(other) - cover?(other.first) || other.cover?(first) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/regexp.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/regexp.rb deleted file mode 100644 index 15534ff52f..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/regexp.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -class Regexp - # Returns +true+ if the regexp has the multiline flag set. - # - # (/./).multiline? # => false - # (/./m).multiline? # => true - # - # Regexp.new(".").multiline? # => false - # Regexp.new(".", Regexp::MULTILINE).multiline? # => true - def multiline? - options & MULTILINE == MULTILINE - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/securerandom.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/securerandom.rb deleted file mode 100644 index ef812f7e1a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/securerandom.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -require "securerandom" - -module SecureRandom - BASE58_ALPHABET = ("0".."9").to_a + ("A".."Z").to_a + ("a".."z").to_a - ["0", "O", "I", "l"] - BASE36_ALPHABET = ("0".."9").to_a + ("a".."z").to_a - - # SecureRandom.base58 generates a random base58 string. - # - # The argument _n_ specifies the length of the random string to be generated. - # - # If _n_ is not specified or is +nil+, 16 is assumed. It may be larger in the future. - # - # The result may contain alphanumeric characters except 0, O, I and l. - # - # p SecureRandom.base58 # => "4kUgL2pdQMSCQtjE" - # p SecureRandom.base58(24) # => "77TMHrHJFvFDwodq8w7Ev2m7" - 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-6.1.7.3/lib/active_support/core_ext/string.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string.rb deleted file mode 100644 index 757d15c51a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/string/conversions" -require "active_support/core_ext/string/filters" -require "active_support/core_ext/string/multibyte" -require "active_support/core_ext/string/starts_ends_with" -require "active_support/core_ext/string/inflections" -require "active_support/core_ext/string/access" -require "active_support/core_ext/string/behavior" -require "active_support/core_ext/string/output_safety" -require "active_support/core_ext/string/exclude" -require "active_support/core_ext/string/strip" -require "active_support/core_ext/string/inquiry" -require "active_support/core_ext/string/indent" -require "active_support/core_ext/string/zones" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/access.rb deleted file mode 100644 index f6a14c08bc..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/access.rb +++ /dev/null @@ -1,95 +0,0 @@ -# frozen_string_literal: true - -class String - # If you pass a single integer, returns a substring of one character at that - # position. The first character of the string is at position 0, the next at - # position 1, and so on. If a range is supplied, a substring containing - # characters at offsets given by the range is returned. In both cases, if an - # offset is negative, it is counted from the end of the string. Returns +nil+ - # if the initial offset falls outside the string. Returns an empty string if - # the beginning of the range is greater than the end of the string. - # - # str = "hello" - # str.at(0) # => "h" - # str.at(1..3) # => "ell" - # str.at(-2) # => "l" - # str.at(-2..-1) # => "lo" - # str.at(5) # => nil - # str.at(5..-1) # => "" - # - # If a Regexp is given, the matching portion of the string is returned. - # If a String is given, that given string is returned if it occurs in - # the string. In both cases, +nil+ is returned if there is no match. - # - # str = "hello" - # str.at(/lo/) # => "lo" - # str.at(/ol/) # => nil - # str.at("lo") # => "lo" - # str.at("ol") # => nil - def at(position) - self[position] - end - - # Returns a substring from the given position to the end of the string. - # If the position is negative, it is counted from the end of the string. - # - # str = "hello" - # str.from(0) # => "hello" - # str.from(3) # => "lo" - # str.from(-2) # => "lo" - # - # You can mix it with +to+ method and do fun things like: - # - # str = "hello" - # str.from(0).to(-1) # => "hello" - # str.from(1).to(-2) # => "ell" - def from(position) - self[position, length] - end - - # Returns a substring from the beginning of the string to the given position. - # If the position is negative, it is counted from the end of the string. - # - # str = "hello" - # str.to(0) # => "h" - # str.to(3) # => "hell" - # str.to(-2) # => "hell" - # - # You can mix it with +from+ method and do fun things like: - # - # str = "hello" - # str.from(0).to(-1) # => "hello" - # str.from(1).to(-2) # => "ell" - def to(position) - position += size if position < 0 - self[0, position + 1] || +"" - end - - # Returns the first character. If a limit is supplied, returns a substring - # from the beginning of the string until it reaches the limit value. If the - # given limit is greater than or equal to the string length, returns a copy of self. - # - # str = "hello" - # str.first # => "h" - # str.first(1) # => "h" - # str.first(2) # => "he" - # str.first(0) # => "" - # str.first(6) # => "hello" - def first(limit = 1) - self[0, limit] || raise(ArgumentError, "negative limit") - end - - # Returns the last character of the string. If a limit is supplied, returns a substring - # from the end of the string until it reaches the limit value (counting backwards). If - # the given limit is greater than or equal to the string length, returns a copy of self. - # - # str = "hello" - # str.last # => "o" - # str.last(1) # => "o" - # str.last(2) # => "lo" - # str.last(0) # => "" - # str.last(6) # => "hello" - def last(limit = 1) - self[[length - limit, 0].max, limit] || raise(ArgumentError, "negative limit") - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/behavior.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/behavior.rb deleted file mode 100644 index 35a5aa7840..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/behavior.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -class String - # Enables more predictable duck-typing on String-like classes. See Object#acts_like?. - def acts_like_string? - true - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/conversions.rb deleted file mode 100644 index e84a3909a1..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/conversions.rb +++ /dev/null @@ -1,60 +0,0 @@ -# frozen_string_literal: true - -require "date" -require "active_support/core_ext/time/calculations" - -class String - # Converts a string to a Time value. - # The +form+ can be either :utc or :local (default :local). - # - # The time is parsed using Time.parse method. - # If +form+ is :local, then the time is in the system timezone. - # If the date part is missing then the current date is used and if - # the time part is missing then it is assumed to be 00:00:00. - # - # "13-12-2012".to_time # => 2012-12-13 00:00:00 +0100 - # "06:12".to_time # => 2012-12-13 06:12:00 +0100 - # "2012-12-13 06:12".to_time # => 2012-12-13 06:12:00 +0100 - # "2012-12-13T06:12".to_time # => 2012-12-13 06:12:00 +0100 - # "2012-12-13T06:12".to_time(:utc) # => 2012-12-13 06:12:00 UTC - # "12/13/2012".to_time # => ArgumentError: argument out of range - # "1604326192".to_time # => ArgumentError: argument out of range - def to_time(form = :local) - parts = Date._parse(self, false) - used_keys = %i(year mon mday hour min sec sec_fraction offset) - return if (parts.keys & used_keys).empty? - - now = Time.now - time = Time.new( - parts.fetch(:year, now.year), - parts.fetch(:mon, now.month), - parts.fetch(:mday, now.day), - parts.fetch(:hour, 0), - parts.fetch(:min, 0), - parts.fetch(:sec, 0) + parts.fetch(:sec_fraction, 0), - parts.fetch(:offset, form == :utc ? 0 : nil) - ) - - form == :utc ? time.utc : time.to_time - end - - # Converts a string to a Date value. - # - # "1-1-2012".to_date # => Sun, 01 Jan 2012 - # "01/01/2012".to_date # => Sun, 01 Jan 2012 - # "2012-12-13".to_date # => Thu, 13 Dec 2012 - # "12/13/2012".to_date # => ArgumentError: invalid date - def to_date - ::Date.parse(self, false) unless blank? - end - - # Converts a string to a DateTime value. - # - # "1-1-2012".to_datetime # => Sun, 01 Jan 2012 00:00:00 +0000 - # "01/01/2012 23:59:59".to_datetime # => Sun, 01 Jan 2012 23:59:59 +0000 - # "2012-12-13 12:50".to_datetime # => Thu, 13 Dec 2012 12:50:00 +0000 - # "12/13/2012".to_datetime # => ArgumentError: invalid date - def to_datetime - ::DateTime.parse(self, false) unless blank? - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/inquiry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/inquiry.rb deleted file mode 100644 index d78ad9b741..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/inquiry.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -require "active_support/string_inquirer" -require "active_support/environment_inquirer" - -class String - # Wraps the current string in the ActiveSupport::StringInquirer class, - # which gives you a prettier way to test for equality. - # - # env = 'production'.inquiry - # env.production? # => true - # env.development? # => false - def inquiry - ActiveSupport::StringInquirer.new(self) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/output_safety.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/output_safety.rb deleted file mode 100644 index a627540a35..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/output_safety.rb +++ /dev/null @@ -1,347 +0,0 @@ -# frozen_string_literal: true - -require "erb" -require "active_support/core_ext/module/redefine_method" -require "active_support/multibyte/unicode" - -class ERB - module Util - HTML_ESCAPE = { "&" => "&", ">" => ">", "<" => "<", '"' => """, "'" => "'" } - JSON_ESCAPE = { "&" => '\u0026', ">" => '\u003e', "<" => '\u003c', "\u2028" => '\u2028', "\u2029" => '\u2029' } - HTML_ESCAPE_ONCE_REGEXP = /["><']|&(?!([a-zA-Z]+|(#\d+)|(#[xX][\dA-Fa-f]+));)/ - JSON_ESCAPE_REGEXP = /[\u2028\u2029&><]/u - - # Following XML requirements: https://www.w3.org/TR/REC-xml/#NT-Name - TAG_NAME_START_REGEXP_SET = "@:A-Z_a-z\u{C0}-\u{D6}\u{D8}-\u{F6}\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}" \ - "\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}" \ - "\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}" - TAG_NAME_START_REGEXP = /[^#{TAG_NAME_START_REGEXP_SET}]/ - TAG_NAME_FOLLOWING_REGEXP = /[^#{TAG_NAME_START_REGEXP_SET}\-.0-9\u{B7}\u{0300}-\u{036F}\u{203F}-\u{2040}]/ - TAG_NAME_REPLACEMENT_CHAR = "_" - - # A utility method for escaping HTML tag characters. - # This method is also aliased as h. - # - # puts html_escape('is a > 0 & a < 10?') - # # => is a > 0 & a < 10? - def html_escape(s) - unwrapped_html_escape(s).html_safe - end - - silence_redefinition_of_method :h - alias h html_escape - - module_function :h - - singleton_class.silence_redefinition_of_method :html_escape - module_function :html_escape - - # HTML escapes strings but doesn't wrap them with an ActiveSupport::SafeBuffer. - # This method is not for public consumption! Seriously! - def unwrapped_html_escape(s) # :nodoc: - s = s.to_s - if s.html_safe? - s - else - CGI.escapeHTML(ActiveSupport::Multibyte::Unicode.tidy_bytes(s)) - end - end - module_function :unwrapped_html_escape - - # A utility method for escaping HTML without affecting existing escaped entities. - # - # html_escape_once('1 < 2 & 3') - # # => "1 < 2 & 3" - # - # html_escape_once('<< Accept & Checkout') - # # => "<< Accept & Checkout" - def html_escape_once(s) - result = ActiveSupport::Multibyte::Unicode.tidy_bytes(s.to_s).gsub(HTML_ESCAPE_ONCE_REGEXP, HTML_ESCAPE) - s.html_safe? ? result.html_safe : result - end - - module_function :html_escape_once - - # A utility method for escaping HTML entities in JSON strings. Specifically, the - # &, > and < characters are replaced with their equivalent unicode escaped form - - # \u0026, \u003e, and \u003c. The Unicode sequences \u2028 and \u2029 are also - # escaped as they are treated as newline characters in some JavaScript engines. - # These sequences have identical meaning as the original characters inside the - # context of a JSON string, so assuming the input is a valid and well-formed - # JSON value, the output will have equivalent meaning when parsed: - # - # json = JSON.generate({ name: ""}) - # # => "{\"name\":\"\"}" - # - # json_escape(json) - # # => "{\"name\":\"\\u003C/script\\u003E\\u003Cscript\\u003Ealert('PWNED!!!')\\u003C/script\\u003E\"}" - # - # JSON.parse(json) == JSON.parse(json_escape(json)) - # # => true - # - # The intended use case for this method is to escape JSON strings before including - # them inside a script tag to avoid XSS vulnerability: - # - # - # - # It is necessary to +raw+ the result of +json_escape+, so that quotation marks - # don't get converted to " entities. +json_escape+ doesn't - # automatically flag the result as HTML safe, since the raw value is unsafe to - # use inside HTML attributes. - # - # If your JSON is being used downstream for insertion into the DOM, be aware of - # whether or not it is being inserted via html(). Most jQuery plugins do this. - # If that is the case, be sure to +html_escape+ or +sanitize+ any user-generated - # content returned by your JSON. - # - # If you need to output JSON elsewhere in your HTML, you can just do something - # like this, as any unsafe characters (including quotation marks) will be - # automatically escaped for you: - # - #
...
- # - # WARNING: this helper only works with valid JSON. Using this on non-JSON values - # will open up serious XSS vulnerabilities. For example, if you replace the - # +current_user.to_json+ in the example above with user input instead, the browser - # will happily eval() that string as JavaScript. - # - # The escaping performed in this method is identical to those performed in the - # Active Support JSON encoder when +ActiveSupport.escape_html_entities_in_json+ is - # set to true. Because this transformation is idempotent, this helper can be - # applied even if +ActiveSupport.escape_html_entities_in_json+ is already true. - # - # Therefore, when you are unsure if +ActiveSupport.escape_html_entities_in_json+ - # is enabled, or if you are unsure where your JSON string originated from, it - # is recommended that you always apply this helper (other libraries, such as the - # JSON gem, do not provide this kind of protection by default; also some gems - # might override +to_json+ to bypass Active Support's encoder). - def json_escape(s) - result = s.to_s.gsub(JSON_ESCAPE_REGEXP, JSON_ESCAPE) - s.html_safe? ? result.html_safe : result - end - - module_function :json_escape - - # A utility method for escaping XML names of tags and names of attributes. - # - # xml_name_escape('1 < 2 & 3') - # # => "1___2___3" - # - # It follows the requirements of the specification: https://www.w3.org/TR/REC-xml/#NT-Name - def xml_name_escape(name) - name = name.to_s - return "" if name.blank? - - starting_char = name[0].gsub(TAG_NAME_START_REGEXP, TAG_NAME_REPLACEMENT_CHAR) - - return starting_char if name.size == 1 - - following_chars = name[1..-1].gsub(TAG_NAME_FOLLOWING_REGEXP, TAG_NAME_REPLACEMENT_CHAR) - - starting_char + following_chars - end - module_function :xml_name_escape - end -end - -class Object - def html_safe? - false - end -end - -class Numeric - def html_safe? - true - end -end - -module ActiveSupport #:nodoc: - class SafeBuffer < String - UNSAFE_STRING_METHODS = %w( - capitalize chomp chop delete delete_prefix delete_suffix - downcase lstrip next reverse rstrip scrub 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 - - # Raised when ActiveSupport::SafeBuffer#safe_concat is called on unsafe buffers. - class SafeConcatError < StandardError - def initialize - super "Could not concatenate to the buffer because it is not html safe." - end - end - - def [](*args) - if html_safe? - new_string = super - - return unless new_string - - new_safe_buffer = new_string.is_a?(SafeBuffer) ? new_string : SafeBuffer.new(new_string) - new_safe_buffer.instance_variable_set :@html_safe, true - new_safe_buffer - else - to_str[*args] - end - end - - def safe_concat(value) - raise SafeConcatError unless html_safe? - original_concat(value) - end - - def initialize(str = "") - @html_safe = true - super - end - - def initialize_copy(other) - super - @html_safe = other.html_safe? - end - - def clone_empty - self[0, 0] - end - - def concat(value) - super(html_escape_interpolated_argument(value)) - end - alias << concat - - def bytesplice(*args, value) - super(*args, implicit_html_escape_interpolated_argument(value)) - end - - 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.length == 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_string = super - new_safe_buffer = new_string.is_a?(SafeBuffer) ? new_string : SafeBuffer.new(new_string) - new_safe_buffer.instance_variable_set(:@html_safe, @html_safe) - new_safe_buffer - end - - def %(args) - case args - when Hash - escaped_args = args.transform_values { |arg| html_escape_interpolated_argument(arg) } - else - escaped_args = Array(args).map { |arg| html_escape_interpolated_argument(arg) } - end - - self.class.new(super(escaped_args)) - end - - def html_safe? - defined?(@html_safe) && @html_safe - end - - def to_s - self - end - - def to_param - to_str - end - - def encode_with(coder) - coder.represent_object nil, to_str - end - - UNSAFE_STRING_METHODS.each do |unsafe_method| - if unsafe_method.respond_to?(unsafe_method) - class_eval <<-EOT, __FILE__, __LINE__ + 1 - def #{unsafe_method}(*args, &block) # def capitalize(*args, &block) - to_str.#{unsafe_method}(*args, &block) # to_str.capitalize(*args, &block) - end # end - - def #{unsafe_method}!(*args) # def capitalize!(*args) - @html_safe = false # @html_safe = false - super # super - end # end - EOT - 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 - -class String - # Marks a string as trusted safe. It will be inserted into HTML with no - # additional escaping performed. It is your responsibility to ensure that the - # string contains no malicious content. This method is equivalent to the - # +raw+ helper in views. It is recommended that you use +sanitize+ instead of - # this method. It should never be called on user input. - def html_safe - ActiveSupport::SafeBuffer.new(self) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/starts_ends_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/starts_ends_with.rb deleted file mode 100644 index 1e216370e4..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/starts_ends_with.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -class String - alias :starts_with? :start_with? - alias :ends_with? :end_with? -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/strip.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/strip.rb deleted file mode 100644 index 60e9952ee6..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/strip.rb +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -class String - # Strips indentation in heredocs. - # - # For example in - # - # if options[:usage] - # puts <<-USAGE.strip_heredoc - # This command does such and such. - # - # Supported options are: - # -h This message - # ... - # USAGE - # end - # - # the user would see the usage message aligned against the left margin. - # - # Technically, it looks for the least indented non-empty line - # in the whole string, and removes that amount of leading whitespace. - def strip_heredoc - gsub(/^#{scan(/^[ \t]*(?=\S)/).min}/, "").tap do |stripped| - stripped.freeze if frozen? - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/zones.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/zones.rb deleted file mode 100644 index 55dc231464..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/string/zones.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/string/conversions" -require "active_support/core_ext/time/zones" - -class String - # Converts String to a TimeWithZone in the current zone if Time.zone or Time.zone_default - # is set, otherwise converts String to a Time via String#to_time - def in_time_zone(zone = ::Time.zone) - if zone - ::Time.find_zone!(zone).parse(self) - else - to_time - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/symbol.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/symbol.rb deleted file mode 100644 index 709fed2024..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/symbol.rb +++ /dev/null @@ -1,3 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/symbol/starts_ends_with" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/symbol/starts_ends_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/symbol/starts_ends_with.rb deleted file mode 100644 index 655a539403..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/symbol/starts_ends_with.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -class Symbol - def start_with?(*prefixes) - to_s.start_with?(*prefixes) - end unless method_defined?(:start_with?) - - def end_with?(*suffixes) - to_s.end_with?(*suffixes) - end unless method_defined?(:end_with?) - - alias :starts_with? :start_with? - alias :ends_with? :end_with? -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time.rb deleted file mode 100644 index c809def05f..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/time/acts_like" -require "active_support/core_ext/time/calculations" -require "active_support/core_ext/time/compatibility" -require "active_support/core_ext/time/conversions" -require "active_support/core_ext/time/zones" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time/acts_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time/acts_like.rb deleted file mode 100644 index 8572b49639..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time/acts_like.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/acts_like" - -class Time - # Duck-types as a Time-like class. See Object#acts_like?. - def acts_like_time? - true - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time/calculations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time/calculations.rb deleted file mode 100644 index 1a7d503fe5..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time/calculations.rb +++ /dev/null @@ -1,365 +0,0 @@ -# frozen_string_literal: true - -require "active_support/duration" -require "active_support/core_ext/time/conversions" -require "active_support/time_with_zone" -require "active_support/core_ext/time/zones" -require "active_support/core_ext/date_and_time/calculations" -require "active_support/core_ext/date/calculations" -require "active_support/core_ext/module/remove_method" - -class Time - include DateAndTime::Calculations - - COMMON_YEAR_DAYS_IN_MONTH = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] - - class << self - # Overriding case equality method so that it returns true for ActiveSupport::TimeWithZone instances - def ===(other) - super || (self == Time && other.is_a?(ActiveSupport::TimeWithZone)) - end - - # Returns the number of days in the given month. - # If no year is specified, it will use the current year. - def days_in_month(month, year = current.year) - if month == 2 && ::Date.gregorian_leap?(year) - 29 - else - COMMON_YEAR_DAYS_IN_MONTH[month] - end - end - - # Returns the number of days in the given year. - # If no year is specified, it will use the current year. - def days_in_year(year = current.year) - days_in_month(2, year) + 337 - end - - # Returns Time.zone.now when Time.zone or config.time_zone are set, otherwise just returns Time.now. - def current - ::Time.zone ? ::Time.zone.now : ::Time.now - end - - # Layers additional behavior on Time.at so that ActiveSupport::TimeWithZone and DateTime - # instances can be used when called with a single argument - def at_with_coercion(*args) - return at_without_coercion(*args) if args.size != 1 - - # Time.at can be called with a time or numerical value - time_or_number = args.first - - if time_or_number.is_a?(ActiveSupport::TimeWithZone) - at_without_coercion(time_or_number.to_r).getlocal - elsif time_or_number.is_a?(DateTime) - at_without_coercion(time_or_number.to_f).getlocal - else - at_without_coercion(time_or_number) - end - end - ruby2_keywords(:at_with_coercion) if respond_to?(:ruby2_keywords, true) - alias_method :at_without_coercion, :at - alias_method :at, :at_with_coercion - - # Creates a +Time+ instance from an RFC 3339 string. - # - # Time.rfc3339('1999-12-31T14:00:00-10:00') # => 2000-01-01 00:00:00 -1000 - # - # If the time or offset components are missing then an +ArgumentError+ will be raised. - # - # Time.rfc3339('1999-12-31') # => ArgumentError: invalid date - def rfc3339(str) - parts = Date._rfc3339(str) - - raise ArgumentError, "invalid date" if parts.empty? - - Time.new( - parts.fetch(:year), - parts.fetch(:mon), - parts.fetch(:mday), - parts.fetch(:hour), - parts.fetch(:min), - parts.fetch(:sec) + parts.fetch(:sec_fraction, 0), - parts.fetch(:offset) - ) - end - end - - # Returns the number of seconds since 00:00:00. - # - # Time.new(2012, 8, 29, 0, 0, 0).seconds_since_midnight # => 0.0 - # Time.new(2012, 8, 29, 12, 34, 56).seconds_since_midnight # => 45296.0 - # Time.new(2012, 8, 29, 23, 59, 59).seconds_since_midnight # => 86399.0 - def seconds_since_midnight - to_i - change(hour: 0).to_i + (usec / 1.0e+6) - end - - # Returns the number of seconds until 23:59:59. - # - # Time.new(2012, 8, 29, 0, 0, 0).seconds_until_end_of_day # => 86399 - # Time.new(2012, 8, 29, 12, 34, 56).seconds_until_end_of_day # => 41103 - # Time.new(2012, 8, 29, 23, 59, 59).seconds_until_end_of_day # => 0 - def seconds_until_end_of_day - end_of_day.to_i - to_i - end - - # Returns the fraction of a second as a +Rational+ - # - # Time.new(2012, 8, 29, 0, 0, 0.5).sec_fraction # => (1/2) - def sec_fraction - subsec - end - - unless Time.method_defined?(:floor) - def floor(precision = 0) - change(nsec: 0) + subsec.floor(precision) - end - end - - # Restricted Ruby version due to a bug in `Time#ceil` - # See https://bugs.ruby-lang.org/issues/17025 for more details - if RUBY_VERSION <= "2.8" - remove_possible_method :ceil - def ceil(precision = 0) - change(nsec: 0) + subsec.ceil(precision) - end - end - - # Returns a new Time where one or more of the elements have been changed according - # to the +options+ parameter. The time options (:hour, :min, - # :sec, :usec, :nsec) reset cascadingly, so if only - # the hour is passed, then minute, sec, usec and nsec is set to 0. If the hour - # and minute is passed, then sec, usec and nsec is set to 0. The +options+ parameter - # takes a hash with any of these keys: :year, :month, :day, - # :hour, :min, :sec, :usec, :nsec, - # :offset. Pass either :usec or :nsec, not both. - # - # Time.new(2012, 8, 29, 22, 35, 0).change(day: 1) # => Time.new(2012, 8, 1, 22, 35, 0) - # Time.new(2012, 8, 29, 22, 35, 0).change(year: 1981, day: 1) # => Time.new(1981, 8, 1, 22, 35, 0) - # Time.new(2012, 8, 29, 22, 35, 0).change(year: 1981, hour: 0) # => Time.new(1981, 8, 29, 0, 0, 0) - def change(options) - new_year = options.fetch(:year, year) - new_month = options.fetch(:month, month) - new_day = options.fetch(:day, day) - new_hour = options.fetch(:hour, hour) - new_min = options.fetch(:min, options[:hour] ? 0 : min) - new_sec = options.fetch(:sec, (options[:hour] || options[:min]) ? 0 : sec) - new_offset = options.fetch(:offset, nil) - - if new_nsec = options[:nsec] - raise ArgumentError, "Can't change both :nsec and :usec at the same time: #{options.inspect}" if options[:usec] - new_usec = Rational(new_nsec, 1000) - else - new_usec = options.fetch(:usec, (options[:hour] || options[:min] || options[:sec]) ? 0 : Rational(nsec, 1000)) - end - - raise ArgumentError, "argument out of range" if new_usec >= 1000000 - - new_sec += Rational(new_usec, 1000000) - - if new_offset - ::Time.new(new_year, new_month, new_day, new_hour, new_min, new_sec, new_offset) - elsif utc? - ::Time.utc(new_year, new_month, new_day, new_hour, new_min, new_sec) - elsif zone&.respond_to?(:utc_to_local) - ::Time.new(new_year, new_month, new_day, new_hour, new_min, new_sec, zone) - elsif zone - ::Time.local(new_year, new_month, new_day, new_hour, new_min, new_sec) - else - ::Time.new(new_year, new_month, new_day, new_hour, new_min, new_sec, utc_offset) - end - end - - # Uses Date to provide precise Time calculations for years, months, and days - # according to the proleptic Gregorian calendar. The +options+ parameter - # takes a hash with any of these keys: :years, :months, - # :weeks, :days, :hours, :minutes, - # :seconds. - # - # Time.new(2015, 8, 1, 14, 35, 0).advance(seconds: 1) # => 2015-08-01 14:35:01 -0700 - # Time.new(2015, 8, 1, 14, 35, 0).advance(minutes: 1) # => 2015-08-01 14:36:00 -0700 - # Time.new(2015, 8, 1, 14, 35, 0).advance(hours: 1) # => 2015-08-01 15:35:00 -0700 - # Time.new(2015, 8, 1, 14, 35, 0).advance(days: 1) # => 2015-08-02 14:35:00 -0700 - # Time.new(2015, 8, 1, 14, 35, 0).advance(weeks: 1) # => 2015-08-08 14:35:00 -0700 - def advance(options) - unless options[:weeks].nil? - options[:weeks], partial_weeks = options[:weeks].divmod(1) - options[:days] = options.fetch(:days, 0) + 7 * partial_weeks - end - - unless options[:days].nil? - options[:days], partial_days = options[:days].divmod(1) - options[:hours] = options.fetch(:hours, 0) + 24 * partial_days - end - - d = to_date.gregorian.advance(options) - time_advanced_by_date = change(year: d.year, month: d.month, day: d.day) - seconds_to_advance = \ - options.fetch(:seconds, 0) + - options.fetch(:minutes, 0) * 60 + - options.fetch(:hours, 0) * 3600 - - if seconds_to_advance.zero? - time_advanced_by_date - else - time_advanced_by_date.since(seconds_to_advance) - end - end - - # Returns a new Time representing the time a number of seconds ago, this is basically a wrapper around the Numeric extension - def ago(seconds) - since(-seconds) - end - - # Returns a new Time representing the time a number of seconds since the instance time - def since(seconds) - self + seconds - rescue - to_datetime.since(seconds) - end - alias :in :since - - # Returns a new Time representing the start of the day (0:00) - def beginning_of_day - change(hour: 0) - end - alias :midnight :beginning_of_day - alias :at_midnight :beginning_of_day - alias :at_beginning_of_day :beginning_of_day - - # Returns a new Time representing the middle of the day (12:00) - def middle_of_day - change(hour: 12) - end - alias :midday :middle_of_day - alias :noon :middle_of_day - alias :at_midday :middle_of_day - alias :at_noon :middle_of_day - alias :at_middle_of_day :middle_of_day - - # Returns a new Time representing the end of the day, 23:59:59.999999 - def end_of_day - change( - hour: 23, - min: 59, - sec: 59, - usec: Rational(999999999, 1000) - ) - end - alias :at_end_of_day :end_of_day - - # Returns a new Time representing the start of the hour (x:00) - def beginning_of_hour - change(min: 0) - end - alias :at_beginning_of_hour :beginning_of_hour - - # Returns a new Time representing the end of the hour, x:59:59.999999 - def end_of_hour - change( - min: 59, - sec: 59, - usec: Rational(999999999, 1000) - ) - end - alias :at_end_of_hour :end_of_hour - - # Returns a new Time representing the start of the minute (x:xx:00) - def beginning_of_minute - change(sec: 0) - end - alias :at_beginning_of_minute :beginning_of_minute - - # Returns a new Time representing the end of the minute, x:xx:59.999999 - def end_of_minute - change( - sec: 59, - usec: Rational(999999999, 1000) - ) - end - alias :at_end_of_minute :end_of_minute - - def plus_with_duration(other) #:nodoc: - if ActiveSupport::Duration === other - other.since(self) - else - plus_without_duration(other) - end - end - alias_method :plus_without_duration, :+ - alias_method :+, :plus_with_duration - - def minus_with_duration(other) #:nodoc: - if ActiveSupport::Duration === other - other.until(self) - else - minus_without_duration(other) - end - end - alias_method :minus_without_duration, :- - alias_method :-, :minus_with_duration - - # Time#- can also be used to determine the number of seconds between two Time instances. - # We're layering on additional behavior so that ActiveSupport::TimeWithZone instances - # are coerced into values that Time#- will recognize - def minus_with_coercion(other) - other = other.comparable_time if other.respond_to?(:comparable_time) - other.is_a?(DateTime) ? to_f - other.to_f : minus_without_coercion(other) - end - alias_method :minus_without_coercion, :- - alias_method :-, :minus_with_coercion - - # Layers additional behavior on Time#<=> so that DateTime and ActiveSupport::TimeWithZone instances - # can be chronologically compared with a Time - def compare_with_coercion(other) - # we're avoiding Time#to_datetime and Time#to_time because they're expensive - if other.class == Time - compare_without_coercion(other) - elsif other.is_a?(Time) - compare_without_coercion(other.to_time) - else - to_datetime <=> other - end - end - alias_method :compare_without_coercion, :<=> - alias_method :<=>, :compare_with_coercion - - # Layers additional behavior on Time#eql? so that ActiveSupport::TimeWithZone instances - # can be eql? to an equivalent Time - def eql_with_coercion(other) - # if other is an ActiveSupport::TimeWithZone, coerce a Time instance from it so we can do eql? comparison - other = other.comparable_time if other.respond_to?(:comparable_time) - eql_without_coercion(other) - end - alias_method :eql_without_coercion, :eql? - alias_method :eql?, :eql_with_coercion - - # Returns a new time the specified number of days ago. - def prev_day(days = 1) - advance(days: -days) - end - - # Returns a new time the specified number of days in the future. - def next_day(days = 1) - advance(days: days) - end - - # Returns a new time the specified number of months ago. - def prev_month(months = 1) - advance(months: -months) - end - - # Returns a new time the specified number of months in the future. - def next_month(months = 1) - advance(months: months) - end - - # Returns a new time the specified number of years ago. - def prev_year(years = 1) - advance(years: -years) - end - - # Returns a new time the specified number of years in the future. - def next_year(years = 1) - advance(years: years) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time/compatibility.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time/compatibility.rb deleted file mode 100644 index 495e4f307b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time/compatibility.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/date_and_time/compatibility" -require "active_support/core_ext/module/redefine_method" - -class Time - include DateAndTime::Compatibility - - silence_redefinition_of_method :to_time - - # Either return +self+ or the time in the local system timezone depending - # on the setting of +ActiveSupport.to_time_preserves_timezone+. - def to_time - preserve_timezone ? self : getlocal - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time/conversions.rb deleted file mode 100644 index d61a191e33..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time/conversions.rb +++ /dev/null @@ -1,74 +0,0 @@ -# frozen_string_literal: true - -require "time" -require "active_support/inflector/methods" -require "active_support/values/time_zone" - -class Time - DATE_FORMATS = { - db: "%Y-%m-%d %H:%M:%S", - inspect: "%Y-%m-%d %H:%M:%S.%9N %z", - number: "%Y%m%d%H%M%S", - nsec: "%Y%m%d%H%M%S%9N", - usec: "%Y%m%d%H%M%S%6N", - time: "%H:%M", - short: "%d %b %H:%M", - long: "%B %d, %Y %H:%M", - long_ordinal: lambda { |time| - day_format = ActiveSupport::Inflector.ordinalize(time.day) - time.strftime("%B #{day_format}, %Y %H:%M") - }, - rfc822: lambda { |time| - offset_format = time.formatted_offset(false) - time.strftime("%a, %d %b %Y %H:%M:%S #{offset_format}") - }, - iso8601: lambda { |time| time.iso8601 } - } - - # Converts to a formatted string. See DATE_FORMATS for built-in formats. - # - # This method is aliased to to_s. - # - # time = Time.now # => 2007-01-18 06:10:17 -06:00 - # - # time.to_formatted_s(:time) # => "06:10" - # time.to_s(:time) # => "06:10" - # - # time.to_formatted_s(:db) # => "2007-01-18 06:10:17" - # time.to_formatted_s(:number) # => "20070118061017" - # time.to_formatted_s(:short) # => "18 Jan 06:10" - # time.to_formatted_s(:long) # => "January 18, 2007 06:10" - # time.to_formatted_s(:long_ordinal) # => "January 18th, 2007 06:10" - # time.to_formatted_s(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600" - # time.to_formatted_s(:iso8601) # => "2007-01-18T06:10:17-06:00" - # - # == Adding your own time formats to +to_formatted_s+ - # You can add your own formats to the Time::DATE_FORMATS hash. - # Use the format name as the hash key and either a strftime string - # or Proc instance that takes a time argument as the value. - # - # # config/initializers/time_formats.rb - # Time::DATE_FORMATS[:month_and_year] = '%B %Y' - # Time::DATE_FORMATS[:short_ordinal] = ->(time) { time.strftime("%B #{time.day.ordinalize}") } - def to_formatted_s(format = :default) - if formatter = DATE_FORMATS[format] - formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter) - else - to_default_s - end - end - alias_method :to_default_s, :to_s - alias_method :to_s, :to_formatted_s - - # Returns a formatted string of the offset from UTC, or an alternative - # string if the time zone is already UTC. - # - # Time.local(2000).formatted_offset # => "-06:00" - # Time.local(2000).formatted_offset(false) # => "-0600" - def formatted_offset(colon = true, alternate_utc_string = nil) - utc? && alternate_utc_string || ActiveSupport::TimeZone.seconds_to_utc_offset(utc_offset, colon) - end - - # Aliased to +xmlschema+ for compatibility with +DateTime+ - alias_method :rfc3339, :xmlschema -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time/zones.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time/zones.rb deleted file mode 100644 index a5588fd488..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/time/zones.rb +++ /dev/null @@ -1,113 +0,0 @@ -# frozen_string_literal: true - -require "active_support/time_with_zone" -require "active_support/core_ext/time/acts_like" -require "active_support/core_ext/date_and_time/zones" - -class Time - include DateAndTime::Zones - class << self - attr_accessor :zone_default - - # Returns the TimeZone for the current request, if this has been set (via Time.zone=). - # If Time.zone has not been set for the current request, returns the TimeZone specified in config.time_zone. - def zone - Thread.current[:time_zone] || zone_default - end - - # Sets Time.zone to a TimeZone object for the current request/thread. - # - # This method accepts any of the following: - # - # * A Rails TimeZone object. - # * An identifier for a Rails TimeZone object (e.g., "Eastern Time (US & Canada)", -5.hours). - # * A TZInfo::Timezone object. - # * An identifier for a TZInfo::Timezone object (e.g., "America/New_York"). - # - # Here's an example of how you might set Time.zone on a per request basis and reset it when the request is done. - # current_user.time_zone just needs to return a string identifying the user's preferred time zone: - # - # class ApplicationController < ActionController::Base - # around_action :set_time_zone - # - # def set_time_zone - # if logged_in? - # Time.use_zone(current_user.time_zone) { yield } - # else - # yield - # end - # end - # end - def zone=(time_zone) - Thread.current[:time_zone] = find_zone!(time_zone) - end - - # Allows override of Time.zone locally inside supplied block; - # resets Time.zone to existing value when done. - # - # class ApplicationController < ActionController::Base - # around_action :set_time_zone - # - # private - # - # def set_time_zone - # Time.use_zone(current_user.timezone) { yield } - # end - # end - # - # NOTE: This won't affect any ActiveSupport::TimeWithZone - # objects that have already been created, e.g. any model timestamp - # attributes that have been read before the block will remain in - # the application's default timezone. - def use_zone(time_zone) - new_zone = find_zone!(time_zone) - begin - old_zone, ::Time.zone = ::Time.zone, new_zone - yield - ensure - ::Time.zone = old_zone - end - end - - # Returns a TimeZone instance matching the time zone provided. - # Accepts the time zone in any format supported by Time.zone=. - # Raises an +ArgumentError+ for invalid time zones. - # - # Time.find_zone! "America/New_York" # => # - # Time.find_zone! "EST" # => # - # Time.find_zone! -5.hours # => # - # Time.find_zone! nil # => nil - # Time.find_zone! false # => false - # Time.find_zone! "NOT-A-TIMEZONE" # => ArgumentError: Invalid Timezone: NOT-A-TIMEZONE - def find_zone!(time_zone) - if !time_zone || time_zone.is_a?(ActiveSupport::TimeZone) - time_zone - else - # Look up the timezone based on the identifier (unless we've been - # passed a TZInfo::Timezone) - unless time_zone.respond_to?(:period_for_local) - time_zone = ActiveSupport::TimeZone[time_zone] || TZInfo::Timezone.get(time_zone) - end - - # Return if a TimeZone instance, or wrap in a TimeZone instance if a TZInfo::Timezone - if time_zone.is_a?(ActiveSupport::TimeZone) - time_zone - else - ActiveSupport::TimeZone.create(time_zone.name, nil, time_zone) - end - end - rescue TZInfo::InvalidTimezoneIdentifier - raise ArgumentError, "Invalid Timezone: #{time_zone}" - end - - # Returns a TimeZone instance matching the time zone provided. - # Accepts the time zone in any format supported by Time.zone=. - # Returns +nil+ for invalid time zones. - # - # Time.find_zone "America/New_York" # => # - # Time.find_zone "NOT-A-TIMEZONE" # => nil - def find_zone(time_zone) - find_zone!(time_zone) rescue nil - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/uri.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/uri.rb deleted file mode 100644 index fd5b0b31cc..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/uri.rb +++ /dev/null @@ -1,29 +0,0 @@ -# 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 - silence_redefinition_of_method :unescape - def unescape(str, escaped = /%[a-fA-F\d]{2}/) - # TODO: Are we actually sure that ASCII == UTF-8? - # YK: My initial experiments say yes, but let's be sure please - enc = str.encoding - enc = Encoding::UTF_8 if enc == Encoding::US_ASCII - str.dup.force_encoding(Encoding::ASCII_8BIT).gsub(escaped) { |match| [match[1, 2].hex].pack("C") }.force_encoding(enc) - end - end -end - -module URI - class << self - def parser - ActiveSupport::Deprecation.warn(<<-MSG.squish) - URI.parser is deprecated and will be removed in Rails 7.0. - Use `URI::DEFAULT_PARSER` instead. - MSG - URI::DEFAULT_PARSER - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/current_attributes.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/current_attributes.rb deleted file mode 100644 index ec487725d4..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/current_attributes.rb +++ /dev/null @@ -1,210 +0,0 @@ -# frozen_string_literal: true - -require "active_support/callbacks" -require "active_support/core_ext/enumerable" -require "active_support/core_ext/module/delegation" - -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 - # available to the whole system. - # - # The following full app-like example demonstrates how to use a Current class to - # facilitate easy access to the global, per-request attributes without passing them deeply - # around everywhere: - # - # # app/models/current.rb - # class Current < ActiveSupport::CurrentAttributes - # attribute :account, :user - # attribute :request_id, :user_agent, :ip_address - # - # resets { Time.zone = nil } - # - # def user=(user) - # super - # self.account = user.account - # Time.zone = user.time_zone - # end - # end - # - # # app/controllers/concerns/authentication.rb - # module Authentication - # extend ActiveSupport::Concern - # - # included do - # before_action :authenticate - # end - # - # private - # def authenticate - # if authenticated_user = User.find_by(id: cookies.encrypted[:user_id]) - # Current.user = authenticated_user - # else - # redirect_to new_session_url - # end - # end - # end - # - # # app/controllers/concerns/set_current_request_details.rb - # module SetCurrentRequestDetails - # extend ActiveSupport::Concern - # - # included do - # before_action do - # Current.request_id = request.uuid - # Current.user_agent = request.user_agent - # Current.ip_address = request.ip - # end - # end - # end - # - # class ApplicationController < ActionController::Base - # include Authentication - # include SetCurrentRequestDetails - # end - # - # class MessagesController < ApplicationController - # def create - # Current.account.messages.create(message_params) - # end - # end - # - # class Message < ApplicationRecord - # belongs_to :creator, default: -> { Current.user } - # after_create { |message| Event.create(record: message) } - # end - # - # class Event < ApplicationRecord - # before_create do - # self.request_id = Current.request_id - # self.user_agent = Current.user_agent - # self.ip_address = Current.ip_address - # end - # end - # - # A word of caution: It's easy to overdo a global singleton like Current and tangle your model as a result. - # Current should only be used for a few, top-level globals, like account, user, and request details. - # The attributes stuck in Current should be used by more or less all actions on all requests. If you start - # sticking controller-specific attributes in there, you're going to create a mess. - class CurrentAttributes - include ActiveSupport::Callbacks - define_callbacks :reset - - class << self - # Returns singleton instance for this class in this thread. If none exists, one is created. - def instance - current_instances[current_instances_key] ||= new - end - - # Declares one or more attributes that will be given both class and instance accessor methods. - def attribute(*names) - generated_attribute_methods.module_eval do - names.each do |name| - define_method(name) do - attributes[name.to_sym] - end - - define_method("#{name}=") do |attribute| - attributes[name.to_sym] = attribute - end - end - end - - names.each do |name| - define_singleton_method(name) do - instance.public_send(name) - end - - define_singleton_method("#{name}=") do |attribute| - instance.public_send("#{name}=", attribute) - end - 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 - - def reset_all # :nodoc: - current_instances.each_value(&:reset) - end - - def clear_all # :nodoc: - reset_all - current_instances.clear - end - - private - def generated_attribute_methods - @generated_attribute_methods ||= Module.new.tap { |mod| include mod } - end - - def current_instances - Thread.current[:current_attributes_instances] ||= {} - end - - def current_instances_key - @current_instances_key ||= name.to_sym - end - - def method_missing(name, *args, &block) - # Caches the method definition as a singleton method of the receiver. - # - # By letting #delegate handle it, we avoid an enclosure that'll capture args. - singleton_class.delegate name, to: :instance - - send(name, *args, &block) - end - ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true) - end - - attr_accessor :attributes - - def initialize - @attributes = {} - end - - # Expose one or more attributes within a block. Old values are returned after the block concludes. - # Example demonstrating the common use of needing to set Current attributes outside the request-cycle: - # - # class Chat::PublicationJob < ApplicationJob - # def perform(attributes, room_number, creator) - # Current.set(person: creator) do - # Chat::Publisher.publish(attributes: attributes, room_number: room_number) - # end - # end - # end - def set(set_attributes) - old_attributes = compute_attributes(set_attributes.keys) - assign_attributes(set_attributes) - yield - ensure - assign_attributes(old_attributes) - end - - # Reset all attributes. Should be called before and after actions, when used as a per-request singleton. - def reset - run_callbacks :reset do - self.attributes = {} - end - end - - private - def assign_attributes(new_attributes) - new_attributes.each { |key, value| public_send("#{key}=", value) } - end - - def compute_attributes(keys) - keys.index_with { |key| public_send(key) } - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/current_attributes/test_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/current_attributes/test_helper.rb deleted file mode 100644 index 2016384a80..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/current_attributes/test_helper.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport::CurrentAttributes::TestHelper # :nodoc: - def before_setup - ActiveSupport::CurrentAttributes.reset_all - super - end - - def after_teardown - super - ActiveSupport::CurrentAttributes.reset_all - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation.rb deleted file mode 100644 index 887328dcc3..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -require "singleton" - -module ActiveSupport - # \Deprecation specifies the API used by Rails to deprecate methods, instance - # variables, objects and constants. - class Deprecation - # active_support.rb sets an autoload for ActiveSupport::Deprecation. - # - # If these requires were at the top of the file the constant would not be - # defined by the time their files were loaded. Since some of them reopen - # ActiveSupport::Deprecation its autoload would be triggered, resulting in - # a circular require warning for active_support/deprecation.rb. - # - # So, we define the constant first, and load dependencies later. - require "active_support/deprecation/instance_delegator" - require "active_support/deprecation/behaviors" - require "active_support/deprecation/reporting" - require "active_support/deprecation/disallowed" - require "active_support/deprecation/constant_accessor" - require "active_support/deprecation/method_wrappers" - require "active_support/deprecation/proxy_wrappers" - require "active_support/core_ext/module/deprecation" - require "concurrent/atomic/thread_local_var" - - include Singleton - include InstanceDelegator - include Behavior - include Reporting - include Disallowed - include MethodWrapper - - # The version number in which the deprecated behavior will be removed, by default. - attr_accessor :deprecation_horizon - - # It accepts two parameters on initialization. The first is a version of library - # and the second is a library name. - # - # ActiveSupport::Deprecation.new('2.0', 'MyLibrary') - def initialize(deprecation_horizon = "7.0", gem_name = "Rails") - self.gem_name = gem_name - self.deprecation_horizon = deprecation_horizon - # By default, warnings are not silenced and debugging is off. - self.silenced = false - self.debug = false - @silenced_thread = Concurrent::ThreadLocalVar.new(false) - @explicitly_allowed_warnings = Concurrent::ThreadLocalVar.new(nil) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/behaviors.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/behaviors.rb deleted file mode 100644 index 9d1fc78360..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/behaviors.rb +++ /dev/null @@ -1,122 +0,0 @@ -# frozen_string_literal: true - -require "active_support/notifications" - -module ActiveSupport - # Raised when ActiveSupport::Deprecation::Behavior#behavior is set with :raise. - # You would set :raise, as a behavior to raise errors and proactively report exceptions from deprecations. - class DeprecationException < StandardError - end - - class Deprecation - # Default warning behaviors per Rails.env. - DEFAULT_BEHAVIORS = { - raise: ->(message, callstack, deprecation_horizon, gem_name) { - e = DeprecationException.new(message) - e.set_backtrace(callstack.map(&:to_s)) - raise e - }, - - stderr: ->(message, callstack, deprecation_horizon, gem_name) { - $stderr.puts(message) - $stderr.puts callstack.join("\n ") if debug - }, - - log: ->(message, callstack, deprecation_horizon, gem_name) { - logger = - if defined?(Rails.logger) && Rails.logger - Rails.logger - else - require "active_support/logger" - ActiveSupport::Logger.new($stderr) - end - logger.warn message - logger.debug callstack.join("\n ") if debug - }, - - notify: ->(message, callstack, deprecation_horizon, gem_name) { - notification_name = "deprecation.#{gem_name.underscore.tr('/', '_')}" - ActiveSupport::Notifications.instrument(notification_name, - message: message, - callstack: callstack, - gem_name: gem_name, - deprecation_horizon: deprecation_horizon) - }, - - silence: ->(message, callstack, deprecation_horizon, gem_name) { }, - } - - # Behavior module allows to determine how to display deprecation messages. - # You can create a custom behavior or set any from the +DEFAULT_BEHAVIORS+ - # constant. Available behaviors are: - # - # [+raise+] Raise ActiveSupport::DeprecationException. - # [+stderr+] Log all deprecation warnings to $stderr. - # [+log+] Log all deprecation warnings to +Rails.logger+. - # [+notify+] Use +ActiveSupport::Notifications+ to notify +deprecation.rails+. - # [+silence+] Do nothing. - # - # Setting behaviors only affects deprecations that happen after boot time. - # For more information you can read the documentation of the +behavior=+ method. - module Behavior - # Whether to print a backtrace along with the warning. - attr_accessor :debug - - # Returns the current behavior or if one isn't set, defaults to +:stderr+. - def behavior - @behavior ||= [DEFAULT_BEHAVIORS[:stderr]] - end - - # Returns the current behavior for disallowed deprecations or if one isn't set, defaults to +:raise+. - def disallowed_behavior - @disallowed_behavior ||= [DEFAULT_BEHAVIORS[:raise]] - end - - # Sets the behavior to the specified value. Can be a single value, array, - # or an object that responds to +call+. - # - # Available behaviors: - # - # [+raise+] Raise ActiveSupport::DeprecationException. - # [+stderr+] Log all deprecation warnings to $stderr. - # [+log+] Log all deprecation warnings to +Rails.logger+. - # [+notify+] Use +ActiveSupport::Notifications+ to notify +deprecation.rails+. - # [+silence+] Do nothing. - # - # Setting behaviors only affects deprecations that happen after boot time. - # Deprecation warnings raised by gems are not affected by this setting - # because they happen before Rails boots up. - # - # ActiveSupport::Deprecation.behavior = :stderr - # ActiveSupport::Deprecation.behavior = [:stderr, :log] - # ActiveSupport::Deprecation.behavior = MyCustomHandler - # ActiveSupport::Deprecation.behavior = ->(message, callstack, deprecation_horizon, gem_name) { - # # custom stuff - # } - def behavior=(behavior) - @behavior = Array(behavior).map { |b| DEFAULT_BEHAVIORS[b] || arity_coerce(b) } - end - - # Sets the behavior for disallowed deprecations (those configured by - # ActiveSupport::Deprecation.disallowed_warnings=) to the specified - # value. As with +behavior=+, this can be a single value, array, or an - # object that responds to +call+. - def disallowed_behavior=(behavior) - @disallowed_behavior = Array(behavior).map { |b| DEFAULT_BEHAVIORS[b] || arity_coerce(b) } - end - - private - def arity_coerce(behavior) - unless behavior.respond_to?(:call) - raise ArgumentError, "#{behavior.inspect} is not a valid deprecation behavior." - end - - if behavior.arity == 4 || behavior.arity == -1 - behavior - else - -> message, callstack, _, _ { behavior.call(message, callstack) } - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/constant_accessor.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/constant_accessor.rb deleted file mode 100644 index 1ed0015812..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/constant_accessor.rb +++ /dev/null @@ -1,52 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - class Deprecation - # DeprecatedConstantAccessor transforms a constant into a deprecated one by - # hooking +const_missing+. - # - # It takes the names of an old (deprecated) constant and of a new constant - # (both in string form) and optionally a deprecator. The deprecator defaults - # to +ActiveSupport::Deprecator+ if none is specified. - # - # The deprecated constant now returns the same object as the new one rather - # than a proxy object, so it can be used transparently in +rescue+ blocks - # etc. - # - # PLANETS = %w(mercury venus earth mars jupiter saturn uranus neptune pluto) - # - # # (In a later update, the original implementation of `PLANETS` has been removed.) - # - # PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune) - # include ActiveSupport::Deprecation::DeprecatedConstantAccessor - # deprecate_constant 'PLANETS', 'PLANETS_POST_2006' - # - # PLANETS.map { |planet| planet.capitalize } - # # => DEPRECATION WARNING: PLANETS is deprecated! Use PLANETS_POST_2006 instead. - # (Backtrace information…) - # ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"] - module DeprecatedConstantAccessor - def self.included(base) - require "active_support/inflector/methods" - - extension = Module.new do - def const_missing(missing_const_name) - if class_variable_defined?(:@@_deprecated_constants) - if (replacement = class_variable_get(:@@_deprecated_constants)[missing_const_name.to_s]) - replacement[:deprecator].warn(replacement[:message] || "#{name}::#{missing_const_name} is deprecated! Use #{replacement[:new]} instead.", caller_locations) - return ActiveSupport::Inflector.constantize(replacement[:new].to_s) - end - end - super - end - - def deprecate_constant(const_name, new_constant, message: nil, deprecator: ActiveSupport::Deprecation.instance) - class_variable_set(:@@_deprecated_constants, {}) unless class_variable_defined?(:@@_deprecated_constants) - class_variable_get(:@@_deprecated_constants)[const_name.to_s] = { new: new_constant, message: message, deprecator: deprecator } - end - end - base.singleton_class.prepend extension - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/disallowed.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/disallowed.rb deleted file mode 100644 index 096ecaae85..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/disallowed.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - class Deprecation - module Disallowed - # Sets the criteria used to identify deprecation messages which should be - # disallowed. Can be an array containing strings, symbols, or regular - # expressions. (Symbols are treated as strings). These are compared against - # the text of the generated deprecation warning. - # - # Additionally the scalar symbol +:all+ may be used to treat all - # deprecations as disallowed. - # - # Deprecations matching a substring or regular expression will be handled - # using the configured +ActiveSupport::Deprecation.disallowed_behavior+ - # rather than +ActiveSupport::Deprecation.behavior+ - attr_writer :disallowed_warnings - - # Returns the configured criteria used to identify deprecation messages - # which should be treated as disallowed. - def disallowed_warnings - @disallowed_warnings ||= [] - end - - private - def deprecation_disallowed?(message) - disallowed = ActiveSupport::Deprecation.disallowed_warnings - return false if explicitly_allowed?(message) - return true if disallowed == :all - disallowed.any? do |rule| - case rule - when String, Symbol - message.include?(rule.to_s) - when Regexp - rule.match?(message) - end - end - end - - def explicitly_allowed?(message) - allowances = @explicitly_allowed_warnings.value - return false unless allowances - return true if allowances == :all - allowances = [allowances] unless allowances.kind_of?(Array) - allowances.any? do |rule| - case rule - when String, Symbol - message.include?(rule.to_s) - when Regexp - rule.match?(message) - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/instance_delegator.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/instance_delegator.rb deleted file mode 100644 index 59dd30ae30..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/instance_delegator.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/module/delegation" - -module ActiveSupport - class Deprecation - module InstanceDelegator # :nodoc: - def self.included(base) - base.extend(ClassMethods) - base.singleton_class.prepend(OverrideDelegators) - base.public_class_method :new - end - - module ClassMethods # :nodoc: - def include(included_module) - included_module.instance_methods.each { |m| method_added(m) } - super - end - - def method_added(method_name) - singleton_class.delegate(method_name, to: :instance) - end - end - - module OverrideDelegators # :nodoc: - def warn(message = nil, callstack = nil) - callstack ||= caller_locations(2) - super - end - - def deprecation_warning(deprecated_method_name, message = nil, caller_backtrace = nil) - caller_backtrace ||= caller_locations(2) - super - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/method_wrappers.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/method_wrappers.rb deleted file mode 100644 index e6cf28a89f..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/method_wrappers.rb +++ /dev/null @@ -1,85 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/array/extract_options" -require "active_support/core_ext/module/redefine_method" - -module ActiveSupport - class Deprecation - module MethodWrapper - # Declare that a method has been deprecated. - # - # class Fred - # def aaa; end - # def bbb; end - # def ccc; end - # def ddd; end - # def eee; end - # end - # - # Using the default deprecator: - # ActiveSupport::Deprecation.deprecate_methods(Fred, :aaa, bbb: :zzz, ccc: 'use Bar#ccc instead') - # # => Fred - # - # Fred.new.aaa - # # DEPRECATION WARNING: aaa is deprecated and will be removed from Rails 5.1. (called from irb_binding at (irb):10) - # # => nil - # - # Fred.new.bbb - # # DEPRECATION WARNING: bbb is deprecated and will be removed from Rails 5.1 (use zzz instead). (called from irb_binding at (irb):11) - # # => nil - # - # Fred.new.ccc - # # DEPRECATION WARNING: ccc is deprecated and will be removed from Rails 5.1 (use Bar#ccc instead). (called from irb_binding at (irb):12) - # # => nil - # - # Passing in a custom deprecator: - # custom_deprecator = ActiveSupport::Deprecation.new('next-release', 'MyGem') - # ActiveSupport::Deprecation.deprecate_methods(Fred, ddd: :zzz, deprecator: custom_deprecator) - # # => [:ddd] - # - # Fred.new.ddd - # DEPRECATION WARNING: ddd is deprecated and will be removed from MyGem next-release (use zzz instead). (called from irb_binding at (irb):15) - # # => nil - # - # Using a custom deprecator directly: - # custom_deprecator = ActiveSupport::Deprecation.new('next-release', 'MyGem') - # custom_deprecator.deprecate_methods(Fred, eee: :zzz) - # # => [:eee] - # - # Fred.new.eee - # DEPRECATION WARNING: eee is deprecated and will be removed from MyGem next-release (use zzz instead). (called from irb_binding at (irb):18) - # # => nil - def deprecate_methods(target_module, *method_names) - options = method_names.extract_options! - deprecator = options.delete(:deprecator) || self - method_names += options.keys - mod = nil - - method_names.each do |method_name| - message = options[method_name] - if target_module.method_defined?(method_name) || target_module.private_method_defined?(method_name) - method = target_module.instance_method(method_name) - target_module.module_eval do - redefine_method(method_name) do |*args, &block| - deprecator.deprecation_warning(method_name, message) - method.bind(self).call(*args, &block) - end - ruby2_keywords(method_name) if respond_to?(:ruby2_keywords, true) - end - else - mod ||= Module.new - mod.module_eval do - define_method(method_name) do |*args, &block| - deprecator.deprecation_warning(method_name, message) - super(*args, &block) - end - ruby2_keywords(method_name) if respond_to?(:ruby2_keywords, true) - end - end - end - - target_module.prepend(mod) if mod - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/proxy_wrappers.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/proxy_wrappers.rb deleted file mode 100644 index 4bc112d6c4..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/proxy_wrappers.rb +++ /dev/null @@ -1,177 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - class Deprecation - class DeprecationProxy #:nodoc: - def self.new(*args, &block) - object = args.first - - return object unless object - super - end - - instance_methods.each { |m| undef_method m unless /^__|^object_id$/.match?(m) } - - # Don't give a deprecation warning on inspect since test/unit and error - # logs rely on it for diagnostics. - def inspect - target.inspect - end - - private - def method_missing(called, *args, &block) - warn caller_locations, called, args - target.__send__(called, *args, &block) - end - end - - # DeprecatedObjectProxy transforms an object into a deprecated one. It - # takes an object, a deprecation message and optionally a deprecator. The - # deprecator defaults to +ActiveSupport::Deprecator+ if none is specified. - # - # deprecated_object = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(Object.new, "This object is now deprecated") - # # => # - # - # deprecated_object.to_s - # DEPRECATION WARNING: This object is now deprecated. - # (Backtrace) - # # => "#" - class DeprecatedObjectProxy < DeprecationProxy - def initialize(object, message, deprecator = ActiveSupport::Deprecation.instance) - @object = object - @message = message - @deprecator = deprecator - end - - private - def target - @object - end - - def warn(callstack, called, args) - @deprecator.warn(@message, callstack) - end - end - - # DeprecatedInstanceVariableProxy transforms an instance variable into a - # deprecated one. It takes an instance of a class, a method on that class - # and an instance variable. It optionally takes a deprecator as the last - # argument. The deprecator defaults to +ActiveSupport::Deprecator+ if none - # is specified. - # - # class Example - # def initialize - # @request = ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new(self, :request, :@request) - # @_request = :special_request - # end - # - # def request - # @_request - # end - # - # def old_request - # @request - # end - # end - # - # example = Example.new - # # => # - # - # example.old_request.to_s - # # => DEPRECATION WARNING: @request is deprecated! Call request.to_s instead of - # @request.to_s - # (Backtrace information…) - # "special_request" - # - # example.request.to_s - # # => "special_request" - class DeprecatedInstanceVariableProxy < DeprecationProxy - def initialize(instance, method, var = "@#{method}", deprecator = ActiveSupport::Deprecation.instance) - @instance = instance - @method = method - @var = var - @deprecator = deprecator - end - - private - def target - @instance.__send__(@method) - end - - def warn(callstack, called, args) - @deprecator.warn("#{@var} is deprecated! Call #{@method}.#{called} instead of #{@var}.#{called}. Args: #{args.inspect}", callstack) - end - end - - # DeprecatedConstantProxy transforms a constant into a deprecated one. It - # takes the names of an old (deprecated) constant and of a new constant - # (both in string form) and optionally a deprecator. The deprecator defaults - # to +ActiveSupport::Deprecator+ if none is specified. The deprecated constant - # now returns the value of the new one. - # - # PLANETS = %w(mercury venus earth mars jupiter saturn uranus neptune pluto) - # - # # (In a later update, the original implementation of `PLANETS` has been removed.) - # - # PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune) - # PLANETS = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('PLANETS', 'PLANETS_POST_2006') - # - # PLANETS.map { |planet| planet.capitalize } - # # => DEPRECATION WARNING: PLANETS is deprecated! Use PLANETS_POST_2006 instead. - # (Backtrace information…) - # ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"] - class DeprecatedConstantProxy < Module - def self.new(*args, **options, &block) - object = args.first - - return object unless object - super - end - - def initialize(old_const, new_const, deprecator = ActiveSupport::Deprecation.instance, message: "#{old_const} is deprecated! Use #{new_const} instead.") - Kernel.require "active_support/inflector/methods" - - @old_const = old_const - @new_const = new_const - @deprecator = deprecator - @message = message - end - - instance_methods.each { |m| undef_method m unless /^__|^object_id$/.match?(m) } - - # Don't give a deprecation warning on inspect since test/unit and error - # logs rely on it for diagnostics. - def inspect - target.inspect - end - - # Don't give a deprecation warning on methods that IRB may invoke - # during tab-completion. - delegate :hash, :instance_methods, :name, :respond_to?, to: :target - - # Returns the class of the new constant. - # - # PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune) - # PLANETS = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('PLANETS', 'PLANETS_POST_2006') - # PLANETS.class # => Array - def class - target.class - end - - private - def target - ActiveSupport::Inflector.constantize(@new_const.to_s) - end - - def const_missing(name) - @deprecator.warn(@message, caller_locations) - target.const_get(name) - end - - def method_missing(called, *args, &block) - @deprecator.warn(@message, caller_locations) - target.__send__(called, *args, &block) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/reporting.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/reporting.rb deleted file mode 100644 index 51514eb3a6..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/deprecation/reporting.rb +++ /dev/null @@ -1,157 +0,0 @@ -# frozen_string_literal: true - -require "rbconfig" - -module ActiveSupport - class Deprecation - module Reporting - # Whether to print a message (silent mode) - attr_writer :silenced - # Name of gem where method is deprecated - attr_accessor :gem_name - - # Outputs a deprecation warning to the output configured by - # ActiveSupport::Deprecation.behavior. - # - # ActiveSupport::Deprecation.warn('something broke!') - # # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)" - def warn(message = nil, callstack = nil) - return if silenced - - callstack ||= caller_locations(2) - deprecation_message(callstack, message).tap do |m| - if deprecation_disallowed?(message) - disallowed_behavior.each { |b| b.call(m, callstack, deprecation_horizon, gem_name) } - else - behavior.each { |b| b.call(m, callstack, deprecation_horizon, gem_name) } - end - end - end - - # Silence deprecation warnings within the block. - # - # ActiveSupport::Deprecation.warn('something broke!') - # # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)" - # - # ActiveSupport::Deprecation.silence do - # ActiveSupport::Deprecation.warn('something broke!') - # end - # # => nil - def silence(&block) - @silenced_thread.bind(true, &block) - end - - # Allow previously disallowed deprecation warnings within the block. - # allowed_warnings can be an array containing strings, symbols, or regular - # expressions. (Symbols are treated as strings). These are compared against - # the text of deprecation warning messages generated within the block. - # Matching warnings will be exempt from the rules set by - # +ActiveSupport::Deprecation.disallowed_warnings+ - # - # The optional if: argument accepts a truthy/falsy value or an object that - # responds to .call. If truthy, then matching warnings will be allowed. - # If falsey then the method yields to the block without allowing the warning. - # - # ActiveSupport::Deprecation.disallowed_behavior = :raise - # ActiveSupport::Deprecation.disallowed_warnings = [ - # "something broke" - # ] - # - # ActiveSupport::Deprecation.warn('something broke!') - # # => ActiveSupport::DeprecationException - # - # ActiveSupport::Deprecation.allow ['something broke'] do - # ActiveSupport::Deprecation.warn('something broke!') - # end - # # => nil - # - # ActiveSupport::Deprecation.allow ['something broke'], if: Rails.env.production? do - # ActiveSupport::Deprecation.warn('something broke!') - # end - # # => ActiveSupport::DeprecationException for dev/test, nil for production - def allow(allowed_warnings = :all, if: true, &block) - conditional = binding.local_variable_get(:if) - conditional = conditional.call if conditional.respond_to?(:call) - if conditional - @explicitly_allowed_warnings.bind(allowed_warnings, &block) - else - yield - end - end - - def silenced - @silenced || @silenced_thread.value - end - - def deprecation_warning(deprecated_method_name, message = nil, caller_backtrace = nil) - caller_backtrace ||= caller_locations(2) - deprecated_method_warning(deprecated_method_name, message).tap do |msg| - warn(msg, caller_backtrace) - end - end - - private - # Outputs a deprecation warning message - # - # deprecated_method_warning(:method_name) - # # => "method_name is deprecated and will be removed from Rails #{deprecation_horizon}" - # deprecated_method_warning(:method_name, :another_method) - # # => "method_name is deprecated and will be removed from Rails #{deprecation_horizon} (use another_method instead)" - # deprecated_method_warning(:method_name, "Optional message") - # # => "method_name is deprecated and will be removed from Rails #{deprecation_horizon} (Optional message)" - def deprecated_method_warning(method_name, message = nil) - warning = "#{method_name} is deprecated and will be removed from #{gem_name} #{deprecation_horizon}" - case message - when Symbol then "#{warning} (use #{message} instead)" - when String then "#{warning} (#{message})" - else warning - end - end - - def deprecation_message(callstack, message = nil) - message ||= "You are using deprecated behavior which will be removed from the next major or minor release." - "DEPRECATION WARNING: #{message} #{deprecation_caller_message(callstack)}" - end - - def deprecation_caller_message(callstack) - file, line, method = extract_callstack(callstack) - if file - if line && method - "(called from #{method} at #{file}:#{line})" - else - "(called from #{file}:#{line})" - end - end - end - - def extract_callstack(callstack) - return _extract_callstack(callstack) if callstack.first.is_a? String - - offending_line = callstack.find { |frame| - frame.absolute_path && !ignored_callstack(frame.absolute_path) - } || callstack.first - - [offending_line.path, offending_line.lineno, offending_line.label] - end - - def _extract_callstack(callstack) - warn "Please pass `caller_locations` to the deprecation API" if $VERBOSE - offending_line = callstack.find { |line| !ignored_callstack(line) } || callstack.first - - if offending_line - if md = offending_line.match(/^(.+?):(\d+)(?::in `(.*?)')?/) - md.captures - else - offending_line - end - end - end - - RAILS_GEM_ROOT = File.expand_path("../../../..", __dir__) + "/" - - def ignored_callstack(path) - path.start_with?(RAILS_GEM_ROOT) || path.start_with?(RbConfig::CONFIG["rubylibdir"]) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/descendants_tracker.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/descendants_tracker.rb deleted file mode 100644 index 2362914dce..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/descendants_tracker.rb +++ /dev/null @@ -1,112 +0,0 @@ -# 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 - alias_method :subclasses, :direct_descendants - - 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 - alias_method :subclasses, :direct_descendants - - 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) - @refs << WeakRef.new(klass) - end - - def each - @refs.reject! do |ref| - yield ref.__getobj__ - false - rescue WeakRef::RefError - true - end - self - 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-6.1.7.3/lib/active_support/digest.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/digest.rb deleted file mode 100644 index c044214648..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/digest.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -require "digest" - -module ActiveSupport - class Digest #:nodoc: - class <(other) - if Scalar === other || Duration === other - value <=> other.value - elsif Numeric === other - value <=> other - else - nil - end - end - - def +(other) - if Duration === other - seconds = value + other.parts.fetch(:seconds, 0) - new_parts = other.parts.merge(seconds: seconds) - new_value = value + other.value - - Duration.new(new_value, new_parts) - else - calculate(:+, other) - end - end - - def -(other) - if Duration === other - seconds = value - other.parts.fetch(:seconds, 0) - new_parts = other.parts.transform_values(&:-@) - new_parts = new_parts.merge(seconds: seconds) - new_value = value - other.value - - Duration.new(new_value, new_parts) - else - calculate(:-, other) - end - end - - def *(other) - if Duration === other - new_parts = other.parts.transform_values { |other_value| value * other_value } - new_value = value * other.value - - Duration.new(new_value, new_parts) - else - calculate(:*, other) - end - end - - def /(other) - if Duration === other - value / other.value - else - calculate(:/, other) - end - end - - def %(other) - if Duration === other - Duration.build(value % other.value) - else - calculate(:%, other) - end - end - - private - def calculate(op, other) - if Scalar === other - Scalar.new(value.public_send(op, other.value)) - elsif Numeric === other - Scalar.new(value.public_send(op, other)) - else - raise_type_error(other) - end - end - - def raise_type_error(other) - raise TypeError, "no implicit conversion of #{other.class} into #{self.class}" - end - end - - SECONDS_PER_MINUTE = 60 - SECONDS_PER_HOUR = 3600 - SECONDS_PER_DAY = 86400 - SECONDS_PER_WEEK = 604800 - SECONDS_PER_MONTH = 2629746 # 1/12 of a gregorian year - SECONDS_PER_YEAR = 31556952 # length of a gregorian year (365.2425 days) - - PARTS_IN_SECONDS = { - seconds: 1, - minutes: SECONDS_PER_MINUTE, - hours: SECONDS_PER_HOUR, - days: SECONDS_PER_DAY, - weeks: SECONDS_PER_WEEK, - months: SECONDS_PER_MONTH, - years: SECONDS_PER_YEAR - }.freeze - - PARTS = [:years, :months, :weeks, :days, :hours, :minutes, :seconds].freeze - - attr_accessor :value, :parts - - autoload :ISO8601Parser, "active_support/duration/iso8601_parser" - autoload :ISO8601Serializer, "active_support/duration/iso8601_serializer" - - class << self - # Creates a new Duration from string formatted according to ISO 8601 Duration. - # - # See {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601#Durations] for more information. - # This method allows negative parts to be present in pattern. - # If invalid string is provided, it will raise +ActiveSupport::Duration::ISO8601Parser::ParsingError+. - def parse(iso8601duration) - parts = ISO8601Parser.new(iso8601duration).parse! - new(calculate_total_seconds(parts), parts) - end - - def ===(other) #:nodoc: - other.is_a?(Duration) - rescue ::NoMethodError - false - end - - def seconds(value) #:nodoc: - new(value, seconds: value) - end - - def minutes(value) #:nodoc: - new(value * SECONDS_PER_MINUTE, minutes: value) - end - - def hours(value) #:nodoc: - new(value * SECONDS_PER_HOUR, hours: value) - end - - def days(value) #:nodoc: - new(value * SECONDS_PER_DAY, days: value) - end - - def weeks(value) #:nodoc: - new(value * SECONDS_PER_WEEK, weeks: value) - end - - def months(value) #:nodoc: - new(value * SECONDS_PER_MONTH, months: value) - end - - def years(value) #:nodoc: - new(value * SECONDS_PER_YEAR, years: value) - end - - # Creates a new Duration from a seconds value that is converted - # to the individual parts: - # - # ActiveSupport::Duration.build(31556952).parts # => {:years=>1} - # ActiveSupport::Duration.build(2716146).parts # => {:months=>1, :days=>1} - # - def build(value) - unless value.is_a?(::Numeric) - raise TypeError, "can't build an #{self.name} from a #{value.class.name}" - end - - parts = {} - remainder_sign = value <=> 0 - remainder = value.round(9).abs - - PARTS.each do |part| - unless part == :seconds - part_in_seconds = PARTS_IN_SECONDS[part] - parts[part] = remainder.div(part_in_seconds) * remainder_sign - remainder %= part_in_seconds - end - end unless value == 0 - - parts[:seconds] = remainder * remainder_sign - - new(value, parts) - end - - private - def calculate_total_seconds(parts) - parts.inject(0) do |total, (part, value)| - total + value * PARTS_IN_SECONDS[part] - end - end - end - - def initialize(value, parts) #:nodoc: - @value, @parts = value, parts - @parts.reject! { |k, v| v.zero? } unless value == 0 - end - - def coerce(other) #:nodoc: - case other - when Scalar - [other, self] - when Duration - [Scalar.new(other.value), self] - else - [Scalar.new(other), self] - end - end - - # Compares one Duration with another or a Numeric to this Duration. - # Numeric values are treated as seconds. - def <=>(other) - if Duration === other - value <=> other.value - elsif Numeric === other - value <=> other - end - end - - # Adds another Duration or a Numeric to this Duration. Numeric values - # are treated as seconds. - def +(other) - if Duration === other - parts = @parts.merge(other.parts) do |_key, value, other_value| - value + other_value - end - Duration.new(value + other.value, parts) - else - seconds = @parts.fetch(:seconds, 0) + other - Duration.new(value + other, @parts.merge(seconds: seconds)) - end - end - - # Subtracts another Duration or a Numeric from this Duration. Numeric - # values are treated as seconds. - def -(other) - self + (-other) - end - - # Multiplies this Duration by a Numeric and returns a new Duration. - def *(other) - if Scalar === other || Duration === other - Duration.new(value * other.value, parts.transform_values { |number| number * other.value }) - elsif Numeric === other - Duration.new(value * other, parts.transform_values { |number| number * other }) - else - raise_type_error(other) - end - end - - # Divides this Duration by a Numeric and returns a new Duration. - def /(other) - if Scalar === other - Duration.new(value / other.value, parts.transform_values { |number| number / other.value }) - elsif Duration === other - value / other.value - elsif Numeric === other - Duration.new(value / other, parts.transform_values { |number| number / other }) - else - raise_type_error(other) - end - end - - # Returns the modulo of this Duration by another Duration or Numeric. - # Numeric values are treated as seconds. - def %(other) - if Duration === other || Scalar === other - Duration.build(value % other.value) - elsif Numeric === other - Duration.build(value % other) - else - raise_type_error(other) - end - end - - def -@ #:nodoc: - Duration.new(-value, parts.transform_values(&:-@)) - end - - def +@ #:nodoc: - self - end - - def is_a?(klass) #:nodoc: - Duration == klass || value.is_a?(klass) - end - alias :kind_of? :is_a? - - def instance_of?(klass) # :nodoc: - Duration == klass || value.instance_of?(klass) - end - - # Returns +true+ if +other+ is also a Duration instance with the - # same +value+, or if other == value. - def ==(other) - if Duration === other - other.value == value - else - other == value - end - end - - # Returns the amount of seconds a duration covers as a string. - # For more information check to_i method. - # - # 1.day.to_s # => "86400" - def to_s - @value.to_s - end - - # Returns the number of seconds that this Duration represents. - # - # 1.minute.to_i # => 60 - # 1.hour.to_i # => 3600 - # 1.day.to_i # => 86400 - # - # Note that this conversion makes some assumptions about the - # duration of some periods, e.g. months are always 1/12 of year - # and years are 365.2425 days: - # - # # equivalent to (1.year / 12).to_i - # 1.month.to_i # => 2629746 - # - # # equivalent to 365.2425.days.to_i - # 1.year.to_i # => 31556952 - # - # In such cases, Ruby's core - # Date[https://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 - end - alias :in_seconds :to_i - - # Returns the amount of minutes a duration covers as a float - # - # 1.day.in_minutes # => 1440.0 - def in_minutes - in_seconds / SECONDS_PER_MINUTE.to_f - end - - # Returns the amount of hours a duration covers as a float - # - # 1.day.in_hours # => 24.0 - def in_hours - in_seconds / SECONDS_PER_HOUR.to_f - end - - # Returns the amount of days a duration covers as a float - # - # 12.hours.in_days # => 0.5 - def in_days - in_seconds / SECONDS_PER_DAY.to_f - end - - # Returns the amount of weeks a duration covers as a float - # - # 2.months.in_weeks # => 8.696 - def in_weeks - in_seconds / SECONDS_PER_WEEK.to_f - end - - # Returns the amount of months a duration covers as a float - # - # 9.weeks.in_months # => 2.07 - def in_months - in_seconds / SECONDS_PER_MONTH.to_f - end - - # Returns the amount of years a duration covers as a float - # - # 30.days.in_years # => 0.082 - def in_years - in_seconds / SECONDS_PER_YEAR.to_f - end - - # Returns +true+ if +other+ is also a Duration instance, which has the - # same parts as this one. - def eql?(other) - Duration === other && other.value.eql?(value) - end - - def hash - @value.hash - end - - # Calculates a new Time or Date that is as far in the future - # as this Duration represents. - def since(time = ::Time.current) - sum(1, time) - end - alias :from_now :since - alias :after :since - - # Calculates a new Time or Date that is as far in the past - # as this Duration represents. - def ago(time = ::Time.current) - sum(-1, time) - end - alias :until :ago - alias :before :ago - - def inspect #:nodoc: - return "#{value} seconds" if parts.empty? - - parts. - sort_by { |unit, _ | PARTS.index(unit) }. - map { |unit, val| "#{val} #{val == 1 ? unit.to_s.chop : unit.to_s}" }. - to_sentence(locale: ::I18n.default_locale) - end - - def as_json(options = nil) #:nodoc: - to_i - end - - def init_with(coder) #:nodoc: - initialize(coder["value"], coder["parts"]) - end - - def encode_with(coder) #:nodoc: - coder.map = { "value" => @value, "parts" => @parts } - end - - # Build ISO 8601 Duration string for this duration. - # The +precision+ parameter can be used to limit seconds' precision of duration. - def iso8601(precision: nil) - ISO8601Serializer.new(self, precision: precision).serialize - end - - private - def sum(sign, time = ::Time.current) - unless time.acts_like?(:time) || time.acts_like?(:date) - raise ::ArgumentError, "expected a time or date, got #{time.inspect}" - end - - if parts.empty? - time.since(sign * value) - else - parts.inject(time) do |t, (type, number)| - if type == :seconds - t.since(sign * number) - elsif type == :minutes - t.since(sign * number * 60) - elsif type == :hours - t.since(sign * number * 3600) - else - t.advance(type => sign * number) - end - end - end - end - - def respond_to_missing?(method, _) - value.respond_to?(method) - end - - def method_missing(method, *args, &block) - value.public_send(method, *args, &block) - end - - def raise_type_error(other) - raise TypeError, "no implicit conversion of #{other.class} into #{self.class}" - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/encrypted_configuration.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/encrypted_configuration.rb deleted file mode 100644 index cc1d026737..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/encrypted_configuration.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -require "yaml" -require "active_support/encrypted_file" -require "active_support/ordered_options" -require "active_support/core_ext/object/inclusion" -require "active_support/core_ext/module/delegation" - -module ActiveSupport - class EncryptedConfiguration < EncryptedFile - delegate :[], :fetch, to: :config - delegate_missing_to :options - - def initialize(config_path:, key_path:, env_key:, raise_if_missing_key:) - super content_path: config_path, key_path: key_path, - env_key: env_key, raise_if_missing_key: raise_if_missing_key - end - - # Allow a config to be started without a file present - def read - super - rescue ActiveSupport::EncryptedFile::MissingContentError - "" - end - - def write(contents) - deserialize(contents) - - super - end - - def config - @config ||= deserialize(read).deep_symbolize_keys - end - - private - def options - @options ||= ActiveSupport::InheritableOptions.new(config) - end - - def deserialize(config) - YAML.load(config).presence || {} - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/encrypted_file.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/encrypted_file.rb deleted file mode 100644 index a35cc54ef5..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/encrypted_file.rb +++ /dev/null @@ -1,117 +0,0 @@ -# frozen_string_literal: true - -require "pathname" -require "tmpdir" -require "active_support/message_encryptor" - -module ActiveSupport - class EncryptedFile - class MissingContentError < RuntimeError - def initialize(content_path) - super "Missing encrypted content file in #{content_path}." - end - end - - class MissingKeyError < RuntimeError - def initialize(key_path:, env_key:) - super \ - "Missing encryption key to decrypt file with. " + - "Ask your team for your master key and write it to #{key_path} or put it in the ENV['#{env_key}']." - end - end - - class InvalidKeyLengthError < RuntimeError - def initialize - super "Encryption key must be exactly #{EncryptedFile.expected_key_length} characters." - end - end - - CIPHER = "aes-128-gcm" - - def self.generate_key - SecureRandom.hex(ActiveSupport::MessageEncryptor.key_len(CIPHER)) - end - - def self.expected_key_length # :nodoc: - @expected_key_length ||= generate_key.length - end - - - attr_reader :content_path, :key_path, :env_key, :raise_if_missing_key - - def initialize(content_path:, key_path:, env_key:, raise_if_missing_key:) - @content_path = Pathname.new(content_path).yield_self { |path| path.symlink? ? path.realpath : path } - @key_path = Pathname.new(key_path) - @env_key, @raise_if_missing_key = env_key, raise_if_missing_key - end - - def key - read_env_key || read_key_file || handle_missing_key - end - - def read - if !key.nil? && content_path.exist? - decrypt content_path.binread - else - raise MissingContentError, content_path - end - end - - def write(contents) - IO.binwrite "#{content_path}.tmp", encrypt(contents) - FileUtils.mv "#{content_path}.tmp", content_path - end - - def change(&block) - writing read, &block - end - - - private - def writing(contents) - tmp_file = "#{Process.pid}.#{content_path.basename.to_s.chomp('.enc')}" - tmp_path = Pathname.new File.join(Dir.tmpdir, tmp_file) - tmp_path.binwrite contents - - yield tmp_path - - updated_contents = tmp_path.binread - - write(updated_contents) if updated_contents != contents - ensure - FileUtils.rm(tmp_path) if tmp_path&.exist? - end - - - def encrypt(contents) - check_key_length - encryptor.encrypt_and_sign contents - end - - def decrypt(contents) - encryptor.decrypt_and_verify contents - end - - def encryptor - @encryptor ||= ActiveSupport::MessageEncryptor.new([ key ].pack("H*"), cipher: CIPHER) - end - - - def read_env_key - ENV[env_key] - end - - def read_key_file - return @key_file_contents if defined?(@key_file_contents) - @key_file_contents = (key_path.binread.strip if key_path.exist?) - end - - def handle_missing_key - raise MissingKeyError.new(key_path: key_path, env_key: env_key) if raise_if_missing_key - end - - def check_key_length - raise InvalidKeyLengthError if key&.length != self.class.expected_key_length - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/environment_inquirer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/environment_inquirer.rb deleted file mode 100644 index 05361d9327..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/environment_inquirer.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -require "active_support/string_inquirer" - -module ActiveSupport - class EnvironmentInquirer < StringInquirer #:nodoc: - DEFAULT_ENVIRONMENTS = ["development", "test", "production"] - def initialize(env) - super(env) - - DEFAULT_ENVIRONMENTS.each do |default| - instance_variable_set :"@#{default}", env == default - end - end - - DEFAULT_ENVIRONMENTS.each do |env| - class_eval "def #{env}?; @#{env}; end" - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/evented_file_update_checker.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/evented_file_update_checker.rb deleted file mode 100644 index f9bc3be9be..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/evented_file_update_checker.rb +++ /dev/null @@ -1,170 +0,0 @@ -# frozen_string_literal: true - -require "set" -require "pathname" -require "concurrent/atomic/atomic_boolean" -require "listen" -require "active_support/fork_tracker" - -module ActiveSupport - # Allows you to "listen" to changes in a file system. - # The evented file updater does not hit disk when checking for updates - # instead it uses platform specific file system events to trigger a change - # in state. - # - # The file checker takes an array of files to watch or a hash specifying directories - # and file extensions to watch. It also takes a block that is called when - # EventedFileUpdateChecker#execute is run or when EventedFileUpdateChecker#execute_if_updated - # is run and there have been changes to the file system. - # - # Note: Forking will cause the first call to `updated?` to return `true`. - # - # Example: - # - # checker = ActiveSupport::EventedFileUpdateChecker.new(["/tmp/foo"]) { puts "changed" } - # checker.updated? - # # => false - # checker.execute_if_updated - # # => nil - # - # FileUtils.touch("/tmp/foo") - # - # checker.updated? - # # => true - # checker.execute_if_updated - # # => "changed" - # - class EventedFileUpdateChecker #:nodoc: all - def initialize(files, dirs = {}, &block) - unless block - raise ArgumentError, "A block is required to initialize an EventedFileUpdateChecker" - end - - @block = block - @core = Core.new(files, dirs) - ObjectSpace.define_finalizer(self, @core.finalizer) - end - - def updated? - if @core.restart? - @core.thread_safely(&:restart) - @core.updated.make_true - end - - @core.updated.true? - end - - def execute - @core.updated.make_false - @block.call - end - - def execute_if_updated - if updated? - yield if block_given? - execute - true - end - end - - class Core - attr_reader :updated - - def initialize(files, dirs) - @files = files.map { |file| Pathname(file).expand_path }.to_set - - @dirs = dirs.each_with_object({}) do |(dir, exts), hash| - hash[Pathname(dir).expand_path] = Array(exts).map { |ext| ext.to_s.sub(/\A\.?/, ".") }.to_set - end - - @common_path = common_path(@dirs.keys) - - @dtw = directories_to_watch - @missing = [] - - @updated = Concurrent::AtomicBoolean.new(false) - @mutex = Mutex.new - - start - @after_fork = ActiveSupport::ForkTracker.after_fork { start } - end - - def finalizer - proc do - stop - ActiveSupport::ForkTracker.unregister(@after_fork) - end - end - - def thread_safely - @mutex.synchronize do - yield self - end - end - - def start - normalize_dirs! - @dtw, @missing = [*@dtw, *@missing].partition(&:exist?) - @listener = @dtw.any? ? Listen.to(*@dtw, &method(:changed)) : nil - @listener&.start - end - - def stop - @listener&.stop - end - - def restart - stop - start - end - - def restart? - @missing.any?(&:exist?) - end - - def normalize_dirs! - @dirs.transform_keys! do |dir| - dir.exist? ? dir.realpath : dir - end - end - - def changed(modified, added, removed) - unless @updated.true? - @updated.make_true if (modified + added + removed).any? { |f| watching?(f) } - end - end - - def watching?(file) - file = Pathname(file) - - if @files.member?(file) - true - elsif file.directory? - false - else - ext = file.extname - - file.dirname.ascend do |dir| - matching = @dirs[dir] - - if matching && (matching.empty? || matching.include?(ext)) - break true - elsif dir == @common_path || dir.root? - break false - end - end - end - end - - def directories_to_watch - dtw = @dirs.keys | @files.map(&:dirname) - accounted_for = dtw.to_set + Gem.path.map { |path| Pathname(path) } - dtw.reject { |dir| dir.ascend.drop(1).any? { |parent| accounted_for.include?(parent) } } - end - - def common_path(paths) - paths.map { |path| path.ascend.to_a }.reduce(&:&)&.first - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/execution_wrapper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/execution_wrapper.rb deleted file mode 100644 index 07c4f435db..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/execution_wrapper.rb +++ /dev/null @@ -1,132 +0,0 @@ -# frozen_string_literal: true - -require "active_support/callbacks" -require "concurrent/hash" - -module ActiveSupport - class ExecutionWrapper - include ActiveSupport::Callbacks - - Null = Object.new # :nodoc: - def Null.complete! # :nodoc: - end - - define_callbacks :run - define_callbacks :complete - - def self.to_run(*args, &block) - set_callback(:run, *args, &block) - end - - def self.to_complete(*args, &block) - set_callback(:complete, *args, &block) - end - - RunHook = Struct.new(:hook) do # :nodoc: - def before(target) - hook_state = target.send(:hook_state) - hook_state[hook] = hook.run - end - end - - CompleteHook = Struct.new(:hook) do # :nodoc: - def before(target) - hook_state = target.send(:hook_state) - if hook_state.key?(hook) - hook.complete hook_state[hook] - end - end - alias after before - end - - # Register an object to be invoked during both the +run+ and - # +complete+ steps. - # - # +hook.complete+ will be passed the value returned from +hook.run+, - # and will only be invoked if +run+ has previously been called. - # (Mostly, this means it won't be invoked if an exception occurs in - # a preceding +to_run+ block; all ordinary +to_complete+ blocks are - # invoked in that situation.) - def self.register_hook(hook, outer: false) - if outer - to_run RunHook.new(hook), prepend: true - to_complete :after, CompleteHook.new(hook) - else - to_run RunHook.new(hook) - to_complete CompleteHook.new(hook) - end - end - - # Run this execution. - # - # Returns an instance, whose +complete!+ method *must* be invoked - # after the work has been performed. - # - # Where possible, prefer +wrap+. - def self.run!(reset: false) - if reset - lost_instance = active.delete(Thread.current) - lost_instance&.complete! - else - return Null if active? - end - - new.tap do |instance| - success = nil - begin - instance.run! - success = true - ensure - instance.complete! unless success - end - end - end - - # Perform the work in the supplied block as an execution. - def self.wrap - return yield if active? - - instance = run! - begin - yield - ensure - instance.complete! - end - end - - class << self # :nodoc: - attr_accessor :active - end - - def self.inherited(other) # :nodoc: - super - other.active = Concurrent::Hash.new - end - - self.active = Concurrent::Hash.new - - def self.active? # :nodoc: - @active.key?(Thread.current) - end - - def run! # :nodoc: - self.class.active[Thread.current] = self - run_callbacks(:run) - end - - # Complete this in-flight execution. This method *must* be called - # exactly once on the result of any call to +run!+. - # - # Where possible, prefer +wrap+. - def complete! - run_callbacks(:complete) - ensure - self.class.active.delete Thread.current - end - - private - def hook_state - @_hook_state ||= {} - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/executor.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/executor.rb deleted file mode 100644 index ce391b07ec..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/executor.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -require "active_support/execution_wrapper" - -module ActiveSupport - class Executor < ExecutionWrapper - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/file_update_checker.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/file_update_checker.rb deleted file mode 100644 index 9b665e7f19..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/file_update_checker.rb +++ /dev/null @@ -1,162 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/time/calculations" - -module ActiveSupport - # FileUpdateChecker specifies the API used by Rails to watch files - # and control reloading. The API depends on four methods: - # - # * +initialize+ which expects two parameters and one block as - # described below. - # - # * +updated?+ which returns a boolean if there were updates in - # the filesystem or not. - # - # * +execute+ which executes the given block on initialization - # and updates the latest watched files and timestamp. - # - # * +execute_if_updated+ which just executes the block if it was updated. - # - # After initialization, a call to +execute_if_updated+ must execute - # the block only if there was really a change in the filesystem. - # - # This class is used by Rails to reload the I18n framework whenever - # they are changed upon a new request. - # - # i18n_reloader = ActiveSupport::FileUpdateChecker.new(paths) do - # I18n.reload! - # end - # - # ActiveSupport::Reloader.to_prepare do - # i18n_reloader.execute_if_updated - # end - class FileUpdateChecker - # It accepts two parameters on initialization. The first is an array - # of files and the second is an optional hash of directories. The hash must - # have directories as keys and the value is an array of extensions to be - # watched under that directory. - # - # This method must also receive a block that will be called once a path - # changes. The array of files and list of directories cannot be changed - # after FileUpdateChecker has been initialized. - def initialize(files, dirs = {}, &block) - unless block - raise ArgumentError, "A block is required to initialize a FileUpdateChecker" - end - - @files = files.freeze - @glob = compile_glob(dirs) - @block = block - - @watched = nil - @updated_at = nil - - @last_watched = watched - @last_update_at = updated_at(@last_watched) - end - - # Check if any of the entries were updated. If so, the watched and/or - # updated_at values are cached until the block is executed via +execute+ - # or +execute_if_updated+. - def updated? - current_watched = watched - if @last_watched.size != current_watched.size - @watched = current_watched - true - else - current_updated_at = updated_at(current_watched) - if @last_update_at < current_updated_at - @watched = current_watched - @updated_at = current_updated_at - true - else - false - end - end - end - - # Executes the given block and updates the latest watched files and - # timestamp. - def execute - @last_watched = watched - @last_update_at = updated_at(@last_watched) - @block.call - ensure - @watched = nil - @updated_at = nil - end - - # Execute the block given if updated. - def execute_if_updated - if updated? - yield if block_given? - execute - true - else - false - end - end - - private - def watched - @watched || begin - all = @files.select { |f| File.exist?(f) } - all.concat(Dir[@glob]) if @glob - all - end - end - - def updated_at(paths) - @updated_at || max_mtime(paths) || Time.at(0) - end - - # This method returns the maximum mtime of the files in +paths+, or +nil+ - # if the array is empty. - # - # Files with a mtime in the future are ignored. Such abnormal situation - # can happen for example if the user changes the clock by hand. It is - # healthy to consider this edge case because with mtimes in the future - # reloading is not triggered. - def max_mtime(paths) - time_now = Time.now - max_mtime = nil - - # Time comparisons are performed with #compare_without_coercion because - # AS redefines these operators in a way that is much slower and does not - # bring any benefit in this particular code. - # - # Read t1.compare_without_coercion(t2) < 0 as t1 < t2. - paths.each do |path| - mtime = File.mtime(path) - - next if time_now.compare_without_coercion(mtime) < 0 - - if max_mtime.nil? || max_mtime.compare_without_coercion(mtime) < 0 - max_mtime = mtime - end - end - - max_mtime - end - - def compile_glob(hash) - hash.freeze # Freeze so changes aren't accidentally pushed - return if hash.empty? - - globs = hash.map do |key, value| - "#{escape(key)}/**/*#{compile_ext(value)}" - end - "{#{globs.join(",")}}" - end - - def escape(key) - key.gsub(",", '\,') - end - - def compile_ext(array) - array = Array(array) - return if array.empty? - ".{#{array.join(",")}}" - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/fork_tracker.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/fork_tracker.rb deleted file mode 100644 index 2f250378ba..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/fork_tracker.rb +++ /dev/null @@ -1,64 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module ForkTracker # :nodoc: - module CoreExt - def fork(*) - if block_given? - super do - ForkTracker.check! - yield - end - else - unless pid = super - ForkTracker.check! - end - pid - end - end - ruby2_keywords(:fork) if respond_to?(:ruby2_keywords, true) - end - - module CoreExtPrivate - include CoreExt - - private - def fork(*) - super - end - ruby2_keywords(:fork) if respond_to?(:ruby2_keywords, true) - end - - @pid = Process.pid - @callbacks = [] - - class << self - def check! - if @pid != Process.pid - @callbacks.each(&:call) - @pid = Process.pid - end - end - - def hook! - if Process.respond_to?(:fork) - ::Object.prepend(CoreExtPrivate) - ::Kernel.prepend(CoreExtPrivate) - ::Kernel.singleton_class.prepend(CoreExt) - ::Process.singleton_class.prepend(CoreExt) - end - end - - def after_fork(&block) - @callbacks << block - block - end - - def unregister(callback) - @callbacks.delete(callback) - end - end - end -end - -ActiveSupport::ForkTracker.hook! diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/gem_version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/gem_version.rb deleted file mode 100644 index 7b91453aea..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/gem_version.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # Returns the version of the currently loaded Active Support as a Gem::Version. - def self.gem_version - Gem::Version.new VERSION::STRING - end - - module VERSION - MAJOR = 6 - MINOR = 1 - TINY = 7 - PRE = "3" - - STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/gzip.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/gzip.rb deleted file mode 100644 index 7ffa6d90a2..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/gzip.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -require "zlib" -require "stringio" - -module ActiveSupport - # A convenient wrapper for the zlib standard library that allows - # compression/decompression of strings with gzip. - # - # gzip = ActiveSupport::Gzip.compress('compress me!') - # # => "\x1F\x8B\b\x00o\x8D\xCDO\x00\x03K\xCE\xCF-(J-.V\xC8MU\x04\x00R>n\x83\f\x00\x00\x00" - # - # ActiveSupport::Gzip.decompress(gzip) - # # => "compress me!" - module Gzip - class Stream < StringIO - def initialize(*) - super - set_encoding "BINARY" - end - def close; rewind; end - end - - # Decompresses a gzipped string. - def self.decompress(source) - Zlib::GzipReader.wrap(StringIO.new(source), &:read) - end - - # Compresses a string using gzip. - def self.compress(source, level = Zlib::DEFAULT_COMPRESSION, strategy = Zlib::DEFAULT_STRATEGY) - output = Stream.new - gz = Zlib::GzipWriter.new(output, level, strategy) - gz.write(source) - gz.close - output.string - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/hash_with_indifferent_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/hash_with_indifferent_access.rb deleted file mode 100644 index 4e574cd059..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/hash_with_indifferent_access.rb +++ /dev/null @@ -1,423 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/hash/keys" -require "active_support/core_ext/hash/reverse_merge" -require "active_support/core_ext/hash/except" -require "active_support/core_ext/hash/slice" - -module ActiveSupport - # Implements a hash where keys :foo and "foo" are considered - # to be the same. - # - # rgb = ActiveSupport::HashWithIndifferentAccess.new - # - # rgb[:black] = '#000000' - # rgb[:black] # => '#000000' - # rgb['black'] # => '#000000' - # - # rgb['white'] = '#FFFFFF' - # rgb[:white] # => '#FFFFFF' - # rgb['white'] # => '#FFFFFF' - # - # Internally symbols are mapped to strings when used as keys in the entire - # writing interface (calling []=, merge, etc). This - # mapping belongs to the public interface. For example, given: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new(a: 1) - # - # You are guaranteed that the key is returned as a string: - # - # hash.keys # => ["a"] - # - # Technically other types of keys are accepted: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new(a: 1) - # hash[0] = 0 - # hash # => {"a"=>1, 0=>0} - # - # but this class is intended for use cases where strings or symbols are the - # expected keys and it is convenient to understand both as the same. For - # example the +params+ hash in Ruby on Rails. - # - # Note that core extensions define Hash#with_indifferent_access: - # - # rgb = { black: '#000000', white: '#FFFFFF' }.with_indifferent_access - # - # which may be handy. - # - # To access this class outside of Rails, require the core extension with: - # - # require "active_support/core_ext/hash/indifferent_access" - # - # which will, in turn, require this file. - class HashWithIndifferentAccess < Hash - # Returns +true+ so that Array#extract_options! finds members of - # this class. - def extractable_options? - true - end - - def with_indifferent_access - dup - end - - def nested_under_indifferent_access - self - end - - def initialize(constructor = {}) - if constructor.respond_to?(:to_hash) - super() - update(constructor) - - hash = constructor.is_a?(Hash) ? constructor : constructor.to_hash - self.default = hash.default if hash.default - self.default_proc = hash.default_proc if hash.default_proc - else - super(constructor) - end - end - - def self.[](*args) - new.merge!(Hash[*args]) - end - - alias_method :regular_writer, :[]= unless method_defined?(:regular_writer) - alias_method :regular_update, :update unless method_defined?(:regular_update) - - # Assigns a new value to the hash: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash[:key] = 'value' - # - # This value can be later fetched using either +:key+ or 'key'. - def []=(key, value) - regular_writer(convert_key(key), convert_value(value, conversion: :assignment)) - end - - alias_method :store, :[]= - - # Updates the receiver in-place, merging in the hashes passed as arguments: - # - # hash_1 = ActiveSupport::HashWithIndifferentAccess.new - # hash_1[:key] = 'value' - # - # hash_2 = ActiveSupport::HashWithIndifferentAccess.new - # hash_2[:key] = 'New Value!' - # - # hash_1.update(hash_2) # => {"key"=>"New Value!"} - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash.update({ "a" => 1 }, { "b" => 2 }) # => { "a" => 1, "b" => 2 } - # - # The arguments can be either an - # ActiveSupport::HashWithIndifferentAccess or a regular +Hash+. - # In either case the merge respects the semantics of indifferent access. - # - # If the argument is a regular hash with keys +:key+ and "key" only one - # of the values end up in the receiver, but which one is unspecified. - # - # When given a block, the value for duplicated keys will be determined - # by the result of invoking the block with the duplicated key, the value - # in the receiver, and the value in +other_hash+. The rules for duplicated - # keys follow the semantics of indifferent access: - # - # hash_1[:key] = 10 - # hash_2['key'] = 12 - # hash_1.update(hash_2) { |key, old, new| old + new } # => {"key"=>22} - def update(*other_hashes, &block) - if other_hashes.size == 1 - update_with_single_argument(other_hashes.first, block) - else - other_hashes.each do |other_hash| - update_with_single_argument(other_hash, block) - end - end - self - end - - alias_method :merge!, :update - - # Checks the hash for a key matching the argument passed in: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash['key'] = 'value' - # hash.key?(:key) # => true - # hash.key?('key') # => true - def key?(key) - super(convert_key(key)) - end - - alias_method :include?, :key? - alias_method :has_key?, :key? - alias_method :member?, :key? - - # Same as Hash#[] where the key passed as argument can be - # either a string or a symbol: - # - # counters = ActiveSupport::HashWithIndifferentAccess.new - # counters[:foo] = 1 - # - # counters['foo'] # => 1 - # counters[:foo] # => 1 - # counters[:zoo] # => nil - def [](key) - super(convert_key(key)) - end - - # Same as Hash#assoc where the key passed as argument can be - # either a string or a symbol: - # - # counters = ActiveSupport::HashWithIndifferentAccess.new - # counters[:foo] = 1 - # - # counters.assoc('foo') # => ["foo", 1] - # counters.assoc(:foo) # => ["foo", 1] - # counters.assoc(:zoo) # => nil - def assoc(key) - super(convert_key(key)) - end - - # Same as Hash#fetch where the key passed as argument can be - # either a string or a symbol: - # - # counters = ActiveSupport::HashWithIndifferentAccess.new - # counters[:foo] = 1 - # - # counters.fetch('foo') # => 1 - # counters.fetch(:bar, 0) # => 0 - # counters.fetch(:bar) { |key| 0 } # => 0 - # counters.fetch(:zoo) # => KeyError: key not found: "zoo" - def fetch(key, *extras) - super(convert_key(key), *extras) - end - - # Same as Hash#dig where the key passed as argument can be - # either a string or a symbol: - # - # counters = ActiveSupport::HashWithIndifferentAccess.new - # counters[:foo] = { bar: 1 } - # - # counters.dig('foo', 'bar') # => 1 - # counters.dig(:foo, :bar) # => 1 - # counters.dig(:zoo) # => nil - def dig(*args) - args[0] = convert_key(args[0]) if args.size > 0 - super(*args) - end - - # Same as Hash#default where the key passed as argument can be - # either a string or a symbol: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new(1) - # hash.default # => 1 - # - # hash = ActiveSupport::HashWithIndifferentAccess.new { |hash, key| key } - # hash.default # => nil - # hash.default('foo') # => 'foo' - # hash.default(:foo) # => 'foo' - def default(*args) - super(*args.map { |arg| convert_key(arg) }) - end - - # Returns an array of the values at the specified indices: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash[:a] = 'x' - # hash[:b] = 'y' - # hash.values_at('a', 'b') # => ["x", "y"] - def values_at(*keys) - super(*keys.map { |key| convert_key(key) }) - end - - # Returns an array of the values at the specified indices, but also - # raises an exception when one of the keys can't be found. - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash[:a] = 'x' - # hash[:b] = 'y' - # hash.fetch_values('a', 'b') # => ["x", "y"] - # hash.fetch_values('a', 'c') { |key| 'z' } # => ["x", "z"] - # hash.fetch_values('a', 'c') # => KeyError: key not found: "c" - def fetch_values(*indices, &block) - super(*indices.map { |key| convert_key(key) }, &block) - end - - # Returns a shallow copy of the hash. - # - # hash = ActiveSupport::HashWithIndifferentAccess.new({ a: { b: 'b' } }) - # dup = hash.dup - # dup[:a][:c] = 'c' - # - # hash[:a][:c] # => "c" - # dup[:a][:c] # => "c" - def dup - self.class.new(self).tap do |new_hash| - set_defaults(new_hash) - end - end - - # This method has the same semantics of +update+, except it does not - # modify the receiver but rather returns a new hash with indifferent - # access with the result of the merge. - def merge(*hashes, &block) - dup.update(*hashes, &block) - end - - # Like +merge+ but the other way around: Merges the receiver into the - # argument and returns a new hash with indifferent access as result: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash['a'] = nil - # hash.reverse_merge(a: 0, b: 1) # => {"a"=>nil, "b"=>1} - def reverse_merge(other_hash) - super(self.class.new(other_hash)) - end - alias_method :with_defaults, :reverse_merge - - # Same semantics as +reverse_merge+ but modifies the receiver in-place. - def reverse_merge!(other_hash) - super(self.class.new(other_hash)) - end - alias_method :with_defaults!, :reverse_merge! - - # Replaces the contents of this hash with other_hash. - # - # h = { "a" => 100, "b" => 200 } - # h.replace({ "c" => 300, "d" => 400 }) # => {"c"=>300, "d"=>400} - def replace(other_hash) - super(self.class.new(other_hash)) - end - - # Removes the specified key from the hash. - def delete(key) - super(convert_key(key)) - end - - # Returns a hash with indifferent access that includes everything except given keys. - # hash = { a: "x", b: "y", c: 10 }.with_indifferent_access - # hash.except(:a, "b") # => {c: 10}.with_indifferent_access - # hash # => { a: "x", b: "y", c: 10 }.with_indifferent_access - def except(*keys) - 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 - def deep_stringify_keys; dup end - undef :symbolize_keys! - undef :deep_symbolize_keys! - def symbolize_keys; to_hash.symbolize_keys! end - alias_method :to_options, :symbolize_keys - def deep_symbolize_keys; to_hash.deep_symbolize_keys! end - def to_options!; self end - - def select(*args, &block) - return to_enum(:select) unless block_given? - dup.tap { |hash| hash.select!(*args, &block) } - end - - def reject(*args, &block) - return to_enum(:reject) unless block_given? - dup.tap { |hash| hash.reject!(*args, &block) } - end - - def transform_values(*args, &block) - return to_enum(:transform_values) unless block_given? - dup.tap { |hash| hash.transform_values!(*args, &block) } - end - - def transform_keys(*args, &block) - return to_enum(:transform_keys) unless block_given? - dup.tap { |hash| hash.transform_keys!(*args, &block) } - end - - def transform_keys! - return enum_for(:transform_keys!) { size } unless block_given? - keys.each do |key| - self[yield(key)] = delete(key) - end - self - end - - def slice(*keys) - keys.map! { |key| convert_key(key) } - self.class.new(super) - end - - def slice!(*keys) - keys.map! { |key| convert_key(key) } - super - end - - def compact - dup.tap(&:compact!) - end - - # Convert to a regular hash with string keys. - def to_hash - _new_hash = Hash.new - set_defaults(_new_hash) - - each do |key, value| - _new_hash[key] = convert_value(value, conversion: :to_hash) - end - _new_hash - end - - private - if Symbol.method_defined?(:name) - def convert_key(key) - key.kind_of?(Symbol) ? key.name : key - end - else - def convert_key(key) - key.kind_of?(Symbol) ? key.to_s : key - end - end - - def convert_value(value, conversion: nil) - if value.is_a? Hash - if conversion == :to_hash - value.to_hash - else - value.nested_under_indifferent_access - end - elsif value.is_a?(Array) - if conversion != :assignment || value.frozen? - value = value.dup - end - value.map! { |e| convert_value(e, conversion: conversion) } - else - value - end - end - - def set_defaults(target) - if default_proc - target.default_proc = default_proc.dup - else - target.default = default - end - end - - def update_with_single_argument(other_hash, block) - if other_hash.is_a? HashWithIndifferentAccess - regular_update(other_hash, &block) - else - other_hash.to_hash.each_pair do |key, value| - if block && key?(key) - value = block.call(convert_key(key), self[key], value) - end - regular_writer(convert_key(key), convert_value(value)) - end - end - end - end -end - -# :stopdoc: - -HashWithIndifferentAccess = ActiveSupport::HashWithIndifferentAccess diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/i18n_railtie.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/i18n_railtie.rb deleted file mode 100644 index 094f65ad6c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/i18n_railtie.rb +++ /dev/null @@ -1,125 +0,0 @@ -# frozen_string_literal: true - -require "active_support" -require "active_support/core_ext/array/wrap" - -# :enddoc: - -module I18n - class Railtie < Rails::Railtie - config.i18n = ActiveSupport::OrderedOptions.new - config.i18n.railties_load_path = [] - config.i18n.load_path = [] - config.i18n.fallbacks = ActiveSupport::OrderedOptions.new - - config.eager_load_namespaces << I18n - - # Set the i18n configuration after initialization since a lot of - # configuration is still usually done in application initializers. - config.after_initialize do |app| - I18n::Railtie.initialize_i18n(app) - end - - # Trigger i18n config before any eager loading has happened - # so it's ready if any classes require it when eager loaded. - config.before_eager_load do |app| - I18n::Railtie.initialize_i18n(app) - end - - @i18n_inited = false - - # Setup i18n configuration. - def self.initialize_i18n(app) - return if @i18n_inited - - fallbacks = app.config.i18n.delete(:fallbacks) - - # Avoid issues with setting the default_locale by disabling available locales - # check while configuring. - enforce_available_locales = app.config.i18n.delete(:enforce_available_locales) - enforce_available_locales = I18n.enforce_available_locales if enforce_available_locales.nil? - I18n.enforce_available_locales = false - - reloadable_paths = [] - app.config.i18n.each do |setting, value| - case setting - when :railties_load_path - reloadable_paths = value - app.config.i18n.load_path.unshift(*value.flat_map(&:existent)) - when :load_path - I18n.load_path += value - when :raise_on_missing_translations - forward_raise_on_missing_translations_config(app) - else - I18n.public_send("#{setting}=", value) - end - end - - init_fallbacks(fallbacks) if fallbacks && validate_fallbacks(fallbacks) - - # Restore available locales check so it will take place from now on. - I18n.enforce_available_locales = enforce_available_locales - - directories = watched_dirs_with_extensions(reloadable_paths) - reloader = app.config.file_watcher.new(I18n.load_path.dup, directories) do - I18n.load_path.keep_if { |p| File.exist?(p) } - I18n.load_path |= reloadable_paths.flat_map(&:existent) - end - - app.reloaders << reloader - app.reloader.to_run do - reloader.execute_if_updated { require_unload_lock! } - end - reloader.execute - - @i18n_inited = true - end - - def self.forward_raise_on_missing_translations_config(app) - ActiveSupport.on_load(:action_view) do - self.raise_on_missing_translations = app.config.i18n.raise_on_missing_translations - end - - ActiveSupport.on_load(:action_controller) do - AbstractController::Translation.raise_on_missing_translations = app.config.i18n.raise_on_missing_translations - end - end - - def self.include_fallbacks_module - I18n.backend.class.include(I18n::Backend::Fallbacks) - end - - def self.init_fallbacks(fallbacks) - include_fallbacks_module - - args = \ - case fallbacks - when ActiveSupport::OrderedOptions - [*(fallbacks[:defaults] || []) << fallbacks[:map]].compact - when Hash, Array - Array.wrap(fallbacks) - else # TrueClass - [I18n.default_locale] - end - - I18n.fallbacks = I18n::Locale::Fallbacks.new(*args) - end - - def self.validate_fallbacks(fallbacks) - case fallbacks - when ActiveSupport::OrderedOptions - !fallbacks.empty? - when TrueClass, Array, Hash - true - else - raise "Unexpected fallback type #{fallbacks.inspect}" - end - end - - def self.watched_dirs_with_extensions(paths) - paths.each_with_object({}) do |path, result| - result[path.absolute_current] = path.extensions - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/key_generator.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/key_generator.rb deleted file mode 100644 index 21f7ab1bcb..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/key_generator.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -require "concurrent/map" -require "openssl" - -module ActiveSupport - # KeyGenerator is a simple wrapper around OpenSSL's implementation of PBKDF2. - # It can be used to derive a number of keys for various purposes from a given secret. - # This lets Rails applications have a single secure secret, but avoid reusing that - # key in multiple incompatible contexts. - class KeyGenerator - def initialize(secret, options = {}) - @secret = secret - # The default iterations are higher than required for our key derivation uses - # on the off chance someone uses this for password storage - @iterations = options[:iterations] || 2**16 - end - - # Returns a derived key suitable for use. The default key_size is chosen - # to be compatible with the default settings of ActiveSupport::MessageVerifier. - # i.e. OpenSSL::Digest::SHA1#block_length - def generate_key(salt, key_size = 64) - OpenSSL::PKCS5.pbkdf2_hmac_sha1(@secret, salt, @iterations, key_size) - end - end - - # CachingKeyGenerator is a wrapper around KeyGenerator which allows users to avoid - # re-executing the key generation process when it's called using the same salt and - # key_size. - class CachingKeyGenerator - def initialize(key_generator) - @key_generator = key_generator - @cache_keys = Concurrent::Map.new - end - - # Returns a derived key suitable for use. - def generate_key(*args) - @cache_keys[args.join("|")] ||= @key_generator.generate_key(*args) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/locale/en.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/locale/en.rb deleted file mode 100644 index 29eb9dec0c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/locale/en.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -{ - en: { - number: { - nth: { - ordinals: lambda do |_key, options| - number = options[:number] - case number - when 1; "st" - when 2; "nd" - when 3; "rd" - when 4, 5, 6, 7, 8, 9, 10, 11, 12, 13; "th" - else - num_modulo = number.to_i.abs % 100 - num_modulo %= 10 if num_modulo > 13 - case num_modulo - when 1; "st" - when 2; "nd" - when 3; "rd" - else "th" - end - end - end, - - ordinalized: lambda do |_key, options| - number = options[:number] - "#{number}#{ActiveSupport::Inflector.ordinal(number)}" - end - } - } - } -} diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/locale/en.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/locale/en.yml deleted file mode 100644 index 725ec3532c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/locale/en.yml +++ /dev/null @@ -1,139 +0,0 @@ -en: - date: - formats: - # Use the strftime parameters for formats. - # When no format has been given, it uses default. - # You can provide other formats here if you like! - default: "%Y-%m-%d" - short: "%b %d" - long: "%B %d, %Y" - - day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday] - abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat] - - # Don't forget the nil at the beginning; there's no such thing as a 0th month - month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December] - abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec] - # Used in date_select and datetime_select. - order: - - year - - month - - day - - time: - formats: - default: "%a, %d %b %Y %H:%M:%S %z" - short: "%d %b %H:%M" - long: "%B %d, %Y %H:%M" - am: "am" - pm: "pm" - -# Used in array.to_sentence. - support: - array: - words_connector: ", " - two_words_connector: " and " - last_word_connector: ", and " - number: - # Used in NumberHelper.number_to_delimited() - # These are also the defaults for 'currency', 'percentage', 'precision', and 'human' - format: - # Sets the separator between the units, for more precision (e.g. 1.0 / 2.0 == 0.5) - separator: "." - # Delimits thousands (e.g. 1,000,000 is a million) (always in groups of three) - delimiter: "," - # Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00) - precision: 3 - # Determine how rounding is performed (see BigDecimal::mode) - round_mode: default - # If set to true, precision will mean the number of significant digits instead - # of the number of decimal digits (1234 with precision 2 becomes 1200, 1.23543 becomes 1.2) - significant: false - # If set, the zeros after the decimal separator will always be stripped (e.g.: 1.200 will be 1.2) - strip_insignificant_zeros: false - - # Used in NumberHelper.number_to_currency() - currency: - format: - # Where is the currency sign? %u is the currency unit, %n the number (default: $5.00) - format: "%u%n" - unit: "$" - # These six are to override number.format and are optional - separator: "." - delimiter: "," - precision: 2 - # round_mode: - significant: false - strip_insignificant_zeros: false - - # Used in NumberHelper.number_to_percentage() - percentage: - format: - # These five are to override number.format and are optional - # separator: - delimiter: "" - # precision: - # significant: false - # strip_insignificant_zeros: false - format: "%n%" - - # Used in NumberHelper.number_to_rounded() - precision: - format: - # These five are to override number.format and are optional - # separator: - delimiter: "" - # precision: - # significant: false - # strip_insignificant_zeros: false - - # Used in NumberHelper.number_to_human_size() and NumberHelper.number_to_human() - human: - format: - # These six are to override number.format and are optional - # separator: - delimiter: "" - precision: 3 - # round_mode: - significant: true - strip_insignificant_zeros: true - # Used in number_to_human_size() - storage_units: - # Storage units output formatting. - # %u is the storage unit, %n is the number (default: 2 MB) - format: "%n %u" - units: - byte: - one: "Byte" - other: "Bytes" - kb: "KB" - mb: "MB" - gb: "GB" - tb: "TB" - pb: "PB" - eb: "EB" - # Used in NumberHelper.number_to_human() - decimal_units: - format: "%n %u" - # Decimal units output formatting - # By default we will only quantify some of the exponents - # but the commented ones might be defined or overridden - # by the user. - units: - # femto: Quadrillionth - # pico: Trillionth - # nano: Billionth - # micro: Millionth - # mili: Thousandth - # centi: Hundredth - # deci: Tenth - unit: "" - # ten: - # one: Ten - # other: Tens - # hundred: Hundred - thousand: Thousand - million: Million - billion: Billion - trillion: Trillion - quadrillion: Quadrillion diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/logger.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/logger.rb deleted file mode 100644 index 1e241c13ac..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/logger.rb +++ /dev/null @@ -1,93 +0,0 @@ -# frozen_string_literal: true - -require "active_support/logger_silence" -require "active_support/logger_thread_safe_level" -require "logger" - -module ActiveSupport - class Logger < ::Logger - include LoggerSilence - - # Returns true if the logger destination matches one of the sources - # - # logger = Logger.new(STDOUT) - # ActiveSupport::Logger.logger_outputs_to?(logger, STDOUT) - # # => true - def self.logger_outputs_to?(logger, *sources) - logdev = logger.instance_variable_get(:@logdev) - logger_source = logdev.dev if logdev.respond_to?(:dev) - sources.any? { |source| source == logger_source } - end - - # Broadcasts logs to multiple loggers. - def self.broadcast(logger) # :nodoc: - Module.new do - define_method(:add) do |*args, &block| - logger.add(*args, &block) - super(*args, &block) - end - - define_method(:<<) do |x| - logger << x - super(x) - end - - define_method(:close) do - logger.close - super() - end - - define_method(:progname=) do |name| - logger.progname = name - super(name) - end - - define_method(:formatter=) do |formatter| - logger.formatter = formatter - super(formatter) - end - - define_method(:level=) do |level| - logger.level = level - super(level) - end - - define_method(:local_level=) do |level| - logger.local_level = level if logger.respond_to?(:local_level=) - super(level) if respond_to?(:local_level=) - end - - define_method(:silence) do |level = Logger::ERROR, &block| - if logger.respond_to?(:silence) - logger.silence(level) do - if defined?(super) - super(level, &block) - else - block.call(self) - end - end - else - if defined?(super) - super(level, &block) - else - block.call(self) - end - end - end - end - end - - def initialize(*args, **kwargs) - super - @formatter = SimpleFormatter.new - end - - # Simple formatter which only displays the message. - class SimpleFormatter < ::Logger::Formatter - # This method is invoked when a log event occurs - def call(severity, timestamp, progname, msg) - "#{String === msg ? msg : msg.inspect}\n" - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/logger_silence.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/logger_silence.rb deleted file mode 100644 index 8567eff403..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/logger_silence.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -require "active_support/concern" -require "active_support/core_ext/module/attribute_accessors" -require "active_support/logger_thread_safe_level" - -module ActiveSupport - module LoggerSilence - extend ActiveSupport::Concern - - included do - cattr_accessor :silencer, default: true - include ActiveSupport::LoggerThreadSafeLevel - end - - # Silences the logger for the duration of the block. - def silence(severity = Logger::ERROR) - silencer ? log_at(severity) { yield self } : yield(self) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/logger_thread_safe_level.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/logger_thread_safe_level.rb deleted file mode 100644 index 1de9ecdbbc..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/logger_thread_safe_level.rb +++ /dev/null @@ -1,78 +0,0 @@ -# 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 local_log_id - Fiber.current.__id__ - end - - def local_level - self.class.local_levels[local_log_id] - end - - def local_level=(level) - case level - when Integer - self.class.local_levels[local_log_id] = level - when Symbol - self.class.local_levels[local_log_id] = Logger::Severity.const_get(level.to_s.upcase) - when nil - self.class.local_levels.delete(local_log_id) - else - raise ArgumentError, "Invalid log level: #{level.inspect}" - end - end - - def level - local_level || super - end - - # Change the thread-local level for the duration of the given block. - def log_at(level) - old_local_level, self.local_level = local_level, level - yield - ensure - self.local_level = old_local_level - end - - # Redefined to check severity against #level, and thus the thread-local level, rather than +@level+. - # FIXME: Remove when the minimum Ruby version supports overriding Logger#level. - def add(severity, message = nil, progname = nil, &block) #:nodoc: - severity ||= UNKNOWN - progname ||= @progname - - return true if @logdev.nil? || severity < level - - if message.nil? - if block_given? - message = yield - else - message = progname - progname = @progname - end - end - - @logdev.write \ - format_message(format_severity(severity), Time.now, progname, message) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/message_encryptor.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/message_encryptor.rb deleted file mode 100644 index 4cf4a44426..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/message_encryptor.rb +++ /dev/null @@ -1,224 +0,0 @@ -# frozen_string_literal: true - -require "openssl" -require "base64" -require "active_support/core_ext/module/attribute_accessors" -require "active_support/message_verifier" -require "active_support/messages/metadata" - -module ActiveSupport - # MessageEncryptor is a simple way to encrypt values which get stored - # somewhere you don't trust. - # - # The cipher text and initialization vector are base64 encoded and returned - # to you. - # - # This can be used in situations similar to the MessageVerifier, but - # where you don't want users to be able to determine the value of the payload. - # - # len = ActiveSupport::MessageEncryptor.key_len - # salt = SecureRandom.random_bytes(len) - # key = ActiveSupport::KeyGenerator.new('password').generate_key(salt, len) # => "\x89\xE0\x156\xAC..." - # crypt = ActiveSupport::MessageEncryptor.new(key) # => # - # encrypted_data = crypt.encrypt_and_sign('my secret data') # => "NlFBTTMwOUV5UlA1QlNEN2xkY2d6eThYWWh..." - # crypt.decrypt_and_verify(encrypted_data) # => "my secret data" - # - # === Confining messages to a specific purpose - # - # By default any message can be used throughout your app. But they can also be - # confined to a specific +:purpose+. - # - # token = crypt.encrypt_and_sign("this is the chair", purpose: :login) - # - # Then that same purpose must be passed when verifying to get the data back out: - # - # crypt.decrypt_and_verify(token, purpose: :login) # => "this is the chair" - # crypt.decrypt_and_verify(token, purpose: :shipping) # => nil - # crypt.decrypt_and_verify(token) # => nil - # - # Likewise, if a message has no purpose it won't be returned when verifying with - # a specific purpose. - # - # token = crypt.encrypt_and_sign("the conversation is lively") - # crypt.decrypt_and_verify(token, purpose: :scare_tactics) # => nil - # crypt.decrypt_and_verify(token) # => "the conversation is lively" - # - # === Making messages expire - # - # By default messages last forever and verifying one year from now will still - # return the original value. But messages can be set to expire at a given - # time with +:expires_in+ or +:expires_at+. - # - # crypt.encrypt_and_sign(parcel, expires_in: 1.month) - # crypt.encrypt_and_sign(doowad, expires_at: Time.now.end_of_year) - # - # Then the messages can be verified and returned up to the expire time. - # Thereafter, verifying returns +nil+. - # - # === Rotating keys - # - # MessageEncryptor also supports rotating out old configurations by falling - # back to a stack of encryptors. Call +rotate+ to build and add an encryptor - # so +decrypt_and_verify+ will also try the fallback. - # - # By default any rotated encryptors use the values of the primary - # encryptor unless specified otherwise. - # - # You'd give your encryptor the new defaults: - # - # crypt = ActiveSupport::MessageEncryptor.new(@secret, cipher: "aes-256-gcm") - # - # Then gradually rotate the old values out by adding them as fallbacks. Any message - # generated with the old values will then work until the rotation is removed. - # - # crypt.rotate old_secret # Fallback to an old secret instead of @secret. - # crypt.rotate cipher: "aes-256-cbc" # Fallback to an old cipher instead of aes-256-gcm. - # - # Though if both the secret and the cipher was changed at the same time, - # the above should be combined into: - # - # crypt.rotate old_secret, cipher: "aes-256-cbc" - class MessageEncryptor - prepend Messages::Rotator::Encryptor - - cattr_accessor :use_authenticated_message_encryption, instance_accessor: false, default: false - - class << self - def default_cipher #:nodoc: - if use_authenticated_message_encryption - "aes-256-gcm" - else - "aes-256-cbc" - end - end - end - - module NullSerializer #:nodoc: - def self.load(value) - value - end - - def self.dump(value) - value - end - end - - module NullVerifier #:nodoc: - def self.verify(value) - value - end - - def self.generate(value) - value - end - end - - class InvalidMessage < StandardError; end - OpenSSLCipherError = OpenSSL::Cipher::CipherError - - # Initialize a new MessageEncryptor. +secret+ must be at least as long as - # the cipher key size. For the default 'aes-256-gcm' cipher, this is 256 - # bits. If you are using a user-entered secret, you can generate a suitable - # key by using ActiveSupport::KeyGenerator or a similar key - # derivation function. - # - # First additional parameter is used as the signature key for +MessageVerifier+. - # This allows you to specify keys to encrypt and sign data. - # - # ActiveSupport::MessageEncryptor.new('secret', 'signature_secret') - # - # Options: - # * :cipher - Cipher to use. Can be any cipher returned by - # OpenSSL::Cipher.ciphers. Default is 'aes-256-gcm'. - # * :digest - String of digest to use for signing. Default is - # +SHA1+. Ignored when using an AEAD cipher like 'aes-256-gcm'. - # * :serializer - Object serializer to use. Default is +Marshal+. - def initialize(secret, sign_secret = nil, cipher: nil, digest: nil, serializer: nil) - @secret = secret - @sign_secret = sign_secret - @cipher = cipher || self.class.default_cipher - @digest = digest || "SHA1" unless aead_mode? - @verifier = resolve_verifier - @serializer = serializer || Marshal - end - - # Encrypt and sign a message. We need to sign the message in order to avoid - # padding attacks. Reference: https://www.limited-entropy.com/padding-oracle-attacks/. - def encrypt_and_sign(value, expires_at: nil, expires_in: nil, purpose: nil) - verifier.generate(_encrypt(value, expires_at: expires_at, expires_in: expires_in, purpose: purpose)) - end - - # Decrypt and verify a message. We need to verify the message in order to - # avoid padding attacks. Reference: https://www.limited-entropy.com/padding-oracle-attacks/. - def decrypt_and_verify(data, purpose: nil, **) - _decrypt(verifier.verify(data), purpose) - end - - # Given a cipher, returns the key length of the cipher to help generate the key of desired size - def self.key_len(cipher = default_cipher) - OpenSSL::Cipher.new(cipher).key_len - end - - private - def _encrypt(value, **metadata_options) - cipher = new_cipher - cipher.encrypt - cipher.key = @secret - - # Rely on OpenSSL for the initialization vector - iv = cipher.random_iv - cipher.auth_data = "" if aead_mode? - - encrypted_data = cipher.update(Messages::Metadata.wrap(@serializer.dump(value), **metadata_options)) - encrypted_data << cipher.final - - blob = "#{::Base64.strict_encode64 encrypted_data}--#{::Base64.strict_encode64 iv}" - blob = "#{blob}--#{::Base64.strict_encode64 cipher.auth_tag}" if aead_mode? - blob - end - - def _decrypt(encrypted_message, purpose) - cipher = new_cipher - 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 - # https://github.com/ruby/openssl/issues/63 - raise InvalidMessage if aead_mode? && (auth_tag.nil? || auth_tag.bytes.length != 16) - - cipher.decrypt - cipher.key = @secret - cipher.iv = iv - if aead_mode? - cipher.auth_tag = auth_tag - cipher.auth_data = "" - end - - decrypted_data = cipher.update(encrypted_data) - decrypted_data << cipher.final - - message = Messages::Metadata.verify(decrypted_data, purpose) - @serializer.load(message) if message - rescue OpenSSLCipherError, TypeError, ArgumentError - raise InvalidMessage - end - - def new_cipher - OpenSSL::Cipher.new(@cipher) - end - - attr_reader :verifier - - def aead_mode? - @aead_mode ||= new_cipher.authenticated? - end - - def resolve_verifier - if aead_mode? - NullVerifier - else - MessageVerifier.new(@sign_secret || @secret, digest: @digest, serializer: NullSerializer) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/message_verifier.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/message_verifier.rb deleted file mode 100644 index ba992a17a1..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/message_verifier.rb +++ /dev/null @@ -1,205 +0,0 @@ -# frozen_string_literal: true - -require "base64" -require "active_support/core_ext/object/blank" -require "active_support/security_utils" -require "active_support/messages/metadata" -require "active_support/messages/rotator" - -module ActiveSupport - # +MessageVerifier+ makes it easy to generate and verify messages which are - # signed to prevent tampering. - # - # This is useful for cases like remember-me tokens and auto-unsubscribe links - # where the session store isn't suitable or available. - # - # Remember Me: - # cookies[:remember_me] = @verifier.generate([@user.id, 2.weeks.from_now]) - # - # In the authentication filter: - # - # id, time = @verifier.verify(cookies[:remember_me]) - # if Time.now < time - # self.current_user = User.find(id) - # end - # - # By default it uses Marshal to serialize the message. If you want to use - # another serialization method, you can set the serializer in the options - # hash upon initialization: - # - # @verifier = ActiveSupport::MessageVerifier.new('s3Krit', serializer: YAML) - # - # +MessageVerifier+ creates HMAC signatures using SHA1 hash algorithm by default. - # If you want to use a different hash algorithm, you can change it by providing - # +:digest+ key as an option while initializing the verifier: - # - # @verifier = ActiveSupport::MessageVerifier.new('s3Krit', digest: 'SHA256') - # - # === Confining messages to a specific purpose - # - # By default any message can be used throughout your app. But they can also be - # confined to a specific +:purpose+. - # - # token = @verifier.generate("this is the chair", purpose: :login) - # - # Then that same purpose must be passed when verifying to get the data back out: - # - # @verifier.verified(token, purpose: :login) # => "this is the chair" - # @verifier.verified(token, purpose: :shipping) # => nil - # @verifier.verified(token) # => nil - # - # @verifier.verify(token, purpose: :login) # => "this is the chair" - # @verifier.verify(token, purpose: :shipping) # => ActiveSupport::MessageVerifier::InvalidSignature - # @verifier.verify(token) # => ActiveSupport::MessageVerifier::InvalidSignature - # - # Likewise, if a message has no purpose it won't be returned when verifying with - # a specific purpose. - # - # token = @verifier.generate("the conversation is lively") - # @verifier.verified(token, purpose: :scare_tactics) # => nil - # @verifier.verified(token) # => "the conversation is lively" - # - # @verifier.verify(token, purpose: :scare_tactics) # => ActiveSupport::MessageVerifier::InvalidSignature - # @verifier.verify(token) # => "the conversation is lively" - # - # === Making messages expire - # - # By default messages last forever and verifying one year from now will still - # return the original value. But messages can be set to expire at a given - # time with +:expires_in+ or +:expires_at+. - # - # @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 up to the expire time. - # Thereafter, the +verified+ method returns +nil+ while +verify+ raises - # ActiveSupport::MessageVerifier::InvalidSignature. - # - # === Rotating keys - # - # MessageVerifier also supports rotating out old configurations by falling - # back to a stack of verifiers. Call +rotate+ to build and add a verifier to - # so either +verified+ or +verify+ will also try verifying with the fallback. - # - # By default any rotated verifiers use the values of the primary - # verifier unless specified otherwise. - # - # You'd give your verifier the new defaults: - # - # verifier = ActiveSupport::MessageVerifier.new(@secret, digest: "SHA512", serializer: JSON) - # - # Then gradually rotate the old values out by adding them as fallbacks. Any message - # generated with the old values will then work until the rotation is removed. - # - # verifier.rotate old_secret # Fallback to an old secret instead of @secret. - # verifier.rotate digest: "SHA256" # Fallback to an old digest instead of SHA512. - # verifier.rotate serializer: Marshal # Fallback to an old serializer instead of JSON. - # - # Though the above would most likely be combined into one rotation: - # - # verifier.rotate old_secret, digest: "SHA256", serializer: Marshal - class MessageVerifier - prepend Messages::Rotator::Verifier - - class InvalidSignature < StandardError; end - - def initialize(secret, digest: nil, serializer: nil) - raise ArgumentError, "Secret should not be nil." unless secret - @secret = secret - @digest = digest || "SHA1" - @serializer = serializer || Marshal - end - - # Checks if a signed message could have been generated by signing an object - # with the +MessageVerifier+'s secret. - # - # verifier = ActiveSupport::MessageVerifier.new 's3Krit' - # signed_message = verifier.generate 'a private message' - # verifier.valid_message?(signed_message) # => true - # - # tampered_message = signed_message.chop # editing the message invalidates the signature - # verifier.valid_message?(tampered_message) # => false - def valid_message?(signed_message) - return if signed_message.nil? || !signed_message.valid_encoding? || signed_message.blank? - - data, digest = signed_message.split("--") - data.present? && digest.present? && ActiveSupport::SecurityUtils.secure_compare(digest, generate_digest(data)) - end - - # Decodes the signed message using the +MessageVerifier+'s secret. - # - # verifier = ActiveSupport::MessageVerifier.new 's3Krit' - # - # signed_message = verifier.generate 'a private message' - # verifier.verified(signed_message) # => 'a private message' - # - # Returns +nil+ if the message was not signed with the same secret. - # - # other_verifier = ActiveSupport::MessageVerifier.new 'd1ff3r3nt-s3Krit' - # other_verifier.verified(signed_message) # => nil - # - # Returns +nil+ if the message is not Base64-encoded. - # - # invalid_message = "f--46a0120593880c733a53b6dad75b42ddc1c8996d" - # verifier.verified(invalid_message) # => nil - # - # Raises any error raised while decoding the signed message. - # - # incompatible_message = "test--dad7b06c94abba8d46a15fafaef56c327665d5ff" - # verifier.verified(incompatible_message) # => TypeError: incompatible marshal file format - def verified(signed_message, purpose: nil, **) - if valid_message?(signed_message) - begin - data = signed_message.split("--")[0] - message = Messages::Metadata.verify(decode(data), purpose) - @serializer.load(message) if message - rescue ArgumentError => argument_error - return if argument_error.message.include?("invalid base64") - raise - end - end - end - - # Decodes the signed message using the +MessageVerifier+'s secret. - # - # verifier = ActiveSupport::MessageVerifier.new 's3Krit' - # signed_message = verifier.generate 'a private message' - # - # verifier.verify(signed_message) # => 'a private message' - # - # Raises +InvalidSignature+ if the message was not signed with the same - # secret or was not Base64-encoded. - # - # other_verifier = ActiveSupport::MessageVerifier.new 'd1ff3r3nt-s3Krit' - # other_verifier.verify(signed_message) # => ActiveSupport::MessageVerifier::InvalidSignature - def verify(*args, **options) - verified(*args, **options) || raise(InvalidSignature) - end - - # Generates a signed message for the provided value. - # - # The message is signed with the +MessageVerifier+'s secret. - # Returns Base64-encoded message joined with the generated signature. - # - # verifier = ActiveSupport::MessageVerifier.new 's3Krit' - # verifier.generate 'a private message' # => "BAhJIhRwcml2YXRlLW1lc3NhZ2UGOgZFVA==--e2d724331ebdee96a10fb99b089508d1c72bd772" - def generate(value, expires_at: nil, expires_in: nil, purpose: nil) - data = encode(Messages::Metadata.wrap(@serializer.dump(value), expires_at: expires_at, expires_in: expires_in, purpose: purpose)) - "#{data}--#{generate_digest(data)}" - end - - private - def encode(data) - ::Base64.strict_encode64(data) - end - - def decode(data) - ::Base64.strict_decode64(data) - end - - def generate_digest(data) - require "openssl" unless defined?(OpenSSL) - OpenSSL::HMAC.hexdigest(OpenSSL::Digest.const_get(@digest).new, @secret, data) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb deleted file mode 100644 index d1227c2473..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/notifications.rb +++ /dev/null @@ -1,280 +0,0 @@ -# frozen_string_literal: true - -require "active_support/notifications/instrumenter" -require "active_support/notifications/fanout" -require "active_support/per_thread_registry" - -module ActiveSupport - # = Notifications - # - # ActiveSupport::Notifications provides an instrumentation API for - # Ruby. - # - # == Instrumenters - # - # To instrument an event you just need to do: - # - # ActiveSupport::Notifications.instrument('render', extra: :information) do - # render plain: 'Foo' - # end - # - # That first executes the block and then notifies all subscribers once done. - # - # In the example above +render+ is the name of the event, and the rest is called - # the _payload_. The payload is a mechanism that allows instrumenters to pass - # extra information to subscribers. Payloads consist of a hash whose contents - # are arbitrary and generally depend on the event. - # - # == Subscribers - # - # You can consume those events and the information they provide by registering - # a subscriber. - # - # ActiveSupport::Notifications.subscribe('render') do |name, start, finish, id, payload| - # name # => String, name of the event (such as 'render' from above) - # start # => Time, when the instrumented block started execution - # finish # => Time, when the instrumented block ended execution - # id # => String, unique ID for the instrumenter that fired the event - # payload # => Hash, the payload - # end - # - # Here, the +start+ and +finish+ values represent wall-clock time. If you are - # concerned about accuracy, you can register a monotonic subscriber. - # - # ActiveSupport::Notifications.monotonic_subscribe('render') do |name, start, finish, id, payload| - # name # => String, name of the event (such as 'render' from above) - # start # => Monotonic time, when the instrumented block started execution - # finish # => Monotonic time, when the instrumented block ended execution - # id # => String, unique ID for the instrumenter that fired the event - # payload # => Hash, the payload - # end - # - # The +start+ and +finish+ values above represent monotonic time. - # - # For instance, let's store all "render" events in an array: - # - # events = [] - # - # ActiveSupport::Notifications.subscribe('render') do |*args| - # events << ActiveSupport::Notifications::Event.new(*args) - # end - # - # That code returns right away, you are just subscribing to "render" events. - # The block is saved and will be called whenever someone instruments "render": - # - # ActiveSupport::Notifications.instrument('render', extra: :information) do - # render plain: 'Foo' - # end - # - # event = events.first - # event.name # => "render" - # event.duration # => 10 (in milliseconds) - # event.payload # => { extra: :information } - # - # 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's instrumenter - # (something like "535801666f04d0298cd6"), and a hash with the payload, in - # that order. - # - # If an exception happens during that particular instrumentation the payload will - # have a key :exception with an array of two elements as value: a string with - # the name of the exception class, and the exception message. - # The :exception_object key of the payload will have the exception - # itself as the value: - # - # event.payload[:exception] # => ["ArgumentError", "Invalid value"] - # event.payload[:exception_object] # => # - # - # As the earlier example depicts, the class ActiveSupport::Notifications::Event - # is able to take the arguments as they come and provide an object-oriented - # interface to that data. - # - # It is also possible to pass an object which responds to call method - # as the second parameter to the subscribe method instead of a block: - # - # module ActionController - # class PageRequest - # def call(name, started, finished, unique_id, payload) - # Rails.logger.debug ['notification:', name, started, finished, unique_id, payload].join(' ') - # end - # end - # end - # - # ActiveSupport::Notifications.subscribe('process_action.action_controller', ActionController::PageRequest.new) - # - # resulting in the following output within the logs including a hash with the payload: - # - # notification: process_action.action_controller 2012-04-13 01:08:35 +0300 2012-04-13 01:08:35 +0300 af358ed7fab884532ec7 { - # controller: "Devise::SessionsController", - # action: "new", - # params: {"action"=>"new", "controller"=>"devise/sessions"}, - # format: :html, - # method: "GET", - # path: "/login/sign_in", - # status: 200, - # view_runtime: 279.3080806732178, - # db_runtime: 40.053 - # } - # - # You can also subscribe to all events whose name matches a certain regexp: - # - # ActiveSupport::Notifications.subscribe(/render/) do |*args| - # ... - # end - # - # and even pass no argument to subscribe, in which case you are subscribing - # to all events. - # - # == Temporary Subscriptions - # - # Sometimes you do not want to subscribe to an event for the entire life of - # the application. There are two ways to unsubscribe. - # - # WARNING: The instrumentation framework is designed for long-running subscribers, - # use this feature sparingly because it wipes some internal caches and that has - # a negative impact on performance. - # - # === Subscribe While a Block Runs - # - # You can subscribe to some event temporarily while some block runs. For - # example, in - # - # callback = lambda {|*args| ... } - # ActiveSupport::Notifications.subscribed(callback, "sql.active_record") do - # ... - # end - # - # the callback will be called for all "sql.active_record" events instrumented - # during the execution of the block. The callback is unsubscribed automatically - # after that. - # - # To record +started+ and +finished+ values with monotonic time, - # specify the optional :monotonic option to the - # subscribed method. The :monotonic option is set - # to +false+ by default. - # - # callback = lambda {|name, started, finished, unique_id, payload| ... } - # ActiveSupport::Notifications.subscribed(callback, "sql.active_record", monotonic: true) do - # ... - # end - # - # === Manual Unsubscription - # - # The +subscribe+ method returns a subscriber object: - # - # subscriber = ActiveSupport::Notifications.subscribe("render") do |*args| - # ... - # end - # - # To prevent that block from being called anymore, just unsubscribe passing - # that reference: - # - # ActiveSupport::Notifications.unsubscribe(subscriber) - # - # You can also unsubscribe by passing the name of the subscriber object. Note - # that this will unsubscribe all subscriptions with the given name: - # - # ActiveSupport::Notifications.unsubscribe("render") - # - # Subscribers using a regexp or other pattern-matching object will remain subscribed - # to all events that match their original pattern, unless those events match a string - # passed to +unsubscribe+: - # - # subscriber = ActiveSupport::Notifications.subscribe(/render/) { } - # ActiveSupport::Notifications.unsubscribe('render_template.action_view') - # subscriber.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 - # to all log subscribers. You can use any queue implementation you want. - # - module Notifications - class << self - attr_accessor :notifier - - def publish(name, *args) - notifier.publish(name, *args) - end - - def instrument(name, payload = {}) - if notifier.listening?(name) - instrumenter.instrument(name, payload) { yield payload if block_given? } - else - yield payload if block_given? - end - end - - # Subscribe to a given event name with the passed +block+. - # - # You can subscribe to events by passing a String to match exact event - # names, or by passing a Regexp to match all events that match a pattern. - # - # 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(pattern = nil, callback = nil, &block) - notifier.subscribe(pattern, callback, monotonic: false, &block) - end - - def monotonic_subscribe(pattern = nil, callback = nil, &block) - notifier.subscribe(pattern, callback, monotonic: true, &block) - end - - def subscribed(callback, pattern = nil, monotonic: false, &block) - subscriber = notifier.subscribe(pattern, callback, monotonic: monotonic) - yield - ensure - unsubscribe(subscriber) - end - - def unsubscribe(subscriber_or_name) - notifier.unsubscribe(subscriber_or_name) - end - - def instrumenter - InstrumentationRegistry.instance.instrumenter_for(notifier) - end - end - - # This class is a registry which holds all of the +Instrumenter+ objects - # in a particular thread local. To access the +Instrumenter+ object for a - # particular +notifier+, you can call the following method: - # - # InstrumentationRegistry.instrumenter_for(notifier) - # - # The instrumenters for multiple notifiers are held in a single instance of - # this class. - class InstrumentationRegistry # :nodoc: - extend ActiveSupport::PerThreadRegistry - - def initialize - @registry = {} - end - - def instrumenter_for(notifier) - @registry[notifier] ||= Instrumenter.new(notifier) - end - end - - self.notifier = Fanout.new - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/notifications/fanout.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/notifications/fanout.rb deleted file mode 100644 index 5fba8347d9..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/notifications/fanout.rb +++ /dev/null @@ -1,259 +0,0 @@ -# frozen_string_literal: true - -require "mutex_m" -require "concurrent/map" -require "set" -require "active_support/core_ext/object/try" - -module ActiveSupport - module Notifications - # This is a default queue implementation that ships with Notifications. - # It just pushes events to all registered log subscribers. - # - # This class is thread safe. All methods are reentrant. - class Fanout - include Mutex_m - - def initialize - @string_subscribers = Hash.new { |h, k| h[k] = [] } - @other_subscribers = [] - @listeners_for = Concurrent::Map.new - super - end - - def subscribe(pattern = nil, callable = nil, monotonic: false, &block) - subscriber = Subscribers.new(pattern, callable || block, monotonic) - synchronize do - if String === pattern - @string_subscribers[pattern] << subscriber - @listeners_for.delete(pattern) - else - @other_subscribers << subscriber - @listeners_for.clear - end - end - subscriber - end - - def unsubscribe(subscriber_or_name) - synchronize do - case subscriber_or_name - when String - @string_subscribers[subscriber_or_name].clear - @listeners_for.delete(subscriber_or_name) - @other_subscribers.each { |sub| sub.unsubscribe!(subscriber_or_name) } - else - pattern = subscriber_or_name.try(:pattern) - if String === pattern - @string_subscribers[pattern].delete(subscriber_or_name) - @listeners_for.delete(pattern) - else - @other_subscribers.delete(subscriber_or_name) - @listeners_for.clear - end - end - end - end - - def start(name, id, payload) - listeners_for(name).each { |s| s.start(name, id, payload) } - end - - def finish(name, id, payload, listeners = listeners_for(name)) - listeners.each { |s| s.finish(name, id, payload) } - end - - def publish(name, *args) - listeners_for(name).each { |s| s.publish(name, *args) } - end - - def listeners_for(name) - # 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] ||= - @string_subscribers[name] + @other_subscribers.select { |s| s.subscribed_to?(name) } - end - end - - def listening?(name) - listeners_for(name).any? - end - - # This is a sync queue, so there is no waiting. - def wait - end - - module Subscribers # :nodoc: - def self.new(pattern, listener, monotonic) - subscriber_class = monotonic ? MonotonicTimed : Timed - - if listener.respond_to?(:start) && listener.respond_to?(:finish) - subscriber_class = Evented - else - # Doing 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.wrap_all(pattern, subscriber) - unless pattern - AllMessages.new(subscriber) - else - subscriber - end - end - - 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 - - def publish(name, *args) - if @can_publish - @delegate.publish name, *args - end - end - - def start(name, id, payload) - @delegate.start name, id, payload - end - - def finish(name, id, payload) - @delegate.finish name, id, payload - end - - def subscribed_to?(name) - pattern === name - end - - def matches?(name) - pattern && pattern === name - end - - def unsubscribe!(name) - pattern.unsubscribe!(name) - end - end - - class Timed < Evented # :nodoc: - def publish(name, *args) - @delegate.call name, *args - end - - def start(name, id, payload) - timestack = Thread.current[:_timestack] ||= [] - timestack.push Time.now - end - - def finish(name, id, payload) - timestack = Thread.current[:_timestack] - started = timestack.pop - @delegate.call(name, started, Time.now, id, payload) - end - end - - class MonotonicTimed < Evented # :nodoc: - def publish(name, *args) - @delegate.call name, *args - end - - def start(name, id, payload) - timestack = Thread.current[:_timestack_monotonic] ||= [] - timestack.push Concurrent.monotonic_time - end - - def finish(name, id, payload) - timestack = Thread.current[:_timestack_monotonic] - started = timestack.pop - @delegate.call(name, started, Concurrent.monotonic_time, id, payload) - 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.payload = payload - 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 - end - - def start(name, id, payload) - @delegate.start name, id, payload - end - - def finish(name, id, payload) - @delegate.finish name, id, payload - end - - def publish(name, *args) - @delegate.publish name, *args - end - - def subscribed_to?(name) - true - end - - def unsubscribe!(*) - false - end - - alias :matches? :=== - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/notifications/instrumenter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/notifications/instrumenter.rb deleted file mode 100644 index e1a9fe349c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/notifications/instrumenter.rb +++ /dev/null @@ -1,155 +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 - - # 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, :children - attr_accessor :payload - - 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 - - # 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 - - begin - Process.clock_gettime(Process::CLOCK_THREAD_CPUTIME_ID) - - def now_cpu - Process.clock_gettime(Process::CLOCK_THREAD_CPUTIME_ID) - end - rescue - 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-6.1.7.3/lib/active_support/option_merger.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/option_merger.rb deleted file mode 100644 index c7f7c0aa6b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/option_merger.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/hash/deep_merge" -require "active_support/core_ext/symbol/starts_ends_with" - -module ActiveSupport - class OptionMerger #:nodoc: - instance_methods.each do |method| - undef_method(method) unless method.start_with?("__", "instance_eval", "class", "object_id") - end - - def initialize(context, options) - @context, @options = context, options - end - - private - def method_missing(method, *arguments, &block) - options = nil - if arguments.first.is_a?(Proc) - proc = arguments.pop - arguments << lambda { |*args| @options.deep_merge(proc.call(*args)) } - elsif arguments.last.respond_to?(:to_hash) - options = @options.deep_merge(arguments.pop) - else - options = @options - end - - invoke_method(method, arguments, options, &block) - end - - if RUBY_VERSION >= "2.7" - def invoke_method(method, arguments, options, &block) - if options - @context.__send__(method, *arguments, **options, &block) - else - @context.__send__(method, *arguments, &block) - end - end - else - def invoke_method(method, arguments, options, &block) - arguments << options.dup if options - @context.__send__(method, *arguments, &block) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/ordered_hash.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/ordered_hash.rb deleted file mode 100644 index ad11524137..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/ordered_hash.rb +++ /dev/null @@ -1,50 +0,0 @@ -# frozen_string_literal: true - -require "yaml" - -YAML.add_builtin_type("omap") do |type, val| - ActiveSupport::OrderedHash[val.map { |v| v.to_a.first }] -end - -module ActiveSupport - # DEPRECATED: ActiveSupport::OrderedHash implements a hash that preserves - # insertion order. - # - # oh = ActiveSupport::OrderedHash.new - # oh[:a] = 1 - # oh[:b] = 2 - # oh.keys # => [:a, :b], this order is guaranteed - # - # Also, maps the +omap+ feature for YAML files - # (See https://yaml.org/type/omap.html) to support ordered items - # when loading from yaml. - # - # ActiveSupport::OrderedHash is namespaced to prevent conflicts - # with other implementations. - class OrderedHash < ::Hash - def to_yaml_type - "!tag:yaml.org,2002:omap" - end - - def encode_with(coder) - coder.represent_seq "!omap", map { |k, v| { k => v } } - end - - def select(*args, &block) - dup.tap { |hash| hash.select!(*args, &block) } - end - - def reject(*args, &block) - dup.tap { |hash| hash.reject!(*args, &block) } - end - - def nested_under_indifferent_access - self - end - - # Returns true to make sure that this hash is extractable via Array#extract_options! - def extractable_options? - true - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/ordered_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/ordered_options.rb deleted file mode 100644 index ba14907d9e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/ordered_options.rb +++ /dev/null @@ -1,95 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/blank" - -module ActiveSupport - # +OrderedOptions+ inherits from +Hash+ and provides dynamic accessor methods. - # - # With a +Hash+, key-value pairs are typically managed like this: - # - # h = {} - # h[:boy] = 'John' - # h[:girl] = 'Mary' - # h[:boy] # => 'John' - # h[:girl] # => 'Mary' - # h[:dog] # => nil - # - # Using +OrderedOptions+, the above code can be written as: - # - # h = ActiveSupport::OrderedOptions.new - # h.boy = 'John' - # h.girl = 'Mary' - # h.boy # => 'John' - # h.girl # => 'Mary' - # h.dog # => nil - # - # To raise an exception when the value is blank, append a - # bang to the key name, like: - # - # h.dog! # => raises KeyError: :dog is blank - # - class OrderedOptions < Hash - alias_method :_get, :[] # preserve the original #[] method - protected :_get # make it protected - - def []=(key, value) - super(key.to_sym, value) - end - - def [](key) - super(key.to_sym) - end - - def method_missing(name, *args) - name_string = +name.to_s - if name_string.chomp!("=") - self[name_string] = args.first - else - bangs = name_string.chomp!("!") - - if bangs - self[name_string].presence || raise(KeyError.new(":#{name_string} is blank")) - else - self[name_string] - end - end - end - - def respond_to_missing?(name, include_private) - true - end - - def extractable_options? - true - end - - def inspect - "#<#{self.class.name} #{super}>" - end - end - - # +InheritableOptions+ provides a constructor to build an +OrderedOptions+ - # hash inherited from another hash. - # - # Use this if you already have some hash and you want to create a new one based on it. - # - # h = ActiveSupport::InheritableOptions.new({ girl: 'Mary', boy: 'John' }) - # h.girl # => 'Mary' - # h.boy # => 'John' - class InheritableOptions < OrderedOptions - def initialize(parent = nil) - if parent.kind_of?(OrderedOptions) - # use the faster _get when dealing with OrderedOptions - super() { |h, k| parent._get(k) } - elsif parent - super() { |h, k| parent[k] } - else - super() - end - end - - def inheritable_copy - self.class.new(self) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/parameter_filter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/parameter_filter.rb deleted file mode 100644 index 134778251f..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/parameter_filter.rb +++ /dev/null @@ -1,133 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/object/duplicable" - -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 /secret/i.match?(k) - # 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, deep_regexps, deep_strings = [], [], [], nil, nil - - filters.each do |item| - case item - when Proc - blocks << item - when Regexp - if item.to_s.include?("\\.") - (deep_regexps ||= []) << item - else - regexps << item - end - else - s = Regexp.escape(item.to_s) - if s.include?("\\.") - (deep_strings ||= []) << s - else - strings << s - end - end - end - - regexps << Regexp.new(strings.join("|"), true) unless strings.empty? - (deep_regexps ||= []) << Regexp.new(deep_strings.join("|"), true) if deep_strings&.any? - - 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.to_s) } - 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-6.1.7.3/lib/active_support/per_thread_registry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/per_thread_registry.rb deleted file mode 100644 index 2ab4707937..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/per_thread_registry.rb +++ /dev/null @@ -1,61 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/module/delegation" - -module ActiveSupport - # NOTE: This approach has been deprecated for end-user code in favor of {thread_mattr_accessor}[rdoc-ref:Module#thread_mattr_accessor] and friends. - # Please use that approach instead. - # - # This module is used to encapsulate access to thread local variables. - # - # Instead of polluting the thread locals namespace: - # - # Thread.current[:connection_handler] - # - # you define a class that extends this module: - # - # module ActiveRecord - # class RuntimeRegistry - # extend ActiveSupport::PerThreadRegistry - # - # attr_accessor :connection_handler - # end - # end - # - # and invoke the declared instance accessors as class methods. So - # - # ActiveRecord::RuntimeRegistry.connection_handler = connection_handler - # - # sets a connection handler local to the current thread, and - # - # ActiveRecord::RuntimeRegistry.connection_handler - # - # returns a connection handler local to the current thread. - # - # This feature is accomplished by instantiating the class and storing the - # instance as a thread local keyed by the class name. In the example above - # a key "ActiveRecord::RuntimeRegistry" is stored in Thread.current. - # The class methods proxy to said thread local instance. - # - # If the class has an initializer, it must accept no arguments. - module PerThreadRegistry - def self.extended(object) - object.instance_variable_set :@per_thread_registry_key, object.name.freeze - end - - def instance - Thread.current[@per_thread_registry_key] ||= new - end - - private - def method_missing(name, *args, &block) - # Caches the method definition as a singleton method of the receiver. - # - # By letting #delegate handle it, we avoid an enclosure that'll capture args. - singleton_class.delegate name, to: :instance - - send(name, *args, &block) - end - ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/proxy_object.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/proxy_object.rb deleted file mode 100644 index 0965fcd2d9..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/proxy_object.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - # A class with no predefined methods that behaves similarly to Builder's - # BlankSlate. Used for proxy classes. - class ProxyObject < ::BasicObject - undef_method :== - undef_method :equal? - - # Let ActiveSupport::ProxyObject at least raise exceptions. - def raise(*args) - ::Object.send(:raise, *args) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/rails.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/rails.rb deleted file mode 100644 index 75676a2e47..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/rails.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -# This is a private interface. -# -# Rails components cherry pick from Active Support as needed, but there are a -# few features that are used for sure in some way or another and it is not worth -# putting individual requires absolutely everywhere. Think blank? for example. -# -# This file is loaded by every Rails component except Active Support itself, -# but it does not belong to the Rails public interface. It is internal to -# Rails and can change anytime. - -# Defines Object#blank? and Object#present?. -require "active_support/core_ext/object/blank" - -# Support for ClassMethods and the included macro. -require "active_support/concern" - -# Defines Class#class_attribute. -require "active_support/core_ext/class/attribute" - -# Defines Module#delegate. -require "active_support/core_ext/module/delegation" - -# Defines ActiveSupport::Deprecation. -require "active_support/deprecation" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/railtie.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/railtie.rb deleted file mode 100644 index a6dd1bb025..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/railtie.rb +++ /dev/null @@ -1,102 +0,0 @@ -# frozen_string_literal: true - -require "active_support" -require "active_support/i18n_railtie" - -module ActiveSupport - class Railtie < Rails::Railtie # :nodoc: - config.active_support = ActiveSupport::OrderedOptions.new - - config.eager_load_namespaces << ActiveSupport - - initializer "active_support.set_authenticated_message_encryption" do |app| - config.after_initialize do - unless app.config.active_support.use_authenticated_message_encryption.nil? - ActiveSupport::MessageEncryptor.use_authenticated_message_encryption = - app.config.active_support.use_authenticated_message_encryption - end - end - end - - initializer "active_support.reset_all_current_attributes_instances" do |app| - app.reloader.before_class_unload { ActiveSupport::CurrentAttributes.clear_all } - app.executor.to_run { ActiveSupport::CurrentAttributes.reset_all } - app.executor.to_complete { ActiveSupport::CurrentAttributes.reset_all } - - ActiveSupport.on_load(:active_support_test_case) do - require "active_support/current_attributes/test_helper" - include ActiveSupport::CurrentAttributes::TestHelper - end - end - - initializer "active_support.deprecation_behavior" do |app| - if deprecation = app.config.active_support.deprecation - ActiveSupport::Deprecation.behavior = deprecation - end - - if disallowed_deprecation = app.config.active_support.disallowed_deprecation - ActiveSupport::Deprecation.disallowed_behavior = disallowed_deprecation - end - - if disallowed_warnings = app.config.active_support.disallowed_deprecation_warnings - ActiveSupport::Deprecation.disallowed_warnings = disallowed_warnings - end - end - - # Sets the default value for Time.zone - # If assigned value cannot be matched to a TimeZone, an exception will be raised. - initializer "active_support.initialize_time_zone" do |app| - begin - TZInfo::DataSource.get - rescue TZInfo::DataSourceNotFound => e - raise e.exception "tzinfo-data is not present. Please add gem 'tzinfo-data' to your Gemfile and run bundle install" - end - require "active_support/core_ext/time/zones" - Time.zone_default = Time.find_zone!(app.config.time_zone) - end - - # Sets the default week start - # If assigned value is not a valid day symbol (e.g. :sunday, :monday, ...), an exception will be raised. - initializer "active_support.initialize_beginning_of_week" do |app| - require "active_support/core_ext/date/calculations" - beginning_of_week_default = Date.find_beginning_of_week!(app.config.beginning_of_week) - - Date.beginning_of_week_default = beginning_of_week_default - end - - initializer "active_support.require_master_key" do |app| - if app.config.respond_to?(:require_master_key) && app.config.require_master_key - begin - app.credentials.key - rescue ActiveSupport::EncryptedFile::MissingKeyError => error - $stderr.puts error.message - exit 1 - end - end - end - - initializer "active_support.set_configs" do |app| - app.config.active_support.each do |k, v| - k = "#{k}=" - ActiveSupport.public_send(k, v) if ActiveSupport.respond_to? k - end - end - - initializer "active_support.set_hash_digest_class" do |app| - config.after_initialize do - if app.config.active_support.use_sha1_digests - ActiveSupport::Deprecation.warn(<<-MSG.squish) - config.active_support.use_sha1_digests is deprecated and will - be removed from Rails 7.0. Use - config.active_support.hash_digest_class = ::Digest::SHA1 instead. - MSG - ActiveSupport::Digest.hash_digest_class = ::Digest::SHA1 - end - - if klass = app.config.active_support.hash_digest_class - ActiveSupport::Digest.hash_digest_class = klass - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/reloader.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/reloader.rb deleted file mode 100644 index e751866a27..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/reloader.rb +++ /dev/null @@ -1,130 +0,0 @@ -# frozen_string_literal: true - -require "active_support/execution_wrapper" -require "active_support/executor" - -module ActiveSupport - #-- - # This class defines several callbacks: - # - # to_prepare -- Run once at application startup, and also from - # +to_run+. - # - # to_run -- Run before a work run that is reloading. If - # +reload_classes_only_on_change+ is true (the default), the class - # unload will have already occurred. - # - # to_complete -- Run after a work run that has reloaded. If - # +reload_classes_only_on_change+ is false, the class unload will - # have occurred after the work run, but before this callback. - # - # before_class_unload -- Run immediately before the classes are - # unloaded. - # - # after_class_unload -- Run immediately after the classes are - # unloaded. - # - class Reloader < ExecutionWrapper - define_callbacks :prepare - - define_callbacks :class_unload - - # Registers a callback that will run once at application startup and every time the code is reloaded. - def self.to_prepare(*args, &block) - set_callback(:prepare, *args, &block) - end - - # Registers a callback that will run immediately before the classes are unloaded. - def self.before_class_unload(*args, &block) - set_callback(:class_unload, *args, &block) - end - - # Registers a callback that will run immediately after the classes are unloaded. - def self.after_class_unload(*args, &block) - set_callback(:class_unload, :after, *args, &block) - end - - to_run(:after) { self.class.prepare! } - - # Initiate a manual reload - def self.reload! - executor.wrap do - new.tap do |instance| - instance.run! - ensure - instance.complete! - end - end - prepare! - end - - def self.run!(reset: false) # :nodoc: - if check! - super - else - Null - end - end - - # Run the supplied block as a work unit, reloading code as needed - def self.wrap - executor.wrap do - super - end - end - - class_attribute :executor, default: Executor - class_attribute :check, default: lambda { false } - - def self.check! # :nodoc: - @should_reload ||= check.call - end - - def self.reloaded! # :nodoc: - @should_reload = false - end - - def self.prepare! # :nodoc: - new.run_callbacks(:prepare) - end - - def initialize - super - @locked = false - end - - # Acquire the ActiveSupport::Dependencies::Interlock unload lock, - # ensuring it will be released automatically - def require_unload_lock! - unless @locked - ActiveSupport::Dependencies.interlock.start_unloading - @locked = true - end - end - - # Release the unload lock if it has been previously obtained - def release_unload_lock! - if @locked - @locked = false - ActiveSupport::Dependencies.interlock.done_unloading - end - end - - def run! # :nodoc: - super - release_unload_lock! - end - - def class_unload!(&block) # :nodoc: - require_unload_lock! - run_callbacks(:class_unload, &block) - end - - def complete! # :nodoc: - super - self.class.reloaded! - ensure - release_unload_lock! - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/rescuable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/rescuable.rb deleted file mode 100644 index 2b965677f3..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/rescuable.rb +++ /dev/null @@ -1,174 +0,0 @@ -# frozen_string_literal: true - -require "active_support/concern" -require "active_support/core_ext/class/attribute" -require "active_support/core_ext/string/inflections" - -module ActiveSupport - # Rescuable module adds support for easier exception handling. - module Rescuable - extend Concern - - included do - class_attribute :rescue_handlers, default: [] - end - - module ClassMethods - # Registers exception classes with a handler to be called by rescue_with_handler. - # - # rescue_from receives a series of exception classes or class - # names, and an exception handler specified by a trailing :with - # option containing the name of a method or a Proc object. Alternatively, a block - # can be given as the handler. - # - # Handlers that take one argument will be called with the exception, so - # that the exception can be inspected when dealing with it. - # - # Handlers are inherited. They are searched from right to left, from - # bottom to top, and up the hierarchy. The handler of the first class for - # which exception.is_a?(klass) holds true is the one invoked, if - # any. - # - # class ApplicationController < ActionController::Base - # rescue_from User::NotAuthorized, with: :deny_access # self defined exception - # rescue_from ActiveRecord::RecordInvalid, with: :show_errors - # - # rescue_from 'MyAppError::Base' do |exception| - # render xml: exception, status: 500 - # end - # - # private - # def deny_access - # ... - # end - # - # def show_errors(exception) - # exception.record.new_record? ? ... - # end - # end - # - # Exceptions raised inside exception handlers are not propagated up. - def rescue_from(*klasses, with: nil, &block) - unless with - if block_given? - with = block - else - raise ArgumentError, "Need a handler. Pass the with: keyword argument or provide a block." - end - end - - klasses.each do |klass| - key = if klass.is_a?(Module) && klass.respond_to?(:===) - klass.name - elsif klass.is_a?(String) - klass - else - raise ArgumentError, "#{klass.inspect} must be an Exception class or a String referencing an Exception class" - end - - # Put the new handler at the end because the list is read in reverse. - self.rescue_handlers += [[key, with]] - end - end - - # Matches an exception to a handler based on the exception class. - # - # If no handler matches the exception, check for a handler matching the - # (optional) exception.cause. If no handler matches the exception or its - # cause, this returns +nil+, so you can deal with unhandled exceptions. - # Be sure to re-raise unhandled exceptions if this is what you expect. - # - # begin - # … - # rescue => exception - # rescue_with_handler(exception) || raise - # end - # - # Returns the exception if it was handled and +nil+ if it was not. - def rescue_with_handler(exception, object: self, visited_exceptions: []) - visited_exceptions << exception - - if handler = handler_for_rescue(exception, object: object) - handler.call exception - exception - elsif exception - if visited_exceptions.include?(exception.cause) - nil - else - rescue_with_handler(exception.cause, object: object, visited_exceptions: visited_exceptions) - end - end - end - - def handler_for_rescue(exception, object: self) #:nodoc: - case rescuer = find_rescue_handler(exception) - when Symbol - method = object.method(rescuer) - if method.arity == 0 - -> e { method.call } - else - method - end - when Proc - if rescuer.arity == 0 - -> e { object.instance_exec(&rescuer) } - else - -> e { object.instance_exec(e, &rescuer) } - end - end - end - - private - def find_rescue_handler(exception) - if exception - # Handlers are in order of declaration but the most recently declared - # is the highest priority match, so we search for matching handlers - # in reverse. - _, handler = rescue_handlers.reverse_each.detect do |class_or_name, _| - if klass = constantize_rescue_handler_class(class_or_name) - klass === exception - end - end - - handler - end - end - - def constantize_rescue_handler_class(class_or_name) - case class_or_name - when String, Symbol - begin - # Try a lexical lookup first since we support - # - # class Super - # rescue_from 'Error', with: … - # end - # - # class Sub - # class Error < StandardError; end - # end - # - # so an Error raised in Sub will hit the 'Error' handler. - const_get class_or_name - rescue NameError - class_or_name.safe_constantize - end - else - class_or_name - end - end - end - - # Delegates to the class method, but uses the instance as the subject for - # rescue_from handlers (method calls, instance_exec blocks). - def rescue_with_handler(exception) - self.class.rescue_with_handler exception, object: self - end - - # Internal handler lookup. Delegates to class method. Some libraries call - # this directly, so keeping it around for compatibility. - def handler_for_rescue(exception) #:nodoc: - self.class.handler_for_rescue exception, object: self - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/secure_compare_rotator.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/secure_compare_rotator.rb deleted file mode 100644 index 269703c34a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/secure_compare_rotator.rb +++ /dev/null @@ -1,51 +0,0 @@ -# frozen_string_literal: true - -require "active_support/security_utils" -require "active_support/messages/rotator" - -module ActiveSupport - # The ActiveSupport::SecureCompareRotator is a wrapper around +ActiveSupport::SecurityUtils.secure_compare+ - # and allows you to rotate a previously defined value to a new one. - # - # It can be used as follow: - # - # rotator = ActiveSupport::SecureCompareRotator.new('new_production_value') - # rotator.rotate('previous_production_value') - # rotator.secure_compare!('previous_production_value') - # - # One real use case example would be to rotate a basic auth credentials: - # - # class MyController < ApplicationController - # def authenticate_request - # rotator = ActiveSupport::SecureComparerotator.new('new_password') - # rotator.rotate('old_password') - # - # authenticate_or_request_with_http_basic do |username, password| - # rotator.secure_compare!(password) - # rescue ActiveSupport::SecureCompareRotator::InvalidMatch - # false - # end - # end - # end - class SecureCompareRotator - include SecurityUtils - prepend Messages::Rotator - - InvalidMatch = Class.new(StandardError) - - def initialize(value, **_options) - @value = value - end - - def secure_compare!(other_value, on_rotation: @on_rotation) - secure_compare(@value, other_value) || - run_rotations(on_rotation) { |wrapper| wrapper.secure_compare!(other_value) } || - raise(InvalidMatch) - end - - private - def build_rotation(previous_value, _options) - self.class.new(previous_value) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/security_utils.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/security_utils.rb deleted file mode 100644 index aa00474448..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/security_utils.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - module SecurityUtils - # Constant time string comparison, for fixed length strings. - # - # The values compared should be of fixed length, such as strings - # that have already been processed by HMAC. Raises in case of length mismatch. - - if defined?(OpenSSL.fixed_length_secure_compare) - def fixed_length_secure_compare(a, b) - OpenSSL.fixed_length_secure_compare(a, b) - end - else - def fixed_length_secure_compare(a, b) - raise ArgumentError, "string length mismatch." unless a.bytesize == b.bytesize - - l = a.unpack "C#{a.bytesize}" - - res = 0 - b.each_byte { |byte| res |= byte ^ l.shift } - res == 0 - end - end - module_function :fixed_length_secure_compare - - # Secure string comparison for strings of variable length. - # - # While a timing attack would not be able to discern the content of - # a secret compared via secure_compare, it is possible to determine - # the secret length. This should be considered when using secure_compare - # to compare weak, short secrets to user input. - def secure_compare(a, b) - a.bytesize == b.bytesize && fixed_length_secure_compare(a, b) - end - module_function :secure_compare - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/string_inquirer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/string_inquirer.rb deleted file mode 100644 index 5ff3f4bfe7..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/string_inquirer.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/symbol/starts_ends_with" - -module ActiveSupport - # Wrapping a string in this class gives you a prettier way to test - # for equality. The value returned by Rails.env is wrapped - # in a StringInquirer object, so instead of calling this: - # - # Rails.env == 'production' - # - # you can call this: - # - # Rails.env.production? - # - # == Instantiating a new StringInquirer - # - # vehicle = ActiveSupport::StringInquirer.new('car') - # vehicle.car? # => true - # vehicle.bike? # => false - class StringInquirer < String - private - def respond_to_missing?(method_name, include_private = false) - method_name.end_with?("?") || super - end - - def method_missing(method_name, *arguments) - if method_name.end_with?("?") - self == method_name[0..-2] - else - super - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/subscriber.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/subscriber.rb deleted file mode 100644 index 24f8681af8..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/subscriber.rb +++ /dev/null @@ -1,174 +0,0 @@ -# frozen_string_literal: true - -require "active_support/per_thread_registry" -require "active_support/notifications" - -module ActiveSupport - # ActiveSupport::Subscriber is an object set to consume - # ActiveSupport::Notifications. The subscriber dispatches notifications to - # a registered object based on its given namespace. - # - # An example would be an Active Record subscriber responsible for collecting - # statistics about queries: - # - # module ActiveRecord - # class StatsSubscriber < ActiveSupport::Subscriber - # attach_to :active_record - # - # def sql(event) - # Statsd.timing("sql.#{event.payload[:name]}", event.duration) - # end - # end - # end - # - # After configured, whenever a "sql.active_record" notification is published, - # it will properly dispatch the event (ActiveSupport::Notifications::Event) to - # the +sql+ method. - # - # We can detach a subscriber as well: - # - # ActiveRecord::StatsSubscriber.detach_from(:active_record) - class Subscriber - class << self - # Attach the subscriber to a namespace. - def attach_to(namespace, subscriber = new, notifier = ActiveSupport::Notifications, inherit_all: false) - @namespace = namespace - @subscriber = subscriber - @notifier = notifier - @inherit_all = inherit_all - - subscribers << subscriber - - # Add event subscribers for all existing methods on the class. - fetch_public_methods(subscriber, inherit_all).each do |event| - add_event_subscriber(event) - end - end - - # Detach the subscriber from a namespace. - def detach_from(namespace, notifier = ActiveSupport::Notifications) - @namespace = namespace - @subscriber = find_attached_subscriber - @notifier = notifier - - return unless subscriber - - subscribers.delete(subscriber) - - # Remove event subscribers of all existing methods on the class. - fetch_public_methods(subscriber, true).each do |event| - remove_event_subscriber(event) - end - - # Reset notifier so that event subscribers will not add for new methods added to the class. - @notifier = nil - end - - # Adds event subscribers for all new methods added to the class. - def method_added(event) - # Only public methods are added as subscribers, and only if a notifier - # has been set up. This means that subscribers will only be set up for - # classes that call #attach_to. - if public_method_defined?(event) && notifier - add_event_subscriber(event) - end - end - - def subscribers - @@subscribers ||= [] - end - - private - attr_reader :subscriber, :notifier, :namespace - - def add_event_subscriber(event) # :doc: - return if invalid_event?(event) - - pattern = prepare_pattern(event) - - # Don't add multiple subscribers (e.g. if methods are redefined). - return if pattern_subscribed?(pattern) - - subscriber.patterns[pattern] = notifier.subscribe(pattern, subscriber) - end - - def remove_event_subscriber(event) # :doc: - return if invalid_event?(event) - - pattern = prepare_pattern(event) - - return unless pattern_subscribed?(pattern) - - notifier.unsubscribe(subscriber.patterns[pattern]) - subscriber.patterns.delete(pattern) - end - - def find_attached_subscriber - subscribers.find { |attached_subscriber| attached_subscriber.instance_of?(self) } - end - - def invalid_event?(event) - %i{ start finish }.include?(event.to_sym) - end - - def prepare_pattern(event) - "#{event}.#{namespace}" - end - - def pattern_subscribed?(pattern) - subscriber.patterns.key?(pattern) - end - - def fetch_public_methods(subscriber, inherit_all) - subscriber.public_methods(inherit_all) - Subscriber.public_instance_methods(true) - end - end - - attr_reader :patterns # :nodoc: - - def initialize - @queue_key = [self.class.name, object_id].join "-" - @patterns = {} - super - end - - def start(name, id, payload) - event = ActiveSupport::Notifications::Event.new(name, nil, nil, id, payload) - event.start! - parent = event_stack.last - parent << event if parent - - event_stack.push event - end - - def finish(name, id, payload) - event = event_stack.pop - event.finish! - event.payload.merge!(payload) - - method = name.split(".").first - send(method, event) - end - - private - def event_stack - SubscriberQueueRegistry.instance.get_queue(@queue_key) - end - end - - # This is a registry for all the event stacks kept for subscribers. - # - # See the documentation of ActiveSupport::PerThreadRegistry - # for further details. - class SubscriberQueueRegistry # :nodoc: - extend PerThreadRegistry - - def initialize - @registry = {} - end - - def get_queue(queue_key) - @registry[queue_key] ||= [] - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/tagged_logging.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/tagged_logging.rb deleted file mode 100644 index 0bc4a21401..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/tagged_logging.rb +++ /dev/null @@ -1,113 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/module/delegation" -require "active_support/core_ext/object/blank" -require "logger" -require "active_support/logger" - -module ActiveSupport - # Wraps any standard Logger object to provide tagging capabilities. - # - # May be called with a block: - # - # logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT)) - # logger.tagged('BCX') { logger.info 'Stuff' } # Logs "[BCX] Stuff" - # logger.tagged('BCX', "Jason") { logger.info 'Stuff' } # Logs "[BCX] [Jason] Stuff" - # logger.tagged('BCX') { logger.tagged('Jason') { logger.info 'Stuff' } } # Logs "[BCX] [Jason] Stuff" - # - # If called without a block, a new logger will be returned with applied tags: - # - # logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT)) - # logger.tagged("BCX").info "Stuff" # Logs "[BCX] Stuff" - # logger.tagged("BCX", "Jason").info "Stuff" # Logs "[BCX] [Jason] Stuff" - # logger.tagged("BCX").tagged("Jason").info "Stuff" # Logs "[BCX] [Jason] Stuff" - # - # This is used by the default Rails.logger as configured by Railties to make - # it easy to stamp log lines with subdomains, request ids, and anything else - # to aid debugging of multi-user production applications. - module TaggedLogging - module Formatter # :nodoc: - # This method is invoked when a log event occurs. - def call(severity, timestamp, progname, msg) - super(severity, timestamp, progname, "#{tags_text}#{msg}") - end - - def tagged(*tags) - new_tags = push_tags(*tags) - yield self - ensure - pop_tags(new_tags.size) - end - - def push_tags(*tags) - tags.flatten! - tags.reject!(&:blank?) - current_tags.concat tags - tags - end - - def pop_tags(size = 1) - current_tags.pop size - end - - def clear_tags! - current_tags.clear - end - - 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}" - Thread.current[thread_key] ||= [] - end - - def tags_text - tags = current_tags - if tags.one? - "[#{tags[0]}] " - elsif tags.any? - tags.collect { |tag| "[#{tag}] " }.join - end - end - end - - module LocalTagStorage # :nodoc: - attr_accessor :current_tags - - def self.extended(base) - base.current_tags = [] - end - end - - def self.new(logger) - logger = logger.clone - - 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 - - delegate :push_tags, :pop_tags, :clear_tags!, to: :formatter - - def tagged(*tags) - if block_given? - formatter.tagged(*tags) { yield self } - else - logger = ActiveSupport::TaggedLogging.new(self) - logger.formatter.extend LocalTagStorage - logger.push_tags(*formatter.current_tags, *tags) - logger - end - end - - def flush - clear_tags! - super if defined?(super) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/test_case.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/test_case.rb deleted file mode 100644 index 7be4108ed7..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/test_case.rb +++ /dev/null @@ -1,163 +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" -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-6.1.7.3/lib/active_support/time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/time.rb deleted file mode 100644 index 51854675bf..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/time.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -module ActiveSupport - autoload :Duration, "active_support/duration" - autoload :TimeWithZone, "active_support/time_with_zone" - autoload :TimeZone, "active_support/values/time_zone" -end - -require "date" -require "time" - -require "active_support/core_ext/time" -require "active_support/core_ext/date" -require "active_support/core_ext/date_time" - -require "active_support/core_ext/integer/time" -require "active_support/core_ext/numeric/time" - -require "active_support/core_ext/string/conversions" -require "active_support/core_ext/string/zones" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/time_with_zone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/time_with_zone.rb deleted file mode 100644 index 03d49d597f..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/time_with_zone.rb +++ /dev/null @@ -1,585 +0,0 @@ -# frozen_string_literal: true - -require "active_support/duration" -require "active_support/values/time_zone" -require "active_support/core_ext/object/acts_like" -require "active_support/core_ext/date_and_time/compatibility" - -module ActiveSupport - # A Time-like class that can represent a time in any time zone. Necessary - # because standard Ruby Time instances are limited to UTC and the - # system's ENV['TZ'] zone. - # - # You shouldn't ever need to create a TimeWithZone instance directly via +new+. - # Instead use methods +local+, +parse+, +at+ and +now+ on TimeZone instances, - # and +in_time_zone+ on Time and DateTime instances. - # - # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' - # Time.zone.local(2007, 2, 10, 15, 30, 45) # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00 - # Time.zone.parse('2007-02-10 15:30:45') # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00 - # Time.zone.at(1171139445) # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00 - # Time.zone.now # => Sun, 18 May 2008 13:07:55.754107581 EDT -04:00 - # Time.utc(2007, 2, 10, 20, 30, 45).in_time_zone # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00 - # - # See Time and TimeZone for further documentation of these methods. - # - # TimeWithZone instances implement the same API as Ruby Time instances, so - # that Time and TimeWithZone instances are interchangeable. - # - # t = Time.zone.now # => Sun, 18 May 2008 13:27:25.031505668 EDT -04:00 - # t.hour # => 13 - # t.dst? # => true - # t.utc_offset # => -14400 - # t.zone # => "EDT" - # t.to_s(:rfc822) # => "Sun, 18 May 2008 13:27:25 -0400" - # t + 1.day # => Mon, 19 May 2008 13:27:25.031505668 EDT -04:00 - # t.beginning_of_year # => Tue, 01 Jan 2008 00:00:00.000000000 EST -05:00 - # t > Time.utc(1999) # => true - # t.is_a?(Time) # => true - # t.is_a?(ActiveSupport::TimeWithZone) # => true - class TimeWithZone - # Report class name as 'Time' to thwart type checking. - def self.name - "Time" - end - - PRECISIONS = Hash.new { |h, n| h[n] = "%FT%T.%#{n}N" } - PRECISIONS[0] = "%FT%T" - - include Comparable, DateAndTime::Compatibility - attr_reader :time_zone - - def initialize(utc_time, time_zone, local_time = nil, period = nil) - @utc = utc_time ? transfer_time_values_to_utc_constructor(utc_time) : nil - @time_zone, @time = time_zone, local_time - @period = @utc ? period : get_period_and_ensure_valid_local_time(period) - end - - # Returns a Time instance that represents the time in +time_zone+. - def time - @time ||= incorporate_utc_offset(@utc, utc_offset) - end - - # Returns a Time instance of the simultaneous time in the UTC timezone. - def utc - @utc ||= incorporate_utc_offset(@time, -utc_offset) - end - alias_method :comparable_time, :utc - alias_method :getgm, :utc - alias_method :getutc, :utc - alias_method :gmtime, :utc - - # Returns the underlying TZInfo::TimezonePeriod. - def period - @period ||= time_zone.period_for_utc(@utc) - end - - # Returns the simultaneous time in Time.zone, or the specified zone. - def in_time_zone(new_zone = ::Time.zone) - return self if time_zone == new_zone - utc.in_time_zone(new_zone) - end - - # Returns a Time instance of the simultaneous time in the system timezone. - def localtime(utc_offset = nil) - utc.getlocal(utc_offset) - end - alias_method :getlocal, :localtime - - # Returns true if the current time is within Daylight Savings Time for the - # specified time zone. - # - # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' - # Time.zone.parse("2012-5-30").dst? # => true - # Time.zone.parse("2012-11-30").dst? # => false - def dst? - period.dst? - end - alias_method :isdst, :dst? - - # Returns true if the current time zone is set to UTC. - # - # Time.zone = 'UTC' # => 'UTC' - # Time.zone.now.utc? # => true - # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' - # Time.zone.now.utc? # => false - def utc? - zone == "UTC" || zone == "UCT" - end - alias_method :gmt?, :utc? - - # Returns the offset from current time to UTC time in seconds. - def utc_offset - period.observed_utc_offset - end - alias_method :gmt_offset, :utc_offset - alias_method :gmtoff, :utc_offset - - # Returns a formatted string of the offset from UTC, or an alternative - # string if the time zone is already UTC. - # - # Time.zone = 'Eastern Time (US & Canada)' # => "Eastern Time (US & Canada)" - # Time.zone.now.formatted_offset(true) # => "-05:00" - # Time.zone.now.formatted_offset(false) # => "-0500" - # Time.zone = 'UTC' # => "UTC" - # Time.zone.now.formatted_offset(true, "0") # => "0" - def formatted_offset(colon = true, alternate_utc_string = nil) - utc? && alternate_utc_string || TimeZone.seconds_to_utc_offset(utc_offset, colon) - end - - # Returns the time zone abbreviation. - # - # Time.zone = 'Eastern Time (US & Canada)' # => "Eastern Time (US & Canada)" - # Time.zone.now.zone # => "EST" - def zone - period.abbreviation - end - - # Returns a string of the object's date, time, zone, and offset from UTC. - # - # Time.zone.now.inspect # => "Thu, 04 Dec 2014 11:00:25.624541392 EST -05:00" - def inspect - "#{time.strftime('%a, %d %b %Y %H:%M:%S.%9N')} #{zone} #{formatted_offset}" - end - - # Returns a string of the object's date and time in the ISO 8601 standard - # format. - # - # Time.zone.now.xmlschema # => "2014-12-04T11:02:37-05:00" - def xmlschema(fraction_digits = 0) - "#{time.strftime(PRECISIONS[fraction_digits.to_i])}#{formatted_offset(true, 'Z')}" - end - alias_method :iso8601, :xmlschema - alias_method :rfc3339, :xmlschema - - # Coerces time to a string for JSON encoding. The default format is ISO 8601. - # You can get %Y/%m/%d %H:%M:%S +offset style by setting - # ActiveSupport::JSON::Encoding.use_standard_json_time_format - # to +false+. - # - # # With ActiveSupport::JSON::Encoding.use_standard_json_time_format = true - # Time.utc(2005,2,1,15,15,10).in_time_zone("Hawaii").to_json - # # => "2005-02-01T05:15:10.000-10:00" - # - # # With ActiveSupport::JSON::Encoding.use_standard_json_time_format = false - # Time.utc(2005,2,1,15,15,10).in_time_zone("Hawaii").to_json - # # => "2005/02/01 05:15:10 -1000" - def as_json(options = nil) - if ActiveSupport::JSON::Encoding.use_standard_json_time_format - xmlschema(ActiveSupport::JSON::Encoding.time_precision) - else - %(#{time.strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)}) - end - end - - def init_with(coder) #:nodoc: - initialize(coder["utc"], coder["zone"], coder["time"]) - end - - def encode_with(coder) #:nodoc: - coder.tag = "!ruby/object:ActiveSupport::TimeWithZone" - coder.map = { "utc" => utc, "zone" => time_zone, "time" => time } - end - - # Returns a string of the object's date and time in the format used by - # HTTP requests. - # - # Time.zone.now.httpdate # => "Tue, 01 Jan 2013 04:39:43 GMT" - def httpdate - utc.httpdate - end - - # Returns a string of the object's date and time in the RFC 2822 standard - # format. - # - # Time.zone.now.rfc2822 # => "Tue, 01 Jan 2013 04:51:39 +0000" - def rfc2822 - to_s(:rfc822) - end - alias_method :rfc822, :rfc2822 - - # Returns a string of the object's date and time. - # Accepts an optional format: - # * :default - default value, mimics Ruby Time#to_s format. - # * :db - format outputs time in UTC :db time. See Time#to_formatted_s(:db). - # * Any key in Time::DATE_FORMATS can be used. See active_support/core_ext/time/conversions.rb. - def to_s(format = :default) - if format == :db - utc.to_s(format) - elsif formatter = ::Time::DATE_FORMATS[format] - formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter) - else - "#{time.strftime("%Y-%m-%d %H:%M:%S")} #{formatted_offset(false, 'UTC')}" # mimicking Ruby Time#to_s format - end - end - alias_method :to_formatted_s, :to_s - - # Replaces %Z directive with +zone before passing to Time#strftime, - # so that zone information is correct. - def strftime(format) - format = format.gsub(/((?:\A|[^%])(?:%%)*)%Z/, "\\1#{zone}") - getlocal(utc_offset).strftime(format) - end - - # Use the time in UTC for comparisons. - def <=>(other) - utc <=> other - end - alias_method :before?, :< - alias_method :after?, :> - - # Returns true if the current object's time is within the specified - # +min+ and +max+ time. - def between?(min, max) - utc.between?(min, max) - end - - # Returns true if the current object's time is in the past. - def past? - utc.past? - end - - # Returns true if the current object's time falls within - # the current day. - def today? - time.today? - end - - # Returns true if the current object's time falls within - # the next day (tomorrow). - def tomorrow? - time.tomorrow? - end - alias :next_day? :tomorrow? - - # Returns true if the current object's time falls within - # the previous day (yesterday). - def yesterday? - time.yesterday? - end - alias :prev_day? :yesterday? - - # Returns true if the current object's time is in the future. - def future? - utc.future? - end - - # Returns +true+ if +other+ is equal to current object. - def eql?(other) - other.eql?(utc) - end - - def hash - utc.hash - end - - # Adds an interval of time to the current object's time and returns that - # value as a new TimeWithZone object. - # - # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' - # now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00 - # now + 1000 # => Sun, 02 Nov 2014 01:43:08.725182881 EDT -04:00 - # - # If we're adding a Duration of variable length (i.e., years, months, days), - # move forward from #time, otherwise move forward from #utc, for accuracy - # when moving across DST boundaries. - # - # For instance, a time + 24.hours will advance exactly 24 hours, while a - # time + 1.day will advance 23-25 hours, depending on the day. - # - # now + 24.hours # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00 - # now + 1.day # => Mon, 03 Nov 2014 01:26:28.725182881 EST -05:00 - def +(other) - if duration_of_variable_length?(other) - method_missing(:+, other) - else - result = utc.acts_like?(:date) ? utc.since(other) : utc + other rescue utc.since(other) - result.in_time_zone(time_zone) - end - end - alias_method :since, :+ - alias_method :in, :+ - - # Subtracts an interval of time and returns a new TimeWithZone object unless - # the other value +acts_like?+ time. 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.725182881 EST -05:00 - # now - 1000 # => Mon, 03 Nov 2014 00:09:48.725182881 EST -05:00 - # - # If subtracting a Duration of variable length (i.e., years, months, days), - # move backward from #time, otherwise move backward from #utc, for accuracy - # when moving across DST boundaries. - # - # For instance, a time - 24.hours will go subtract exactly 24 hours, while a - # time - 1.day will subtract 23-25 hours, depending on the day. - # - # now - 24.hours # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00 - # now - 1.day # => Sun, 02 Nov 2014 00:26:28.725182881 EDT -04:00 - # - # If both the TimeWithZone object and the other value act like Time, a Float - # will be returned. - # - # Time.zone.now - 1.day.ago # => 86399.999967 - # - def -(other) - if other.acts_like?(:time) - to_time - other.to_time - elsif duration_of_variable_length?(other) - method_missing(:-, other) - else - result = utc.acts_like?(:date) ? utc.ago(other) : utc - other rescue utc.ago(other) - result.in_time_zone(time_zone) - end - end - - # Subtracts an interval of time from the current object's time and returns - # the result as a new TimeWithZone object. - # - # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' - # now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00 - # now.ago(1000) # => Mon, 03 Nov 2014 00:09:48.725182881 EST -05:00 - # - # If we're subtracting a Duration of variable length (i.e., years, months, - # days), move backward from #time, otherwise move backward from #utc, for - # accuracy when moving across DST boundaries. - # - # For instance, time.ago(24.hours) will move back exactly 24 hours, - # while time.ago(1.day) will move back 23-25 hours, depending on - # the day. - # - # now.ago(24.hours) # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00 - # now.ago(1.day) # => Sun, 02 Nov 2014 00:26:28.725182881 EDT -04:00 - def ago(other) - since(-other) - end - - # Returns a new +ActiveSupport::TimeWithZone+ where one or more of the elements have - # been changed according to the +options+ parameter. The time options (:hour, - # :min, :sec, :usec, :nsec) reset cascadingly, - # so if only the hour is passed, then minute, sec, usec and nsec is set to 0. If the - # hour and minute is passed, then sec, usec and nsec is set to 0. The +options+ - # parameter takes a hash with any of these keys: :year, :month, - # :day, :hour, :min, :sec, :usec, - # :nsec, :offset, :zone. Pass either :usec - # or :nsec, not both. Similarly, pass either :zone or - # :offset, not both. - # - # t = Time.zone.now # => Fri, 14 Apr 2017 11:45:15.116992711 EST -05:00 - # t.change(year: 2020) # => Tue, 14 Apr 2020 11:45:15.116992711 EST -05:00 - # t.change(hour: 12) # => Fri, 14 Apr 2017 12:00:00.116992711 EST -05:00 - # t.change(min: 30) # => Fri, 14 Apr 2017 11:30:00.116992711 EST -05:00 - # t.change(offset: "-10:00") # => Fri, 14 Apr 2017 11:45:15.116992711 HST -10:00 - # t.change(zone: "Hawaii") # => Fri, 14 Apr 2017 11:45:15.116992711 HST -10:00 - def change(options) - if options[:zone] && options[:offset] - raise ArgumentError, "Can't change both :offset and :zone at the same time: #{options.inspect}" - end - - new_time = time.change(options) - - if options[:zone] - new_zone = ::Time.find_zone(options[:zone]) - elsif options[:offset] - new_zone = ::Time.find_zone(new_time.utc_offset) - end - - new_zone ||= time_zone - periods = new_zone.periods_for_local(new_time) - - self.class.new(nil, new_zone, new_time, periods.include?(period) ? period : nil) - end - - # Uses Date to provide precise Time calculations for years, months, and days - # according to the proleptic Gregorian calendar. The result is returned as a - # new TimeWithZone object. - # - # The +options+ parameter takes a hash with any of these keys: - # :years, :months, :weeks, :days, - # :hours, :minutes, :seconds. - # - # If advancing by a value of variable length (i.e., years, weeks, months, - # days), move forward from #time, otherwise move forward from #utc, for - # accuracy when moving across DST boundaries. - # - # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' - # now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.558049687 EDT -04:00 - # now.advance(seconds: 1) # => Sun, 02 Nov 2014 01:26:29.558049687 EDT -04:00 - # now.advance(minutes: 1) # => Sun, 02 Nov 2014 01:27:28.558049687 EDT -04:00 - # now.advance(hours: 1) # => Sun, 02 Nov 2014 01:26:28.558049687 EST -05:00 - # now.advance(days: 1) # => Mon, 03 Nov 2014 01:26:28.558049687 EST -05:00 - # now.advance(weeks: 1) # => Sun, 09 Nov 2014 01:26:28.558049687 EST -05:00 - # now.advance(months: 1) # => Tue, 02 Dec 2014 01:26:28.558049687 EST -05:00 - # now.advance(years: 1) # => Mon, 02 Nov 2015 01:26:28.558049687 EST -05:00 - def advance(options) - # If we're advancing a value of variable length (i.e., years, weeks, months, days), advance from #time, - # otherwise advance from #utc, for accuracy when moving across DST boundaries - if options.values_at(:years, :weeks, :months, :days).any? - method_missing(:advance, options) - else - utc.advance(options).in_time_zone(time_zone) - end - end - - %w(year mon month day mday wday yday hour min sec usec nsec to_date).each do |method_name| - class_eval <<-EOV, __FILE__, __LINE__ + 1 - def #{method_name} # def month - time.#{method_name} # time.month - end # end - EOV - end - - # Returns Array of parts of Time in sequence of - # [seconds, minutes, hours, day, month, year, weekday, yearday, dst?, zone]. - # - # now = Time.zone.now # => Tue, 18 Aug 2015 02:29:27.485278555 UTC +00:00 - # now.to_a # => [27, 29, 2, 18, 8, 2015, 2, 230, false, "UTC"] - def to_a - [time.sec, time.min, time.hour, time.day, time.mon, time.year, time.wday, time.yday, dst?, zone] - end - - # Returns the object's date and time as a floating point number of seconds - # since the Epoch (January 1, 1970 00:00 UTC). - # - # Time.zone.now.to_f # => 1417709320.285418 - def to_f - utc.to_f - end - - # Returns the object's date and time as an integer number of seconds - # since the Epoch (January 1, 1970 00:00 UTC). - # - # Time.zone.now.to_i # => 1417709320 - def to_i - utc.to_i - end - alias_method :tv_sec, :to_i - - # Returns the object's date and time as a rational number of seconds - # since the Epoch (January 1, 1970 00:00 UTC). - # - # Time.zone.now.to_r # => (708854548642709/500000) - def to_r - utc.to_r - end - - # Returns an instance of DateTime with the timezone's UTC offset - # - # Time.zone.now.to_datetime # => Tue, 18 Aug 2015 02:32:20 +0000 - # Time.current.in_time_zone('Hawaii').to_datetime # => Mon, 17 Aug 2015 16:32:20 -1000 - def to_datetime - @to_datetime ||= utc.to_datetime.new_offset(Rational(utc_offset, 86_400)) - end - - # Returns an instance of +Time+, either with the same UTC offset - # as +self+ or in the local system timezone depending on the setting - # of +ActiveSupport.to_time_preserves_timezone+. - def to_time - if preserve_timezone - @to_time_with_instance_offset ||= getlocal(utc_offset) - else - @to_time_with_system_offset ||= getlocal - end - end - - # So that +self+ acts_like?(:time). - def acts_like_time? - true - end - - # Say we're a Time to thwart type checking. - def is_a?(klass) - klass == ::Time || super - end - alias_method :kind_of?, :is_a? - - # An instance of ActiveSupport::TimeWithZone is never blank - def blank? - false - end - - def freeze - # preload instance variables before freezing - period; utc; time; to_datetime; to_time - super - end - - def marshal_dump - [utc, time_zone.name, time] - end - - def marshal_load(variables) - initialize(variables[0].utc, ::Time.find_zone(variables[1]), variables[2].utc) - end - - # respond_to_missing? is not called in some cases, such as when type conversion is - # performed with Kernel#String - def respond_to?(sym, include_priv = false) - # ensure that we're not going to throw and rescue from NoMethodError in method_missing which is slow - return false if sym.to_sym == :to_str - super - end - - # Ensure proxy class responds to all methods that underlying time instance - # responds to. - def respond_to_missing?(sym, include_priv) - return false if sym.to_sym == :acts_like_date? - time.respond_to?(sym, include_priv) - end - - # Send the missing method to +time+ instance, and wrap result in a new - # TimeWithZone with the existing +time_zone+. - def method_missing(sym, *args, &block) - wrap_with_time_zone time.__send__(sym, *args, &block) - rescue NoMethodError => e - raise e, e.message.sub(time.inspect, inspect), e.backtrace - end - - private - SECONDS_PER_DAY = 86400 - - def incorporate_utc_offset(time, offset) - if time.kind_of?(Date) - time + Rational(offset, SECONDS_PER_DAY) - else - time + offset - end - end - - def get_period_and_ensure_valid_local_time(period) - # we don't want a Time.local instance enforcing its own DST rules as well, - # so transfer time values to a utc constructor if necessary - @time = transfer_time_values_to_utc_constructor(@time) unless @time.utc? - begin - period || @time_zone.period_for_local(@time) - rescue ::TZInfo::PeriodNotFound - # time is in the "spring forward" hour gap, so we're moving the time forward one hour and trying again - @time += 1.hour - retry - end - end - - def transfer_time_values_to_utc_constructor(time) - # avoid creating another Time object if possible - return time if time.instance_of?(::Time) && time.utc? - ::Time.utc(time.year, time.month, time.day, time.hour, time.min, time.sec + time.subsec) - end - - def duration_of_variable_length?(obj) - ActiveSupport::Duration === obj && obj.parts.any? { |p| [:years, :months, :weeks, :days].include?(p[0]) } - end - - def wrap_with_time_zone(time) - if time.acts_like?(:time) - periods = time_zone.periods_for_local(time) - self.class.new(nil, time_zone, time, periods.include?(period) ? period : nil) - elsif time.is_a?(Range) - wrap_with_time_zone(time.begin)..wrap_with_time_zone(time.end) - else - time - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/values/time_zone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/values/time_zone.rb deleted file mode 100644 index d4160eacbe..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/values/time_zone.rb +++ /dev/null @@ -1,582 +0,0 @@ -# frozen_string_literal: true - -require "tzinfo" -require "concurrent/map" - -module ActiveSupport - # The TimeZone class serves as a wrapper around TZInfo::Timezone instances. - # It allows us to do the following: - # - # * Limit the set of zones provided by TZInfo to a meaningful subset of 134 - # zones. - # * Retrieve and display zones with a friendlier name - # (e.g., "Eastern Time (US & Canada)" instead of "America/New_York"). - # * Lazily load TZInfo::Timezone instances only when they're needed. - # * Create ActiveSupport::TimeWithZone instances via TimeZone's +local+, - # +parse+, +at+ and +now+ methods. - # - # If you set config.time_zone in the Rails Application, you can - # access this TimeZone object via Time.zone: - # - # # application.rb: - # class Application < Rails::Application - # config.time_zone = 'Eastern Time (US & Canada)' - # end - # - # Time.zone # => # - # Time.zone.name # => "Eastern Time (US & Canada)" - # Time.zone.now # => Sun, 18 May 2008 14:30:44 EDT -04:00 - class TimeZone - # Keys are Rails TimeZone names, values are TZInfo identifiers. - MAPPING = { - "International Date Line West" => "Etc/GMT+12", - "Midway Island" => "Pacific/Midway", - "American Samoa" => "Pacific/Pago_Pago", - "Hawaii" => "Pacific/Honolulu", - "Alaska" => "America/Juneau", - "Pacific Time (US & Canada)" => "America/Los_Angeles", - "Tijuana" => "America/Tijuana", - "Mountain Time (US & Canada)" => "America/Denver", - "Arizona" => "America/Phoenix", - "Chihuahua" => "America/Chihuahua", - "Mazatlan" => "America/Mazatlan", - "Central Time (US & Canada)" => "America/Chicago", - "Saskatchewan" => "America/Regina", - "Guadalajara" => "America/Mexico_City", - "Mexico City" => "America/Mexico_City", - "Monterrey" => "America/Monterrey", - "Central America" => "America/Guatemala", - "Eastern Time (US & Canada)" => "America/New_York", - "Indiana (East)" => "America/Indiana/Indianapolis", - "Bogota" => "America/Bogota", - "Lima" => "America/Lima", - "Quito" => "America/Lima", - "Atlantic Time (Canada)" => "America/Halifax", - "Caracas" => "America/Caracas", - "La Paz" => "America/La_Paz", - "Santiago" => "America/Santiago", - "Newfoundland" => "America/St_Johns", - "Brasilia" => "America/Sao_Paulo", - "Buenos Aires" => "America/Argentina/Buenos_Aires", - "Montevideo" => "America/Montevideo", - "Georgetown" => "America/Guyana", - "Puerto Rico" => "America/Puerto_Rico", - "Greenland" => "America/Godthab", - "Mid-Atlantic" => "Atlantic/South_Georgia", - "Azores" => "Atlantic/Azores", - "Cape Verde Is." => "Atlantic/Cape_Verde", - "Dublin" => "Europe/Dublin", - "Edinburgh" => "Europe/London", - "Lisbon" => "Europe/Lisbon", - "London" => "Europe/London", - "Casablanca" => "Africa/Casablanca", - "Monrovia" => "Africa/Monrovia", - "UTC" => "Etc/UTC", - "Belgrade" => "Europe/Belgrade", - "Bratislava" => "Europe/Bratislava", - "Budapest" => "Europe/Budapest", - "Ljubljana" => "Europe/Ljubljana", - "Prague" => "Europe/Prague", - "Sarajevo" => "Europe/Sarajevo", - "Skopje" => "Europe/Skopje", - "Warsaw" => "Europe/Warsaw", - "Zagreb" => "Europe/Zagreb", - "Brussels" => "Europe/Brussels", - "Copenhagen" => "Europe/Copenhagen", - "Madrid" => "Europe/Madrid", - "Paris" => "Europe/Paris", - "Amsterdam" => "Europe/Amsterdam", - "Berlin" => "Europe/Berlin", - "Bern" => "Europe/Zurich", - "Zurich" => "Europe/Zurich", - "Rome" => "Europe/Rome", - "Stockholm" => "Europe/Stockholm", - "Vienna" => "Europe/Vienna", - "West Central Africa" => "Africa/Algiers", - "Bucharest" => "Europe/Bucharest", - "Cairo" => "Africa/Cairo", - "Helsinki" => "Europe/Helsinki", - "Kyiv" => "Europe/Kiev", - "Riga" => "Europe/Riga", - "Sofia" => "Europe/Sofia", - "Tallinn" => "Europe/Tallinn", - "Vilnius" => "Europe/Vilnius", - "Athens" => "Europe/Athens", - "Istanbul" => "Europe/Istanbul", - "Minsk" => "Europe/Minsk", - "Jerusalem" => "Asia/Jerusalem", - "Harare" => "Africa/Harare", - "Pretoria" => "Africa/Johannesburg", - "Kaliningrad" => "Europe/Kaliningrad", - "Moscow" => "Europe/Moscow", - "St. Petersburg" => "Europe/Moscow", - "Volgograd" => "Europe/Volgograd", - "Samara" => "Europe/Samara", - "Kuwait" => "Asia/Kuwait", - "Riyadh" => "Asia/Riyadh", - "Nairobi" => "Africa/Nairobi", - "Baghdad" => "Asia/Baghdad", - "Tehran" => "Asia/Tehran", - "Abu Dhabi" => "Asia/Muscat", - "Muscat" => "Asia/Muscat", - "Baku" => "Asia/Baku", - "Tbilisi" => "Asia/Tbilisi", - "Yerevan" => "Asia/Yerevan", - "Kabul" => "Asia/Kabul", - "Ekaterinburg" => "Asia/Yekaterinburg", - "Islamabad" => "Asia/Karachi", - "Karachi" => "Asia/Karachi", - "Tashkent" => "Asia/Tashkent", - "Chennai" => "Asia/Kolkata", - "Kolkata" => "Asia/Kolkata", - "Mumbai" => "Asia/Kolkata", - "New Delhi" => "Asia/Kolkata", - "Kathmandu" => "Asia/Kathmandu", - "Astana" => "Asia/Dhaka", - "Dhaka" => "Asia/Dhaka", - "Sri Jayawardenepura" => "Asia/Colombo", - "Almaty" => "Asia/Almaty", - "Novosibirsk" => "Asia/Novosibirsk", - "Rangoon" => "Asia/Rangoon", - "Bangkok" => "Asia/Bangkok", - "Hanoi" => "Asia/Bangkok", - "Jakarta" => "Asia/Jakarta", - "Krasnoyarsk" => "Asia/Krasnoyarsk", - "Beijing" => "Asia/Shanghai", - "Chongqing" => "Asia/Chongqing", - "Hong Kong" => "Asia/Hong_Kong", - "Urumqi" => "Asia/Urumqi", - "Kuala Lumpur" => "Asia/Kuala_Lumpur", - "Singapore" => "Asia/Singapore", - "Taipei" => "Asia/Taipei", - "Perth" => "Australia/Perth", - "Irkutsk" => "Asia/Irkutsk", - "Ulaanbaatar" => "Asia/Ulaanbaatar", - "Seoul" => "Asia/Seoul", - "Osaka" => "Asia/Tokyo", - "Sapporo" => "Asia/Tokyo", - "Tokyo" => "Asia/Tokyo", - "Yakutsk" => "Asia/Yakutsk", - "Darwin" => "Australia/Darwin", - "Adelaide" => "Australia/Adelaide", - "Canberra" => "Australia/Melbourne", - "Melbourne" => "Australia/Melbourne", - "Sydney" => "Australia/Sydney", - "Brisbane" => "Australia/Brisbane", - "Hobart" => "Australia/Hobart", - "Vladivostok" => "Asia/Vladivostok", - "Guam" => "Pacific/Guam", - "Port Moresby" => "Pacific/Port_Moresby", - "Magadan" => "Asia/Magadan", - "Srednekolymsk" => "Asia/Srednekolymsk", - "Solomon Is." => "Pacific/Guadalcanal", - "New Caledonia" => "Pacific/Noumea", - "Fiji" => "Pacific/Fiji", - "Kamchatka" => "Asia/Kamchatka", - "Marshall Is." => "Pacific/Majuro", - "Auckland" => "Pacific/Auckland", - "Wellington" => "Pacific/Auckland", - "Nuku'alofa" => "Pacific/Tongatapu", - "Tokelau Is." => "Pacific/Fakaofo", - "Chatham Is." => "Pacific/Chatham", - "Samoa" => "Pacific/Apia" - } - - UTC_OFFSET_WITH_COLON = "%s%02d:%02d" # :nodoc: - UTC_OFFSET_WITHOUT_COLON = UTC_OFFSET_WITH_COLON.tr(":", "") # :nodoc: - private_constant :UTC_OFFSET_WITH_COLON, :UTC_OFFSET_WITHOUT_COLON - - @lazy_zones_map = Concurrent::Map.new - @country_zones = Concurrent::Map.new - - class << self - # Assumes self represents an offset from UTC in seconds (as returned from - # Time#utc_offset) and turns this into an +HH:MM formatted string. - # - # ActiveSupport::TimeZone.seconds_to_utc_offset(-21_600) # => "-06:00" - def seconds_to_utc_offset(seconds, colon = true) - format = colon ? UTC_OFFSET_WITH_COLON : UTC_OFFSET_WITHOUT_COLON - sign = (seconds < 0 ? "-" : "+") - hours = seconds.abs / 3600 - minutes = (seconds.abs % 3600) / 60 - format % [sign, hours, minutes] - end - - def find_tzinfo(name) - TZInfo::Timezone.get(MAPPING[name] || name) - end - - alias_method :create, :new - - # Returns a TimeZone instance with the given name, or +nil+ if no - # such TimeZone instance exists. (This exists to support the use of - # this class with the +composed_of+ macro.) - def new(name) - self[name] - end - - # Returns an array of all TimeZone objects. There are multiple - # TimeZone objects per time zone, in many cases, to make it easier - # for users to find their own time zone. - def all - @zones ||= zones_map.values.sort - end - - # Locate a specific time zone object. If the argument is a string, it - # is interpreted to mean the name of the timezone to locate. If it is a - # numeric value it is either the hour offset, or the second offset, of the - # timezone to find. (The first one with that offset will be returned.) - # Returns +nil+ if no such time zone is known to the system. - def [](arg) - case arg - when String - begin - @lazy_zones_map[arg] ||= create(arg) - rescue TZInfo::InvalidTimezoneIdentifier - nil - end - when Numeric, ActiveSupport::Duration - arg *= 3600 if arg.abs <= 13 - all.find { |z| z.utc_offset == arg.to_i } - else - raise ArgumentError, "invalid argument to TimeZone[]: #{arg.inspect}" - end - end - - # A convenience method for returning a collection of TimeZone objects - # for time zones in the USA. - def us_zones - country_zones(:us) - end - - # A convenience method for returning a collection of TimeZone objects - # for time zones in the country specified by its ISO 3166-1 Alpha2 code. - def country_zones(country_code) - code = country_code.to_s.upcase - @country_zones[code] ||= load_country_zones(code) - end - - def clear #:nodoc: - @lazy_zones_map = Concurrent::Map.new - @country_zones = Concurrent::Map.new - @zones = nil - @zones_map = nil - end - - private - def load_country_zones(code) - country = TZInfo::Country.get(code) - country.zone_identifiers.flat_map do |tz_id| - if MAPPING.value?(tz_id) - MAPPING.inject([]) do |memo, (key, value)| - memo << self[key] if value == tz_id - memo - end - else - create(tz_id, nil, TZInfo::Timezone.get(tz_id)) - end - end.sort! - end - - def zones_map - @zones_map ||= MAPPING.each_with_object({}) do |(name, _), zones| - timezone = self[name] - zones[name] = timezone if timezone - end - end - end - - include Comparable - attr_reader :name - attr_reader :tzinfo - - # Create a new TimeZone object with the given name and offset. The - # offset is the number of seconds that this time zone is offset from UTC - # (GMT). Seconds were chosen as the offset unit because that is the unit - # that Ruby uses to represent time zone offsets (see Time#utc_offset). - def initialize(name, utc_offset = nil, tzinfo = nil) - @name = name - @utc_offset = utc_offset - @tzinfo = tzinfo || TimeZone.find_tzinfo(name) - end - - # Returns the offset of this time zone from UTC in seconds. - def utc_offset - @utc_offset || tzinfo&.current_period&.base_utc_offset - end - - # Returns a formatted string of the offset from UTC, or an alternative - # string if the time zone is already UTC. - # - # zone = ActiveSupport::TimeZone['Central Time (US & Canada)'] - # zone.formatted_offset # => "-06:00" - # zone.formatted_offset(false) # => "-0600" - def formatted_offset(colon = true, alternate_utc_string = nil) - utc_offset == 0 && alternate_utc_string || self.class.seconds_to_utc_offset(utc_offset, colon) - end - - # Compare this time zone to the parameter. The two are compared first on - # their offsets, and then by name. - def <=>(zone) - return unless zone.respond_to? :utc_offset - result = (utc_offset <=> zone.utc_offset) - result = (name <=> zone.name) if result == 0 - result - end - - # Compare #name and TZInfo identifier to a supplied regexp, returning +true+ - # if a match is found. - def =~(re) - re === name || re === MAPPING[name] - end - - # Compare #name and TZInfo identifier to a supplied regexp, returning +true+ - # if a match is found. - def match?(re) - (re == name) || (re == MAPPING[name]) || - ((Regexp === re) && (re.match?(name) || re.match?(MAPPING[name]))) - end - - # Returns a textual representation of this time zone. - def to_s - "(GMT#{formatted_offset}) #{name}" - end - - # Method for creating new ActiveSupport::TimeWithZone instance in time zone - # of +self+ from given values. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.zone.local(2007, 2, 1, 15, 30, 45) # => Thu, 01 Feb 2007 15:30:45 HST -10:00 - def local(*args) - time = Time.utc(*args) - ActiveSupport::TimeWithZone.new(nil, self, time) - end - - # Method for creating new ActiveSupport::TimeWithZone instance in time zone - # of +self+ from number of seconds since the Unix epoch. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.utc(2000).to_f # => 946684800.0 - # Time.zone.at(946684800.0) # => Fri, 31 Dec 1999 14:00:00 HST -10:00 - # - # A second argument can be supplied to specify sub-second precision. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.at(946684800, 123456.789).nsec # => 123456789 - def at(*args) - Time.at(*args).utc.in_time_zone(self) - end - - # Method for creating new ActiveSupport::TimeWithZone instance in time zone - # of +self+ from an ISO 8601 string. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.zone.iso8601('1999-12-31T14:00:00') # => Fri, 31 Dec 1999 14:00:00 HST -10:00 - # - # If the time components are missing then they will be set to zero. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.zone.iso8601('1999-12-31') # => Fri, 31 Dec 1999 00:00:00 HST -10:00 - # - # If the string is invalid then an +ArgumentError+ will be raised unlike +parse+ - # which usually returns +nil+ when given an invalid date string. - def iso8601(str) - raise ArgumentError, "invalid date" if str.nil? - - parts = Date._iso8601(str) - - raise ArgumentError, "invalid date" if parts.empty? - - time = Time.new( - parts.fetch(:year), - parts.fetch(:mon), - parts.fetch(:mday), - parts.fetch(:hour, 0), - parts.fetch(:min, 0), - parts.fetch(:sec, 0) + parts.fetch(:sec_fraction, 0), - parts.fetch(:offset, 0) - ) - - if parts[:offset] - TimeWithZone.new(time.utc, self) - else - TimeWithZone.new(nil, self, time) - end - end - - # Method for creating new ActiveSupport::TimeWithZone instance in time zone - # of +self+ from parsed string. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.zone.parse('1999-12-31 14:00:00') # => Fri, 31 Dec 1999 14:00:00 HST -10:00 - # - # If upper components are missing from the string, they are supplied from - # TimeZone#now: - # - # Time.zone.now # => Fri, 31 Dec 1999 14:00:00 HST -10:00 - # Time.zone.parse('22:30:00') # => Fri, 31 Dec 1999 22:30:00 HST -10:00 - # - # However, if the date component is not provided, but any other upper - # components are supplied, then the day of the month defaults to 1: - # - # Time.zone.parse('Mar 2000') # => Wed, 01 Mar 2000 00:00:00 HST -10:00 - # - # If the string is invalid then an +ArgumentError+ could be raised. - def parse(str, now = now()) - parts_to_time(Date._parse(str, false), now) - end - - # Method for creating new ActiveSupport::TimeWithZone instance in time zone - # of +self+ from an RFC 3339 string. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.zone.rfc3339('2000-01-01T00:00:00Z') # => Fri, 31 Dec 1999 14:00:00 HST -10:00 - # - # If the time or zone components are missing then an +ArgumentError+ will - # be raised. This is much stricter than either +parse+ or +iso8601+ which - # allow for missing components. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.zone.rfc3339('1999-12-31') # => ArgumentError: invalid date - def rfc3339(str) - parts = Date._rfc3339(str) - - raise ArgumentError, "invalid date" if parts.empty? - - time = Time.new( - parts.fetch(:year), - parts.fetch(:mon), - parts.fetch(:mday), - parts.fetch(:hour), - parts.fetch(:min), - parts.fetch(:sec) + parts.fetch(:sec_fraction, 0), - parts.fetch(:offset) - ) - - TimeWithZone.new(time.utc, self) - end - - # Parses +str+ according to +format+ and returns an ActiveSupport::TimeWithZone. - # - # Assumes that +str+ is a time in the time zone +self+, - # unless +format+ includes an explicit time zone. - # (This is the same behavior as +parse+.) - # In either case, the returned TimeWithZone has the timezone of +self+. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.zone.strptime('1999-12-31 14:00:00', '%Y-%m-%d %H:%M:%S') # => Fri, 31 Dec 1999 14:00:00 HST -10:00 - # - # If upper components are missing from the string, they are supplied from - # TimeZone#now: - # - # Time.zone.now # => Fri, 31 Dec 1999 14:00:00 HST -10:00 - # Time.zone.strptime('22:30:00', '%H:%M:%S') # => Fri, 31 Dec 1999 22:30:00 HST -10:00 - # - # However, if the date component is not provided, but any other upper - # components are supplied, then the day of the month defaults to 1: - # - # Time.zone.strptime('Mar 2000', '%b %Y') # => Wed, 01 Mar 2000 00:00:00 HST -10:00 - def strptime(str, format, now = now()) - parts_to_time(DateTime._strptime(str, format), now) - end - - # Returns an ActiveSupport::TimeWithZone instance representing the current - # time in the time zone represented by +self+. - # - # Time.zone = 'Hawaii' # => "Hawaii" - # Time.zone.now # => Wed, 23 Jan 2008 20:24:27 HST -10:00 - def now - time_now.utc.in_time_zone(self) - end - - # Returns the current date in this time zone. - def today - tzinfo.now.to_date - end - - # Returns the next date in this time zone. - def tomorrow - today + 1 - end - - # Returns the previous date in this time zone. - def yesterday - today - 1 - end - - # Adjust the given time to the simultaneous time in the time zone - # represented by +self+. Returns a local time with the appropriate offset - # -- if you want an ActiveSupport::TimeWithZone instance, use - # Time#in_time_zone() instead. - # - # As of tzinfo 2, utc_to_local returns a Time with a non-zero utc_offset. - # See the +utc_to_local_returns_utc_offset_times+ config for more info. - def utc_to_local(time) - tzinfo.utc_to_local(time).yield_self do |t| - ActiveSupport.utc_to_local_returns_utc_offset_times ? - t : Time.utc(t.year, t.month, t.day, t.hour, t.min, t.sec, t.sec_fraction) - end - end - - # Adjust the given time to the simultaneous time in UTC. Returns a - # Time.utc() instance. - def local_to_utc(time, dst = true) - tzinfo.local_to_utc(time, dst) - end - - # Available so that TimeZone instances respond like TZInfo::Timezone - # instances. - def period_for_utc(time) - tzinfo.period_for_utc(time) - end - - # Available so that TimeZone instances respond like TZInfo::Timezone - # instances. - def period_for_local(time, dst = true) - tzinfo.period_for_local(time, dst) { |periods| periods.last } - end - - def periods_for_local(time) #:nodoc: - tzinfo.periods_for_local(time) - end - - def init_with(coder) #:nodoc: - initialize(coder["name"]) - end - - def encode_with(coder) #:nodoc: - coder.tag = "!ruby/object:#{self.class}" - coder.map = { "name" => tzinfo.name } - end - - private - def parts_to_time(parts, now) - raise ArgumentError, "invalid date" if parts.nil? - return if parts.empty? - - if parts[:seconds] - time = Time.at(parts[:seconds]) - else - time = Time.new( - parts.fetch(:year, now.year), - parts.fetch(:mon, now.month), - parts.fetch(:mday, parts[:year] || parts[:mon] ? 1 : now.day), - parts.fetch(:hour, 0), - parts.fetch(:min, 0), - parts.fetch(:sec, 0) + parts.fetch(:sec_fraction, 0), - parts.fetch(:offset, 0) - ) - end - - if parts[:offset] || parts[:seconds] - TimeWithZone.new(time.utc, self) - else - TimeWithZone.new(nil, self, time) - end - end - - def time_now - Time.now - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/version.rb deleted file mode 100644 index 928838c837..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/version.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -require_relative "gem_version" - -module ActiveSupport - # Returns the version of the currently loaded ActiveSupport as a Gem::Version - def self.version - gem_version - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini.rb deleted file mode 100644 index f6ae08bb5d..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini.rb +++ /dev/null @@ -1,201 +0,0 @@ -# frozen_string_literal: true - -require "time" -require "base64" -require "bigdecimal" -require "bigdecimal/util" -require "active_support/core_ext/module/delegation" -require "active_support/core_ext/string/inflections" -require "active_support/core_ext/date_time/calculations" - -module ActiveSupport - # = XmlMini - # - # To use the much faster libxml parser: - # gem 'libxml-ruby', '=0.9.7' - # XmlMini.backend = 'LibXML' - module XmlMini - extend self - - # This module decorates files deserialized using Hash.from_xml with - # the original_filename and content_type methods. - module FileLike #:nodoc: - attr_writer :original_filename, :content_type - - def original_filename - @original_filename || "untitled" - end - - def content_type - @content_type || "application/octet-stream" - end - end - - DEFAULT_ENCODINGS = { - "binary" => "base64" - } unless defined?(DEFAULT_ENCODINGS) - - unless defined?(TYPE_NAMES) - TYPE_NAMES = { - "Symbol" => "symbol", - "Integer" => "integer", - "BigDecimal" => "decimal", - "Float" => "float", - "TrueClass" => "boolean", - "FalseClass" => "boolean", - "Date" => "date", - "DateTime" => "dateTime", - "Time" => "dateTime", - "Array" => "array", - "Hash" => "hash" - } - end - - FORMATTING = { - "symbol" => Proc.new { |symbol| symbol.to_s }, - "date" => Proc.new { |date| date.to_s(:db) }, - "dateTime" => Proc.new { |time| time.xmlschema }, - "binary" => Proc.new { |binary| ::Base64.encode64(binary) }, - "yaml" => Proc.new { |yaml| yaml.to_yaml } - } unless defined?(FORMATTING) - - # TODO use regexp instead of Date.parse - unless defined?(PARSING) - PARSING = { - "symbol" => Proc.new { |symbol| symbol.to_s.to_sym }, - "date" => Proc.new { |date| ::Date.parse(date) }, - "datetime" => Proc.new { |time| Time.xmlschema(time).utc rescue ::DateTime.parse(time).utc }, - "integer" => Proc.new { |integer| integer.to_i }, - "float" => Proc.new { |float| float.to_f }, - "decimal" => Proc.new do |number| - if String === number - number.to_d - else - BigDecimal(number) - end - end, - "boolean" => Proc.new { |boolean| %w(1 true).include?(boolean.to_s.strip) }, - "string" => Proc.new { |string| string.to_s }, - "yaml" => Proc.new { |yaml| YAML.load(yaml) rescue yaml }, - "base64Binary" => Proc.new { |bin| ::Base64.decode64(bin) }, - "binary" => Proc.new { |bin, entity| _parse_binary(bin, entity) }, - "file" => Proc.new { |file, entity| _parse_file(file, entity) } - } - - PARSING.update( - "double" => PARSING["float"], - "dateTime" => PARSING["datetime"] - ) - end - - attr_accessor :depth - self.depth = 100 - - delegate :parse, to: :backend - - def backend - current_thread_backend || @backend - end - - def backend=(name) - backend = name && cast_backend_name_to_module(name) - self.current_thread_backend = backend if current_thread_backend - @backend = backend - end - - def with_backend(name) - old_backend = current_thread_backend - self.current_thread_backend = name && cast_backend_name_to_module(name) - yield - ensure - self.current_thread_backend = old_backend - end - - def to_tag(key, value, options) - type_name = options.delete(:type) - merged_options = options.merge(root: key, skip_instruct: true) - - if value.is_a?(::Method) || value.is_a?(::Proc) - if value.arity == 1 - value.call(merged_options) - else - value.call(merged_options, key.to_s.singularize) - end - elsif value.respond_to?(:to_xml) - value.to_xml(merged_options) - else - type_name ||= TYPE_NAMES[value.class.name] - type_name ||= value.class.name if value && !value.respond_to?(:to_str) - type_name = type_name.to_s if type_name - type_name = "dateTime" if type_name == "datetime" - - key = rename_key(key.to_s, options) - - attributes = options[:skip_types] || type_name.nil? ? {} : { type: type_name } - attributes[:nil] = true if value.nil? - - encoding = options[:encoding] || DEFAULT_ENCODINGS[type_name] - attributes[:encoding] = encoding if encoding - - formatted_value = FORMATTING[type_name] && !value.nil? ? - FORMATTING[type_name].call(value) : value - - options[:builder].tag!(key, formatted_value, attributes) - end - end - - def rename_key(key, options = {}) - camelize = options[:camelize] - dasherize = !options.has_key?(:dasherize) || options[:dasherize] - if camelize - key = true == camelize ? key.camelize : key.camelize(camelize) - end - key = _dasherize(key) if dasherize - key - end - - private - def _dasherize(key) - # $2 must be a non-greedy regex for this to work - left, middle, right = /\A(_*)(.*?)(_*)\Z/.match(key.strip)[1, 3] - "#{left}#{middle.tr('_ ', '--')}#{right}" - end - - # TODO: Add support for other encodings - def _parse_binary(bin, entity) - case entity["encoding"] - when "base64" - ::Base64.decode64(bin) - else - bin - end - end - - def _parse_file(file, entity) - f = StringIO.new(::Base64.decode64(file)) - f.extend(FileLike) - f.original_filename = entity["name"] - f.content_type = entity["content_type"] - f - end - - def current_thread_backend - Thread.current[:xml_mini_backend] - end - - def current_thread_backend=(name) - Thread.current[:xml_mini_backend] = name && cast_backend_name_to_module(name) - end - - def cast_backend_name_to_module(name) - if name.is_a?(Module) - name - else - require "active_support/xml_mini/#{name.downcase}" - ActiveSupport.const_get("XmlMini_#{name}") - end - end - end - - XmlMini.backend = "REXML" -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini/jdom.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini/jdom.rb deleted file mode 100644 index 12ca19a76f..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini/jdom.rb +++ /dev/null @@ -1,182 +0,0 @@ -# frozen_string_literal: true - -raise "JRuby is required to use the JDOM backend for XmlMini" unless RUBY_PLATFORM.include?("java") - -require "jruby" -include Java - -require "active_support/core_ext/object/blank" - -java_import javax.xml.parsers.DocumentBuilder unless defined? DocumentBuilder -java_import javax.xml.parsers.DocumentBuilderFactory unless defined? DocumentBuilderFactory -java_import java.io.StringReader unless defined? StringReader -java_import org.xml.sax.InputSource unless defined? InputSource -java_import org.xml.sax.Attributes unless defined? Attributes -java_import org.w3c.dom.Node unless defined? Node - -module ActiveSupport - module XmlMini_JDOM #:nodoc: - extend self - - CONTENT_KEY = "__content__" - - 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 - PROCESSING_INSTRUCTION_NODE TEXT_NODE} - - node_type_map = {} - NODE_TYPE_NAMES.each { |type| node_type_map[Node.send(type)] = type } - - # Parse an XML Document string or IO into a simple hash using Java's jdom. - # data:: - # XML Document string or IO to parse - def parse(data) - if data.respond_to?(:read) - data = data.read - end - - if data.blank? - {} - else - @dbf = DocumentBuilderFactory.new_instance - # secure processing of java xml - # https://archive.is/9xcQQ - @dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false) - @dbf.setFeature("http://xml.org/sax/features/external-general-entities", false) - @dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false) - @dbf.setFeature(javax.xml.XMLConstants::FEATURE_SECURE_PROCESSING, true) - xml_string_reader = StringReader.new(data) - xml_input_source = InputSource.new(xml_string_reader) - doc = @dbf.new_document_builder.parse(xml_input_source) - merge_element!({ CONTENT_KEY => "" }, doc.document_element, XmlMini.depth) - end - end - - private - # Convert an XML element and merge into the hash - # - # hash:: - # Hash to merge the converted element into. - # element:: - # XML element to merge into hash - def merge_element!(hash, element, depth) - raise "Document too deep!" if depth == 0 - delete_empty(hash) - merge!(hash, element.tag_name, collapse(element, depth)) - end - - def delete_empty(hash) - hash.delete(CONTENT_KEY) if hash[CONTENT_KEY] == "" - end - - # Actually converts an XML document element into a data structure. - # - # element:: - # The document element to be collapsed. - def collapse(element, depth) - hash = get_attributes(element) - - child_nodes = element.child_nodes - if child_nodes.length > 0 - (0...child_nodes.length).each do |i| - child = child_nodes.item(i) - merge_element!(hash, child, depth - 1) unless child.node_type == Node.TEXT_NODE - end - merge_texts!(hash, element) unless empty_content?(element) - hash - else - merge_texts!(hash, element) - end - end - - # Merge all the texts of an element into the hash - # - # hash:: - # Hash to add the converted element to. - # element:: - # XML element whose texts are to me merged into the hash - def merge_texts!(hash, element) - delete_empty(hash) - text_children = texts(element) - if text_children.join.empty? - hash - else - # must use value to prevent double-escaping - merge!(hash, CONTENT_KEY, text_children.join) - end - end - - # Adds a new key/value pair to an existing Hash. If the key to be added - # already exists and the existing value associated with key is not - # an Array, it will be wrapped in an Array. Then the new value is - # appended to that Array. - # - # hash:: - # Hash to add key/value pair to. - # key:: - # Key to be added. - # value:: - # Value to be associated with key. - def merge!(hash, key, value) - if hash.has_key?(key) - if hash[key].instance_of?(Array) - hash[key] << value - else - hash[key] = [hash[key], value] - end - elsif value.instance_of?(Array) - hash[key] = [value] - else - hash[key] = value - end - hash - end - - # Converts the attributes array of an XML element into a hash. - # Returns an empty Hash if node has no attributes. - # - # element:: - # XML element to extract attributes from. - def get_attributes(element) - attribute_hash = {} - attributes = element.attributes - (0...attributes.length).each do |i| - attribute_hash[CONTENT_KEY] ||= "" - attribute_hash[attributes.item(i).name] = attributes.item(i).value - end - attribute_hash - end - - # Determines if a document element has text content - # - # element:: - # XML element to be checked. - def texts(element) - texts = [] - child_nodes = element.child_nodes - (0...child_nodes.length).each do |i| - item = child_nodes.item(i) - if item.node_type == Node.TEXT_NODE - texts << item.get_data - end - end - texts - end - - # Determines if a document element has text content - # - # element:: - # XML element to be checked. - def empty_content?(element) - text = +"" - child_nodes = element.child_nodes - (0...child_nodes.length).each do |i| - item = child_nodes.item(i) - if item.node_type == Node.TEXT_NODE - text << item.get_data.strip - end - end - text.strip.length == 0 - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini/libxml.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini/libxml.rb deleted file mode 100644 index c2e999ef6c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini/libxml.rb +++ /dev/null @@ -1,80 +0,0 @@ -# frozen_string_literal: true - -require "libxml" -require "active_support/core_ext/object/blank" -require "stringio" - -module ActiveSupport - module XmlMini_LibXML #:nodoc: - extend self - - # Parse an XML Document string or IO into a simple hash using libxml. - # data:: - # XML Document string or IO to parse - def parse(data) - if !data.respond_to?(:read) - data = StringIO.new(data || "") - end - - if data.eof? - {} - else - LibXML::XML::Parser.io(data).parse.to_hash - end - end - end -end - -module LibXML #:nodoc: - module Conversions #:nodoc: - module Document #:nodoc: - def to_hash - root.to_hash - end - end - - module Node #:nodoc: - CONTENT_ROOT = "__content__" - - # Convert XML document to hash. - # - # hash:: - # Hash to merge the converted element into. - def to_hash(hash = {}) - node_hash = {} - - # Insert node hash into parent hash correctly. - case hash[name] - when Array then hash[name] << node_hash - when Hash then hash[name] = [hash[name], node_hash] - when nil then hash[name] = node_hash - end - - # Handle child elements - each_child do |c| - if c.element? - c.to_hash(node_hash) - elsif c.text? || c.cdata? - node_hash[CONTENT_ROOT] ||= +"" - node_hash[CONTENT_ROOT] << c.content - end - end - - # Remove content node if it is blank - if node_hash.length > 1 && node_hash[CONTENT_ROOT].blank? - node_hash.delete(CONTENT_ROOT) - end - - # Handle attributes - each_attr { |a| node_hash[a.name] = a.value } - - hash - end - end - end -end - -# :enddoc: - -LibXML::XML::Document.include(LibXML::Conversions::Document) -LibXML::XML::Node.include(LibXML::Conversions::Node) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini/libxmlsax.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini/libxmlsax.rb deleted file mode 100644 index ac8acdfc3c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini/libxmlsax.rb +++ /dev/null @@ -1,83 +0,0 @@ -# frozen_string_literal: true - -require "libxml" -require "active_support/core_ext/object/blank" -require "stringio" - -module ActiveSupport - module XmlMini_LibXMLSAX #:nodoc: - extend self - - # Class that will build the hash while the XML document - # is being parsed using SAX events. - class HashBuilder - include LibXML::XML::SaxParser::Callbacks - - CONTENT_KEY = "__content__" - HASH_SIZE_KEY = "__hash_size__" - - attr_reader :hash - - def current_hash - @hash_stack.last - end - - def on_start_document - @hash = { CONTENT_KEY => +"" } - @hash_stack = [@hash] - end - - def on_end_document - @hash = @hash_stack.pop - @hash.delete(CONTENT_KEY) - end - - def on_start_element(name, attrs = {}) - new_hash = { CONTENT_KEY => +"" }.merge!(attrs) - new_hash[HASH_SIZE_KEY] = new_hash.size + 1 - - case current_hash[name] - when Array then current_hash[name] << new_hash - when Hash then current_hash[name] = [current_hash[name], new_hash] - when nil then current_hash[name] = new_hash - end - - @hash_stack.push(new_hash) - end - - def on_end_element(name) - if current_hash.length > current_hash.delete(HASH_SIZE_KEY) && current_hash[CONTENT_KEY].blank? || current_hash[CONTENT_KEY] == "" - current_hash.delete(CONTENT_KEY) - end - @hash_stack.pop - end - - def on_characters(string) - current_hash[CONTENT_KEY] << string - end - - alias_method :on_cdata_block, :on_characters - end - - attr_accessor :document_class - self.document_class = HashBuilder - - def parse(data) - if !data.respond_to?(:read) - data = StringIO.new(data || "") - end - - if data.eof? - {} - else - LibXML::XML::Error.set_handler(&LibXML::XML::Error::QUIET_HANDLER) - parser = LibXML::XML::SaxParser.io(data) - document = document_class.new - - parser.callbacks = document - parser.parse - document.hash - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini/nokogiri.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini/nokogiri.rb deleted file mode 100644 index f76513f48b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini/nokogiri.rb +++ /dev/null @@ -1,83 +0,0 @@ -# frozen_string_literal: true - -begin - require "nokogiri" -rescue LoadError => e - $stderr.puts "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install" - raise e -end -require "active_support/core_ext/object/blank" -require "stringio" - -module ActiveSupport - module XmlMini_Nokogiri #:nodoc: - extend self - - # Parse an XML Document string or IO into a simple hash using libxml / nokogiri. - # data:: - # XML Document string or IO to parse - def parse(data) - if !data.respond_to?(:read) - data = StringIO.new(data || "") - end - - if data.eof? - {} - else - doc = Nokogiri::XML(data) - raise doc.errors.first if doc.errors.length > 0 - doc.to_hash - end - end - - module Conversions #:nodoc: - module Document #:nodoc: - def to_hash - root.to_hash - end - end - - module Node #:nodoc: - CONTENT_ROOT = "__content__" - - # Convert XML document to hash. - # - # hash:: - # Hash to merge the converted element into. - def to_hash(hash = {}) - node_hash = {} - - # Insert node hash into parent hash correctly. - case hash[name] - when Array then hash[name] << node_hash - when Hash then hash[name] = [hash[name], node_hash] - when nil then hash[name] = node_hash - end - - # Handle child elements - children.each do |c| - if c.element? - c.to_hash(node_hash) - elsif c.text? || c.cdata? - node_hash[CONTENT_ROOT] ||= +"" - node_hash[CONTENT_ROOT] << c.content - end - end - - # Remove content node if it is blank and there are child tags - if node_hash.length > 1 && node_hash[CONTENT_ROOT].blank? - node_hash.delete(CONTENT_ROOT) - end - - # Handle attributes - attribute_nodes.each { |a| node_hash[a.node_name] = a.value } - - hash - end - end - end - - Nokogiri::XML::Document.include(Conversions::Document) - Nokogiri::XML::Node.include(Conversions::Node) - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini/nokogirisax.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini/nokogirisax.rb deleted file mode 100644 index 55cd72e093..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini/nokogirisax.rb +++ /dev/null @@ -1,86 +0,0 @@ -# frozen_string_literal: true - -begin - require "nokogiri" -rescue LoadError => e - $stderr.puts "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install" - raise e -end -require "active_support/core_ext/object/blank" -require "stringio" - -module ActiveSupport - module XmlMini_NokogiriSAX #:nodoc: - extend self - - # Class that will build the hash while the XML document - # is being parsed using SAX events. - class HashBuilder < Nokogiri::XML::SAX::Document - CONTENT_KEY = "__content__" - HASH_SIZE_KEY = "__hash_size__" - - attr_reader :hash - - def current_hash - @hash_stack.last - end - - def start_document - @hash = {} - @hash_stack = [@hash] - end - - def end_document - raise "Parse stack not empty!" if @hash_stack.size > 1 - end - - def error(error_message) - raise error_message - end - - def start_element(name, attrs = []) - new_hash = { CONTENT_KEY => +"" }.merge!(Hash[attrs]) - new_hash[HASH_SIZE_KEY] = new_hash.size + 1 - - case current_hash[name] - when Array then current_hash[name] << new_hash - when Hash then current_hash[name] = [current_hash[name], new_hash] - when nil then current_hash[name] = new_hash - end - - @hash_stack.push(new_hash) - end - - def end_element(name) - if current_hash.length > current_hash.delete(HASH_SIZE_KEY) && current_hash[CONTENT_KEY].blank? || current_hash[CONTENT_KEY] == "" - current_hash.delete(CONTENT_KEY) - end - @hash_stack.pop - end - - def characters(string) - current_hash[CONTENT_KEY] << string - end - - alias_method :cdata_block, :characters - end - - attr_accessor :document_class - self.document_class = HashBuilder - - def parse(data) - if !data.respond_to?(:read) - data = StringIO.new(data || "") - end - - if data.eof? - {} - else - document = document_class.new - parser = Nokogiri::XML::SAX::Parser.new(document) - parser.parse(data) - document.hash - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini/rexml.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini/rexml.rb deleted file mode 100644 index c700959f71..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.7.3/lib/active_support/xml_mini/rexml.rb +++ /dev/null @@ -1,137 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/kernel/reporting" -require "active_support/core_ext/object/blank" -require "stringio" - -module ActiveSupport - module XmlMini_REXML #:nodoc: - extend self - - CONTENT_KEY = "__content__" - - # Parse an XML Document string or IO into a simple hash. - # - # Same as XmlSimple::xml_in but doesn't shoot itself in the foot, - # and uses the defaults from Active Support. - # - # data:: - # XML Document string or IO to parse - def parse(data) - if !data.respond_to?(:read) - data = StringIO.new(data || "") - end - - if data.eof? - {} - else - require_rexml unless defined?(REXML::Document) - doc = REXML::Document.new(data) - - if doc.root - merge_element!({}, doc.root, XmlMini.depth) - else - raise REXML::ParseException, - "The document #{doc.to_s.inspect} does not have a valid root" - end - end - end - - private - def require_rexml - silence_warnings { require "rexml/document" } - rescue LoadError => e - $stderr.puts "You don't have rexml installed in your application. Please add it to your Gemfile and run bundle install" - raise e - end - - # Convert an XML element and merge into the hash - # - # hash:: - # Hash to merge the converted element into. - # element:: - # XML element to merge into hash - def merge_element!(hash, element, depth) - raise REXML::ParseException, "The document is too deep" if depth == 0 - merge!(hash, element.name, collapse(element, depth)) - end - - # Actually converts an XML document element into a data structure. - # - # element:: - # The document element to be collapsed. - def collapse(element, depth) - hash = get_attributes(element) - - if element.has_elements? - element.each_element { |child| merge_element!(hash, child, depth - 1) } - merge_texts!(hash, element) unless empty_content?(element) - hash - else - merge_texts!(hash, element) - end - end - - # Merge all the texts of an element into the hash - # - # hash:: - # Hash to add the converted element to. - # element:: - # XML element whose texts are to me merged into the hash - def merge_texts!(hash, element) - unless element.has_text? - hash - else - # must use value to prevent double-escaping - texts = +"" - element.texts.each { |t| texts << t.value } - merge!(hash, CONTENT_KEY, texts) - end - end - - # Adds a new key/value pair to an existing Hash. If the key to be added - # already exists and the existing value associated with key is not - # an Array, it will be wrapped in an Array. Then the new value is - # appended to that Array. - # - # hash:: - # Hash to add key/value pair to. - # key:: - # Key to be added. - # value:: - # Value to be associated with key. - def merge!(hash, key, value) - if hash.has_key?(key) - if hash[key].instance_of?(Array) - hash[key] << value - else - hash[key] = [hash[key], value] - end - elsif value.instance_of?(Array) - hash[key] = [value] - else - hash[key] = value - end - hash - end - - # Converts the attributes array of an XML element into a hash. - # Returns an empty Hash if node has no attributes. - # - # element:: - # XML element to extract attributes from. - def get_attributes(element) - attributes = {} - element.attributes.each { |n, v| attributes[n] = v } - attributes - end - - # Determines if a document element has text content - # - # element:: - # XML element to be checked. - def empty_content?(element) - element.texts.join.blank? - end - end -end