activesupport 5.0.7.2 → 5.1.7
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 +464 -694
- data/MIT-LICENSE +1 -1
- data/README.rdoc +1 -1
- data/lib/active_support.rb +8 -4
- data/lib/active_support/all.rb +3 -3
- data/lib/active_support/array_inquirer.rb +7 -5
- data/lib/active_support/backtrace_cleaner.rb +4 -4
- data/lib/active_support/benchmarkable.rb +3 -3
- data/lib/active_support/builder.rb +1 -1
- data/lib/active_support/cache.rb +41 -48
- data/lib/active_support/cache/file_store.rb +11 -20
- data/lib/active_support/cache/mem_cache_store.rb +30 -40
- data/lib/active_support/cache/memory_store.rb +13 -13
- data/lib/active_support/cache/null_store.rb +4 -4
- data/lib/active_support/cache/strategy/local_cache.rb +13 -22
- data/lib/active_support/cache/strategy/local_cache_middleware.rb +4 -5
- data/lib/active_support/callbacks.rb +649 -584
- data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +17 -0
- data/lib/active_support/concurrency/share_lock.rb +20 -21
- data/lib/active_support/configurable.rb +5 -5
- data/lib/active_support/core_ext.rb +1 -2
- data/lib/active_support/core_ext/array.rb +7 -7
- data/lib/active_support/core_ext/array/access.rb +1 -1
- data/lib/active_support/core_ext/array/conversions.rb +15 -15
- data/lib/active_support/core_ext/array/grouping.rb +1 -1
- data/lib/active_support/core_ext/array/inquiry.rb +1 -1
- data/lib/active_support/core_ext/array/prepend_and_append.rb +1 -1
- data/lib/active_support/core_ext/benchmark.rb +1 -1
- data/lib/active_support/core_ext/big_decimal.rb +1 -1
- data/lib/active_support/core_ext/big_decimal/conversions.rb +4 -6
- data/lib/active_support/core_ext/class.rb +2 -2
- data/lib/active_support/core_ext/class/attribute.rb +5 -5
- data/lib/active_support/core_ext/class/attribute_accessors.rb +1 -1
- data/lib/active_support/core_ext/class/subclasses.rb +18 -4
- data/lib/active_support/core_ext/date.rb +5 -5
- data/lib/active_support/core_ext/date/acts_like.rb +1 -1
- data/lib/active_support/core_ext/date/blank.rb +1 -1
- data/lib/active_support/core_ext/date/calculations.rb +8 -8
- data/lib/active_support/core_ext/date/conversions.rb +12 -12
- data/lib/active_support/core_ext/date/zones.rb +2 -2
- data/lib/active_support/core_ext/date_and_time/calculations.rb +27 -22
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +1 -1
- data/lib/active_support/core_ext/date_and_time/zones.rb +7 -8
- data/lib/active_support/core_ext/date_time.rb +5 -5
- data/lib/active_support/core_ext/date_time/acts_like.rb +2 -2
- data/lib/active_support/core_ext/date_time/blank.rb +1 -1
- data/lib/active_support/core_ext/date_time/calculations.rb +20 -10
- data/lib/active_support/core_ext/date_time/compatibility.rb +2 -2
- data/lib/active_support/core_ext/date_time/conversions.rb +12 -12
- data/lib/active_support/core_ext/digest/uuid.rb +4 -4
- data/lib/active_support/core_ext/enumerable.rb +23 -12
- data/lib/active_support/core_ext/file.rb +1 -1
- data/lib/active_support/core_ext/file/atomic.rb +4 -4
- data/lib/active_support/core_ext/hash.rb +9 -9
- data/lib/active_support/core_ext/hash/compact.rb +12 -9
- data/lib/active_support/core_ext/hash/conversions.rb +36 -37
- data/lib/active_support/core_ext/hash/indifferent_access.rb +1 -2
- data/lib/active_support/core_ext/hash/keys.rb +6 -6
- data/lib/active_support/core_ext/hash/reverse_merge.rb +1 -1
- data/lib/active_support/core_ext/hash/slice.rb +4 -4
- data/lib/active_support/core_ext/hash/transform_values.rb +1 -0
- data/lib/active_support/core_ext/integer.rb +3 -3
- data/lib/active_support/core_ext/integer/inflections.rb +1 -1
- data/lib/active_support/core_ext/integer/time.rb +2 -2
- data/lib/active_support/core_ext/kernel.rb +4 -4
- data/lib/active_support/core_ext/kernel/concern.rb +1 -1
- data/lib/active_support/core_ext/kernel/reporting.rb +1 -1
- data/lib/active_support/core_ext/load_error.rb +1 -18
- data/lib/active_support/core_ext/module.rb +11 -12
- data/lib/active_support/core_ext/module/aliasing.rb +3 -48
- data/lib/active_support/core_ext/module/attr_internal.rb +4 -4
- data/lib/active_support/core_ext/module/attribute_accessors.rb +11 -5
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +20 -13
- data/lib/active_support/core_ext/module/concerning.rb +1 -1
- data/lib/active_support/core_ext/module/delegation.rb +85 -16
- data/lib/active_support/core_ext/module/introspection.rb +3 -11
- data/lib/active_support/core_ext/module/reachable.rb +2 -2
- data/lib/active_support/core_ext/numeric.rb +4 -4
- data/lib/active_support/core_ext/numeric/conversions.rb +3 -9
- data/lib/active_support/core_ext/numeric/inquiry.rb +21 -21
- data/lib/active_support/core_ext/numeric/time.rb +5 -5
- data/lib/active_support/core_ext/object.rb +12 -12
- data/lib/active_support/core_ext/object/blank.rb +3 -1
- data/lib/active_support/core_ext/object/conversions.rb +4 -4
- data/lib/active_support/core_ext/object/deep_dup.rb +1 -1
- data/lib/active_support/core_ext/object/duplicable.rb +34 -4
- data/lib/active_support/core_ext/object/inclusion.rb +1 -1
- data/lib/active_support/core_ext/object/json.rb +26 -12
- data/lib/active_support/core_ext/object/to_param.rb +1 -1
- data/lib/active_support/core_ext/object/to_query.rb +8 -5
- data/lib/active_support/core_ext/object/try.rb +1 -1
- data/lib/active_support/core_ext/object/with_options.rb +12 -1
- data/lib/active_support/core_ext/range.rb +4 -4
- data/lib/active_support/core_ext/range/conversions.rb +1 -1
- data/lib/active_support/core_ext/regexp.rb +4 -0
- data/lib/active_support/core_ext/securerandom.rb +3 -3
- data/lib/active_support/core_ext/string.rb +13 -13
- data/lib/active_support/core_ext/string/access.rb +6 -6
- data/lib/active_support/core_ext/string/conversions.rb +2 -2
- data/lib/active_support/core_ext/string/filters.rb +3 -3
- data/lib/active_support/core_ext/string/indent.rb +4 -4
- data/lib/active_support/core_ext/string/inflections.rb +10 -14
- data/lib/active_support/core_ext/string/inquiry.rb +1 -1
- data/lib/active_support/core_ext/string/multibyte.rb +1 -1
- data/lib/active_support/core_ext/string/output_safety.rb +19 -20
- data/lib/active_support/core_ext/string/strip.rb +1 -1
- data/lib/active_support/core_ext/string/zones.rb +2 -2
- data/lib/active_support/core_ext/time.rb +5 -5
- data/lib/active_support/core_ext/time/acts_like.rb +1 -1
- data/lib/active_support/core_ext/time/calculations.rb +46 -29
- data/lib/active_support/core_ext/time/conversions.rb +15 -12
- data/lib/active_support/core_ext/time/zones.rb +3 -3
- data/lib/active_support/core_ext/uri.rb +2 -2
- data/lib/active_support/dependencies.rb +45 -46
- data/lib/active_support/dependencies/interlock.rb +1 -1
- data/lib/active_support/deprecation.rb +9 -8
- data/lib/active_support/deprecation/behaviors.rb +3 -3
- data/lib/active_support/deprecation/constant_accessor.rb +50 -0
- data/lib/active_support/deprecation/instance_delegator.rb +2 -2
- data/lib/active_support/deprecation/method_wrappers.rb +10 -3
- data/lib/active_support/deprecation/proxy_wrappers.rb +6 -4
- data/lib/active_support/deprecation/reporting.rb +7 -7
- data/lib/active_support/duration.rb +221 -28
- data/lib/active_support/duration/iso8601_parser.rb +66 -65
- data/lib/active_support/duration/iso8601_serializer.rb +11 -9
- data/lib/active_support/evented_file_update_checker.rb +59 -55
- data/lib/active_support/execution_wrapper.rb +3 -3
- data/lib/active_support/executor.rb +1 -1
- data/lib/active_support/file_update_checker.rb +54 -50
- data/lib/active_support/gem_version.rb +2 -2
- data/lib/active_support/gzip.rb +4 -4
- data/lib/active_support/hash_with_indifferent_access.rb +40 -28
- data/lib/active_support/i18n.rb +5 -5
- data/lib/active_support/i18n_railtie.rb +14 -9
- data/lib/active_support/inflections.rb +11 -11
- data/lib/active_support/inflector.rb +5 -5
- data/lib/active_support/inflector/inflections.rb +11 -9
- data/lib/active_support/inflector/methods.rb +52 -51
- data/lib/active_support/inflector/transliterate.rb +8 -11
- data/lib/active_support/json.rb +2 -2
- data/lib/active_support/json/decoding.rb +3 -3
- data/lib/active_support/json/encoding.rb +8 -7
- data/lib/active_support/key_generator.rb +17 -17
- data/lib/active_support/lazy_load_hooks.rb +2 -2
- data/lib/active_support/log_subscriber.rb +9 -7
- data/lib/active_support/log_subscriber/test_helper.rb +9 -9
- data/lib/active_support/logger.rb +3 -3
- data/lib/active_support/logger_silence.rb +3 -3
- data/lib/active_support/logger_thread_safe_level.rb +1 -1
- data/lib/active_support/message_encryptor.rb +77 -35
- data/lib/active_support/message_verifier.rb +7 -7
- data/lib/active_support/multibyte.rb +2 -2
- data/lib/active_support/multibyte/chars.rb +23 -21
- data/lib/active_support/multibyte/unicode.rb +68 -89
- data/lib/active_support/notifications.rb +7 -5
- data/lib/active_support/notifications/fanout.rb +3 -3
- data/lib/active_support/notifications/instrumenter.rb +5 -5
- data/lib/active_support/number_helper.rb +5 -4
- data/lib/active_support/number_helper/number_converter.rb +11 -11
- data/lib/active_support/number_helper/number_to_currency_converter.rb +3 -3
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +1 -2
- data/lib/active_support/number_helper/number_to_human_converter.rb +8 -10
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +6 -11
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_phone_converter.rb +1 -3
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +12 -32
- data/lib/active_support/number_helper/rounding_helper.rb +64 -0
- data/lib/active_support/option_merger.rb +1 -1
- data/lib/active_support/ordered_hash.rb +3 -3
- data/lib/active_support/ordered_options.rb +6 -4
- data/lib/active_support/per_thread_registry.rb +5 -5
- data/lib/active_support/rails.rb +12 -6
- data/lib/active_support/railtie.rb +3 -3
- data/lib/active_support/reloader.rb +1 -1
- data/lib/active_support/rescuable.rb +6 -6
- data/lib/active_support/security_utils.rb +1 -1
- data/lib/active_support/string_inquirer.rb +8 -2
- data/lib/active_support/subscriber.rb +9 -5
- data/lib/active_support/tagged_logging.rb +4 -4
- data/lib/active_support/test_case.rb +12 -29
- data/lib/active_support/testing/assertions.rb +100 -2
- data/lib/active_support/testing/autorun.rb +2 -2
- data/lib/active_support/testing/constant_lookup.rb +0 -1
- data/lib/active_support/testing/declarative.rb +1 -1
- data/lib/active_support/testing/deprecation.rb +3 -2
- data/lib/active_support/testing/isolation.rb +15 -22
- data/lib/active_support/testing/method_call_assertions.rb +1 -1
- data/lib/active_support/testing/setup_and_teardown.rb +2 -2
- data/lib/active_support/testing/stream.rb +28 -28
- data/lib/active_support/testing/tagged_logging.rb +1 -1
- data/lib/active_support/testing/time_helpers.rb +45 -11
- data/lib/active_support/time.rb +12 -12
- data/lib/active_support/time_with_zone.rb +16 -14
- data/lib/active_support/values/time_zone.rb +100 -31
- data/lib/active_support/values/unicode_tables.dat +0 -0
- data/lib/active_support/version.rb +1 -1
- data/lib/active_support/xml_mini.rb +34 -36
- data/lib/active_support/xml_mini/jdom.rb +112 -112
- data/lib/active_support/xml_mini/libxml.rb +12 -11
- data/lib/active_support/xml_mini/libxmlsax.rb +13 -14
- data/lib/active_support/xml_mini/nokogiri.rb +10 -10
- data/lib/active_support/xml_mini/nokogirisax.rb +12 -13
- data/lib/active_support/xml_mini/rexml.rb +9 -9
- metadata +8 -9
- data/lib/active_support/concurrency/latch.rb +0 -26
- data/lib/active_support/core_ext/kernel/debugger.rb +0 -3
- data/lib/active_support/core_ext/module/method_transplanting.rb +0 -3
- data/lib/active_support/core_ext/module/qualified_const.rb +0 -70
- data/lib/active_support/core_ext/struct.rb +0 -3
- data/lib/active_support/core_ext/time/marshal.rb +0 -3
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "libxml"
|
2
|
+
require "active_support/core_ext/object/blank"
|
3
|
+
require "stringio"
|
4
4
|
|
5
5
|
module ActiveSupport
|
6
6
|
module XmlMini_LibXMLSAX #:nodoc:
|
@@ -9,11 +9,10 @@ module ActiveSupport
|
|
9
9
|
# Class that will build the hash while the XML document
|
10
10
|
# is being parsed using SAX events.
|
11
11
|
class HashBuilder
|
12
|
-
|
13
12
|
include LibXML::XML::SaxParser::Callbacks
|
14
13
|
|
15
|
-
CONTENT_KEY =
|
16
|
-
HASH_SIZE_KEY =
|
14
|
+
CONTENT_KEY = "__content__".freeze
|
15
|
+
HASH_SIZE_KEY = "__hash_size__".freeze
|
17
16
|
|
18
17
|
attr_reader :hash
|
19
18
|
|
@@ -22,7 +21,7 @@ module ActiveSupport
|
|
22
21
|
end
|
23
22
|
|
24
23
|
def on_start_document
|
25
|
-
@hash = { CONTENT_KEY =>
|
24
|
+
@hash = { CONTENT_KEY => "" }
|
26
25
|
@hash_stack = [@hash]
|
27
26
|
end
|
28
27
|
|
@@ -32,20 +31,20 @@ module ActiveSupport
|
|
32
31
|
end
|
33
32
|
|
34
33
|
def on_start_element(name, attrs = {})
|
35
|
-
new_hash = { CONTENT_KEY =>
|
34
|
+
new_hash = { CONTENT_KEY => "" }.merge!(attrs)
|
36
35
|
new_hash[HASH_SIZE_KEY] = new_hash.size + 1
|
37
36
|
|
38
37
|
case current_hash[name]
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
when Array then current_hash[name] << new_hash
|
39
|
+
when Hash then current_hash[name] = [current_hash[name], new_hash]
|
40
|
+
when nil then current_hash[name] = new_hash
|
42
41
|
end
|
43
42
|
|
44
43
|
@hash_stack.push(new_hash)
|
45
44
|
end
|
46
45
|
|
47
46
|
def on_end_element(name)
|
48
|
-
if current_hash.length > current_hash.delete(HASH_SIZE_KEY) && current_hash[CONTENT_KEY].blank? || current_hash[CONTENT_KEY] ==
|
47
|
+
if current_hash.length > current_hash.delete(HASH_SIZE_KEY) && current_hash[CONTENT_KEY].blank? || current_hash[CONTENT_KEY] == ""
|
49
48
|
current_hash.delete(CONTENT_KEY)
|
50
49
|
end
|
51
50
|
@hash_stack.pop
|
@@ -63,7 +62,7 @@ module ActiveSupport
|
|
63
62
|
|
64
63
|
def parse(data)
|
65
64
|
if !data.respond_to?(:read)
|
66
|
-
data = StringIO.new(data ||
|
65
|
+
data = StringIO.new(data || "")
|
67
66
|
end
|
68
67
|
|
69
68
|
if data.eof?
|
@@ -71,7 +70,7 @@ module ActiveSupport
|
|
71
70
|
else
|
72
71
|
LibXML::XML::Error.set_handler(&LibXML::XML::Error::QUIET_HANDLER)
|
73
72
|
parser = LibXML::XML::SaxParser.io(data)
|
74
|
-
document =
|
73
|
+
document = document_class.new
|
75
74
|
|
76
75
|
parser.callbacks = document
|
77
76
|
parser.parse
|
@@ -1,11 +1,11 @@
|
|
1
1
|
begin
|
2
|
-
require
|
2
|
+
require "nokogiri"
|
3
3
|
rescue LoadError => e
|
4
4
|
$stderr.puts "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install"
|
5
5
|
raise e
|
6
6
|
end
|
7
|
-
require
|
8
|
-
require
|
7
|
+
require "active_support/core_ext/object/blank"
|
8
|
+
require "stringio"
|
9
9
|
|
10
10
|
module ActiveSupport
|
11
11
|
module XmlMini_Nokogiri #:nodoc:
|
@@ -16,7 +16,7 @@ module ActiveSupport
|
|
16
16
|
# XML Document string or IO to parse
|
17
17
|
def parse(data)
|
18
18
|
if !data.respond_to?(:read)
|
19
|
-
data = StringIO.new(data ||
|
19
|
+
data = StringIO.new(data || "")
|
20
20
|
end
|
21
21
|
|
22
22
|
if data.eof?
|
@@ -36,20 +36,20 @@ module ActiveSupport
|
|
36
36
|
end
|
37
37
|
|
38
38
|
module Node #:nodoc:
|
39
|
-
CONTENT_ROOT =
|
39
|
+
CONTENT_ROOT = "__content__".freeze
|
40
40
|
|
41
41
|
# Convert XML document to hash.
|
42
42
|
#
|
43
43
|
# hash::
|
44
44
|
# Hash to merge the converted element into.
|
45
|
-
def to_hash(hash={})
|
45
|
+
def to_hash(hash = {})
|
46
46
|
node_hash = {}
|
47
47
|
|
48
48
|
# Insert node hash into parent hash correctly.
|
49
49
|
case hash[name]
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
when Array then hash[name] << node_hash
|
51
|
+
when Hash then hash[name] = [hash[name], node_hash]
|
52
|
+
when nil then hash[name] = node_hash
|
53
53
|
end
|
54
54
|
|
55
55
|
# Handle child elements
|
@@ -57,7 +57,7 @@ module ActiveSupport
|
|
57
57
|
if c.element?
|
58
58
|
c.to_hash(node_hash)
|
59
59
|
elsif c.text? || c.cdata?
|
60
|
-
node_hash[CONTENT_ROOT] ||=
|
60
|
+
node_hash[CONTENT_ROOT] ||= ""
|
61
61
|
node_hash[CONTENT_ROOT] << c.content
|
62
62
|
end
|
63
63
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
begin
|
2
|
-
require
|
2
|
+
require "nokogiri"
|
3
3
|
rescue LoadError => e
|
4
4
|
$stderr.puts "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install"
|
5
5
|
raise e
|
6
6
|
end
|
7
|
-
require
|
8
|
-
require
|
7
|
+
require "active_support/core_ext/object/blank"
|
8
|
+
require "stringio"
|
9
9
|
|
10
10
|
module ActiveSupport
|
11
11
|
module XmlMini_NokogiriSAX #:nodoc:
|
@@ -14,9 +14,8 @@ module ActiveSupport
|
|
14
14
|
# Class that will build the hash while the XML document
|
15
15
|
# is being parsed using SAX events.
|
16
16
|
class HashBuilder < Nokogiri::XML::SAX::Document
|
17
|
-
|
18
|
-
|
19
|
-
HASH_SIZE_KEY = '__hash_size__'.freeze
|
17
|
+
CONTENT_KEY = "__content__".freeze
|
18
|
+
HASH_SIZE_KEY = "__hash_size__".freeze
|
20
19
|
|
21
20
|
attr_reader :hash
|
22
21
|
|
@@ -38,20 +37,20 @@ module ActiveSupport
|
|
38
37
|
end
|
39
38
|
|
40
39
|
def start_element(name, attrs = [])
|
41
|
-
new_hash = { CONTENT_KEY =>
|
40
|
+
new_hash = { CONTENT_KEY => "" }.merge!(Hash[attrs])
|
42
41
|
new_hash[HASH_SIZE_KEY] = new_hash.size + 1
|
43
42
|
|
44
43
|
case current_hash[name]
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
when Array then current_hash[name] << new_hash
|
45
|
+
when Hash then current_hash[name] = [current_hash[name], new_hash]
|
46
|
+
when nil then current_hash[name] = new_hash
|
48
47
|
end
|
49
48
|
|
50
49
|
@hash_stack.push(new_hash)
|
51
50
|
end
|
52
51
|
|
53
52
|
def end_element(name)
|
54
|
-
if current_hash.length > current_hash.delete(HASH_SIZE_KEY) && current_hash[CONTENT_KEY].blank? || current_hash[CONTENT_KEY] ==
|
53
|
+
if current_hash.length > current_hash.delete(HASH_SIZE_KEY) && current_hash[CONTENT_KEY].blank? || current_hash[CONTENT_KEY] == ""
|
55
54
|
current_hash.delete(CONTENT_KEY)
|
56
55
|
end
|
57
56
|
@hash_stack.pop
|
@@ -69,13 +68,13 @@ module ActiveSupport
|
|
69
68
|
|
70
69
|
def parse(data)
|
71
70
|
if !data.respond_to?(:read)
|
72
|
-
data = StringIO.new(data ||
|
71
|
+
data = StringIO.new(data || "")
|
73
72
|
end
|
74
73
|
|
75
74
|
if data.eof?
|
76
75
|
{}
|
77
76
|
else
|
78
|
-
document =
|
77
|
+
document = document_class.new
|
79
78
|
parser = Nokogiri::XML::SAX::Parser.new(document)
|
80
79
|
parser.parse(data)
|
81
80
|
document.hash
|
@@ -1,12 +1,12 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "active_support/core_ext/kernel/reporting"
|
2
|
+
require "active_support/core_ext/object/blank"
|
3
|
+
require "stringio"
|
4
4
|
|
5
5
|
module ActiveSupport
|
6
6
|
module XmlMini_REXML #:nodoc:
|
7
7
|
extend self
|
8
8
|
|
9
|
-
CONTENT_KEY =
|
9
|
+
CONTENT_KEY = "__content__".freeze
|
10
10
|
|
11
11
|
# Parse an XML Document string or IO into a simple hash.
|
12
12
|
#
|
@@ -17,13 +17,13 @@ module ActiveSupport
|
|
17
17
|
# XML Document string or IO to parse
|
18
18
|
def parse(data)
|
19
19
|
if !data.respond_to?(:read)
|
20
|
-
data = StringIO.new(data ||
|
20
|
+
data = StringIO.new(data || "")
|
21
21
|
end
|
22
22
|
|
23
23
|
if data.eof?
|
24
24
|
{}
|
25
25
|
else
|
26
|
-
silence_warnings { require
|
26
|
+
silence_warnings { require "rexml/document" } unless defined?(REXML::Document)
|
27
27
|
doc = REXML::Document.new(data)
|
28
28
|
|
29
29
|
if doc.root
|
@@ -55,7 +55,7 @@ module ActiveSupport
|
|
55
55
|
hash = get_attributes(element)
|
56
56
|
|
57
57
|
if element.has_elements?
|
58
|
-
element.each_element {|child| merge_element!(hash, child, depth - 1) }
|
58
|
+
element.each_element { |child| merge_element!(hash, child, depth - 1) }
|
59
59
|
merge_texts!(hash, element) unless empty_content?(element)
|
60
60
|
hash
|
61
61
|
else
|
@@ -74,7 +74,7 @@ module ActiveSupport
|
|
74
74
|
hash
|
75
75
|
else
|
76
76
|
# must use value to prevent double-escaping
|
77
|
-
texts =
|
77
|
+
texts = ""
|
78
78
|
element.texts.each { |t| texts << t.value }
|
79
79
|
merge!(hash, CONTENT_KEY, texts)
|
80
80
|
end
|
@@ -113,7 +113,7 @@ module ActiveSupport
|
|
113
113
|
# XML element to extract attributes from.
|
114
114
|
def get_attributes(element)
|
115
115
|
attributes = {}
|
116
|
-
element.attributes.each { |n,v| attributes[n] = v }
|
116
|
+
element.attributes.each { |n, v| attributes[n] = v }
|
117
117
|
attributes
|
118
118
|
end
|
119
119
|
|
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: 5.
|
4
|
+
version: 5.1.7
|
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-03-
|
11
|
+
date: 2019-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -104,7 +104,7 @@ files:
|
|
104
104
|
- lib/active_support/cache/strategy/local_cache_middleware.rb
|
105
105
|
- lib/active_support/callbacks.rb
|
106
106
|
- lib/active_support/concern.rb
|
107
|
-
- lib/active_support/concurrency/
|
107
|
+
- lib/active_support/concurrency/load_interlock_aware_monitor.rb
|
108
108
|
- lib/active_support/concurrency/share_lock.rb
|
109
109
|
- lib/active_support/configurable.rb
|
110
110
|
- lib/active_support/core_ext.rb
|
@@ -159,7 +159,6 @@ files:
|
|
159
159
|
- lib/active_support/core_ext/kernel.rb
|
160
160
|
- lib/active_support/core_ext/kernel/agnostics.rb
|
161
161
|
- lib/active_support/core_ext/kernel/concern.rb
|
162
|
-
- lib/active_support/core_ext/kernel/debugger.rb
|
163
162
|
- lib/active_support/core_ext/kernel/reporting.rb
|
164
163
|
- lib/active_support/core_ext/kernel/singleton_class.rb
|
165
164
|
- lib/active_support/core_ext/load_error.rb
|
@@ -174,8 +173,6 @@ files:
|
|
174
173
|
- lib/active_support/core_ext/module/delegation.rb
|
175
174
|
- lib/active_support/core_ext/module/deprecation.rb
|
176
175
|
- lib/active_support/core_ext/module/introspection.rb
|
177
|
-
- lib/active_support/core_ext/module/method_transplanting.rb
|
178
|
-
- lib/active_support/core_ext/module/qualified_const.rb
|
179
176
|
- lib/active_support/core_ext/module/reachable.rb
|
180
177
|
- lib/active_support/core_ext/module/remove_method.rb
|
181
178
|
- lib/active_support/core_ext/name_error.rb
|
@@ -218,13 +215,11 @@ files:
|
|
218
215
|
- lib/active_support/core_ext/string/starts_ends_with.rb
|
219
216
|
- lib/active_support/core_ext/string/strip.rb
|
220
217
|
- lib/active_support/core_ext/string/zones.rb
|
221
|
-
- lib/active_support/core_ext/struct.rb
|
222
218
|
- lib/active_support/core_ext/time.rb
|
223
219
|
- lib/active_support/core_ext/time/acts_like.rb
|
224
220
|
- lib/active_support/core_ext/time/calculations.rb
|
225
221
|
- lib/active_support/core_ext/time/compatibility.rb
|
226
222
|
- lib/active_support/core_ext/time/conversions.rb
|
227
|
-
- lib/active_support/core_ext/time/marshal.rb
|
228
223
|
- lib/active_support/core_ext/time/zones.rb
|
229
224
|
- lib/active_support/core_ext/uri.rb
|
230
225
|
- lib/active_support/dependencies.rb
|
@@ -232,6 +227,7 @@ files:
|
|
232
227
|
- lib/active_support/dependencies/interlock.rb
|
233
228
|
- lib/active_support/deprecation.rb
|
234
229
|
- lib/active_support/deprecation/behaviors.rb
|
230
|
+
- lib/active_support/deprecation/constant_accessor.rb
|
235
231
|
- lib/active_support/deprecation/instance_delegator.rb
|
236
232
|
- lib/active_support/deprecation/method_wrappers.rb
|
237
233
|
- lib/active_support/deprecation/proxy_wrappers.rb
|
@@ -282,6 +278,7 @@ files:
|
|
282
278
|
- lib/active_support/number_helper/number_to_percentage_converter.rb
|
283
279
|
- lib/active_support/number_helper/number_to_phone_converter.rb
|
284
280
|
- lib/active_support/number_helper/number_to_rounded_converter.rb
|
281
|
+
- lib/active_support/number_helper/rounding_helper.rb
|
285
282
|
- lib/active_support/option_merger.rb
|
286
283
|
- lib/active_support/ordered_hash.rb
|
287
284
|
- lib/active_support/ordered_options.rb
|
@@ -323,7 +320,9 @@ files:
|
|
323
320
|
homepage: http://rubyonrails.org
|
324
321
|
licenses:
|
325
322
|
- MIT
|
326
|
-
metadata:
|
323
|
+
metadata:
|
324
|
+
source_code_uri: https://github.com/rails/rails/tree/v5.1.7/activesupport
|
325
|
+
changelog_uri: https://github.com/rails/rails/blob/v5.1.7/activesupport/CHANGELOG.md
|
327
326
|
post_install_message:
|
328
327
|
rdoc_options:
|
329
328
|
- "--encoding"
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'concurrent/atomic/count_down_latch'
|
2
|
-
|
3
|
-
module ActiveSupport
|
4
|
-
module Concurrency
|
5
|
-
class Latch
|
6
|
-
|
7
|
-
def initialize(count = 1)
|
8
|
-
if count == 1
|
9
|
-
ActiveSupport::Deprecation.warn("ActiveSupport::Concurrency::Latch is deprecated. Please use Concurrent::Event instead.")
|
10
|
-
else
|
11
|
-
ActiveSupport::Deprecation.warn("ActiveSupport::Concurrency::Latch is deprecated. Please use Concurrent::CountDownLatch instead.")
|
12
|
-
end
|
13
|
-
|
14
|
-
@inner = Concurrent::CountDownLatch.new(count)
|
15
|
-
end
|
16
|
-
|
17
|
-
def release
|
18
|
-
@inner.count_down
|
19
|
-
end
|
20
|
-
|
21
|
-
def await
|
22
|
-
@inner.wait(nil)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext/string/inflections'
|
2
|
-
|
3
|
-
#--
|
4
|
-
# Allows code reuse in the methods below without polluting Module.
|
5
|
-
#++
|
6
|
-
|
7
|
-
module ActiveSupport
|
8
|
-
module QualifiedConstUtils
|
9
|
-
def self.raise_if_absolute(path)
|
10
|
-
raise NameError.new("wrong constant name #$&") if path =~ /\A::[^:]+/
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.names(path)
|
14
|
-
path.split('::')
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
##
|
20
|
-
# Extends the API for constants to be able to deal with qualified names. Arguments
|
21
|
-
# are assumed to be relative to the receiver.
|
22
|
-
#
|
23
|
-
#--
|
24
|
-
# Qualified names are required to be relative because we are extending existing
|
25
|
-
# methods that expect constant names, ie, relative paths of length 1. For example,
|
26
|
-
# Object.const_get('::String') raises NameError and so does qualified_const_get.
|
27
|
-
#++
|
28
|
-
class Module
|
29
|
-
def qualified_const_defined?(path, search_parents=true)
|
30
|
-
ActiveSupport::Deprecation.warn(<<-MESSAGE.squish)
|
31
|
-
Module#qualified_const_defined? is deprecated in favour of the builtin
|
32
|
-
Module#const_defined? and will be removed in Rails 5.1.
|
33
|
-
MESSAGE
|
34
|
-
|
35
|
-
ActiveSupport::QualifiedConstUtils.raise_if_absolute(path)
|
36
|
-
|
37
|
-
ActiveSupport::QualifiedConstUtils.names(path).inject(self) do |mod, name|
|
38
|
-
return unless mod.const_defined?(name, search_parents)
|
39
|
-
mod.const_get(name)
|
40
|
-
end
|
41
|
-
return true
|
42
|
-
end
|
43
|
-
|
44
|
-
def qualified_const_get(path)
|
45
|
-
ActiveSupport::Deprecation.warn(<<-MESSAGE.squish)
|
46
|
-
Module#qualified_const_get is deprecated in favour of the builtin
|
47
|
-
Module#const_get and will be removed in Rails 5.1.
|
48
|
-
MESSAGE
|
49
|
-
|
50
|
-
ActiveSupport::QualifiedConstUtils.raise_if_absolute(path)
|
51
|
-
|
52
|
-
ActiveSupport::QualifiedConstUtils.names(path).inject(self) do |mod, name|
|
53
|
-
mod.const_get(name)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def qualified_const_set(path, value)
|
58
|
-
ActiveSupport::Deprecation.warn(<<-MESSAGE.squish)
|
59
|
-
Module#qualified_const_set is deprecated in favour of the builtin
|
60
|
-
Module#const_set and will be removed in Rails 5.1.
|
61
|
-
MESSAGE
|
62
|
-
|
63
|
-
ActiveSupport::QualifiedConstUtils.raise_if_absolute(path)
|
64
|
-
|
65
|
-
const_name = path.demodulize
|
66
|
-
mod_name = path.deconstantize
|
67
|
-
mod = mod_name.empty? ? self : const_get(mod_name)
|
68
|
-
mod.const_set(const_name, value)
|
69
|
-
end
|
70
|
-
end
|