activesupport 6.0.0.beta2 → 6.0.2.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +287 -3
- data/README.rdoc +2 -1
- data/lib/active_support.rb +1 -0
- data/lib/active_support/actionable_error.rb +48 -0
- data/lib/active_support/backtrace_cleaner.rb +5 -1
- data/lib/active_support/cache.rb +5 -5
- data/lib/active_support/cache/memory_store.rb +2 -0
- data/lib/active_support/cache/redis_cache_store.rb +9 -6
- data/lib/active_support/concern.rb +24 -1
- data/lib/active_support/configurable.rb +3 -3
- data/lib/active_support/core_ext/array/access.rb +18 -6
- data/lib/active_support/core_ext/class/attribute.rb +10 -15
- data/lib/active_support/core_ext/date_and_time/calculations.rb +0 -30
- data/lib/active_support/core_ext/digest.rb +3 -0
- data/lib/active_support/core_ext/enumerable.rb +24 -4
- data/lib/active_support/core_ext/hash/deep_transform_values.rb +2 -2
- data/lib/active_support/core_ext/hash/except.rb +1 -1
- data/lib/active_support/core_ext/module/attribute_accessors.rb +5 -5
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +5 -5
- data/lib/active_support/core_ext/module/delegation.rb +6 -0
- data/lib/active_support/core_ext/object/duplicable.rb +7 -117
- data/lib/active_support/core_ext/range/compare_range.rb +27 -12
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +2 -2
- data/lib/active_support/core_ext/string/filters.rb +1 -1
- data/lib/active_support/core_ext/string/inflections.rb +7 -2
- data/lib/active_support/core_ext/string/output_safety.rb +51 -4
- data/lib/active_support/core_ext/time/calculations.rb +31 -2
- data/lib/active_support/dependencies.rb +41 -5
- data/lib/active_support/dependencies/zeitwerk_integration.rb +44 -21
- data/lib/active_support/deprecation/method_wrappers.rb +7 -18
- data/lib/active_support/deprecation/proxy_wrappers.rb +24 -3
- data/lib/active_support/descendants_tracker.rb +52 -6
- data/lib/active_support/duration.rb +2 -3
- data/lib/active_support/evented_file_update_checker.rb +14 -2
- data/lib/active_support/gem_version.rb +2 -2
- data/lib/active_support/hash_with_indifferent_access.rb +6 -3
- data/lib/active_support/i18n_railtie.rb +6 -1
- data/lib/active_support/inflector/transliterate.rb +43 -14
- data/lib/active_support/logger_thread_safe_level.rb +2 -1
- data/lib/active_support/notifications/fanout.rb +2 -2
- data/lib/active_support/notifications/instrumenter.rb +12 -11
- data/lib/active_support/ordered_hash.rb +1 -1
- data/lib/active_support/ordered_options.rb +1 -1
- data/lib/active_support/parameter_filter.rb +6 -1
- data/lib/active_support/security_utils.rb +1 -1
- data/lib/active_support/subscriber.rb +55 -6
- data/lib/active_support/testing/parallelization.rb +21 -2
- metadata +13 -14
| @@ -16,7 +16,7 @@ module ActiveSupport | |
| 16 16 | 
             
              #   oh.keys # => [:a, :b], this order is guaranteed
         | 
| 17 17 | 
             
              #
         | 
| 18 18 | 
             
              # Also, maps the +omap+ feature for YAML files
         | 
| 19 | 
            -
              # (See  | 
| 19 | 
            +
              # (See https://yaml.org/type/omap.html) to support ordered items
         | 
| 20 20 | 
             
              # when loading from yaml.
         | 
| 21 21 | 
             
              #
         | 
| 22 22 | 
             
              # <tt>ActiveSupport::OrderedHash</tt> is namespaced to prevent conflicts
         | 
| @@ -110,7 +110,12 @@ module ActiveSupport | |
| 110 110 | 
             
                    elsif value.is_a?(Hash)
         | 
| 111 111 | 
             
                      value = call(value, parents, original_params)
         | 
| 112 112 | 
             
                    elsif value.is_a?(Array)
         | 
| 113 | 
            -
                       | 
| 113 | 
            +
                      # If we don't pop the current parent it will be duplicated as we
         | 
| 114 | 
            +
                      # process each array value.
         | 
| 115 | 
            +
                      parents.pop if deep_regexps
         | 
| 116 | 
            +
                      value = value.map { |v| value_for_key(key, v, parents, original_params) }
         | 
| 117 | 
            +
                      # Restore the parent stack after processing the array.
         | 
| 118 | 
            +
                      parents.push(key) if deep_regexps
         | 
| 114 119 | 
             
                    elsif blocks.any?
         | 
| 115 120 | 
             
                      key = key.dup if key.duplicable?
         | 
| 116 121 | 
             
                      value = value.dup if value.duplicable?
         | 
| @@ -24,7 +24,7 @@ module ActiveSupport | |
| 24 24 | 
             
                # The values are first processed by SHA256, so that we don't leak length info
         | 
| 25 25 | 
             
                # via timing attacks.
         | 
| 26 26 | 
             
                def secure_compare(a, b)
         | 
| 27 | 
            -
                  fixed_length_secure_compare(::Digest::SHA256. | 
| 27 | 
            +
                  fixed_length_secure_compare(::Digest::SHA256.digest(a), ::Digest::SHA256.digest(b)) && a == b
         | 
| 28 28 | 
             
                end
         | 
| 29 29 | 
             
                module_function :secure_compare
         | 
| 30 30 | 
             
              end
         | 
| @@ -24,6 +24,10 @@ module ActiveSupport | |
| 24 24 | 
             
              # After configured, whenever a "sql.active_record" notification is published,
         | 
| 25 25 | 
             
              # it will properly dispatch the event (ActiveSupport::Notifications::Event) to
         | 
| 26 26 | 
             
              # the +sql+ method.
         | 
| 27 | 
            +
              #
         | 
| 28 | 
            +
              # We can detach a subscriber as well:
         | 
| 29 | 
            +
              #
         | 
| 30 | 
            +
              #   ActiveRecord::StatsSubscriber.detach_from(:active_record)
         | 
| 27 31 | 
             
              class Subscriber
         | 
| 28 32 | 
             
                class << self
         | 
| 29 33 | 
             
                  # Attach the subscriber to a namespace.
         | 
| @@ -40,6 +44,25 @@ module ActiveSupport | |
| 40 44 | 
             
                    end
         | 
| 41 45 | 
             
                  end
         | 
| 42 46 |  | 
| 47 | 
            +
                  # Detach the subscriber from a namespace.
         | 
| 48 | 
            +
                  def detach_from(namespace, notifier = ActiveSupport::Notifications)
         | 
| 49 | 
            +
                    @namespace  = namespace
         | 
| 50 | 
            +
                    @subscriber = find_attached_subscriber
         | 
| 51 | 
            +
                    @notifier   = notifier
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                    return unless subscriber
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                    subscribers.delete(subscriber)
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                    # Remove event subscribers of all existing methods on the class.
         | 
| 58 | 
            +
                    subscriber.public_methods(false).each do |event|
         | 
| 59 | 
            +
                      remove_event_subscriber(event)
         | 
| 60 | 
            +
                    end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                    # Reset notifier so that event subscribers will not add for new methods added to the class.
         | 
| 63 | 
            +
                    @notifier = nil
         | 
| 64 | 
            +
                  end
         | 
| 65 | 
            +
             | 
| 43 66 | 
             
                  # Adds event subscribers for all new methods added to the class.
         | 
| 44 67 | 
             
                  def method_added(event)
         | 
| 45 68 | 
             
                    # Only public methods are added as subscribers, and only if a notifier
         | 
| @@ -58,15 +81,41 @@ module ActiveSupport | |
| 58 81 | 
             
                    attr_reader :subscriber, :notifier, :namespace
         | 
| 59 82 |  | 
| 60 83 | 
             
                    def add_event_subscriber(event) # :doc:
         | 
| 61 | 
            -
                      return if  | 
| 84 | 
            +
                      return if invalid_event?(event.to_s)
         | 
| 62 85 |  | 
| 63 | 
            -
                      pattern =  | 
| 86 | 
            +
                      pattern = prepare_pattern(event)
         | 
| 64 87 |  | 
| 65 88 | 
             
                      # Don't add multiple subscribers (eg. if methods are redefined).
         | 
| 66 | 
            -
                      return if  | 
| 89 | 
            +
                      return if pattern_subscribed?(pattern)
         | 
| 90 | 
            +
             | 
| 91 | 
            +
                      subscriber.patterns[pattern] = notifier.subscribe(pattern, subscriber)
         | 
| 92 | 
            +
                    end
         | 
| 93 | 
            +
             | 
| 94 | 
            +
                    def remove_event_subscriber(event) # :doc:
         | 
| 95 | 
            +
                      return if invalid_event?(event.to_s)
         | 
| 96 | 
            +
             | 
| 97 | 
            +
                      pattern = prepare_pattern(event)
         | 
| 98 | 
            +
             | 
| 99 | 
            +
                      return unless pattern_subscribed?(pattern)
         | 
| 100 | 
            +
             | 
| 101 | 
            +
                      notifier.unsubscribe(subscriber.patterns[pattern])
         | 
| 102 | 
            +
                      subscriber.patterns.delete(pattern)
         | 
| 103 | 
            +
                    end
         | 
| 104 | 
            +
             | 
| 105 | 
            +
                    def find_attached_subscriber
         | 
| 106 | 
            +
                      subscribers.find { |attached_subscriber| attached_subscriber.instance_of?(self) }
         | 
| 107 | 
            +
                    end
         | 
| 108 | 
            +
             | 
| 109 | 
            +
                    def invalid_event?(event)
         | 
| 110 | 
            +
                      %w{ start finish }.include?(event.to_s)
         | 
| 111 | 
            +
                    end
         | 
| 112 | 
            +
             | 
| 113 | 
            +
                    def prepare_pattern(event)
         | 
| 114 | 
            +
                      "#{event}.#{namespace}"
         | 
| 115 | 
            +
                    end
         | 
| 67 116 |  | 
| 68 | 
            -
             | 
| 69 | 
            -
                       | 
| 117 | 
            +
                    def pattern_subscribed?(pattern)
         | 
| 118 | 
            +
                      subscriber.patterns.key?(pattern)
         | 
| 70 119 | 
             
                    end
         | 
| 71 120 | 
             
                end
         | 
| 72 121 |  | 
| @@ -74,7 +123,7 @@ module ActiveSupport | |
| 74 123 |  | 
| 75 124 | 
             
                def initialize
         | 
| 76 125 | 
             
                  @queue_key = [self.class.name, object_id].join "-"
         | 
| 77 | 
            -
                  @patterns  =  | 
| 126 | 
            +
                  @patterns  = {}
         | 
| 78 127 | 
             
                  super
         | 
| 79 128 | 
             
                end
         | 
| 80 129 |  | 
| @@ -27,6 +27,10 @@ module ActiveSupport | |
| 27 27 | 
             
                      @queue << o
         | 
| 28 28 | 
             
                    end
         | 
| 29 29 |  | 
| 30 | 
            +
                    def length
         | 
| 31 | 
            +
                      @queue.length
         | 
| 32 | 
            +
                    end
         | 
| 33 | 
            +
             | 
| 30 34 | 
             
                    def pop; @queue.pop; end
         | 
| 31 35 | 
             
                  end
         | 
| 32 36 |  | 
| @@ -71,7 +75,9 @@ module ActiveSupport | |
| 71 75 | 
             
                      fork do
         | 
| 72 76 | 
             
                        DRb.stop_service
         | 
| 73 77 |  | 
| 74 | 
            -
                         | 
| 78 | 
            +
                        begin
         | 
| 79 | 
            +
                          after_fork(worker)
         | 
| 80 | 
            +
                        rescue => setup_exception; end
         | 
| 75 81 |  | 
| 76 82 | 
             
                        queue = DRbObject.new_with_uri(@url)
         | 
| 77 83 |  | 
| @@ -79,7 +85,11 @@ module ActiveSupport | |
| 79 85 | 
             
                          klass    = job[0]
         | 
| 80 86 | 
             
                          method   = job[1]
         | 
| 81 87 | 
             
                          reporter = job[2]
         | 
| 82 | 
            -
                          result | 
| 88 | 
            +
                          result = klass.with_info_handler reporter do
         | 
| 89 | 
            +
                            Minitest.run_one_method(klass, method)
         | 
| 90 | 
            +
                          end
         | 
| 91 | 
            +
             | 
| 92 | 
            +
                          add_setup_exception(result, setup_exception) if setup_exception
         | 
| 83 93 |  | 
| 84 94 | 
             
                          begin
         | 
| 85 95 | 
             
                            queue.record(reporter, result)
         | 
| @@ -103,7 +113,16 @@ module ActiveSupport | |
| 103 113 | 
             
                  def shutdown
         | 
| 104 114 | 
             
                    @queue_size.times { @queue << nil }
         | 
| 105 115 | 
             
                    @pool.each { |pid| Process.waitpid pid }
         | 
| 116 | 
            +
             | 
| 117 | 
            +
                    if @queue.length > 0
         | 
| 118 | 
            +
                      raise "Queue not empty, but all workers have finished. This probably means that a worker crashed and #{@queue.length} tests were missed."
         | 
| 119 | 
            +
                    end
         | 
| 106 120 | 
             
                  end
         | 
| 121 | 
            +
             | 
| 122 | 
            +
                  private
         | 
| 123 | 
            +
                    def add_setup_exception(result, setup_exception)
         | 
| 124 | 
            +
                      result.failures.prepend Minitest::UnexpectedError.new(setup_exception)
         | 
| 125 | 
            +
                    end
         | 
| 107 126 | 
             
                end
         | 
| 108 127 | 
             
              end
         | 
| 109 128 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: activesupport
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 6.0. | 
| 4 | 
            +
              version: 6.0.2.rc1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - David Heinemeier Hansson
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2019- | 
| 11 | 
            +
            date: 2019-11-27 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: i18n
         | 
| @@ -84,20 +84,14 @@ dependencies: | |
| 84 84 | 
             
                requirements:
         | 
| 85 85 | 
             
                - - "~>"
         | 
| 86 86 | 
             
                  - !ruby/object:Gem::Version
         | 
| 87 | 
            -
                    version: ' | 
| 88 | 
            -
                - - ">="
         | 
| 89 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 90 | 
            -
                    version: 1.3.1
         | 
| 87 | 
            +
                    version: '2.2'
         | 
| 91 88 | 
             
              type: :runtime
         | 
| 92 89 | 
             
              prerelease: false
         | 
| 93 90 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 94 91 | 
             
                requirements:
         | 
| 95 92 | 
             
                - - "~>"
         | 
| 96 93 | 
             
                  - !ruby/object:Gem::Version
         | 
| 97 | 
            -
                    version: ' | 
| 98 | 
            -
                - - ">="
         | 
| 99 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 100 | 
            -
                    version: 1.3.1
         | 
| 94 | 
            +
                    version: '2.2'
         | 
| 101 95 | 
             
            description: A toolkit of support libraries and Ruby core extensions extracted from
         | 
| 102 96 | 
             
              the Rails framework. Rich support for multibyte strings, internationalization, time
         | 
| 103 97 | 
             
              zones, and testing.
         | 
| @@ -110,6 +104,7 @@ files: | |
| 110 104 | 
             
            - MIT-LICENSE
         | 
| 111 105 | 
             
            - README.rdoc
         | 
| 112 106 | 
             
            - lib/active_support.rb
         | 
| 107 | 
            +
            - lib/active_support/actionable_error.rb
         | 
| 113 108 | 
             
            - lib/active_support/all.rb
         | 
| 114 109 | 
             
            - lib/active_support/array_inquirer.rb
         | 
| 115 110 | 
             
            - lib/active_support/backtrace_cleaner.rb
         | 
| @@ -160,6 +155,7 @@ files: | |
| 160 155 | 
             
            - lib/active_support/core_ext/date_time/calculations.rb
         | 
| 161 156 | 
             
            - lib/active_support/core_ext/date_time/compatibility.rb
         | 
| 162 157 | 
             
            - lib/active_support/core_ext/date_time/conversions.rb
         | 
| 158 | 
            +
            - lib/active_support/core_ext/digest.rb
         | 
| 163 159 | 
             
            - lib/active_support/core_ext/digest/uuid.rb
         | 
| 164 160 | 
             
            - lib/active_support/core_ext/enumerable.rb
         | 
| 165 161 | 
             
            - lib/active_support/core_ext/file.rb
         | 
| @@ -352,12 +348,15 @@ files: | |
| 352 348 | 
             
            - lib/active_support/xml_mini/nokogiri.rb
         | 
| 353 349 | 
             
            - lib/active_support/xml_mini/nokogirisax.rb
         | 
| 354 350 | 
             
            - lib/active_support/xml_mini/rexml.rb
         | 
| 355 | 
            -
            homepage:  | 
| 351 | 
            +
            homepage: https://rubyonrails.org
         | 
| 356 352 | 
             
            licenses:
         | 
| 357 353 | 
             
            - MIT
         | 
| 358 354 | 
             
            metadata:
         | 
| 359 | 
            -
               | 
| 360 | 
            -
              changelog_uri: https://github.com/rails/rails/blob/v6.0. | 
| 355 | 
            +
              bug_tracker_uri: https://github.com/rails/rails/issues
         | 
| 356 | 
            +
              changelog_uri: https://github.com/rails/rails/blob/v6.0.2.rc1/activesupport/CHANGELOG.md
         | 
| 357 | 
            +
              documentation_uri: https://api.rubyonrails.org/v6.0.2.rc1/
         | 
| 358 | 
            +
              mailing_list_uri: https://groups.google.com/forum/#!forum/rubyonrails-talk
         | 
| 359 | 
            +
              source_code_uri: https://github.com/rails/rails/tree/v6.0.2.rc1/activesupport
         | 
| 361 360 | 
             
            post_install_message: 
         | 
| 362 361 | 
             
            rdoc_options:
         | 
| 363 362 | 
             
            - "--encoding"
         | 
| @@ -375,7 +374,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 375 374 | 
             
                - !ruby/object:Gem::Version
         | 
| 376 375 | 
             
                  version: 1.3.1
         | 
| 377 376 | 
             
            requirements: []
         | 
| 378 | 
            -
            rubygems_version: 3.0. | 
| 377 | 
            +
            rubygems_version: 3.0.3
         | 
| 379 378 | 
             
            signing_key: 
         | 
| 380 379 | 
             
            specification_version: 4
         | 
| 381 380 | 
             
            summary: A toolkit of support libraries and Ruby core extensions extracted from the
         |