activesupport 5.2.0 → 6.0.3.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +479 -330
- data/MIT-LICENSE +1 -1
- data/README.rdoc +4 -3
- data/lib/active_support.rb +2 -1
- data/lib/active_support/actionable_error.rb +48 -0
- data/lib/active_support/backtrace_cleaner.rb +27 -1
- data/lib/active_support/cache.rb +104 -84
- data/lib/active_support/cache/file_store.rb +29 -30
- data/lib/active_support/cache/mem_cache_store.rb +14 -19
- data/lib/active_support/cache/memory_store.rb +15 -9
- data/lib/active_support/cache/null_store.rb +8 -3
- data/lib/active_support/cache/redis_cache_store.rb +73 -34
- data/lib/active_support/cache/strategy/local_cache.rb +23 -23
- data/lib/active_support/callbacks.rb +16 -8
- data/lib/active_support/concern.rb +31 -4
- data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +18 -0
- data/lib/active_support/concurrency/share_lock.rb +0 -1
- data/lib/active_support/configurable.rb +7 -11
- data/lib/active_support/core_ext/array.rb +1 -1
- data/lib/active_support/core_ext/array/access.rb +18 -6
- data/lib/active_support/core_ext/array/conversions.rb +5 -5
- data/lib/active_support/core_ext/array/extract.rb +21 -0
- data/lib/active_support/core_ext/array/prepend_and_append.rb +2 -6
- data/lib/active_support/core_ext/class/attribute.rb +11 -16
- data/lib/active_support/core_ext/class/subclasses.rb +1 -1
- data/lib/active_support/core_ext/date/calculations.rb +6 -5
- data/lib/active_support/core_ext/date_and_time/calculations.rb +24 -47
- data/lib/active_support/core_ext/date_and_time/zones.rb +0 -1
- data/lib/active_support/core_ext/date_time/calculations.rb +1 -1
- data/lib/active_support/core_ext/date_time/conversions.rb +0 -1
- data/lib/active_support/core_ext/digest.rb +3 -0
- data/lib/active_support/core_ext/enumerable.rb +97 -68
- data/lib/active_support/core_ext/file/atomic.rb +1 -1
- data/lib/active_support/core_ext/hash.rb +1 -2
- data/lib/active_support/core_ext/hash/compact.rb +2 -26
- data/lib/active_support/core_ext/hash/conversions.rb +1 -1
- data/lib/active_support/core_ext/hash/deep_transform_values.rb +46 -0
- data/lib/active_support/core_ext/hash/except.rb +1 -1
- data/lib/active_support/core_ext/hash/keys.rb +0 -29
- data/lib/active_support/core_ext/hash/slice.rb +3 -25
- data/lib/active_support/core_ext/hash/transform_values.rb +2 -29
- data/lib/active_support/core_ext/integer/multiple.rb +1 -1
- data/lib/active_support/core_ext/kernel.rb +0 -1
- data/lib/active_support/core_ext/load_error.rb +1 -1
- data/lib/active_support/core_ext/module.rb +0 -1
- data/lib/active_support/core_ext/module/attribute_accessors.rb +7 -10
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +13 -19
- data/lib/active_support/core_ext/module/delegation.rb +41 -8
- data/lib/active_support/core_ext/module/introspection.rb +38 -13
- data/lib/active_support/core_ext/module/reachable.rb +1 -6
- data/lib/active_support/core_ext/module/redefine_method.rb +8 -17
- data/lib/active_support/core_ext/numeric.rb +0 -1
- data/lib/active_support/core_ext/numeric/conversions.rb +124 -128
- data/lib/active_support/core_ext/numeric/inquiry.rb +2 -25
- data/lib/active_support/core_ext/object/blank.rb +1 -2
- data/lib/active_support/core_ext/object/duplicable.rb +7 -114
- data/lib/active_support/core_ext/object/json.rb +1 -0
- data/lib/active_support/core_ext/object/to_query.rb +5 -2
- data/lib/active_support/core_ext/object/try.rb +17 -7
- data/lib/active_support/core_ext/object/with_options.rb +1 -1
- data/lib/active_support/core_ext/range.rb +1 -1
- data/lib/active_support/core_ext/range/compare_range.rb +76 -0
- data/lib/active_support/core_ext/range/conversions.rb +31 -29
- data/lib/active_support/core_ext/range/each.rb +0 -1
- data/lib/active_support/core_ext/range/include_range.rb +6 -22
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +2 -2
- data/lib/active_support/core_ext/regexp.rb +0 -4
- data/lib/active_support/core_ext/securerandom.rb +23 -3
- data/lib/active_support/core_ext/string/access.rb +8 -0
- data/lib/active_support/core_ext/string/filters.rb +42 -1
- data/lib/active_support/core_ext/string/inflections.rb +7 -2
- data/lib/active_support/core_ext/string/multibyte.rb +4 -3
- data/lib/active_support/core_ext/string/output_safety.rb +63 -6
- data/lib/active_support/core_ext/string/strip.rb +3 -1
- data/lib/active_support/core_ext/time/calculations.rb +31 -2
- data/lib/active_support/core_ext/uri.rb +2 -4
- data/lib/active_support/current_attributes.rb +8 -0
- data/lib/active_support/dependencies.rb +77 -18
- data/lib/active_support/dependencies/zeitwerk_integration.rb +117 -0
- data/lib/active_support/deprecation.rb +1 -1
- data/lib/active_support/deprecation/behaviors.rb +5 -1
- data/lib/active_support/deprecation/method_wrappers.rb +20 -13
- data/lib/active_support/deprecation/proxy_wrappers.rb +28 -5
- data/lib/active_support/deprecation/reporting.rb +1 -1
- data/lib/active_support/descendants_tracker.rb +55 -9
- data/lib/active_support/duration.rb +19 -16
- data/lib/active_support/duration/iso8601_parser.rb +2 -4
- data/lib/active_support/duration/iso8601_serializer.rb +3 -5
- data/lib/active_support/encrypted_configuration.rb +1 -5
- data/lib/active_support/encrypted_file.rb +4 -3
- data/lib/active_support/evented_file_update_checker.rb +39 -10
- data/lib/active_support/execution_wrapper.rb +1 -0
- data/lib/active_support/file_update_checker.rb +0 -1
- data/lib/active_support/gem_version.rb +4 -4
- data/lib/active_support/hash_with_indifferent_access.rb +36 -18
- data/lib/active_support/i18n.rb +1 -0
- data/lib/active_support/i18n_railtie.rb +18 -2
- data/lib/active_support/inflector/inflections.rb +1 -5
- data/lib/active_support/inflector/methods.rb +18 -29
- data/lib/active_support/inflector/transliterate.rb +47 -18
- data/lib/active_support/json/decoding.rb +23 -24
- data/lib/active_support/json/encoding.rb +6 -2
- data/lib/active_support/key_generator.rb +0 -32
- data/lib/active_support/lazy_load_hooks.rb +5 -2
- data/lib/active_support/locale/en.rb +33 -0
- data/lib/active_support/log_subscriber.rb +31 -9
- data/lib/active_support/logger.rb +1 -16
- data/lib/active_support/logger_silence.rb +28 -12
- data/lib/active_support/logger_thread_safe_level.rb +28 -5
- data/lib/active_support/message_encryptor.rb +4 -6
- data/lib/active_support/message_verifier.rb +5 -5
- data/lib/active_support/messages/metadata.rb +3 -2
- data/lib/active_support/messages/rotator.rb +4 -4
- data/lib/active_support/multibyte/chars.rb +29 -49
- data/lib/active_support/multibyte/unicode.rb +44 -282
- data/lib/active_support/notifications.rb +41 -4
- data/lib/active_support/notifications/fanout.rb +100 -15
- data/lib/active_support/notifications/instrumenter.rb +80 -9
- data/lib/active_support/number_helper.rb +11 -0
- data/lib/active_support/number_helper/number_converter.rb +4 -5
- data/lib/active_support/number_helper/number_to_currency_converter.rb +9 -10
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +3 -2
- data/lib/active_support/number_helper/number_to_human_converter.rb +3 -2
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +3 -2
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +3 -1
- data/lib/active_support/number_helper/number_to_phone_converter.rb +2 -1
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +5 -4
- data/lib/active_support/option_merger.rb +21 -3
- data/lib/active_support/ordered_hash.rb +1 -1
- data/lib/active_support/ordered_options.rb +5 -1
- data/lib/active_support/parameter_filter.rb +128 -0
- data/lib/active_support/rails.rb +0 -6
- data/lib/active_support/reloader.rb +4 -5
- data/lib/active_support/security_utils.rb +1 -1
- data/lib/active_support/string_inquirer.rb +0 -1
- data/lib/active_support/subscriber.rb +65 -22
- data/lib/active_support/tagged_logging.rb +13 -4
- data/lib/active_support/test_case.rb +92 -1
- data/lib/active_support/testing/assertions.rb +15 -1
- data/lib/active_support/testing/deprecation.rb +0 -1
- data/lib/active_support/testing/file_fixtures.rb +2 -0
- data/lib/active_support/testing/isolation.rb +2 -2
- data/lib/active_support/testing/method_call_assertions.rb +28 -1
- data/lib/active_support/testing/parallelization.rb +134 -0
- data/lib/active_support/testing/setup_and_teardown.rb +5 -9
- data/lib/active_support/testing/stream.rb +1 -2
- data/lib/active_support/testing/time_helpers.rb +7 -9
- data/lib/active_support/time_with_zone.rb +15 -5
- data/lib/active_support/values/time_zone.rb +14 -8
- data/lib/active_support/xml_mini.rb +2 -10
- data/lib/active_support/xml_mini/jdom.rb +2 -3
- data/lib/active_support/xml_mini/libxml.rb +2 -2
- data/lib/active_support/xml_mini/libxmlsax.rb +4 -4
- data/lib/active_support/xml_mini/nokogiri.rb +2 -2
- data/lib/active_support/xml_mini/nokogirisax.rb +3 -3
- data/lib/active_support/xml_mini/rexml.rb +2 -2
- metadata +42 -13
- data/lib/active_support/core_ext/kernel/agnostics.rb +0 -13
- data/lib/active_support/values/unicode_tables.dat +0 -0
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "active_support/core_ext/module/redefine_method"
|
4
|
-
require "active_support/core_ext/string/strip" # for strip_heredoc
|
5
4
|
require "active_support/core_ext/time/calculations"
|
6
5
|
require "concurrent/map"
|
7
6
|
|
@@ -23,7 +22,7 @@ module ActiveSupport
|
|
23
22
|
|
24
23
|
@stubs[object.object_id][method_name] = Stub.new(object, method_name, new_name)
|
25
24
|
|
26
|
-
object.singleton_class.
|
25
|
+
object.singleton_class.alias_method new_name, method_name
|
27
26
|
object.define_singleton_method(method_name, &block)
|
28
27
|
end
|
29
28
|
|
@@ -41,12 +40,11 @@ module ActiveSupport
|
|
41
40
|
end
|
42
41
|
|
43
42
|
private
|
44
|
-
|
45
43
|
def unstub_object(stub)
|
46
44
|
singleton_class = stub.object.singleton_class
|
47
|
-
singleton_class.
|
48
|
-
singleton_class.
|
49
|
-
singleton_class.
|
45
|
+
singleton_class.silence_redefinition_of_method stub.method_name
|
46
|
+
singleton_class.alias_method stub.method_name, stub.original_method
|
47
|
+
singleton_class.undef_method stub.original_method
|
50
48
|
end
|
51
49
|
end
|
52
50
|
|
@@ -112,7 +110,7 @@ module ActiveSupport
|
|
112
110
|
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
|
113
111
|
def travel_to(date_or_time)
|
114
112
|
if block_given? && simple_stubs.stubbing(Time, :now)
|
115
|
-
travel_to_nested_block_call =
|
113
|
+
travel_to_nested_block_call = <<~MSG
|
116
114
|
|
117
115
|
Calling `travel_to` with a block, when we have previously already made a call to `travel_to`, can lead to confusing time stubbing.
|
118
116
|
|
@@ -159,7 +157,7 @@ module ActiveSupport
|
|
159
157
|
end
|
160
158
|
|
161
159
|
# Returns the current time back to its original state, by removing the stubs added by
|
162
|
-
# +travel+ and +
|
160
|
+
# +travel+, +travel_to+, and +freeze_time+.
|
163
161
|
#
|
164
162
|
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
|
165
163
|
# travel_to Time.zone.local(2004, 11, 24, 01, 04, 44)
|
@@ -169,6 +167,7 @@ module ActiveSupport
|
|
169
167
|
def travel_back
|
170
168
|
simple_stubs.unstub_all!
|
171
169
|
end
|
170
|
+
alias_method :unfreeze_time, :travel_back
|
172
171
|
|
173
172
|
# Calls +travel_to+ with +Time.now+.
|
174
173
|
#
|
@@ -191,7 +190,6 @@ module ActiveSupport
|
|
191
190
|
end
|
192
191
|
|
193
192
|
private
|
194
|
-
|
195
193
|
def simple_stubs
|
196
194
|
@simple_stubs ||= SimpleStubs.new
|
197
195
|
end
|
@@ -43,8 +43,8 @@ module ActiveSupport
|
|
43
43
|
"Time"
|
44
44
|
end
|
45
45
|
|
46
|
-
PRECISIONS = Hash.new { |h, n| h[n] = "%FT%T.%#{n}N"
|
47
|
-
PRECISIONS[0] = "%FT%T"
|
46
|
+
PRECISIONS = Hash.new { |h, n| h[n] = "%FT%T.%#{n}N" }
|
47
|
+
PRECISIONS[0] = "%FT%T"
|
48
48
|
|
49
49
|
include Comparable, DateAndTime::Compatibility
|
50
50
|
attr_reader :time_zone
|
@@ -147,7 +147,7 @@ module ActiveSupport
|
|
147
147
|
#
|
148
148
|
# Time.zone.now.xmlschema # => "2014-12-04T11:02:37-05:00"
|
149
149
|
def xmlschema(fraction_digits = 0)
|
150
|
-
"#{time.strftime(PRECISIONS[fraction_digits.to_i])}#{formatted_offset(true, 'Z'
|
150
|
+
"#{time.strftime(PRECISIONS[fraction_digits.to_i])}#{formatted_offset(true, 'Z')}"
|
151
151
|
end
|
152
152
|
alias_method :iso8601, :xmlschema
|
153
153
|
alias_method :rfc3339, :xmlschema
|
@@ -225,6 +225,8 @@ module ActiveSupport
|
|
225
225
|
def <=>(other)
|
226
226
|
utc <=> other
|
227
227
|
end
|
228
|
+
alias_method :before?, :<
|
229
|
+
alias_method :after?, :>
|
228
230
|
|
229
231
|
# Returns true if the current object's time is within the specified
|
230
232
|
# +min+ and +max+ time.
|
@@ -284,8 +286,10 @@ module ActiveSupport
|
|
284
286
|
alias_method :since, :+
|
285
287
|
alias_method :in, :+
|
286
288
|
|
287
|
-
#
|
288
|
-
# the
|
289
|
+
# Subtracts an interval of time and returns a new TimeWithZone object unless
|
290
|
+
# the other value `acts_like?` time. Then it will return a Float of the difference
|
291
|
+
# between the two times that represents the difference between the current
|
292
|
+
# object's time and the +other+ time.
|
289
293
|
#
|
290
294
|
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
|
291
295
|
# now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28 EST -05:00
|
@@ -300,6 +304,12 @@ module ActiveSupport
|
|
300
304
|
#
|
301
305
|
# now - 24.hours # => Sun, 02 Nov 2014 01:26:28 EDT -04:00
|
302
306
|
# now - 1.day # => Sun, 02 Nov 2014 00:26:28 EDT -04:00
|
307
|
+
#
|
308
|
+
# If both the TimeWithZone object and the other value act like Time, a Float
|
309
|
+
# will be returned.
|
310
|
+
#
|
311
|
+
# Time.zone.now - 1.day.ago # => 86399.999967
|
312
|
+
#
|
303
313
|
def -(other)
|
304
314
|
if other.acts_like?(:time)
|
305
315
|
to_time - other.to_time
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require "tzinfo"
|
4
4
|
require "concurrent/map"
|
5
|
-
require "active_support/core_ext/object/blank"
|
6
5
|
|
7
6
|
module ActiveSupport
|
8
7
|
# The TimeZone class serves as a wrapper around TZInfo::Timezone instances.
|
@@ -183,8 +182,9 @@ module ActiveSupport
|
|
183
182
|
"Samoa" => "Pacific/Apia"
|
184
183
|
}
|
185
184
|
|
186
|
-
UTC_OFFSET_WITH_COLON = "%s%02d:%02d"
|
187
|
-
UTC_OFFSET_WITHOUT_COLON = UTC_OFFSET_WITH_COLON.tr(":", "")
|
185
|
+
UTC_OFFSET_WITH_COLON = "%s%02d:%02d" # :nodoc:
|
186
|
+
UTC_OFFSET_WITHOUT_COLON = UTC_OFFSET_WITH_COLON.tr(":", "") # :nodoc:
|
187
|
+
private_constant :UTC_OFFSET_WITH_COLON, :UTC_OFFSET_WITHOUT_COLON
|
188
188
|
|
189
189
|
@lazy_zones_map = Concurrent::Map.new
|
190
190
|
@country_zones = Concurrent::Map.new
|
@@ -266,7 +266,7 @@ module ActiveSupport
|
|
266
266
|
private
|
267
267
|
def load_country_zones(code)
|
268
268
|
country = TZInfo::Country.get(code)
|
269
|
-
country.zone_identifiers.
|
269
|
+
country.zone_identifiers.flat_map do |tz_id|
|
270
270
|
if MAPPING.value?(tz_id)
|
271
271
|
MAPPING.inject([]) do |memo, (key, value)|
|
272
272
|
memo << self[key] if value == tz_id
|
@@ -275,12 +275,13 @@ module ActiveSupport
|
|
275
275
|
else
|
276
276
|
create(tz_id, nil, TZInfo::Timezone.new(tz_id))
|
277
277
|
end
|
278
|
-
end.
|
278
|
+
end.sort!
|
279
279
|
end
|
280
280
|
|
281
281
|
def zones_map
|
282
282
|
@zones_map ||= MAPPING.each_with_object({}) do |(name, _), zones|
|
283
|
-
|
283
|
+
timezone = self[name]
|
284
|
+
zones[name] = timezone if timezone
|
284
285
|
end
|
285
286
|
end
|
286
287
|
end
|
@@ -354,8 +355,13 @@ module ActiveSupport
|
|
354
355
|
# Time.zone = 'Hawaii' # => "Hawaii"
|
355
356
|
# Time.utc(2000).to_f # => 946684800.0
|
356
357
|
# Time.zone.at(946684800.0) # => Fri, 31 Dec 1999 14:00:00 HST -10:00
|
357
|
-
|
358
|
-
|
358
|
+
#
|
359
|
+
# A second argument can be supplied to specify sub-second precision.
|
360
|
+
#
|
361
|
+
# Time.zone = 'Hawaii' # => "Hawaii"
|
362
|
+
# Time.at(946684800, 123456.789).nsec # => 123456789
|
363
|
+
def at(*args)
|
364
|
+
Time.at(*args).utc.in_time_zone(self)
|
359
365
|
end
|
360
366
|
|
361
367
|
# Method for creating new ActiveSupport::TimeWithZone instance in time zone
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require "time"
|
4
4
|
require "base64"
|
5
5
|
require "bigdecimal"
|
6
|
+
require "bigdecimal/util"
|
6
7
|
require "active_support/core_ext/module/delegation"
|
7
8
|
require "active_support/core_ext/string/inflections"
|
8
9
|
require "active_support/core_ext/date_time/calculations"
|
@@ -48,10 +49,6 @@ module ActiveSupport
|
|
48
49
|
"Array" => "array",
|
49
50
|
"Hash" => "hash"
|
50
51
|
}
|
51
|
-
|
52
|
-
# No need to map these on Ruby 2.4+
|
53
|
-
TYPE_NAMES["Fixnum"] = "integer" unless 0.class == Integer
|
54
|
-
TYPE_NAMES["Bignum"] = "integer" unless 0.class == Integer
|
55
52
|
end
|
56
53
|
|
57
54
|
FORMATTING = {
|
@@ -72,11 +69,7 @@ module ActiveSupport
|
|
72
69
|
"float" => Proc.new { |float| float.to_f },
|
73
70
|
"decimal" => Proc.new do |number|
|
74
71
|
if String === number
|
75
|
-
|
76
|
-
BigDecimal(number)
|
77
|
-
rescue ArgumentError
|
78
|
-
BigDecimal("0")
|
79
|
-
end
|
72
|
+
number.to_d
|
80
73
|
else
|
81
74
|
BigDecimal(number)
|
82
75
|
end
|
@@ -162,7 +155,6 @@ module ActiveSupport
|
|
162
155
|
end
|
163
156
|
|
164
157
|
private
|
165
|
-
|
166
158
|
def _dasherize(key)
|
167
159
|
# $2 must be a non-greedy regex for this to work
|
168
160
|
left, middle, right = /\A(_*)(.*?)(_*)\Z/.match(key.strip)[1, 3]
|
@@ -18,7 +18,7 @@ module ActiveSupport
|
|
18
18
|
module XmlMini_JDOM #:nodoc:
|
19
19
|
extend self
|
20
20
|
|
21
|
-
CONTENT_KEY = "__content__"
|
21
|
+
CONTENT_KEY = "__content__"
|
22
22
|
|
23
23
|
NODE_TYPE_NAMES = %w{ATTRIBUTE_NODE CDATA_SECTION_NODE COMMENT_NODE DOCUMENT_FRAGMENT_NODE
|
24
24
|
DOCUMENT_NODE DOCUMENT_TYPE_NODE ELEMENT_NODE ENTITY_NODE ENTITY_REFERENCE_NODE NOTATION_NODE
|
@@ -53,7 +53,6 @@ module ActiveSupport
|
|
53
53
|
end
|
54
54
|
|
55
55
|
private
|
56
|
-
|
57
56
|
# Convert an XML element and merge into the hash
|
58
57
|
#
|
59
58
|
# hash::
|
@@ -169,7 +168,7 @@ module ActiveSupport
|
|
169
168
|
# element::
|
170
169
|
# XML element to be checked.
|
171
170
|
def empty_content?(element)
|
172
|
-
text = ""
|
171
|
+
text = +""
|
173
172
|
child_nodes = element.child_nodes
|
174
173
|
(0...child_nodes.length).each do |i|
|
175
174
|
item = child_nodes.item(i)
|
@@ -34,7 +34,7 @@ module LibXML #:nodoc:
|
|
34
34
|
end
|
35
35
|
|
36
36
|
module Node #:nodoc:
|
37
|
-
CONTENT_ROOT = "__content__"
|
37
|
+
CONTENT_ROOT = "__content__"
|
38
38
|
|
39
39
|
# Convert XML document to hash.
|
40
40
|
#
|
@@ -55,7 +55,7 @@ module LibXML #:nodoc:
|
|
55
55
|
if c.element?
|
56
56
|
c.to_hash(node_hash)
|
57
57
|
elsif c.text? || c.cdata?
|
58
|
-
node_hash[CONTENT_ROOT] ||= ""
|
58
|
+
node_hash[CONTENT_ROOT] ||= +""
|
59
59
|
node_hash[CONTENT_ROOT] << c.content
|
60
60
|
end
|
61
61
|
end
|
@@ -13,8 +13,8 @@ module ActiveSupport
|
|
13
13
|
class HashBuilder
|
14
14
|
include LibXML::XML::SaxParser::Callbacks
|
15
15
|
|
16
|
-
CONTENT_KEY = "__content__"
|
17
|
-
HASH_SIZE_KEY = "__hash_size__"
|
16
|
+
CONTENT_KEY = "__content__"
|
17
|
+
HASH_SIZE_KEY = "__hash_size__"
|
18
18
|
|
19
19
|
attr_reader :hash
|
20
20
|
|
@@ -23,7 +23,7 @@ module ActiveSupport
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def on_start_document
|
26
|
-
@hash = { CONTENT_KEY => ""
|
26
|
+
@hash = { CONTENT_KEY => +"" }
|
27
27
|
@hash_stack = [@hash]
|
28
28
|
end
|
29
29
|
|
@@ -33,7 +33,7 @@ module ActiveSupport
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def on_start_element(name, attrs = {})
|
36
|
-
new_hash = { CONTENT_KEY => ""
|
36
|
+
new_hash = { CONTENT_KEY => +"" }.merge!(attrs)
|
37
37
|
new_hash[HASH_SIZE_KEY] = new_hash.size + 1
|
38
38
|
|
39
39
|
case current_hash[name]
|
@@ -38,7 +38,7 @@ module ActiveSupport
|
|
38
38
|
end
|
39
39
|
|
40
40
|
module Node #:nodoc:
|
41
|
-
CONTENT_ROOT = "__content__"
|
41
|
+
CONTENT_ROOT = "__content__"
|
42
42
|
|
43
43
|
# Convert XML document to hash.
|
44
44
|
#
|
@@ -59,7 +59,7 @@ module ActiveSupport
|
|
59
59
|
if c.element?
|
60
60
|
c.to_hash(node_hash)
|
61
61
|
elsif c.text? || c.cdata?
|
62
|
-
node_hash[CONTENT_ROOT] ||= ""
|
62
|
+
node_hash[CONTENT_ROOT] ||= +""
|
63
63
|
node_hash[CONTENT_ROOT] << c.content
|
64
64
|
end
|
65
65
|
end
|
@@ -16,8 +16,8 @@ module ActiveSupport
|
|
16
16
|
# Class that will build the hash while the XML document
|
17
17
|
# is being parsed using SAX events.
|
18
18
|
class HashBuilder < Nokogiri::XML::SAX::Document
|
19
|
-
CONTENT_KEY = "__content__"
|
20
|
-
HASH_SIZE_KEY = "__hash_size__"
|
19
|
+
CONTENT_KEY = "__content__"
|
20
|
+
HASH_SIZE_KEY = "__hash_size__"
|
21
21
|
|
22
22
|
attr_reader :hash
|
23
23
|
|
@@ -39,7 +39,7 @@ module ActiveSupport
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def start_element(name, attrs = [])
|
42
|
-
new_hash = { CONTENT_KEY => ""
|
42
|
+
new_hash = { CONTENT_KEY => +"" }.merge!(Hash[attrs])
|
43
43
|
new_hash[HASH_SIZE_KEY] = new_hash.size + 1
|
44
44
|
|
45
45
|
case current_hash[name]
|
@@ -8,7 +8,7 @@ module ActiveSupport
|
|
8
8
|
module XmlMini_REXML #:nodoc:
|
9
9
|
extend self
|
10
10
|
|
11
|
-
CONTENT_KEY = "__content__"
|
11
|
+
CONTENT_KEY = "__content__"
|
12
12
|
|
13
13
|
# Parse an XML Document string or IO into a simple hash.
|
14
14
|
#
|
@@ -76,7 +76,7 @@ module ActiveSupport
|
|
76
76
|
hash
|
77
77
|
else
|
78
78
|
# must use value to prevent double-escaping
|
79
|
-
texts = ""
|
79
|
+
texts = +""
|
80
80
|
element.texts.each { |t| texts << t.value }
|
81
81
|
merge!(hash, CONTENT_KEY, texts)
|
82
82
|
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:
|
4
|
+
version: 6.0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -78,6 +78,26 @@ dependencies:
|
|
78
78
|
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: 1.0.2
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: zeitwerk
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '2.2'
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 2.2.2
|
91
|
+
type: :runtime
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '2.2'
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 2.2.2
|
81
101
|
description: A toolkit of support libraries and Ruby core extensions extracted from
|
82
102
|
the Rails framework. Rich support for multibyte strings, internationalization, time
|
83
103
|
zones, and testing.
|
@@ -90,6 +110,7 @@ files:
|
|
90
110
|
- MIT-LICENSE
|
91
111
|
- README.rdoc
|
92
112
|
- lib/active_support.rb
|
113
|
+
- lib/active_support/actionable_error.rb
|
93
114
|
- lib/active_support/all.rb
|
94
115
|
- lib/active_support/array_inquirer.rb
|
95
116
|
- lib/active_support/backtrace_cleaner.rb
|
@@ -112,6 +133,7 @@ files:
|
|
112
133
|
- lib/active_support/core_ext/array.rb
|
113
134
|
- lib/active_support/core_ext/array/access.rb
|
114
135
|
- lib/active_support/core_ext/array/conversions.rb
|
136
|
+
- lib/active_support/core_ext/array/extract.rb
|
115
137
|
- lib/active_support/core_ext/array/extract_options.rb
|
116
138
|
- lib/active_support/core_ext/array/grouping.rb
|
117
139
|
- lib/active_support/core_ext/array/inquiry.rb
|
@@ -139,6 +161,7 @@ files:
|
|
139
161
|
- lib/active_support/core_ext/date_time/calculations.rb
|
140
162
|
- lib/active_support/core_ext/date_time/compatibility.rb
|
141
163
|
- lib/active_support/core_ext/date_time/conversions.rb
|
164
|
+
- lib/active_support/core_ext/digest.rb
|
142
165
|
- lib/active_support/core_ext/digest/uuid.rb
|
143
166
|
- lib/active_support/core_ext/enumerable.rb
|
144
167
|
- lib/active_support/core_ext/file.rb
|
@@ -147,6 +170,7 @@ files:
|
|
147
170
|
- lib/active_support/core_ext/hash/compact.rb
|
148
171
|
- lib/active_support/core_ext/hash/conversions.rb
|
149
172
|
- lib/active_support/core_ext/hash/deep_merge.rb
|
173
|
+
- lib/active_support/core_ext/hash/deep_transform_values.rb
|
150
174
|
- lib/active_support/core_ext/hash/except.rb
|
151
175
|
- lib/active_support/core_ext/hash/indifferent_access.rb
|
152
176
|
- lib/active_support/core_ext/hash/keys.rb
|
@@ -158,7 +182,6 @@ files:
|
|
158
182
|
- lib/active_support/core_ext/integer/multiple.rb
|
159
183
|
- lib/active_support/core_ext/integer/time.rb
|
160
184
|
- lib/active_support/core_ext/kernel.rb
|
161
|
-
- lib/active_support/core_ext/kernel/agnostics.rb
|
162
185
|
- lib/active_support/core_ext/kernel/concern.rb
|
163
186
|
- lib/active_support/core_ext/kernel/reporting.rb
|
164
187
|
- lib/active_support/core_ext/kernel/singleton_class.rb
|
@@ -197,6 +220,7 @@ files:
|
|
197
220
|
- lib/active_support/core_ext/object/try.rb
|
198
221
|
- lib/active_support/core_ext/object/with_options.rb
|
199
222
|
- lib/active_support/core_ext/range.rb
|
223
|
+
- lib/active_support/core_ext/range/compare_range.rb
|
200
224
|
- lib/active_support/core_ext/range/conversions.rb
|
201
225
|
- lib/active_support/core_ext/range/each.rb
|
202
226
|
- lib/active_support/core_ext/range/include_range.rb
|
@@ -229,6 +253,7 @@ files:
|
|
229
253
|
- lib/active_support/dependencies.rb
|
230
254
|
- lib/active_support/dependencies/autoload.rb
|
231
255
|
- lib/active_support/dependencies/interlock.rb
|
256
|
+
- lib/active_support/dependencies/zeitwerk_integration.rb
|
232
257
|
- lib/active_support/deprecation.rb
|
233
258
|
- lib/active_support/deprecation/behaviors.rb
|
234
259
|
- lib/active_support/deprecation/constant_accessor.rb
|
@@ -262,6 +287,7 @@ files:
|
|
262
287
|
- lib/active_support/json/encoding.rb
|
263
288
|
- lib/active_support/key_generator.rb
|
264
289
|
- lib/active_support/lazy_load_hooks.rb
|
290
|
+
- lib/active_support/locale/en.rb
|
265
291
|
- lib/active_support/locale/en.yml
|
266
292
|
- lib/active_support/log_subscriber.rb
|
267
293
|
- lib/active_support/log_subscriber/test_helper.rb
|
@@ -292,6 +318,7 @@ files:
|
|
292
318
|
- lib/active_support/option_merger.rb
|
293
319
|
- lib/active_support/ordered_hash.rb
|
294
320
|
- lib/active_support/ordered_options.rb
|
321
|
+
- lib/active_support/parameter_filter.rb
|
295
322
|
- lib/active_support/per_thread_registry.rb
|
296
323
|
- lib/active_support/proxy_object.rb
|
297
324
|
- lib/active_support/rails.rb
|
@@ -311,6 +338,7 @@ files:
|
|
311
338
|
- lib/active_support/testing/file_fixtures.rb
|
312
339
|
- lib/active_support/testing/isolation.rb
|
313
340
|
- lib/active_support/testing/method_call_assertions.rb
|
341
|
+
- lib/active_support/testing/parallelization.rb
|
314
342
|
- lib/active_support/testing/setup_and_teardown.rb
|
315
343
|
- lib/active_support/testing/stream.rb
|
316
344
|
- lib/active_support/testing/tagged_logging.rb
|
@@ -318,7 +346,6 @@ files:
|
|
318
346
|
- lib/active_support/time.rb
|
319
347
|
- lib/active_support/time_with_zone.rb
|
320
348
|
- lib/active_support/values/time_zone.rb
|
321
|
-
- lib/active_support/values/unicode_tables.dat
|
322
349
|
- lib/active_support/version.rb
|
323
350
|
- lib/active_support/xml_mini.rb
|
324
351
|
- lib/active_support/xml_mini/jdom.rb
|
@@ -327,13 +354,16 @@ files:
|
|
327
354
|
- lib/active_support/xml_mini/nokogiri.rb
|
328
355
|
- lib/active_support/xml_mini/nokogirisax.rb
|
329
356
|
- lib/active_support/xml_mini/rexml.rb
|
330
|
-
homepage:
|
357
|
+
homepage: https://rubyonrails.org
|
331
358
|
licenses:
|
332
359
|
- MIT
|
333
360
|
metadata:
|
334
|
-
|
335
|
-
changelog_uri: https://github.com/rails/rails/blob/
|
336
|
-
|
361
|
+
bug_tracker_uri: https://github.com/rails/rails/issues
|
362
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.0.3.2/activesupport/CHANGELOG.md
|
363
|
+
documentation_uri: https://api.rubyonrails.org/v6.0.3.2/
|
364
|
+
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
365
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.0.3.2/activesupport
|
366
|
+
post_install_message:
|
337
367
|
rdoc_options:
|
338
368
|
- "--encoding"
|
339
369
|
- UTF-8
|
@@ -343,16 +373,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
343
373
|
requirements:
|
344
374
|
- - ">="
|
345
375
|
- !ruby/object:Gem::Version
|
346
|
-
version: 2.
|
376
|
+
version: 2.5.0
|
347
377
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
348
378
|
requirements:
|
349
379
|
- - ">="
|
350
380
|
- !ruby/object:Gem::Version
|
351
381
|
version: '0'
|
352
382
|
requirements: []
|
353
|
-
|
354
|
-
|
355
|
-
signing_key:
|
383
|
+
rubygems_version: 3.1.2
|
384
|
+
signing_key:
|
356
385
|
specification_version: 4
|
357
386
|
summary: A toolkit of support libraries and Ruby core extensions extracted from the
|
358
387
|
Rails framework.
|